feat: restore Orven iris purple appearance with remembered defaults
This commit is contained in:
+1
-1
@@ -573,7 +573,7 @@ export default function App() {
|
||||
{ id: 'rea', label: 'REA 工件研究', description: '研究应用工件,核对分析证据', group: '能力与研究', icon: BookOpenText, disabled: !selectedProject || creatingSession || restrictedWorker, reason: '请先选择可编辑的项目', run: () => void openRea() },
|
||||
{ id: 'research', label: '机制研究与设计', description: '阅读已有研究报告与机制说明', group: '能力与研究', icon: BookOpenText, run: () => void openResearch() },
|
||||
{ id: 'models', label: '模型中心', description: '选择模型、管理连接和模型池', group: '设置与连接', icon: ModelServer, run: () => setModelCenterOpen(true) },
|
||||
{ id: 'appearance', label: '外观', description: '在深青绿和雾蓝之间选择工作台配色', group: '设置与连接', icon: PaletteIcon, run: () => setAppearanceOpen(true) },
|
||||
{ id: 'appearance', label: '外观', description: '选择深青绿、雾蓝或鸢尾紫,自动记住你的偏好', group: '设置与连接', icon: PaletteIcon, run: () => setAppearanceOpen(true) },
|
||||
{ id: 'diagnostics', label: '运行诊断', description: '检查连接、终端与最近错误', group: '设置与连接', icon: Activity, run: () => void openDiagnostics() },
|
||||
{ id: 'companion', label: '手机连接', description: '在手机上查看和接续电脑任务', group: '设置与连接', icon: Link2, run: () => setCompanionOpen(true) },
|
||||
...(desktop ? [{ id: 'desktop', label: '桌面宿主', description: '查看窗口、后台任务与本地宿主', group: '设置与连接', icon: SquareTerminal, run: () => setDesktopOpen(true) }] : []),
|
||||
|
||||
@@ -6,6 +6,7 @@ import './appearance.css';
|
||||
const choices = [
|
||||
{ id: 'green', name: '深青绿', description: '沉静的绿,配合雾灰与松墨。', accent: '#176b5b', canvas: '#f3f6f4', selected: '#dfede4', ink: '#28382f' },
|
||||
{ id: 'blue', name: '雾蓝', description: '通透的雾蓝白,配合靛蓝与深蓝灰。', accent: '#4f6ef7', canvas: '#f6f8fc', selected: '#edf1ff', ink: '#24334b' },
|
||||
{ id: 'purple', name: '鸢尾紫', description: '柔和的紫,配合浅灰与纯白。', accent: '#6253b5', canvas: '#f5f5f8', selected: '#e9e5f3', ink: '#37333f' },
|
||||
] as const;
|
||||
|
||||
export function AppearancePanel() {
|
||||
@@ -18,6 +19,6 @@ export function AppearancePanel() {
|
||||
<span className="appearance-choice-description">{choice.description}</span>
|
||||
<span className="appearance-swatches" aria-hidden="true"><i /><i /><i /></span>
|
||||
</label>)}</fieldset>
|
||||
<p className="appearance-note" role="status">{saved ? '已自动保存。工作台、文件与成果区、工具面板会一起切换。' : '本次配色已切换,但浏览器暂时无法保存;刷新后可能恢复默认配色。'}</p>
|
||||
<p className="appearance-note" role="status">{saved ? '已设为默认配色,下次打开会继续使用。工作台、文件与成果区、工具面板会一起切换。' : '本次配色已切换,但浏览器暂时无法保存;刷新后可能恢复默认配色。'}</p>
|
||||
</div>;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
.modal-backdrop:has(.appearance-panel) { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgb(var(--orven-shadow-rgb) / 33%); backdrop-filter: blur(2px); }
|
||||
.modal:has(.appearance-panel) { box-sizing: border-box; width: min(620px, 100%); max-height: calc(100dvh - 40px); overflow: auto; padding: 26px; background: #fff; border: 1px solid var(--orven-border); border-radius: 14px; color: var(--orven-text); box-shadow: 0 24px 100px rgb(var(--orven-shadow-rgb) / 19%); }
|
||||
.modal:has(.appearance-panel) { box-sizing: border-box; width: min(720px, 100%); max-width: 720px; max-height: calc(100dvh - 40px); overflow: auto; padding: 26px; background: #fff; border: 1px solid var(--orven-border); border-radius: 14px; color: var(--orven-text); box-shadow: 0 24px 100px rgb(var(--orven-shadow-rgb) / 19%); }
|
||||
.modal:has(.appearance-panel) .modal-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
|
||||
.modal:has(.appearance-panel) .modal-heading h2 { margin: 0; color: var(--orven-ink); font-size: 20px; font-weight: 600; line-height: 1.4; }
|
||||
.modal:has(.appearance-panel) .modal-heading p { margin: 8px 0 0; color: var(--orven-muted); font-size: 12px; line-height: 1.8; }
|
||||
.modal:has(.appearance-panel) .modal-heading .icon-button { display: grid; place-items: center; min-height: 32px; width: 32px; height: 32px; padding: 0; background: transparent; border: 0; border-radius: 6px; color: var(--orven-text); }
|
||||
.appearance-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 0; margin: 24px 0 0; border: 0; min-width: 0; }
|
||||
.appearance-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; padding: 0; margin: 24px 0 0; border: 0; min-width: 0; }
|
||||
.appearance-choices legend { padding: 0 0 14px; color: var(--orven-heading); font-size: 13px; font-weight: 600; }
|
||||
.appearance-choice { position: relative; display: flex; flex-direction: column; min-width: 0; padding: 11px; border: 1px solid var(--orven-border); border-radius: 10px; cursor: pointer; background: #fff; }
|
||||
.appearance-choice.selected { border-color: var(--orven-accent); box-shadow: 0 0 0 1px var(--orven-accent); }
|
||||
@@ -26,18 +26,21 @@
|
||||
.appearance-choice-title strong { font-weight: 600; }
|
||||
.appearance-selected { display: grid; place-items: center; height: 20px; width: 20px; border: 1px solid var(--orven-border); border-radius: 50%; }
|
||||
.selected .appearance-selected { color: #fff; background: var(--orven-action); border-color: var(--orven-action); }
|
||||
.appearance-choice-description { margin: 7px 2px 0; color: var(--orven-muted); font-size: 11px; line-height: 1.8; }
|
||||
.appearance-choice-description { margin: 7px 2px 0; min-height: 40px; color: var(--orven-muted); font-size: 11px; line-height: 1.8; }
|
||||
.appearance-swatches { display: flex; gap: 5px; margin: 13px 2px 3px; }
|
||||
.appearance-swatches i { width: 12px; height: 12px; border-radius: 50%; border: 1px solid #24334b14; background: var(--preview-accent); }
|
||||
.appearance-swatches i:nth-child(2) { background: var(--preview-ink); }
|
||||
.appearance-swatches i:nth-child(3) { background: var(--preview-canvas); }
|
||||
.appearance-note { margin: 22px 0 0; padding-top: 16px; border-top: 1px solid var(--orven-border-soft); color: var(--orven-muted); font-size: 11px; line-height: 1.9; }
|
||||
@media (max-width: 420px) {
|
||||
@media (max-width: 600px) {
|
||||
.modal-backdrop:has(.appearance-panel) { padding: 12px; }
|
||||
.modal:has(.appearance-panel) { padding: 20px 18px; max-height: calc(100dvh - 24px); }
|
||||
.appearance-choices { gap: 11px; }
|
||||
.appearance-choice { padding: 8px; }
|
||||
.appearance-preview { height: 103px; }
|
||||
.appearance-preview-work { padding: 18px 9px 10px; }
|
||||
.appearance-choice-description { min-height: 39px; font-size: 10px; }
|
||||
.appearance-choices { grid-template-columns: 1fr; gap: 12px; margin-top: 18px; }
|
||||
.appearance-choice { display: grid; grid-template-columns: 104px minmax(0, 1fr); column-gap: 14px; padding: 10px; }
|
||||
.appearance-preview { grid-row: 1 / 4; height: 92px; }
|
||||
.appearance-preview-nav { padding: 13px 5px; }
|
||||
.appearance-preview-work { padding: 16px 8px 10px; }
|
||||
.appearance-choice-title { margin: 3px 0 0; }
|
||||
.appearance-choice-description { margin: 4px 0 0; min-height: 0; }
|
||||
.appearance-swatches { margin: 7px 0 3px; }
|
||||
}
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
import { useSyncExternalStore } from 'react';
|
||||
|
||||
export type Palette = 'green' | 'blue';
|
||||
export type Palette = 'green' | 'blue' | 'purple';
|
||||
const storageKey = 'orven-palette';
|
||||
const palettes = { green: { color: '#176b5b', icon: '/favicon.svg' }, blue: { color: '#4f6ef7', icon: '/brand/orven-icon-blue.svg' } };
|
||||
const palettes = {
|
||||
green: { color: '#176b5b', icon: '/favicon.svg' },
|
||||
blue: { color: '#4f6ef7', icon: '/brand/orven-icon-blue.svg' },
|
||||
purple: { color: '#6253b5', icon: '/brand/orven-icon-purple.svg' },
|
||||
};
|
||||
let snapshot: { palette: Palette; saved: boolean } = { palette: 'green', saved: true };
|
||||
let initialized = false;
|
||||
const listeners = new Set<() => void>();
|
||||
const isPalette = (value: unknown): value is Palette => value === 'green' || value === 'blue';
|
||||
const isPalette = (value: unknown): value is Palette => value === 'green' || value === 'blue' || value === 'purple';
|
||||
|
||||
function apply(palette: Palette, saved = true) {
|
||||
document.documentElement.dataset.palette = palette;
|
||||
@@ -27,7 +31,7 @@ export function initializeAppearance() {
|
||||
if (initialized) return;
|
||||
initialized = true;
|
||||
let palette: Palette = 'green';
|
||||
try { const stored = localStorage.getItem(storageKey); if (isPalette(stored)) palette = stored; } catch { /* The current page can still use either palette. */ }
|
||||
try { const stored = localStorage.getItem(storageKey); if (isPalette(stored)) palette = stored; } catch { /* The current page can still switch palettes. */ }
|
||||
const url = new URL(location.href), requested = url.searchParams.get('palette');
|
||||
if (isPalette(requested)) {
|
||||
choosePalette(requested);
|
||||
|
||||
@@ -74,3 +74,40 @@
|
||||
--orven-toast-text: #eff3ff;
|
||||
--orven-shadow-rgb: 28 46 78;
|
||||
}
|
||||
:root[data-palette="purple"] {
|
||||
--orven-accent: #6253b5;
|
||||
--orven-action: #6253b5;
|
||||
--orven-accent-ink: #6253b5;
|
||||
--orven-accent-hover: #51439c;
|
||||
--orven-accent-soft: #efecf9;
|
||||
--orven-ink: #37333f;
|
||||
--orven-heading: #514b5c;
|
||||
--orven-text: #57515f;
|
||||
--orven-muted: #716979;
|
||||
--orven-canvas: #f9f9fb;
|
||||
--orven-workspace: #ffffff;
|
||||
--orven-navigation: #f5f5f8;
|
||||
--orven-surface: #f6f6f9;
|
||||
--orven-surface-faint: #fcfbfe;
|
||||
--orven-hover: #eeecf3;
|
||||
--orven-selected: #e9e5f3;
|
||||
--orven-selection: #e1dcf4;
|
||||
--orven-line: #e4e4eb;
|
||||
--orven-border: #e1dce9;
|
||||
--orven-border-soft: #eeebf4;
|
||||
--orven-border-strong: #d9d5e5;
|
||||
--orven-border-hover: #c4bbdc;
|
||||
--orven-scrollbar: #d0ced9;
|
||||
--orven-focus-border: #ab94c7;
|
||||
--orven-focus-ring: #ab94c715;
|
||||
--orven-stream-border: #b8a9d5;
|
||||
--orven-handle: #9a86b3;
|
||||
--orven-unset: #aaa0b8;
|
||||
--orven-icon-muted: #8d7c9e;
|
||||
--orven-message: #f6f3fa;
|
||||
--orven-message-border: #e8e2f1;
|
||||
--orven-toast: #44334f;
|
||||
--orven-toast-border: #65506f;
|
||||
--orven-toast-text: #f3ecf7;
|
||||
--orven-shadow-rgb: 48 35 74;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user