Skip to content

Commit ea702c8

Browse files
authored
Merge pull request metabrainz#1787 from reosarevok/report-display-refactoring
Report display refactoring + MBS-11513
2 parents 4dc24f7 + 55b48a8 commit ea702c8

File tree

96 files changed

+2113
-3465
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+2113
-3465
lines changed

root/report/AnnotationsArtists.js

+14-28
Original file line numberDiff line numberDiff line change
@@ -9,45 +9,31 @@
99

1010
import * as React from 'react';
1111

12-
import Layout from '../layout';
13-
import formatUserDate from '../utility/formatUserDate';
14-
1512
import {ANNOTATION_REPORT_TEXT} from './constants';
1613
import ArtistAnnotationList from './components/ArtistAnnotationList';
17-
import FilterLink from './FilterLink';
14+
import ReportLayout from './components/ReportLayout';
1815
import type {ReportArtistAnnotationT, ReportDataT} from './types';
1916

2017
const AnnotationsArtists = ({
21-
$c,
2218
canBeFiltered,
2319
filtered,
2420
generated,
2521
items,
2622
pager,
27-
}: ReportDataT<ReportArtistAnnotationT>): React.Element<typeof Layout> => (
28-
<Layout $c={$c} fullWidth title={l('Artist annotations')}>
29-
<h1>{l('Artist annotations')}</h1>
30-
31-
<ul>
32-
<li>
33-
{l('This report lists artists with annotations.')}
34-
</li>
35-
<li>{ANNOTATION_REPORT_TEXT()}</li>
36-
<li>
37-
{texp.l('Total artists found: {count}',
38-
{count: pager.total_entries})}
39-
</li>
40-
<li>
41-
{texp.l('Generated on {date}',
42-
{date: formatUserDate($c, generated)})}
43-
</li>
44-
45-
{canBeFiltered ? <FilterLink $c={$c} filtered={filtered} /> : null}
46-
</ul>
47-
23+
}: ReportDataT<ReportArtistAnnotationT>):
24+
React.Element<typeof ReportLayout> => (
25+
<ReportLayout
26+
canBeFiltered={canBeFiltered}
27+
description={l('This report lists artists with annotations.')}
28+
entityType="artist"
29+
extraInfo={ANNOTATION_REPORT_TEXT()}
30+
filtered={filtered}
31+
generated={generated}
32+
title={l('Artist annotations')}
33+
totalEntries={pager.total_entries}
34+
>
4835
<ArtistAnnotationList items={items} pager={pager} />
49-
50-
</Layout>
36+
</ReportLayout>
5137
);
5238

5339
export default AnnotationsArtists;

root/report/AnnotationsLabels.js

+14-28
Original file line numberDiff line numberDiff line change
@@ -9,45 +9,31 @@
99

1010
import * as React from 'react';
1111

12-
import Layout from '../layout';
13-
import formatUserDate from '../utility/formatUserDate';
14-
1512
import {ANNOTATION_REPORT_TEXT} from './constants';
1613
import LabelAnnotationList from './components/LabelAnnotationList';
17-
import FilterLink from './FilterLink';
14+
import ReportLayout from './components/ReportLayout';
1815
import type {ReportDataT, ReportLabelAnnotationT} from './types';
1916

2017
const AnnotationsLabels = ({
21-
$c,
2218
canBeFiltered,
2319
filtered,
2420
generated,
2521
items,
2622
pager,
27-
}: ReportDataT<ReportLabelAnnotationT>): React.Element<typeof Layout> => (
28-
<Layout $c={$c} fullWidth title={l('Label annotations')}>
29-
<h1>{l('Label annotations')}</h1>
30-
31-
<ul>
32-
<li>
33-
{l('This report lists labels with annotations.')}
34-
</li>
35-
<li>{ANNOTATION_REPORT_TEXT()}</li>
36-
<li>
37-
{texp.l('Total labels found: {count}',
38-
{count: pager.total_entries})}
39-
</li>
40-
<li>
41-
{texp.l('Generated on {date}',
42-
{date: formatUserDate($c, generated)})}
43-
</li>
44-
45-
{canBeFiltered ? <FilterLink $c={$c} filtered={filtered} /> : null}
46-
</ul>
47-
23+
}: ReportDataT<ReportLabelAnnotationT>):
24+
React.Element<typeof ReportLayout> => (
25+
<ReportLayout
26+
canBeFiltered={canBeFiltered}
27+
description={l('This report lists labels with annotations.')}
28+
entityType="label"
29+
extraInfo={ANNOTATION_REPORT_TEXT()}
30+
filtered={filtered}
31+
generated={generated}
32+
title={l('Label annotations')}
33+
totalEntries={pager.total_entries}
34+
>
4835
<LabelAnnotationList items={items} pager={pager} />
49-
50-
</Layout>
36+
</ReportLayout>
5137
);
5238

