X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=resources%2Fjs%2Fpages%2FEvent.js;h=fa5dc2163c30c3432356857dbfa330fa153c28ff;hb=9ac5e263a259207e3ecd132188df41f7c3315b88;hp=70b3beffa021d489bc463697ed2a6aea8612221b;hpb=4c5a82cb876e96c72c50e8bc12bd8a43a9afe847;p=alttp.git diff --git a/resources/js/pages/Event.js b/resources/js/pages/Event.js index 70b3bef..fa5dc21 100644 --- a/resources/js/pages/Event.js +++ b/resources/js/pages/Event.js @@ -3,7 +3,7 @@ import moment from 'moment'; import React from 'react'; import { Container } from 'react-bootstrap'; import { Helmet } from 'react-helmet'; -import { withTranslation } from 'react-i18next'; +import { useTranslation } from 'react-i18next'; import { useParams } from 'react-router-dom'; import toastr from 'toastr'; @@ -23,10 +23,11 @@ import { getTranslation } from '../helpers/Technique'; import { useUser } from '../hooks/user'; import i18n from '../i18n'; -const Event = () => { +export const Component = () => { const params = useParams(); const { name } = params; const { user } = useUser(); + const { t } = useTranslation(); const [error, setError] = React.useState(null); const [loading, setLoading] = React.useState(true); @@ -76,14 +77,14 @@ const Event = () => { parent_id: event.description_id, ...values, }); - toastr.success(i18n.t('content.saveSuccess')); + toastr.success(t('content.saveSuccess')); setEvent(event => ({ ...event, description: response.data, })); setShowContentDialog(false); } catch (e) { - toastr.error(i18n.t('content.saveError')); + toastr.error(t('content.saveError')); } }, [event && event.description_id]); @@ -149,7 +150,7 @@ const Event = () => { {episodes.length ? <>

- {i18n.t(hasConcluded(event) + {t(hasConcluded(event) ? 'events.pastEpisodes' : 'events.upcomingEpisodes' )} @@ -166,5 +167,3 @@ const Event = () => { /> ; }; - -export default withTranslation()(Event);