- Add multi-language support for registration and user menu components
- Refactor `TextEditor` to include book-closing functionality with updated toolbar buttons - Replace `generateHTML` with a lightweight custom TipTap-to-HTML renderer - Update and lock `esbuild` and related dependencies to latest versions
This commit is contained in:
@@ -2,9 +2,11 @@ import {useContext, useEffect, useRef, useState} from "react";
|
||||
import {SessionContext} from "@/context/SessionContext";
|
||||
import NoPicture from "@/components/NoPicture";
|
||||
import System from "@/lib/models/System";
|
||||
import {useTranslations} from "next-intl";
|
||||
|
||||
export default function UserMenu() {
|
||||
const {session} = useContext(SessionContext);
|
||||
const t = useTranslations();
|
||||
|
||||
const profileMenuRef: React.RefObject<HTMLDivElement | null> = useRef<HTMLDivElement>(null);
|
||||
|
||||
@@ -32,15 +34,8 @@ export default function UserMenu() {
|
||||
|
||||
async function handleLogout(): Promise<void> {
|
||||
System.removeCookie("token");
|
||||
|
||||
// Si dans Electron, utiliser IPC pour logout
|
||||
if (window.electron) {
|
||||
await window.electron.removeToken();
|
||||
window.electron.logout();
|
||||
} else {
|
||||
// Fallback web
|
||||
document.location.href = "https://eritors.com/login";
|
||||
}
|
||||
await window.electron.removeToken();
|
||||
window.electron.logout();
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -64,11 +59,11 @@ export default function UserMenu() {
|
||||
<a href="https://eritors.com/settings"
|
||||
className="group flex items-center gap-3 px-4 py-2.5 text-text-primary hover:bg-secondary/50 transition-all hover:pl-5">
|
||||
<span
|
||||
className="text-sm font-medium group-hover:text-primary transition-colors">Paramètres</span>
|
||||
className="text-sm font-medium group-hover:text-primary transition-colors">{t('userMenu.settings')}</span>
|
||||
</a>
|
||||
<a onClick={handleLogout} href="#"
|
||||
className="group flex items-center gap-3 px-4 py-2.5 text-error hover:bg-error/10 transition-all hover:pl-5 rounded-b-xl">
|
||||
<span className="text-sm font-medium">Déconnexion</span>
|
||||
<span className="text-sm font-medium">{t('userMenu.logout')}</span>
|
||||
</a>
|
||||
</div>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user