Skip to content

Commit cfaee60

Browse files
committed
fixup! ✨(frontend) can restore from trashbin list actions
1 parent 5a50fa2 commit cfaee60

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

src/frontend/apps/impress/src/components/dropdown-menu/DropdownMenu.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { HorizontalSeparator } from '@gouvfr-lasuite/ui-kit';
22
import {
33
Fragment,
44
PropsWithChildren,
5+
ReactNode,
56
useCallback,
67
useEffect,
78
useRef,
@@ -15,7 +16,7 @@ import { useCunninghamTheme } from '@/cunningham';
1516
import { useDropdownKeyboardNav } from './hook/useDropdownKeyboardNav';
1617

1718
export type DropdownMenuOption = {
18-
icon?: string;
19+
icon?: ReactNode;
1920
label: string;
2021
testId?: string;
2122
value?: string;
@@ -220,7 +221,7 @@ export const DropdownMenu = ({
220221
$align="center"
221222
$gap={spacingsTokens['base']}
222223
>
223-
{option.icon && (
224+
{option.icon && typeof option.icon === 'string' && (
224225
<Icon
225226
$size="20px"
226227
$theme="greyscale"
@@ -229,6 +230,9 @@ export const DropdownMenu = ({
229230
aria-hidden="true"
230231
/>
231232
)}
233+
{option.icon &&
234+
typeof option.icon !== 'string' &&
235+
option.icon}
232236
<Text $variation={isDisabled ? '400' : '1000'}>
233237
{option.label}
234238
</Text>

src/frontend/apps/impress/src/features/docs/docs-grid/components/DocsGridTrashbinActions.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { VariantType, useToastProvider } from '@openfun/cunningham-react';
2-
import { useRouter } from 'next/router';
32
import { useTranslation } from 'react-i18next';
43
import { css } from 'styled-components';
54

@@ -17,13 +16,10 @@ export const DocsGridTrashbinActions = ({
1716
}: DocsGridTrashbinActionsProps) => {
1817
const { t } = useTranslation();
1918
const { toast } = useToastProvider();
20-
const { push } = useRouter();
2119
const { mutate: restoreDoc, error } = useRestoreDoc({
2220
listInvalidQueries: [KEY_LIST_DOC, KEY_LIST_DOC_TRASHBIN],
2321
options: {
24-
onSuccess: (_data, variables) => {
25-
void push('/docs/' + variables.docId);
26-
22+
onSuccess: (_data) => {
2723
toast(t('The document has been restored.'), VariantType.SUCCESS, {
2824
duration: 4000,
2925
});
@@ -45,7 +41,16 @@ export const DocsGridTrashbinActions = ({
4541
const options: DropdownMenuOption[] = [
4642
{
4743
label: t('Restore'),
48-
icon: 'undo',
44+
icon: (
45+
<Icon
46+
$size="20px"
47+
$theme="greyscale"
48+
$variation="1000"
49+
iconName="undo"
50+
aria-hidden="true"
51+
variant="symbols-outlined"
52+
/>
53+
),
4954
callback: () => {
5055
restoreDoc({
5156
docId: doc.id,

0 commit comments

Comments
 (0)