fix: 修正租戶品牌樣式注入邏輯與清除深色模式殘留
This commit is contained in:
@@ -34,6 +34,7 @@ import {
|
||||
import { usePermission } from "@/hooks/usePermission";
|
||||
import ApplicationLogo from "@/Components/ApplicationLogo";
|
||||
import { generateLightestColor, generateLightColor, generateDarkColor, generateActiveColor } from "@/utils/colorUtils";
|
||||
import { PageProps } from "@/types/global";
|
||||
|
||||
interface MenuItem {
|
||||
id: string;
|
||||
@@ -51,9 +52,9 @@ export default function AuthenticatedLayout({
|
||||
children: React.ReactNode,
|
||||
breadcrumbs?: BreadcrumbItemType[]
|
||||
}) {
|
||||
const { url, props } = usePage();
|
||||
// @ts-ignore
|
||||
const user = props.auth?.user || { name: 'Guest', username: 'guest' };
|
||||
const { url, props } = usePage<PageProps & { [key: string]: any }>();
|
||||
const branding = props.branding;
|
||||
const user = props.auth?.user || { name: 'Guest', username: 'guest', roles: [], role_labels: [], permissions: [] };
|
||||
const { can, canAny } = usePermission();
|
||||
const [isCollapsed, setIsCollapsed] = useState(() => {
|
||||
if (typeof window !== "undefined") {
|
||||
@@ -331,16 +332,16 @@ export default function AuthenticatedLayout({
|
||||
<div className="flex min-h-screen bg-slate-50">
|
||||
<Head>
|
||||
<link rel="icon" type="image/png" href="/favicon.png" />
|
||||
<style>{`
|
||||
:root {
|
||||
--primary-main: ${(props as any).branding?.primary_color || '#01ab83'};
|
||||
--primary-dark: ${generateDarkColor((props as any).branding?.primary_color || '#01ab83')};
|
||||
--primary-light: ${generateLightColor((props as any).branding?.primary_color || '#01ab83')};
|
||||
--primary-lightest: ${generateLightestColor((props as any).branding?.primary_color || '#01ab83')};
|
||||
--button-main-active: ${generateActiveColor((props as any).branding?.primary_color || '#01ab83')};
|
||||
}
|
||||
`}</style>
|
||||
</Head>
|
||||
<style>{`
|
||||
:root {
|
||||
--primary-main: ${branding?.primary_color || '#01ab83'};
|
||||
--primary-dark: ${generateDarkColor(branding?.primary_color || '#01ab83')};
|
||||
--primary-light: ${generateLightColor(branding?.primary_color || '#01ab83')};
|
||||
--primary-lightest: ${generateLightestColor(branding?.primary_color || '#01ab83')};
|
||||
--button-main-active: ${generateActiveColor(branding?.primary_color || '#01ab83')};
|
||||
}
|
||||
`}</style>
|
||||
{/* Mobile Header -> Global Header */}
|
||||
<header className="fixed top-0 left-0 right-0 h-16 bg-white border-b border-slate-200 z-[60] flex items-center justify-between px-4 transition-all duration-300">
|
||||
<div className="flex items-center gap-2">
|
||||
|
||||
Reference in New Issue
Block a user