Add react-i18next integration
This commit is contained in:
parent
cec3db5feb
commit
7ce6b66b75
|
@ -227,7 +227,7 @@ const App = connect((state) => ({login: state.login}))(function App({login}) {
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noreferrer"
|
rel="noreferrer"
|
||||||
>
|
>
|
||||||
{apiVersion ? t('App.footer.version', {apiVersion}) : t('App.footer.versionLoading')}
|
Version {apiVersion ? t('App.footer.version', {apiVersion}) : t('App.footer.versionLoading')}
|
||||||
</a>
|
</a>
|
||||||
</List.Item>
|
</List.Item>
|
||||||
</List>
|
</List>
|
||||||
|
|
|
@ -14,23 +14,26 @@ import styles from './HomePage.module.less'
|
||||||
function MostRecentTrack() {
|
function MostRecentTrack() {
|
||||||
const {t} = useTranslation()
|
const {t} = useTranslation()
|
||||||
|
|
||||||
const tracks: Track[] | null = useObservable(
|
const track: Track | null = useObservable(
|
||||||
() =>
|
() =>
|
||||||
of(null).pipe(
|
of(null).pipe(
|
||||||
switchMap(() => from(api.fetch("/tracks?limit=3"))),
|
switchMap(() => from(api.fetch('/tracks?limit=1'))),
|
||||||
map((response) => response?.tracks)
|
map((response) => response?.tracks?.[0])
|
||||||
),
|
),
|
||||||
null,
|
null,
|
||||||
[]
|
[]
|
||||||
);
|
)
|
||||||
|
|
||||||
|
const {t} = useTranslation()
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Header as="h2">{t('HomePage.mostRecentTrack')}</Header>
|
<Header as="h2">Most recent tracks</Header>
|
||||||
<Loader active={track === null} />
|
<Loader active={tracks === null} />
|
||||||
{track === undefined ? (
|
{tracks?.length === 0 ? (
|
||||||
<NoPublicTracksMessage />
|
<Message>
|
||||||
) : track ? (
|
No public tracks yet. <Link to="/upload">Upload the first!</Link>
|
||||||
|
</Message>
|
||||||
|
) : tracks ? (
|
||||||
<Item.Group>
|
<Item.Group>
|
||||||
{tracks.map((track) => (
|
{tracks.map((track) => (
|
||||||
<TrackListItem key={track.id} track={track} />
|
<TrackListItem key={track.id} track={track} />
|
||||||
|
@ -38,7 +41,7 @@ function MostRecentTrack() {
|
||||||
</Item.Group>
|
</Item.Group>
|
||||||
) : null}
|
) : null}
|
||||||
</>
|
</>
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function HomePage() {
|
export default function HomePage() {
|
||||||
|
@ -48,13 +51,13 @@ export default function HomePage() {
|
||||||
<Grid.Row>
|
<Grid.Row>
|
||||||
<Grid.Column width={8}>
|
<Grid.Column width={8}>
|
||||||
<Stats />
|
<Stats />
|
||||||
<MostRecentTrack />
|
|
||||||
</Grid.Column>
|
</Grid.Column>
|
||||||
<Grid.Column width={8}>
|
<Grid.Column width={8}>
|
||||||
|
<MostRecentTrack />
|
||||||
<RegionStats />
|
<RegionStats />
|
||||||
</Grid.Column>
|
</Grid.Column>
|
||||||
</Grid.Row>
|
</Grid.Row>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Page>
|
</Page>
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue