forked from metabrainz/musicbrainz-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AddStandaloneRecording.js
87 lines (81 loc) · 2.3 KB
/
AddStandaloneRecording.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*
* @flow strict-local
* Copyright (C) 2020 Anirudh Jain
*
* This file is part of MusicBrainz, the open internet music database,
* and is licensed under the GPL version 2, or (at your option) any
* later version: http://www.gnu.org/licenses/gpl-2.0.txt
*/
import * as React from 'react';
import EntityLink from '../../static/scripts/common/components/EntityLink';
import ExpandedArtistCredit from
'../../static/scripts/common/components/ExpandedArtistCredit';
import formatTrackLength from
'../../static/scripts/common/utility/formatTrackLength';
import yesNo from '../../static/scripts/common/utility/yesNo';
type AddStandaloneRecordingEditT = {
...EditT,
+display_data: {
+artist_credit: ArtistCreditT,
+comment: string | null,
+length: number | null,
+name: string,
+recording: RecordingT,
+video: boolean,
},
};
type Props = {
+allowNew?: boolean,
+edit: AddStandaloneRecordingEditT,
};
const AddStandaloneRecording = ({
allowNew,
edit,
}: Props): React.MixedElement => {
const display = edit.display_data;
return (
<>
<table className="details">
<tbody>
<tr>
<th>{addColonText(l('Recording'))}</th>
<td>
<EntityLink allowNew={allowNew} entity={display.recording} />
</td>
</tr>
</tbody>
</table>
<table className="details add-standalone-recording">
<tbody>
<tr>
<th>{addColonText(l('Name'))}</th>
<td>{display.name}</td>
</tr>
<tr>
<th>{addColonText(l('Artist'))}</th>
<td>
<ExpandedArtistCredit artistCredit={display.artist_credit} />
</td>
</tr>
{nonEmpty(display.comment) ? (
<tr>
<th>{addColonText(l('Disambiguation'))}</th>
<td>{display.comment}</td>
</tr>
) : null}
{display.length == null ? null : (
<tr>
<th>{addColonText(l('Length'))}</th>
<td>{formatTrackLength(display.length)}</td>
</tr>
)}
<tr>
<th>{addColonText(l('Video'))}</th>
<td>{yesNo(display.video)}</td>
</tr>
</tbody>
</table>
</>
);
};
export default AddStandaloneRecording;