Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ const ALLOWED_TABS: Record<Role, string[]> = {
export const App: React.FC = () => {
const { user, activeRole, setActiveRole, isAuthenticated, isLoading, logout } = useAuth();
const [activeTab, setActiveTab] = useState<string>('create');
const [theme, setTheme] = useState<'dark' | 'light'>(() => {
const savedTheme = window.localStorage.getItem('resolveiq-theme');
return savedTheme === 'light' ? 'light' : 'dark';
});

useEffect(() => {
document.documentElement.dataset.theme = theme;
window.localStorage.setItem('resolveiq-theme', theme);
}, [theme]);

useEffect(() => {
if (!ALLOWED_TABS[activeRole].includes(activeTab)) setActiveTab(DEFAULT_TAB[activeRole]);
Expand Down Expand Up @@ -72,7 +81,15 @@ export const App: React.FC = () => {

return (
<div className="flex min-h-screen flex-col bg-background">
<Navbar currentRole={activeRole} availableRoles={user.roles} userName={user.fullName} onRoleChange={handleRoleChange} onLogout={logout} />
<Navbar
currentRole={activeRole}
availableRoles={user.roles}
userName={user.fullName}
theme={theme}
onRoleChange={handleRoleChange}
onThemeToggle={() => setTheme(currentTheme => currentTheme === 'dark' ? 'light' : 'dark')}
onLogout={logout}
/>
<div className="flex min-h-0 flex-1">
<Sidebar currentRole={activeRole} activeTab={activeTab} onSelectTab={setActiveTab} />
<main className="min-w-0 flex-1 overflow-x-hidden pb-[68px] lg:pb-0">
Expand Down
29 changes: 19 additions & 10 deletions frontend/src/components/layout/Navbar.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import React from 'react';
import { Bell, ChevronDown, LogOut, Sparkles } from 'lucide-react';
import { Bell, ChevronDown, LogOut, Moon, Sun } from 'lucide-react';
import { Role } from '../../types';

interface NavbarProps {
currentRole: Role;
availableRoles: Role[];
userName: string;
theme: 'dark' | 'light';
onRoleChange: (role: string) => void;
onThemeToggle: () => void;
onLogout: () => Promise<void>;
}

Expand All @@ -23,7 +25,9 @@ export const Navbar: React.FC<NavbarProps> = ({
currentRole,
availableRoles,
userName,
theme,
onRoleChange,
onThemeToggle,
onLogout,
}) => {
const initials = userName
Expand All @@ -34,20 +38,15 @@ export const Navbar: React.FC<NavbarProps> = ({
.toUpperCase();

return (
<header className="sticky top-0 z-40 h-16 border-b border-border-subtle bg-surface/95 backdrop-blur">
<div className="flex h-full items-center justify-between px-4 sm:px-6">
<header className="sticky top-0 z-40 h-[72px] border-b border-border-subtle bg-surface/95 backdrop-blur">
<div className="flex h-full items-center justify-between px-5 sm:px-8">
<div className="flex min-w-0 items-center gap-3">
<div className="grid h-9 w-9 flex-none place-items-center rounded-[11px] bg-slate-950 text-white shadow-sm dark:bg-white dark:text-slate-950">
<Sparkles className="h-[18px] w-[18px]" strokeWidth={2.2} />
</div>
<div className="grid h-10 w-10 flex-none place-items-center rounded-lg bg-primary text-sm font-semibold text-white">R</div>
<div className="min-w-0">
<div className="flex items-center gap-2">
<span className="truncate text-[15px] font-semibold tracking-[-0.02em] text-DEFAULT">ResolveIQ</span>
<span className="hidden rounded-full border border-border-subtle bg-surface-muted px-2 py-0.5 text-[9px] font-semibold uppercase tracking-[0.08em] text-muted sm:inline-flex">
Alpha
</span>
</div>
<span className="hidden text-[11px] text-muted sm:block">Support intelligence workspace</span>
<span className="hidden text-[11px] text-muted sm:block">Support workspace</span>
</div>
</div>

Expand Down Expand Up @@ -86,6 +85,16 @@ export const Navbar: React.FC<NavbarProps> = ({
<span className="absolute right-1.5 top-1.5 h-1.5 w-1.5 rounded-full bg-primary ring-2 ring-surface" />
</button>

<button
type="button"
onClick={onThemeToggle}
aria-label={theme === 'dark' ? 'Switch to light mode' : 'Switch to dark mode'}
title={theme === 'dark' ? 'Switch to light mode' : 'Switch to dark mode'}
className="icon-button"
>
{theme === 'dark' ? <Sun className="h-[17px] w-[17px]" /> : <Moon className="h-[17px] w-[17px]" />}
</button>

<div className="ml-1 flex items-center gap-2 border-l border-border-subtle pl-3">
<div className="grid h-8 w-8 flex-none place-items-center rounded-full bg-primary-soft text-[11px] font-semibold text-primary">
{initials || 'RI'}
Expand Down
7 changes: 3 additions & 4 deletions frontend/src/components/layout/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,22 +93,21 @@ export const Sidebar: React.FC<SidebarProps> = ({ currentRole, activeTab, onSele
key={item.id}
onClick={() => onSelectTab(item.id)}
aria-current={isActive ? 'page' : undefined}
className={`group relative flex items-center gap-3 rounded-btn text-sm transition-colors lg:w-full lg:px-3 lg:py-2.5 ${
className={`group relative flex items-center gap-3 rounded-btn text-sm transition-colors lg:w-full lg:px-3 lg:py-2 ${
isActive
? 'bg-primary-soft text-primary'
: 'text-muted hover:bg-surface-muted hover:text-DEFAULT'
}`}
>
<Icon className="h-[17px] w-[17px] flex-none" strokeWidth={isActive ? 2.2 : 1.8} />
<span className="font-medium lg:block">{item.label}</span>
{isActive && <span className="absolute left-0 hidden h-5 w-0.5 rounded-full bg-primary lg:block" />}
</button>
);
});

return (
<>
<aside className="hidden w-64 flex-none flex-col justify-between border-r border-border-subtle bg-surface px-3 py-5 lg:flex">
<aside className="hidden w-60 flex-none flex-col justify-between border-r border-border-subtle bg-surface px-3 py-5 lg:flex">
<div>
<div className="px-3 pb-4">
<span className="eyebrow mb-1">Workspace</span>
Expand All @@ -117,7 +116,7 @@ export const Sidebar: React.FC<SidebarProps> = ({ currentRole, activeTab, onSele
<nav aria-label="Primary navigation" className="space-y-1">{navigation}</nav>
</div>

<div className="mx-1 rounded-card border border-border-subtle bg-surface-muted p-3.5">
<div className="mx-1 rounded-card border border-border-subtle bg-surface-muted p-3">
<div className="mb-1.5 flex items-center gap-2 text-xs font-semibold text-DEFAULT">
<LifeBuoy className="h-4 w-4 text-primary" />
Need a hand?
Expand Down
Loading
Loading