Skip to content

Commit 6dd1697

Browse files
committed
🐛(frontend) use hook useTranslation
Sentry highlitghted a few errors about the function "t" not being defined. Better to get it from the hook useTranslation.
1 parent 79e899c commit 6dd1697

File tree

5 files changed

+10
-5
lines changed

5 files changed

+10
-5
lines changed

src/frontend/apps/impress/src/features/docs/doc-header/components/ModalExport.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import {
1010
VariantType,
1111
useToastProvider,
1212
} from '@openfun/cunningham-react';
13-
import { t } from 'i18next';
1413
import { useEffect, useMemo, useState } from 'react';
14+
import { useTranslation } from 'react-i18next';
1515

1616
import { Box, Text } from '@/components';
1717
import { useEditorStore } from '@/features/docs/doc-editor';
@@ -27,6 +27,7 @@ interface ModalPDFProps {
2727
}
2828

2929
export const ModalPDF = ({ onClose, doc }: ModalPDFProps) => {
30+
const { t } = useTranslation();
3031
const { data: templates } = useTemplates({
3132
ordering: TemplatesOrdering.BY_CREATED_ON_DESC,
3233
});

src/frontend/apps/impress/src/features/docs/doc-management/components/ModalRemoveDoc.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import {
66
VariantType,
77
useToastProvider,
88
} from '@openfun/cunningham-react';
9-
import { t } from 'i18next';
109
import { useRouter } from 'next/router';
10+
import { useTranslation } from 'react-i18next';
1111

1212
import { Box, Text, TextErrors } from '@/components';
1313
import { useCunninghamTheme } from '@/cunningham/';
@@ -22,6 +22,7 @@ interface ModalRemoveDocProps {
2222
}
2323

2424
export const ModalRemoveDoc = ({ onClose, doc }: ModalRemoveDocProps) => {
25+
const { t } = useTranslation();
2526
const { colorsTokens } = useCunninghamTheme();
2627
const { toast } = useToastProvider();
2728
const { push } = useRouter();

src/frontend/apps/impress/src/features/docs/doc-management/components/ModalShare.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
VariantType,
44
useToastProvider,
55
} from '@openfun/cunningham-react';
6-
import { t } from 'i18next';
6+
import { useTranslation } from 'react-i18next';
77
import { createGlobalStyle } from 'styled-components';
88

99
import { Box, Card, IconBG, SideModal, Text } from '@/components';
@@ -44,6 +44,7 @@ interface ModalShareProps {
4444
}
4545

4646
export const ModalShare = ({ onClose, doc }: ModalShareProps) => {
47+
const { t } = useTranslation();
4748
const { isMobile, isSmallMobile } = useResponsiveStore();
4849
const width = isSmallMobile ? '100vw' : isMobile ? '90vw' : '70vw';
4950
const { toast } = useToastProvider();

src/frontend/apps/impress/src/features/docs/doc-versioning/components/ModalVersion.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import {
66
VariantType,
77
useToastProvider,
88
} from '@openfun/cunningham-react';
9-
import { t } from 'i18next';
109
import { useRouter } from 'next/router';
10+
import { useTranslation } from 'react-i18next';
1111
import * as Y from 'yjs';
1212

1313
import { Box, Text } from '@/components';
@@ -30,6 +30,7 @@ export const ModalVersion = ({
3030
docId,
3131
versionId,
3232
}: ModalVersionProps) => {
33+
const { t } = useTranslation();
3334
const { toast } = useToastProvider();
3435
const { push } = useRouter();
3536
const { providers } = useDocStore();

src/frontend/apps/impress/src/features/docs/doc-versioning/components/VersionItem.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Button } from '@openfun/cunningham-react';
2-
import { t } from 'i18next';
32
import React, { PropsWithChildren, useState } from 'react';
3+
import { useTranslation } from 'react-i18next';
44

55
import { Box, DropButton, IconOptions, StyledLink, Text } from '@/components';
66
import { useCunninghamTheme } from '@/cunningham';
@@ -25,6 +25,7 @@ export const VersionItem = ({
2525
link,
2626
isActive,
2727
}: VersionItemProps) => {
28+
const { t } = useTranslation();
2829
const { colorsTokens } = useCunninghamTheme();
2930
const [isDropOpen, setIsDropOpen] = useState(false);
3031
const [isModalVersionOpen, setIsModalVersionOpen] = useState(false);

0 commit comments

Comments
 (0)