From 18cb1257f4a456f81bb60adc1d52a4acadd69876 Mon Sep 17 00:00:00 2001 From: R3D347HR4Y Date: Mon, 18 May 2026 14:38:27 +0200 Subject: [PATCH] Enhance email components with dynamic accent colors for active tabs and improved styling. Updated CompactInboxCategoryTabs and EmailList to utilize new accent color logic, refined sidebar icons, and adjusted layout for better responsiveness in split view. --- app/mail/mail-app-shell.tsx | 24 +++++++++-- .../gmail/compact-inbox-category-tabs.tsx | 22 ++++++++-- components/gmail/email-list.tsx | 42 +++++++++++-------- components/gmail/sidebar.tsx | 21 ++++++---- lib/inbox-category-tabs.ts | 16 ++++++- lib/mail-nav-icons.tsx | 6 ++- 6 files changed, 95 insertions(+), 36 deletions(-) diff --git a/app/mail/mail-app-shell.tsx b/app/mail/mail-app-shell.tsx index e3b10e5..2d051a8 100644 --- a/app/mail/mail-app-shell.tsx +++ b/app/mail/mail-app-shell.tsx @@ -33,6 +33,7 @@ import { DEFAULT_INBOX_TAB, type MailRouteState, } from "@/lib/mail-url" +import { cn } from "@/lib/utils" function segmentsFromPathname(pathname: string | null): string[] | undefined { if (!pathname?.startsWith("/mail")) return undefined @@ -120,7 +121,12 @@ function MailAppInner() { /> ) : null} -
+
{!sidebarCollapsed && touchNav && (
{!splitView ? ( t.id === displayedTabId) + const activeAccentColor = activeTab + ? inboxTabActiveAccentColor(activeTab.id, activeTab.badgeColor) + : "#0b57d0" + return (
{tabs.map((tab) => { const isActive = displayedTabId === tab.id + const accentColor = isActive + ? inboxTabActiveAccentColor(tab.id, tab.badgeColor) + : undefined const unseen = unseenInTabById[tab.id] ?? 0 const showMeta = inboxTabShowsInactiveMeta(tab.id) && !isActive && unseen > 0 @@ -135,8 +145,9 @@ export const CompactInboxCategoryTabs = memo(function CompactInboxCategoryTabs({ className={cn( TAB_ICON_CLASS, "transition-colors duration-200 motion-reduce:transition-none", - isActive ? "text-[#0b57d0]" : "text-[#5f6368]" + !isActive && "text-[#5f6368]" )} + style={accentColor ? { color: accentColor } : undefined} aria-hidden /> {showMeta && unseen > 0 ? ( @@ -147,7 +158,10 @@ export const CompactInboxCategoryTabs = memo(function CompactInboxCategoryTabs({ ) : null}
{isActive ? ( - + {tab.label} ) : null} diff --git a/components/gmail/email-list.tsx b/components/gmail/email-list.tsx index 6fab409..2086960 100644 --- a/components/gmail/email-list.tsx +++ b/components/gmail/email-list.tsx @@ -129,6 +129,7 @@ import { } from "@/lib/mail-folder-display" import { buildInboxCategoryTabIcons, + inboxTabActiveAccentColor, resolveEmailInboxCategoryTabs, } from "@/lib/inbox-category-tabs" import { @@ -2981,6 +2982,9 @@ export function EmailList({ > {inboxTabBarItems.map((tab) => { const isActive = activeInboxTabId === tab.id + const accentColor = isActive + ? inboxTabActiveAccentColor(tab.id, tab.badgeColor) + : undefined const unseen = unseenInTabById[tab.id] ?? 0 const senderLine = tabUnseenSenderLineById[tab.id] ?? "" const showMeta = @@ -2994,11 +2998,15 @@ export function EmailList({ aria-label={tab.label} aria-current={isActive ? "true" : undefined} onClick={() => handleCategoryInboxTabClick(tab.id)} + style={ + accentColor + ? { boxShadow: `inset 0 -3px 0 0 ${accentColor}` } + : undefined + } className={cn( "relative z-[1] flex cursor-pointer transition-colors", "min-w-0 w-full overflow-hidden max-sm:min-h-10 max-sm:items-center max-sm:justify-center", "sm:min-h-14 sm:items-center sm:py-2 sm:text-left", - isActive && "shadow-[inset_0_-3px_0_0_#0b57d0]", !isActive && "hover:bg-[#f1f3f4]" )} > @@ -3009,8 +3017,9 @@ export function EmailList({ icon={tab.icon} className={cn( CATEGORY_TAB_ICON_CLASS, - isActive ? "text-[#0b57d0]" : "text-[#5f6368]" + !isActive && "text-[#5f6368]" )} + style={accentColor ? { color: accentColor } : undefined} aria-hidden /> {showMeta && unseen > 0 ? ( @@ -3028,8 +3037,9 @@ export function EmailList({ className={cn( CATEGORY_TAB_ICON_CLASS, "self-center", - isActive ? "text-[#0b57d0]" : "text-[#5f6368]" + !isActive && "text-[#5f6368]" )} + style={accentColor ? { color: accentColor } : undefined} aria-hidden />
@@ -3042,8 +3052,9 @@ export function EmailList({ {tab.label} @@ -3080,8 +3091,7 @@ export function EmailList({ !splitView && isViewMode && openEmail ? "relative flex min-h-0 flex-1 flex-col overflow-hidden" : mainScrollClass, - "relative min-h-0 flex-1 overscroll-y-none max-sm:pb-16", - listToolbarMode && "sm:pb-12" + "relative min-h-0 flex-1 overscroll-y-none max-sm:pb-16" )} > {listToolbarMode && ( @@ -3286,7 +3296,7 @@ export function EmailList({ !splitView && "md:flex md:items-start md:gap-2 md:px-2 md:py-1.5", isSplitActiveRow - ? "z-[1] bg-[#e8f0fe] shadow-[inset_3px_0_0_0_#0b57d0]" + ? "z-[1] bg-[#e8f0fe] shadow-[inset_3px_0_0_0_#669df6]" : isSelected ? "bg-[#e8f0fe]" : isRead @@ -4527,16 +4537,14 @@ export function EmailList({
{listToolbarMode ? ( -
-
- -
+
+
) : null}
diff --git a/components/gmail/sidebar.tsx b/components/gmail/sidebar.tsx index 2c41898..331f817 100644 --- a/components/gmail/sidebar.tsx +++ b/components/gmail/sidebar.tsx @@ -7,7 +7,6 @@ import { ClockArrowUp, Send, FileText, - Tag, ChevronDown, GripVertical, Pencil, @@ -141,7 +140,7 @@ const mainItems = [ { id: "inbox", label: "Boîte de réception", icon: Inbox }, { id: "starred", label: "Messages suivis", icon: Star }, { id: "snoozed", label: "En attente", icon: Clock }, - { id: "important", label: "Important", icon: Tag }, + { id: "important", label: "Important", icon: "mdi:label-variant-outline" }, { id: "sent", label: "Messages envoyés", icon: Send }, { id: "drafts", label: "Brouillons", icon: FileText }, { id: "scheduled", label: "Planifié", icon: ClockArrowUp }, @@ -1015,12 +1014,16 @@ export function Sidebar({ isSelected, unreadCount, }: { - item: { id: string; label: string; icon: React.ElementType } + item: { id: string; label: string; icon: React.ElementType | string } isSelected: boolean unreadCount: number }) => { const { isOver, dropHandlers } = useEmailDropTarget(item.id, item.label) const hasUnread = unreadCount > 0 + const iconClassName = cn( + "h-5 w-5 shrink-0", + hasUnread && !isSelected && "text-gray-900" + ) return (