ultisuite-client/lib/mail-settings/settings-nav.ts
R3D347HR4Y 6ec95262af Add OnlyOffice integration and update project configurations
- Updated .env.example to include configuration for OnlyOffice Document Server.
- Modified the workspace configuration to remove the drive-suite path.
- Adjusted TypeScript environment imports for consistency.
- Enhanced Next.js configuration to disable canvas in Webpack.
- Updated package.json to include new dependencies for OnlyOffice and PDF.js.
- Added global styles for OnlyOffice theme integration in the CSS.
- Created new layout and page components for the Drive feature, including public sharing and editing functionalities.
- Updated metadata handling across various layouts to reflect the new app structure.
2026-06-07 15:49:21 +02:00

111 lines
2.6 KiB
TypeScript

import type { LucideIcon } from "lucide-react"
import {
Bell,
Bot,
FolderKanban,
Monitor,
PenLine,
Users,
} from "lucide-react"
export type MailSettingsSectionId =
| "display"
| "accounts"
| "signatures"
| "labels"
| "notifications"
| "automation"
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 et identités d'envoi",
href: "/mail/settings/accounts",
icon: Users,
},
{
id: "signatures",
label: "Signatures",
description: "Bibliothèque et attribution par identité",
href: "/mail/settings/signatures",
icon: PenLine,
},
{
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,
},
]
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",
"signatures",
"automation",
]
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)
)
}