Skip to content

Commit 8d84ecf

Browse files
committed
refactor(ui): migrate bare z-index to tier scale
1 parent 54b9b93 commit 8d84ecf

42 files changed

Lines changed: 267 additions & 127 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎app/src/components/AiConversationDock.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* (挂载不拉,首次 open 才装载)+静态数据 10s 时效。
1616
*/
1717
import { useCallback, useEffect, useRef, useState } from "react";
18+
import { zIndex } from "../ui/zIndex";
1819
import { invoke } from "@tauri-apps/api/core";
1920
import { listen } from "@tauri-apps/api/event";
2021
import type { AiTaskRecord, AiTaskState, AiTurn, ChatMessage, ChatSession } from "../types";
@@ -239,7 +240,7 @@ export default function AiConversationDock({
239240
<div
240241
data-testid="ai-dock"
241242
style={{
242-
position: "fixed", top: "var(--ed-nav-h)", right: 0, bottom: 0, width: PANEL_W, zIndex: 900,
243+
position: "fixed", top: "var(--ed-nav-h)", right: 0, bottom: 0, width: PANEL_W, zIndex: zIndex("panel"),
243244
background: "#fff", borderLeft: "1px solid #e5e7eb", boxShadow: "-8px 0 24px rgba(0,0,0,0.08)",
244245
display: open ? "flex" : "none", flexDirection: "column", overflow: "hidden",
245246
fontSize: 12.5, color: "#1f2937",

‎app/src/components/BoxSelectOverlay.tsx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* 无图屏不进入(调用方禁用按钮)。
88
*/
99
import { useRef, useState } from "react";
10+
import { zIndex } from "../ui/zIndex";
1011
import { invoke } from "@tauri-apps/api/core";
1112

1213
interface Props {
@@ -153,7 +154,7 @@ export default function BoxSelectOverlay({ src, sessionId, firstSeenMs, onDone,
153154
position: "absolute",
154155
inset: 0,
155156
cursor: "crosshair",
156-
zIndex: 10,
157+
zIndex: zIndex("raised"),
157158
border: "2px dashed #0d9488",
158159
background: "rgba(13,148,136,0.06)",
159160
}}
@@ -179,7 +180,7 @@ export default function BoxSelectOverlay({ src, sessionId, firstSeenMs, onDone,
179180
position: "absolute",
180181
inset: 0,
181182
background: "rgba(255,255,255,0.96)",
182-
zIndex: 20,
183+
zIndex: zIndex("raised"),
183184
display: "flex",
184185
flexDirection: "column",
185186
alignItems: "center",

‎app/src/components/BrowserChrome.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* (不弹错;Ctrl+C/V 主路径不受影响)。
1515
*/
1616
import { useEffect, useRef, useState } from "react";
17+
import { zIndex } from "../ui/zIndex";
1718

1819
interface MenuState {
1920
x: number;
@@ -137,7 +138,7 @@ export default function BrowserChrome() {
137138
position: "fixed",
138139
left: px,
139140
top: py,
140-
zIndex: 1000,
141+
zIndex: zIndex("popover"),
141142
minWidth: 128,
142143
background: "#fff",
143144
border: "1px solid #e5e7eb",

‎app/src/components/ChatSaveNoteDialog.tsx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* (onOpenNote 已由 ChatPage 透传)+ 关闭;失败红字不关窗(改后再试)。
99
*/
1010
import { useState } from "react";
11+
import { zIndex } from "../ui/zIndex";
1112
import { invoke } from "@tauri-apps/api/core";
1213
import type { Note, NoteGroup } from "../types";
1314

@@ -66,12 +67,12 @@ export default function ChatSaveNoteDialog({ initialTitle, content, groups, onOp
6667
<div
6768
onClick={onClose}
6869
data-testid="chat-note-backdrop"
69-
style={{ position: "fixed", inset: 0, zIndex: 50, background: "rgba(0,0,0,0.18)" }}
70+
style={{ position: "fixed", inset: 0, zIndex: zIndex("modal"), background: "rgba(0,0,0,0.18)" }}
7071
/>
7172
<div
7273
data-testid="chat-note-dialog"
7374
style={{
74-
position: "fixed", zIndex: 51, top: "50%", left: "50%",
75+
position: "fixed", zIndex: zIndex("modal"), top: "50%", left: "50%",
7576
transform: "translate(-50%, -50%)",
7677
width: 380, background: "#fff", borderRadius: 10,
7778
border: "1px solid #e5e7eb", boxShadow: "0 12px 32px rgba(0,0,0,0.18)",

‎app/src/components/GoalPlanApprovalDialog.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* 清理登记(丢弃项)诚实展示,绝不静默。
99
*/
1010
import { useMemo, useState } from "react";
11+
import { zIndex } from "../ui/zIndex";
1112
import type { GoalPlanView } from "../types/goals";
1213

1314
interface Props {
@@ -75,7 +76,7 @@ export default function GoalPlanApprovalDialog({ view, onConfirm, onClose, onUse
7576
};
7677

7778
return (
78-
<div style={{ position: "fixed", inset: 0, background: "rgba(0,0,0,.35)", display: "flex", alignItems: "center", justifyContent: "center", zIndex: 60 }}>
79+
<div style={{ position: "fixed", inset: 0, background: "rgba(0,0,0,.35)", display: "flex", alignItems: "center", justifyContent: "center", zIndex: zIndex("modal") }}>
7980
<div data-testid="plan-approval" style={{ width: 560, maxHeight: "86vh", overflow: "auto", background: "#fff", borderRadius: 10, padding: 18, boxSizing: "border-box" }}>
8081
<div style={{ display: "flex", alignItems: "center", marginBottom: 6 }}>
8182
<span style={{ fontWeight: 700, fontSize: 15 }}>✨ AI 规划建议(草案——确认后落库)</span>

‎app/src/components/GraduateDialog.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* @ai-context: 未达标时按钮不可达(GoalDetail 禁用);本对话框只管确认流。
88
*/
99
import { useCallback, useEffect, useState } from "react";
10+
import { zIndex } from "../ui/zIndex";
1011
import { invoke } from "@tauri-apps/api/core";
1112
import type { GraduationReport, GoalDetailView, GoalProgressView } from "../types/goals";
1213

@@ -53,7 +54,7 @@ export default function GraduateDialog({ goalId, onClose, onGraduated }: Props)
5354

5455
const p = progress?.progress;
5556
return (
56-
<div style={{ position: "fixed", inset: 0, background: "rgba(0,0,0,.35)", display: "flex", alignItems: "center", justifyContent: "center", zIndex: 60 }}>
57+
<div style={{ position: "fixed", inset: 0, background: "rgba(0,0,0,.35)", display: "flex", alignItems: "center", justifyContent: "center", zIndex: zIndex("modal") }}>
5758
<div data-testid="graduate-dialog" style={{ width: 520, maxHeight: "86vh", overflow: "auto", background: "#fff", borderRadius: 10, padding: 18, boxSizing: "border-box" }}>
5859
<div style={{ display: "flex", alignItems: "center", marginBottom: 8 }}>
5960
<span style={{ fontWeight: 700, fontSize: 15 }}>🎓 毕业仪式</span>

‎app/src/components/GroupCreateDialog.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
* (弹窗随即关闭,内部 setStatus 一帧即卸载——死代码)。
1313
*/
1414
import { useEffect, useState } from "react";
15+
import { zIndex } from "../ui/zIndex";
1516
import { invoke } from "@tauri-apps/api/core";
1617
import { DOMAIN_OPTIONS } from "../utils/domainOptions";
1718
import NoteColorPicker from "./NoteColorPicker";
@@ -79,7 +80,7 @@ export default function GroupCreateDialog({ onClose, onCreated }: Props) {
7980

8081
return (
8182
<div
82-
style={{ position: "fixed", inset: 0, background: "rgba(0,0,0,0.45)", zIndex: 1000, display: "flex", alignItems: "center", justifyContent: "center" }}
83+
style={{ position: "fixed", inset: 0, background: "rgba(0,0,0,0.45)", zIndex: zIndex("modal"), display: "flex", alignItems: "center", justifyContent: "center" }}
8384
onClick={onClose}
8485
>
8586
<div

‎app/src/components/GroupDeleteConfirm.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* (数据不可恢复后果透明可见)。
99
*/
1010
import { useCallback, useEffect, useState } from "react";
11+
import { zIndex } from "../ui/zIndex";
1112
import { invoke } from "@tauri-apps/api/core";
1213
import type { NoteGroup } from "../types";
1314

@@ -79,7 +80,7 @@ export default function GroupDeleteConfirm({ group, onClose, onDeleted }: Props)
7980
return (
8081
<div
8182
data-testid="group-delete-confirm-backdrop"
82-
style={{ position: "fixed", inset: 0, background: "rgba(0,0,0,0.45)", zIndex: 1000, display: "flex", alignItems: "center", justifyContent: "center" }}
83+
style={{ position: "fixed", inset: 0, background: "rgba(0,0,0,0.45)", zIndex: zIndex("modal"), display: "flex", alignItems: "center", justifyContent: "center" }}
8384
onClick={onClose}
8485
>
8586
<div

‎app/src/components/GroupRowContextMenu.tsx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
* 与笔记置顶语义一致;边界/置顶可用性由父层按分区可见序计算。
1313
*/
1414
import { useEffect } from "react";
15+
import { zIndex } from "../ui/zIndex";
1516

1617
interface Props {
1718
/** 组名(菜单头) */
@@ -75,7 +76,7 @@ export default function GroupRowContextMenu({
7576
<div
7677
onClick={onClose}
7778
onContextMenu={(e) => { e.preventDefault(); onClose(); }}
78-
style={{ position: "fixed", inset: 0, zIndex: 60, background: "transparent" }}
79+
style={{ position: "fixed", inset: 0, zIndex: zIndex("popover"), background: "transparent" }}
7980
/>
8081
<div
8182
role="menu"
@@ -87,7 +88,7 @@ export default function GroupRowContextMenu({
8788
position: "fixed",
8889
left: px,
8990
top: py,
90-
zIndex: 61,
91+
zIndex: zIndex("popover"),
9192
width: 216,
9293
background: "#fff",
9394
border: "1px solid #e5e7eb",

‎app/src/components/GroupSidebarRow.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* 所有事件 stopPropagation(不与行点击过滤/色点/ⓘ/拖拽冲突)。
1010
*/
1111
import { useMemo, useState } from "react";
12+
import { zIndex } from "../ui/zIndex";
1213
import type { NoteGroup } from "../types";
1314
import type { KnowledgeSystem } from "../types/knowledge";
1415
import { parseRouteReason, routeLineState } from "../utils/routeReason";
@@ -171,7 +172,7 @@ export default function GroupSidebarRow({
171172
{colorPickerOpen && (
172173
<div
173174
data-testid={`group-color-picker-${group.id}`}
174-
style={{ position: "absolute", top: "100%", left: 8, zIndex: 20, background: "#fff", border: "1px solid #e5e7eb", borderRadius: 6, padding: 8, boxShadow: "0 4px 12px rgba(0,0,0,0.12)" }}
175+
style={{ position: "absolute", top: "100%", left: 8, zIndex: zIndex("popover"), background: "#fff", border: "1px solid #e5e7eb", borderRadius: 6, padding: 8, boxShadow: "0 4px 12px rgba(0,0,0,0.12)" }}
175176
>
176177
<NoteColorPicker
177178
value={group.color ?? null}

0 commit comments

Comments
 (0)