5339
export default AnnotationsLabels;

root/report/AnnotationsPlaces.js

+14-28
Original file line numberDiff line numberDiff line change
@@ -9,45 +9,31 @@
99

1010
import * as React from 'react';
1111

12-
import Layout from '../layout';
13-
import formatUserDate from '../utility/formatUserDate';
14-
1512
import {ANNOTATION_REPORT_TEXT} from './constants';
1613
import PlaceAnnotationList from './components/PlaceAnnotationList';
17-
import FilterLink from './FilterLink';
14+
import ReportLayout from './components/ReportLayout';
1815
import type {ReportDataT, ReportPlaceAnnotationT} from './types';
1916

2017
const AnnotationsPlaces = ({
21-
$c,
2218
canBeFiltered,
2319
filtered,
2420
generated,
2521
items,
2622
pager,
27-
}: ReportDataT<ReportPlaceAnnotationT>): React.Element<typeof Layout> => (
28-
<Layout $c={$c} fullWidth title={l('Place annotations')}>
29-
<h1>{l('Place annotations')}</h1>
30-
31-
<ul>
32-
<li>
33-
{l('This report lists places with annotations.')}
34-
</li>
35-
<li>{ANNOTATION_REPORT_TEXT()}</li>
36-
<li>
37-
{texp.l('Total places found: {count}',
38-
{count: pager.total_entries})}
39-
</li>
40-
<li>
41-
{texp.l('Generated on {date}',
42-
{date: formatUserDate($c, generated)})}
43-
</li>
44-
45-
{canBeFiltered ? <FilterLink $c={$c} filtered={filtered} /> : null}
46-
</ul>
47-
23+
}: ReportDataT<ReportPlaceAnnotationT>):
24+
React.Element<typeof ReportLayout> => (
25+
<ReportLayout
26+
canBeFiltered={canBeFiltered}
27+
description={l('This report lists places with annotations.')}
28+
entityType="place"
29+
extraInfo={ANNOTATION_REPORT_TEXT()}
30+
filtered={filtered}
31+
generated={generated}
32+
title={l('Place annotations')}
33+
totalEntries={pager.total_entries}
34+
>
4835
<PlaceAnnotationList items={items} pager={pager} />
49-
50-
</Layout>
36+
</ReportLayout>
5137
);
5238

5339
export default AnnotationsPlaces;

root/report/AnnotationsRecordings.js

+14-28
Original file line numberDiff line numberDiff line change
@@ -9,45 +9,31 @@
99

1010
import * as React from 'react';
1111

12-
import Layout from '../layout';
13-
import formatUserDate from '../utility/formatUserDate';
14-
1512
import {ANNOTATION_REPORT_TEXT} from './constants';
1613
import RecordingAnnotationList from './components/RecordingAnnotationList';
17-
import FilterLink from './FilterLink';
14+
import ReportLayout from './components/ReportLayout';
1815
import type {ReportDataT, ReportRecordingAnnotationT} from './types';
1916

2017
const AnnotationsRecordings = ({
21-
$c,
2218
canBeFiltered,
2319
filtered,
2420
generated,
2521
items,
2622
pager,
27-
}: ReportDataT<ReportRecordingAnnotationT>): React.Element<typeof Layout> => (
28-
<Layout $c={$c} fullWidth title={l('Recording annotations')}>
29-
<h1>{l('Recording annotations')}</h1>
30-
31-
<ul>
32-
<li>
33-
{l('This report lists recordings with annotations.')}
34-
</li>
35-
<li>{ANNOTATION_REPORT_TEXT()}</li>
36-
<li>
37-
{texp.l('Total recordings found: {count}',
38-
{count: pager.total_entries})}
39-
</li>
40-
<li>
41-
{texp.l('Generated on {date}',
42-
{date: formatUserDate($c, generated)})}
43-
</li>
44-
45-
{canBeFiltered ? <FilterLink $c={$c} filtered={filtered} /> : null}
46-
</ul>
47-
23+
}: ReportDataT<ReportRecordingAnnotationT>):
24+
React.Element<typeof ReportLayout> => (
25+
<ReportLayout
26+
canBeFiltered={canBeFiltered}
27+
description={l('This report lists recordings with annotations.')}
28+
entityType="recording"
29+
extraInfo={ANNOTATION_REPORT_TEXT()}
30+
filtered={filtered}
31+
generated={generated}
32+
title={l('Recording annotations')}
33+
totalEntries={pager.total_entries}
34+
>
4835
<RecordingAnnotationList items={items} pager={pager} />
49-
50-
</Layout>
36+
</ReportLayout>
5137
);
5238

