mirror of
https://github.com/Luchexx/wacrm.git
synced 2026-11-02 17:29:45 +00:00
The legal brief on third-party trademark use says: avoid the WhatsApp teal/green palette and any visual treatment that could read as a WhatsApp/Meta product. Emerald-500 was used as the primary brand colour across hero, CTAs, sidebar, charts, badges, and the favicon — close enough in hue to WhatsApp's signature green to muddy the line. Swapping to Tailwind violet (which matches the Hostinger brand purple #7c3aed) makes the visual identity unambiguously ours. Scope: - Mechanical Tailwind class swap: emerald-* → violet-* across src/. - src/app/globals.css: --primary, --ring, --sidebar-primary, --sidebar-ring, --chart-1 oklch tokens swapped from emerald (oklch 0.696 0.17 162) to Hostinger-aligned violet (oklch 0.526 0.247 293). - src/app/icon.tsx: favicon background #10b981 → #7c3aed. - src/app/opengraph-image.tsx: badge bg, accent text, gradient. - src/components/landing/hero.tsx + cta-banner.tsx: radial-gradient hex. - src/components/landing/mock/analytics-mock.tsx: marketing chart line. - src/components/dashboard/conversations-chart.tsx + response-time-chart.tsx: "Outgoing" series colour. Distinguishable from "Incoming" blue at a glance; we can revisit the chart pair later for stronger colourblind contrast (separate concern). - README.md: license badge colour parameter. Out of scope: - src/components/settings/tag-manager.tsx still offers "Emerald" as one of the user-pickable contact-tag colours alongside Blue / Yellow / Red / etc. — that's a user data choice, not a brand mark. Contrast check: white text on #7c3aed measures ~4.78:1 (WCAG AA passing for normal body text). Violet-400 (#a78bfa) on slate-950 measures ~10:1 for accent text, well clear of AA. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
140 lines
4.5 KiB
TypeScript
140 lines
4.5 KiB
TypeScript
"use client";
|
||
|
||
import Link from "next/link";
|
||
import { usePathname } from "next/navigation";
|
||
import { useAuth } from "@/hooks/use-auth";
|
||
import { LogOut, Menu, Settings as SettingsIcon, User } from "lucide-react";
|
||
import {
|
||
Avatar,
|
||
AvatarFallback,
|
||
AvatarImage,
|
||
} from "@/components/ui/avatar";
|
||
import {
|
||
DropdownMenu,
|
||
DropdownMenuContent,
|
||
DropdownMenuItem,
|
||
DropdownMenuSeparator,
|
||
DropdownMenuTrigger,
|
||
} from "@/components/ui/dropdown-menu";
|
||
|
||
const pageTitles: Record<string, string> = {
|
||
"/dashboard": "Dashboard",
|
||
"/inbox": "Inbox",
|
||
"/contacts": "Contacts",
|
||
"/pipelines": "Pipelines",
|
||
"/broadcasts": "Broadcasts",
|
||
"/automations": "Automations",
|
||
"/settings": "Settings",
|
||
};
|
||
|
||
function getPageTitle(pathname: string): string {
|
||
if (pageTitles[pathname]) return pageTitles[pathname];
|
||
const match = Object.entries(pageTitles).find(([path]) =>
|
||
pathname.startsWith(path),
|
||
);
|
||
return match ? match[1] : "Dashboard";
|
||
}
|
||
|
||
interface HeaderProps {
|
||
/** Wired to the shell's drawer state. Used only on mobile — the
|
||
* hamburger button is hidden on lg+. */
|
||
onOpenSidebar?: () => void;
|
||
}
|
||
|
||
export function Header({ onOpenSidebar }: HeaderProps) {
|
||
const pathname = usePathname();
|
||
const { profile, signOut } = useAuth();
|
||
const title = getPageTitle(pathname);
|
||
|
||
const initial =
|
||
profile?.full_name?.charAt(0)?.toUpperCase() ??
|
||
profile?.email?.charAt(0)?.toUpperCase() ??
|
||
"U";
|
||
|
||
return (
|
||
<header className="flex h-14 shrink-0 items-center justify-between gap-3 border-b border-slate-800 bg-slate-950 px-4 lg:px-6">
|
||
<div className="flex min-w-0 items-center gap-2">
|
||
{/* Hamburger — mobile only. 44×44 hit target per Apple HIG. */}
|
||
<button
|
||
type="button"
|
||
onClick={onOpenSidebar}
|
||
aria-label="Open menu"
|
||
className="flex h-10 w-10 items-center justify-center rounded-md text-slate-300 transition-colors hover:bg-slate-800 hover:text-white lg:hidden"
|
||
>
|
||
<Menu className="h-5 w-5" />
|
||
</button>
|
||
<h1 className="truncate text-base font-semibold text-white sm:text-lg">
|
||
{title}
|
||
</h1>
|
||
</div>
|
||
|
||
<DropdownMenu>
|
||
<DropdownMenuTrigger
|
||
className="flex items-center gap-2 rounded-md px-1 py-1 transition-colors hover:bg-slate-800/70 focus:bg-slate-800/70 focus:outline-none data-popup-open:bg-slate-800/70 sm:gap-3 sm:pl-1 sm:pr-3"
|
||
aria-label="Open account menu"
|
||
>
|
||
<Avatar className="size-8">
|
||
{profile?.avatar_url ? (
|
||
<AvatarImage
|
||
src={profile.avatar_url}
|
||
alt={profile.full_name ?? "Avatar"}
|
||
/>
|
||
) : null}
|
||
<AvatarFallback className="bg-violet-500/10 text-sm font-medium text-violet-500">
|
||
{initial}
|
||
</AvatarFallback>
|
||
</Avatar>
|
||
<span className="hidden text-sm font-medium text-white sm:inline">
|
||
{profile?.full_name ?? "User"}
|
||
</span>
|
||
</DropdownMenuTrigger>
|
||
<DropdownMenuContent
|
||
align="end"
|
||
sideOffset={6}
|
||
className="min-w-56 bg-slate-900 text-slate-100 ring-slate-700"
|
||
>
|
||
<div className="px-2 py-1.5">
|
||
<p className="truncate text-sm font-medium text-white">
|
||
{profile?.full_name ?? "User"}
|
||
</p>
|
||
<p className="truncate text-xs text-slate-400">
|
||
{profile?.email ?? ""}
|
||
</p>
|
||
</div>
|
||
<DropdownMenuSeparator className="bg-slate-800" />
|
||
<DropdownMenuItem
|
||
render={
|
||
<Link
|
||
href="/settings?tab=profile"
|
||
className="text-slate-200 focus:bg-slate-800 focus:text-white"
|
||
/>
|
||
}
|
||
>
|
||
<User className="size-4" />
|
||
Profile
|
||
</DropdownMenuItem>
|
||
<DropdownMenuItem
|
||
render={
|
||
<Link
|
||
href="/settings?tab=whatsapp"
|
||
className="text-slate-200 focus:bg-slate-800 focus:text-white"
|
||
/>
|
||
}
|
||
>
|
||
<SettingsIcon className="size-4" />
|
||
Settings
|
||
</DropdownMenuItem>
|
||
<DropdownMenuSeparator className="bg-slate-800" />
|
||
<DropdownMenuItem
|
||
onClick={signOut}
|
||
className="text-slate-200 focus:bg-slate-800 focus:text-white"
|
||
>
|
||
<LogOut className="size-4" />
|
||
Sign out
|
||
</DropdownMenuItem>
|
||
</DropdownMenuContent>
|
||
</DropdownMenu>
|
||
</header>
|
||
);
|
||
}
|