feat: update App entry and global styles

This commit is contained in:
zhenyi 2026-05-30 15:07:36 +08:00
parent 79b03a90a7
commit db5b54025b
2 changed files with 94 additions and 89 deletions

View File

@ -1,6 +1,8 @@
import './App.css' import './App.css'
import { useEffect } from "react";
import { Navigate, createBrowserRouter, useParams } from "react-router"; import { Navigate, createBrowserRouter, useParams } from "react-router";
import { RouterProvider } from "react-router/dom"; import { RouterProvider } from "react-router/dom";
import { getSavedThemeId, getThemeById, applyTheme, defaultThemeId } from "@/lib/theme";
import AuthLayout from "@/page/auth/layout"; import AuthLayout from "@/page/auth/layout";
import LoginPage from "@/page/auth/login"; import LoginPage from "@/page/auth/login";
@ -51,6 +53,12 @@ function WorkspaceCompatRedirect() {
} }
function App() { function App() {
useEffect(() => {
const id = getSavedThemeId();
const preset = getThemeById(id) || getThemeById(defaultThemeId)!;
applyTheme(preset);
}, []);
const router = createBrowserRouter([ const router = createBrowserRouter([
{ {
path: "/", path: "/",

View File

@ -4,7 +4,7 @@
@import "@fontsource-variable/space-grotesk"; @import "@fontsource-variable/space-grotesk";
@import "@fontsource-variable/dm-sans"; @import "@fontsource-variable/dm-sans";
@import "@fontsource-variable/jetbrains-mono"; @import "@fontsource-variable/jetbrains-mono";
@import "highlight.js/styles/github-dark.css"; @import "highlight.js/styles/github.css";
@custom-variant dark (&:is(.dark *)); @custom-variant dark (&:is(.dark *));
@ -43,82 +43,77 @@
--color-card: var(--card); --color-card: var(--card);
--color-foreground: var(--foreground); --color-foreground: var(--foreground);
--color-background: var(--background); --color-background: var(--background);
--radius-sm: calc(var(--radius) * 0.6); --radius-sm: calc(var(--radius) * 0.5);
--radius-md: calc(var(--radius) * 0.8); --radius-md: calc(var(--radius) * 0.75);
--radius-lg: var(--radius); --radius-lg: var(--radius);
--radius-xl: calc(var(--radius) * 1.4); --radius-xl: calc(var(--radius) * 1.25);
--radius-2xl: calc(var(--radius) * 1.8); --radius-2xl: calc(var(--radius) * 1.5);
--radius-3xl: calc(var(--radius) * 2.2); --radius-3xl: calc(var(--radius) * 2);
--radius-4xl: calc(var(--radius) * 2.6); --radius-4xl: calc(var(--radius) * 2.5);
} }
:root { :root {
--background: oklch(1 0 0); --background: #ffffff;
--foreground: oklch(0.145 0 0); --foreground: #111111;
--card: oklch(1 0 0); --card: #ffffff;
--card-foreground: oklch(0.145 0 0); --card-foreground: #111111;
--popover: oklch(1 0 0); --popover: #ffffff;
--popover-foreground: oklch(0.145 0 0); --popover-foreground: #111111;
--primary: oklch(0.45 0.24 290); --primary: #111111;
--primary-foreground: oklch(0.98 0 0); --primary-foreground: #ffffff;
--secondary: oklch(0.97 0 0); --secondary: #f5f5f5;
--secondary-foreground: oklch(0.205 0 0); --secondary-foreground: #111111;
--muted: oklch(0.97 0 0); --muted: #f5f5f5;
--muted-foreground: oklch(0.556 0 0); --muted-foreground: #737373;
--accent: oklch(0.97 0 0); --accent: #f5f5f5;
--accent-foreground: oklch(0.205 0 0); --accent-foreground: #111111;
--destructive: oklch(0.577 0.245 27.325); --destructive: #ef4444;
--border: oklch(0.922 0 0); --border: #e8e8e8;
--input: oklch(0.922 0 0); --input: #e8e8e8;
--ring: oklch(0.45 0.24 290); --ring: #111111;
--chart-1: oklch(0.45 0.24 290); --chart-1: #111111;
--chart-2: oklch(0.556 0 0); --chart-2: #737373;
--chart-3: oklch(0.439 0 0); --chart-3: #4b5563;
--chart-4: oklch(0.371 0 0); --chart-4: #374151;
--chart-5: oklch(0.269 0 0); --chart-5: #1f2937;
--radius: 0.625rem; --radius: 0.875rem;
--sidebar: oklch(0.985 0 0); --sidebar: #fafafa;
--sidebar-foreground: oklch(0.145 0 0); --sidebar-foreground: #111111;
--sidebar-primary: oklch(0.45 0.24 290); --sidebar-primary: #111111;
--sidebar-primary-foreground: oklch(0.98 0 0); --sidebar-primary-foreground: #ffffff;
--sidebar-accent: oklch(0.97 0 0); --sidebar-accent: #f5f5f5;
--sidebar-accent-foreground: oklch(0.205 0 0); --sidebar-accent-foreground: #111111;
--sidebar-border: oklch(0.922 0 0); --sidebar-border: #e8e8e8;
--sidebar-ring: oklch(0.45 0.24 290); --sidebar-ring: #111111;
} }
.dark { .dark {
--background: oklch(0.145 0 0); --background: #0f1115;
--foreground: oklch(0.985 0 0); --foreground: #ececf1;
--card: oklch(0.205 0 0); --card: #16181d;
--card-foreground: oklch(0.985 0 0); --card-foreground: #ececf1;
--popover: oklch(0.205 0 0); --popover: #16181d;
--popover-foreground: oklch(0.985 0 0); --popover-foreground: #ececf1;
--primary: oklch(0.45 0.24 290); --primary: #5E6AD2;
--primary-foreground: oklch(0.98 0 0); --primary-foreground: #ffffff;
--secondary: oklch(0.269 0 0); --secondary: #1f2128;
--secondary-foreground: oklch(0.985 0 0); --secondary-foreground: #ececf1;
--muted: oklch(0.269 0 0); --muted: #1f2128;
--muted-foreground: oklch(0.708 0 0); --muted-foreground: #6e7681;
--accent: oklch(0.269 0 0); --accent: #1f2128;
--accent-foreground: oklch(0.985 0 0); --accent-foreground: #ececf1;
--destructive: oklch(0.704 0.191 22.216); --destructive: #EF4444;
--border: oklch(1 0 0 / 10%); --border: rgba(255, 255, 255, 0.08);
--input: oklch(1 0 0 / 15%); --input: rgba(255, 255, 255, 0.08);
--ring: oklch(0.45 0.24 290); --ring: #5E6AD2;
--chart-1: oklch(0.45 0.24 290); --sidebar: #0f1115;
--chart-2: oklch(0.556 0 0); --sidebar-foreground: #ececf1;
--chart-3: oklch(0.439 0 0); --sidebar-primary: #5E6AD2;
--chart-4: oklch(0.371 0 0); --sidebar-primary-foreground: #ffffff;
--chart-5: oklch(0.269 0 0); --sidebar-accent: #1f2128;
--sidebar: oklch(0.205 0 0); --sidebar-accent-foreground: #ececf1;
--sidebar-foreground: oklch(0.985 0 0); --sidebar-border: rgba(255, 255, 255, 0.08);
--sidebar-primary: oklch(0.45 0.24 290); --sidebar-ring: #5E6AD2;
--sidebar-primary-foreground: oklch(0.98 0 0);
--sidebar-accent: oklch(0.269 0 0);
--sidebar-accent-foreground: oklch(0.985 0 0);
--sidebar-border: oklch(1 0 0 / 10%);
--sidebar-ring: oklch(0.45 0.24 290);
} }
@layer base { @layer base {
@ -126,7 +121,8 @@
@apply border-border outline-ring/50; @apply border-border outline-ring/50;
} }
body { body {
@apply bg-background text-foreground; @apply bg-background text-foreground antialiased;
font-feature-settings: "cv02", "cv03", "cv04", "cv11";
} }
html { html {
@apply font-sans; @apply font-sans;
@ -144,23 +140,24 @@
/* cmdk / Radix Dialog */ /* cmdk / Radix Dialog */
[cmdk-overlay] { [cmdk-overlay] {
position: fixed; position: fixed;
inset: 0; inset: 0;
background: rgba(0, 0, 0, 0.6); background: rgba(0, 0, 0, 0.4);
z-index: 50; z-index: 50;
} }
[cmdk-dialog] { [cmdk-dialog] {
position: fixed; position: fixed;
top: 12%; top: 12%;
left: 50%; left: 50%;
transform: translateX(-50%); transform: translateX(-50%);
width: min(640px, 92vw); width: min(640px, 92vw);
max-height: 72vh; max-height: 72vh;
z-index: 51; z-index: 51;
overflow: hidden; overflow: hidden;
border-radius: 16px; border-radius: 12px;
border: 1px solid hsl(var(--border) / 0.6); border: 1px solid rgba(0, 0, 0, 0.08);
background: var(--card); background: var(--card);
color: var(--card-foreground); color: var(--card-foreground);
box-shadow: 0 25px 80px rgba(0, 0, 0, 0.25); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12);
} }