diff --git a/app/dashboard/layout.tsx b/app/dashboard/layout.tsx index a1160de..9ed7b97 100644 --- a/app/dashboard/layout.tsx +++ b/app/dashboard/layout.tsx @@ -21,9 +21,10 @@ import { LogOut, ChevronDown, Home, - Key, TestTube, - User + User, + Copy, + CheckCircle, } from "@/lib/icons" import UserStore from "@/lib/4nk/UserStore" import EventBus from "@/lib/4nk/EventBus" @@ -39,12 +40,11 @@ export default function DashboardLayout({ children }: { children: React.ReactNod const [isAuthModalOpen, setIsAuthModalOpen] = useState(false) const [show4nkAuthModal, setShow4nkAuthModal] = useState(false) const [isLoading, setIsLoading] = useState(true) - const [isMockMode, setIsMockMode] = useState(false) + const [isMockMode, setIsMockMode] = useState(true) const [userInfo, setUserInfo] = useState(null) const [showLogoutConfirm, setShowLogoutConfirm] = useState(false) - const [isPrivateKeyFlash, setIsPrivateKeyFlash] = useState(false) + const [isCopied, setIsCopied] = useState(false) const router = useRouter() - const pathname = usePathname() useEffect(() => { try { @@ -114,20 +114,16 @@ export default function DashboardLayout({ children }: { children: React.ReactNod setShowLogoutConfirm(true) }, []); - useEffect(() => { - const onPrivateKeyAccess = () => { - setIsPrivateKeyFlash(true) - setTimeout(() => setIsPrivateKeyFlash(false), 400) + const handleCopyToClipboard = useCallback(() => { + if (userPairingId) { + navigator.clipboard.writeText(userPairingId).then(() => { + setIsCopied(true); + setTimeout(() => setIsCopied(false), 2000); + }).catch(err => { + console.error('Erreur lors de la copie : ', err); + }); } - if (typeof window !== "undefined") { - window.addEventListener("private-key-access", onPrivateKeyAccess as EventListener) - } - return () => { - if (typeof window !== "undefined") { - window.removeEventListener("private-key-access", onPrivateKeyAccess as EventListener) - } - } - }, []) + }, [userPairingId]); return (
@@ -180,6 +176,27 @@ export default function DashboardLayout({ children }: { children: React.ReactNod +
+

+ {userInfo?.id} +

+ +

{userInfo?.name}

{userInfo?.company}