From 719674b4add057fba256e007d9ae79f50d2b5881 Mon Sep 17 00:00:00 2001 From: Stringadmin Date: Fri, 5 Jun 2026 19:17:35 +0800 Subject: [PATCH] perf: defer home page styles --- src/features/home/HomePage.tsx | 1 + src/features/home/ModelGenerationShowcase.tsx | 1 + src/features/home/ScriptReviewShowcase.tsx | 1 + src/features/home/ScriptReviewVisual.tsx | 1 + src/features/home/ToolboxSection.tsx | 1 + src/features/home/WelcomeSplash.tsx | 1 + src/features/image-workbench/ImageWorkbenchPage.tsx | 9 ++++++--- src/features/profile/ProfilePage.tsx | 12 +++++++++--- src/styles/index.css | 6 ------ 9 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src/features/home/HomePage.tsx b/src/features/home/HomePage.tsx index 2883532..6d954b3 100644 --- a/src/features/home/HomePage.tsx +++ b/src/features/home/HomePage.tsx @@ -11,6 +11,7 @@ import { Fragment, useCallback, useEffect, useMemo, useRef, useState, type CSSPr import type { WebViewKey, WebImageWorkbenchTool } from "../../types"; import { useScrollEntrance } from "../../hooks/useScrollEntrance"; import { ossAssets } from "../../data/ossAssets"; +import "../../styles/pages/home.css"; import WelcomeSplash from "./WelcomeSplash"; import ToolboxSection from "./ToolboxSection"; import ScriptReviewShowcase from "./ScriptReviewShowcase"; diff --git a/src/features/home/ModelGenerationShowcase.tsx b/src/features/home/ModelGenerationShowcase.tsx index 6cd0c9c..a92e63b 100644 --- a/src/features/home/ModelGenerationShowcase.tsx +++ b/src/features/home/ModelGenerationShowcase.tsx @@ -1,4 +1,5 @@ import { useEffect, useRef, useState } from "react"; +import "../../styles/pages/model-generation-showcase.css"; type ShowMode = "agent" | "image" | "video"; diff --git a/src/features/home/ScriptReviewShowcase.tsx b/src/features/home/ScriptReviewShowcase.tsx index 5435bef..e29e5f1 100644 --- a/src/features/home/ScriptReviewShowcase.tsx +++ b/src/features/home/ScriptReviewShowcase.tsx @@ -1,4 +1,5 @@ import { useEffect, useRef, useState } from "react"; +import "../../styles/pages/script-review-showcase.css"; const DIMS = [ { name: "钩子设计", score: 16, max: 20, hue: 145, desc: "吸引力·悬念·黄金三秒", isPerfect: false, isLow: false }, diff --git a/src/features/home/ScriptReviewVisual.tsx b/src/features/home/ScriptReviewVisual.tsx index 14981b7..ed03861 100644 --- a/src/features/home/ScriptReviewVisual.tsx +++ b/src/features/home/ScriptReviewVisual.tsx @@ -1,4 +1,5 @@ import { useEffect, useRef, useState } from "react"; +import "../../styles/pages/script-review-visual.css"; const DIMS = [ { name: "钩子设计", score: 19, max: 20, hue: 145 }, diff --git a/src/features/home/ToolboxSection.tsx b/src/features/home/ToolboxSection.tsx index 44f1402..ac23134 100644 --- a/src/features/home/ToolboxSection.tsx +++ b/src/features/home/ToolboxSection.tsx @@ -1,6 +1,7 @@ import { ToolOutlined } from "@ant-design/icons"; import type { WebViewKey, WebImageWorkbenchTool } from "../../types"; import { ossAssets } from "../../data/ossAssets"; +import "../../styles/pages/toolbox.css"; const { imageBefore: toolImageBefore, diff --git a/src/features/home/WelcomeSplash.tsx b/src/features/home/WelcomeSplash.tsx index e9a0271..dc8f5c5 100644 --- a/src/features/home/WelcomeSplash.tsx +++ b/src/features/home/WelcomeSplash.tsx @@ -1,4 +1,5 @@ import { useCallback, useEffect, useRef, useState } from "react"; +import "../../styles/pages/welcome-splash.css"; interface WelcomeSplashProps { onEnter: () => void; diff --git a/src/features/image-workbench/ImageWorkbenchPage.tsx b/src/features/image-workbench/ImageWorkbenchPage.tsx index bbe351b..783ed6c 100644 --- a/src/features/image-workbench/ImageWorkbenchPage.tsx +++ b/src/features/image-workbench/ImageWorkbenchPage.tsx @@ -38,6 +38,9 @@ type WorkMode = "single" | "blend"; type OutputSize = "9:16" | "16:9" | "4:3" | "3:4" | "1:1"; type OutputCount = 1 | 2 | 3 | 4; +const OUTPUT_SIZE_OPTIONS: OutputSize[] = ["9:16", "16:9", "4:3", "3:4", "1:1"]; +const OUTPUT_COUNT_OPTIONS: OutputCount[] = [1, 2, 3, 4]; + const SIZE_TO_RATIO: Record = { "9:16": "9:16", "16:9": "16:9", @@ -761,7 +764,7 @@ function ImageWorkbenchPage({ initialTool = "workbench", onOpenMore, onSelectVie

参数

输出分辨率
- {(["9:16", "16:9", "4:3", "3:4", "1:1"] as OutputSize[]).map((s) => ( + {OUTPUT_SIZE_OPTIONS.map((s) => ( @@ -1317,7 +1320,7 @@ function ImageWorkbenchPage({ initialTool = "workbench", onOpenMore, onSelectVie

输出

尺寸
- {(["9:16", "16:9", "4:3", "3:4", "1:1"] as OutputSize[]).map((s) => ( + {OUTPUT_SIZE_OPTIONS.map((s) => ( @@ -1326,7 +1329,7 @@ function ImageWorkbenchPage({ initialTool = "workbench", onOpenMore, onSelectVie
数量
- {([1, 2, 3, 4] as OutputCount[]).map((count) => ( + {OUTPUT_COUNT_OPTIONS.map((count) => (