Revert the earlier mis-scoped orange on the personalization panel and instead expose rgb(241,119,50) as a selectable 'رنگ اصلی' swatch. When picked it overrides --primary/-600/-700/-soft/-soft2/-ring inline with exact hex, so every var(--primary) consumer across the whole admin (buttons, active nav, rings) becomes that orange. Non-fixed hues keep the oklch hue pipeline (inline overrides removed on switch). - uiStore: BrandHue interface + optional fixed hex; shared applyBrand() helper handles fixed vs hue, dark-aware soft tints - AdminLayout: reuse applyBrand() (no divergence with store) - Topbar: swatch shows the exact fixed color - tests: fixed-color apply, dark soft, and override-cleanup on switch Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
40 lines
1.4 KiB
TypeScript
40 lines
1.4 KiB
TypeScript
import React, { useEffect, useState } from 'react';
|
|
import { Outlet } from 'react-router-dom';
|
|
import Sidebar from './Sidebar';
|
|
import Topbar from './Topbar';
|
|
import { useUiStore, applyBrand } from '../../stores/uiStore';
|
|
|
|
export default function AdminLayout() {
|
|
const darkMode = useUiStore((s) => s.darkMode);
|
|
const density = useUiStore((s) => s.density);
|
|
const brandHue = useUiStore((s) => s.brandHue);
|
|
const sidebarOpen = useUiStore((s) => s.sidebarOpen);
|
|
const setSidebarOpen = useUiStore((s) => s.setSidebarOpen);
|
|
const [mobileOpen, setMobileOpen] = useState(false);
|
|
|
|
useEffect(() => {
|
|
const root = document.documentElement;
|
|
root.classList.toggle('dark', darkMode);
|
|
root.setAttribute('data-theme', darkMode ? 'dark' : 'light');
|
|
root.setAttribute('data-density', density);
|
|
applyBrand(root, brandHue, darkMode);
|
|
}, [darkMode, density, brandHue]);
|
|
|
|
return (
|
|
<div
|
|
className="app"
|
|
data-collapsed={!sidebarOpen ? 'true' : 'false'}
|
|
data-mobile-open={mobileOpen ? 'true' : 'false'}
|
|
>
|
|
<div className="scrim" onClick={() => setMobileOpen(false)} />
|
|
<Sidebar mobileOpen={mobileOpen} onMobileClose={() => setMobileOpen(false)} />
|
|
<div className="main">
|
|
<Topbar onMobileMenuOpen={() => setMobileOpen(true)} />
|
|
<main className="content">
|
|
<Outlet />
|
|
</main>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|