Skip to content

Commit

Permalink
MBS-10392 Convert Add Series edit to React
Browse files Browse the repository at this point in the history
  • Loading branch information
anirudhjain75 committed Jan 21, 2020
1 parent 732ee3f commit 890c5a1
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 34 deletions.
2 changes: 2 additions & 0 deletions lib/MusicBrainz/Server/Edit/Series/Create.pm
Expand Up @@ -55,6 +55,8 @@ sub build_display_data {
};
}

sub edit_template_react { "AddSeries" }

__PACKAGE__->meta->make_immutable;
no Moose;

Expand Down
77 changes: 77 additions & 0 deletions root/edit/details/AddSeries.js
@@ -0,0 +1,77 @@
/*
* @flow
* 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 React from 'react';

import {addColonText} from '../../static/scripts/common/i18n/addColon';
import EntityLink from '../../static/scripts/common/components/EntityLink';

type AddSeriesEditProps = {
...EditT,
+display_data: {
+comment: string,
+name: string,
+ordering_type: SeriesOrderingTypeT,
+series: SeriesT,
+type: SeriesTypeT,
},
};

const AddSeries = ({edit}: {edit: AddSeriesEditProps}) => {
return (
<>
<table className="details">
<tbody>
<tr>
<th>{addColonText(l('Series'))}</th>
<td><EntityLink entity={edit.display_data.series} /></td>
</tr>
</tbody>
</table>
<table className="details add-series">
<tbody>
<tr>
<th>{addColonText(l('Name'))}</th>
<td>{edit.display_data.name}</td>
</tr>
{edit.display_data.comment ? (
<tr>
<th>{addColonText(l('Disambiguation'))}</th>
<td>{edit.display_data.comment}</td>
</tr>
) : null}
{edit.display_data.type ? (
<tr>
<th>{addColonText(l('Type'))}</th>
<td>
{lp_attributes(
edit.display_data.type.name,
'series_type',
)}
</td>
</tr>
) : null}
{edit.display_data.ordering_type ? (
<tr>
<th>{addColonText(l('Ordering Type'))}</th>
<td>
{lp_attributes(
edit.display_data.ordering_type.name,
'series_ordering_type'
)}
</td>
</tr>
) : null}
</tbody>
</table>
</>
);
};

export default AddSeries;
34 changes: 0 additions & 34 deletions root/edit/details/add_series.tt

This file was deleted.

1 change: 1 addition & 0 deletions root/server/components.js
Expand Up @@ -254,6 +254,7 @@ module.exports = {
'edit/details/AddArtist': require('../edit/details/AddArtist'),
'edit/details/AddEvent': require('../edit/details/AddEvent'),
'edit/details/AddRemoveAlias': require('../edit/details/AddRemoveAlias'),
'edit/details/AddSeries': require('../edit/details/AddSeries'),
'edit/details/EditAlias': require('../edit/details/EditAlias'),
'event/EventHeader': require('../event/EventHeader'),
'instrument/InstrumentHeader': require('../instrument/InstrumentHeader'),
Expand Down

0 comments on commit 890c5a1

Please sign in to comment.