/
AddOrEditAlias.js
64 lines (57 loc) · 1.6 KB
/
AddOrEditAlias.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
/*
* @flow strict-local
* Copyright (C) 2019 Anirudh Jain
* Copyright (C) 2020 MetaBrainz Foundation
*
* 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 chooseLayoutComponent from '../../utility/chooseLayoutComponent.js';
import * as manifest from '../../static/manifest.mjs';
import AliasEditForm from '../../static/scripts/alias/AliasEditForm.js';
import {ENTITIES} from '../../static/scripts/common/constants.js';
import type {AliasEditFormT} from './types.js';
type Props = {
+aliasTypes: SelectOptionsT,
+entity: CoreEntityT,
+form: AliasEditFormT,
+formType: string,
+locales: SelectOptionsT,
+type: string,
};
const AddOrEditAlias = ({
aliasTypes,
entity,
form,
formType,
locales,
type,
}: Props): React.MixedElement => {
const LayoutComponent = chooseLayoutComponent(type);
const header = formType === 'add'
? l('Add alias')
: l('Edit alias');
const entityProperties = ENTITIES[type];
const searchHintType = entityProperties.aliases.search_hint_type;
return (
<LayoutComponent
entity={entity}
fullWidth
title={header}
>
<h2>{header}</h2>
<AliasEditForm
aliasTypes={aliasTypes}
entity={entity}
form={form}
locales={locales}
searchHintType={searchHintType}
/>
<div id="guesscase-options" />
{manifest.js('alias', {async: 'async'})}
</LayoutComponent>
);
};
export default AddOrEditAlias;