5339
export default AnnotationsRecordings;

root/report/AnnotationsReleaseGroups.js

+13-28
Original file line numberDiff line numberDiff line change
@@ -9,47 +9,32 @@
99

1010
import * as React from 'react';
1111

12-
import Layout from '../layout';
13-
import formatUserDate from '../utility/formatUserDate';
14-
1512
import {ANNOTATION_REPORT_TEXT} from './constants';
1613
import ReleaseGroupAnnotationList
1714
from './components/ReleaseGroupAnnotationList';
18-
import FilterLink from './FilterLink';
15+
import ReportLayout from './components/ReportLayout';
1916
import type {ReportDataT, ReportReleaseGroupAnnotationT} from './types';
2017

2118
const AnnotationsReleaseGroups = ({
22-
$c,
2319
canBeFiltered,
2420
filtered,
2521
generated,
2622
items,
2723
pager,
2824
}: ReportDataT<ReportReleaseGroupAnnotationT>):
29-
React.Element<typeof Layout> => (
30-
<Layout $c={$c} fullWidth title={l('Release group annotations')}>
31-
<h1>{l('Release group annotations')}</h1>
32-
33-
<ul>
34-
<li>
35-
{l('This report lists release groups with annotations.')}
36-
</li>
37-
<li>{ANNOTATION_REPORT_TEXT()}</li>
38-
<li>
39-
{texp.l('Total release groups found: {count}',
40-
{count: pager.total_entries})}
41-
</li>
42-
<li>
43-
{texp.l('Generated on {date}',
44-
{date: formatUserDate($c, generated)})}
45-
</li>
46-
47-
{canBeFiltered ? <FilterLink $c={$c} filtered={filtered} /> : null}
48-
</ul>
49-
25+
React.Element<typeof ReportLayout> => (
26+
<ReportLayout
27+
canBeFiltered={canBeFiltered}
28+
description={l('This report lists release groups with annotations.')}
29+
entityType="release_group"
30+
extraInfo={ANNOTATION_REPORT_TEXT()}
31+
filtered={filtered}
32+
generated={generated}
33+
title={l('Release group annotations')}
34+
totalEntries={pager.total_entries}
35+
>
5036
<ReleaseGroupAnnotationList items={items} pager={pager} />
51-
52-
</Layout>
37+
</ReportLayout>
5338
);
5439

5540
export default AnnotationsReleaseGroups;

root/report/AnnotationsReleases.js

+13-28
Original file line numberDiff line numberDiff line change
@@ -9,46 +9,31 @@
99

1010
import * as React from 'react';
1111

12-
import Layout from '../layout';
13-
import formatUserDate from '../utility/formatUserDate';
14-
1512
import {ANNOTATION_REPORT_TEXT} from './constants';
1613
import ReleaseAnnotationList from './components/ReleaseAnnotationList';
17-
import FilterLink from './FilterLink';
14+
import ReportLayout from './components/ReportLayout';
1815
import type {ReportDataT, ReportReleaseAnnotationT} from './types';
1916

2017
const AnnotationsReleases = ({
21-
$c,
2218
canBeFiltered,
2319
filtered,
2420
generated,
2521
items,
2622
pager,
2723
}: ReportDataT<ReportReleaseAnnotationT>):
28-
React.Element<typeof Layout> => (
29-
<Layout $c={$c} fullWidth title={l('Release annotations')}>
30-
<h1>{l('Release annotations')}</h1>
31-
32-
<ul>
33-
<li>
34-
{l('This report lists releases with annotations.')}
35-
</li>
36-
<li>{ANNOTATION_REPORT_TEXT()}</li>
37-
<li>
38-
{texp.l('Total releases found: {count}',
39-
{count: pager.total_entries})}
40-
</li>
41-
<li>
42-
{texp.l('Generated on {date}',
43-
{date: formatUserDate($c, generated)})}
44-
</li>
45-
46-
{canBeFiltered ? <FilterLink $c={$c} filtered={filtered} /> : null}
47-
</ul>
48-
24+
React.Element<typeof ReportLayout> => (
25+
<ReportLayout
26+
canBeFiltered={canBeFiltered}
27+
description={l('This report lists releases with annotations.')}
28+
entityType="release"
29+
extraInfo={ANNOTATION_REPORT_TEXT()}
30+
filtered={filtered}
31+
generated={generated}
32+
title={l('Release annotations')}
33+
totalEntries={pager.total_entries}
34+
>
4935
<ReleaseAnnotationList items={items} pager={pager} />
50-
51-
</Layout>
36+
</ReportLayout>
5237
);
5338

5439
export default AnnotationsReleases;

0 commit comments

Comments
 (0)