diff --git a/CHANGELOG.md b/CHANGELOG.md index f6220a44..2e355e59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,10 @@ and this project adheres to - 🔥(backend) drop deprecated numchild columns from item +### Added + +- ✨(frontend) add CTA on public link for anonymous and authenticated users + ## [v0.18.0] - 2026-05-04 ### Added diff --git a/src/frontend/apps/drive/src/features/ui/components/user/UserProfile.tsx b/src/frontend/apps/drive/src/features/ui/components/user/UserProfile.tsx index c7af44fd..bb2361f2 100644 --- a/src/frontend/apps/drive/src/features/ui/components/user/UserProfile.tsx +++ b/src/frontend/apps/drive/src/features/ui/components/user/UserProfile.tsx @@ -1,8 +1,20 @@ -import { UserMenu } from "@gouvfr-lasuite/ui-kit"; +import { + DropdownMenu, + Icon, + IconSize, + useDropdownMenu, + UserMenu, +} from "@gouvfr-lasuite/ui-kit"; import { useAuth } from "@/features/auth/Auth"; import { logout } from "@/features/auth/Auth"; -import { LanguagePickerUserMenu } from "@/features/layouts/components/header/Header"; -import { LoginButton } from "@/features/auth/components/LoginButton"; +import { + LanguagePickerUserMenu, + LANGUAGES, +} from "@/features/layouts/components/header/Header"; +import { AnonymousCTA } from "../anonymous-cta/AnonymousCTA"; +import { Button } from "@gouvfr-lasuite/cunningham-react"; +import { useTranslation } from "react-i18next"; +import { useClipboard } from "@/hooks/useCopyToClipboard"; export const UserProfile = () => { const { user } = useAuth(); @@ -16,8 +28,50 @@ export const UserProfile = () => { actions={} /> ) : ( - + <> + + + )} ); }; + +const AnonymousDropdownMenu = () => { + const { isOpen, setIsOpen } = useDropdownMenu(); + const { t, i18n } = useTranslation(); + const copyToClipboard = useClipboard(); + + return ( + , + label: t("anonymous_dropdown_menu.copy_link"), + callback: () => { + copyToClipboard(window.location.href); + }, + }, + { + icon: , + label: t("anonymous_dropdown_menu.languages"), + children: LANGUAGES.map((language) => ({ + label: language.label, + callback: () => { + i18n.changeLanguage(language.value); + }, + })), + }, + ]} + > + - + {mode === CustomFilesPreviewMode.DEFAULT && ( + <> +
+ +
- {shareModal.isOpen && ( - + {shareModal.isOpen && ( + + )} + + )} + + {children} + + {mode === CustomFilesPreviewMode.CONTEXTUAL && ( +
+ {user ? : } +
)} ); diff --git a/src/frontend/apps/drive/src/pages/explorer/items/files/[id].tsx b/src/frontend/apps/drive/src/pages/explorer/items/files/[id].tsx index 1f46c65a..3b7cab05 100644 --- a/src/frontend/apps/drive/src/pages/explorer/items/files/[id].tsx +++ b/src/frontend/apps/drive/src/pages/explorer/items/files/[id].tsx @@ -1,11 +1,15 @@ import { GenericDisclaimer } from "@/features/ui/components/generic-disclaimer/GenericDisclaimer"; import { SpinnerPage } from "@/features/ui/components/spinner/SpinnerPage"; -import { CustomFilesPreview } from "@/features/ui/preview/CustomFilesPreview"; +import { + CustomFilesPreview, + CustomFilesPreviewMode, +} from "@/features/ui/preview/CustomFilesPreview"; import { Icon } from "@gouvfr-lasuite/ui-kit"; import { Button } from "@gouvfr-lasuite/cunningham-react"; import { useRouter } from "next/router"; import { useTranslation } from "react-i18next"; import { useItem } from "@/features/explorer/hooks/useQueries"; +import { GlobalLayout } from "@/features/layouts/components/global/GlobalLayout"; export default function FilePage() { const { t } = useTranslation(); @@ -37,7 +41,15 @@ export default function FilePage() { return (
- +
); } + +FilePage.getLayout = function getLayout(page: React.ReactElement) { + return {page}; +};