ultisuite-client/lib/mail-settings/settings-nav.ts
R3D347HR4Y ad1370ea7e
Some checks are pending
E2E / Playwright e2e (push) Waiting to run
feat: enhance configuration and add new demo layouts
- Introduced turbopack alias for canvas in next.config.mjs.
- Updated package.json scripts for development and branding tasks.
- Added new dependencies for Tiptap extensions.
- Implemented new demo layouts for agenda, contacts, drive, and mail applications.
- Enhanced globals.css for improved theming and splash screen animations.
- Added OAuth callback handling for drive mounts.
- Updated layout components to integrate new demo shells and improve structure.
2026-06-12 19:10:24 +02:00

122 lines
2.9 KiB
TypeScript

import type { LucideIcon } from "lucide-react"
import {
Bell,
Bot,
CalendarDays,
FolderKanban,
Monitor,
Users,
} from "lucide-react"
export type MailSettingsSectionId =
| "display"
| "accounts"
| "labels"
| "notifications"
| "automation"
| "agenda"
export type MailSettingsNavItem = {
id: MailSettingsSectionId
label: string
description: string
href: string
icon: LucideIcon
}
export const MAIL_SETTINGS_NAV: MailSettingsNavItem[] = [
{
id: "display",
label: "Affichage",
description: "Densité, thème, boîte de réception, volet de lecture",
href: "/mail/settings",
icon: Monitor,
},
{
id: "accounts",
label: "Comptes mail",
description: "IMAP, SMTP, identités d'envoi et signatures",
href: "/mail/settings/accounts",
icon: Users,
},
{
id: "labels",
label: "Libellés et dossiers",
description: "Organisation unifiée cross-comptes",
href: "/mail/settings/labels",
icon: FolderKanban,
},
{
id: "notifications",
label: "Notifications",
description: "Alertes desktop, mobile et e-mail",
href: "/mail/settings/notifications",
icon: Bell,
},
{
id: "automation",
label: "Automatisations",
description: "Règles, webhooks, LLM, recherche web, tokens API",
href: "/mail/settings/automation",
icon: Bot,
},
{
id: "agenda",
label: "Agenda",
description: "Affichage, visio, invitations, agendas et vues",
href: "/mail/settings/agenda",
icon: CalendarDays,
},
]
export function isMailSettingsNavActive(
pathname: string | null,
item: MailSettingsNavItem
): boolean {
if (item.href === "/mail/settings") {
return (
pathname === "/mail/settings" || pathname === "/mail/settings/display"
)
}
return (
pathname === item.href || Boolean(pathname?.startsWith(`${item.href}/`))
)
}
export function resolveMailSettingsSection(
segments: string[] | undefined
): MailSettingsSectionId {
const slug = segments?.[0]
const match = MAIL_SETTINGS_NAV.find((item) => {
if (item.id === "display") return !slug || slug === "display"
return item.href.endsWith(`/${slug}`)
})
return match?.id ?? "display"
}
const MAIL_SETTINGS_WIDE_LAYOUT_SECTIONS: MailSettingsSectionId[] = [
"display",
"automation",
"agenda",
]
const MAIL_SETTINGS_LEFT_ALIGNED_SECTIONS: MailSettingsSectionId[] = ["accounts"]
export function isMailSettingsWideLayoutPath(pathname: string | null): boolean {
if (!pathname?.startsWith("/mail/settings")) return false
return MAIL_SETTINGS_NAV.some(
(item) =>
MAIL_SETTINGS_WIDE_LAYOUT_SECTIONS.includes(item.id) &&
isMailSettingsNavActive(pathname, item)
)
}
export function isMailSettingsLeftAlignedPath(pathname: string | null): boolean {
if (!pathname?.startsWith("/mail/settings")) return false
return MAIL_SETTINGS_NAV.some(
(item) =>
MAIL_SETTINGS_LEFT_ALIGNED_SECTIONS.includes(item.id) &&
isMailSettingsNavActive(pathname, item)
)
}