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