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';
mayEditContent,
} from '../helpers/permissions';
import { getTranslation } from '../helpers/Technique';
-import { useUser } from '../helpers/UserContext';
+import { useUser } from '../hooks/user';
import i18n from '../i18n';
-const Event = () => {
+export const Component = () => {
const params = useParams();
const { name } = params;
- const user = useUser();
+ const { user } = useUser();
+ const { t } = useTranslation();
const [error, setError] = React.useState(null);
const [loading, setLoading] = React.useState(true);
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]);
<Detail actions={actions} event={event} />
{episodes.length ? <>
<h2 className="mt-4">
- {i18n.t(hasConcluded(event)
+ {t(hasConcluded(event)
? 'events.pastEpisodes'
: 'events.upcomingEpisodes'
)}
/>
</ErrorBoundary>;
};
-
-export default withTranslation()(Event);