diff --git a/apps/desktop/src/App.tsx b/apps/desktop/src/App.tsx index d788c7c..af223cb 100644 --- a/apps/desktop/src/App.tsx +++ b/apps/desktop/src/App.tsx @@ -13,13 +13,12 @@ import { const { Text, Title } = Typography const SESSION_KEY = 'senlin-app-session' -type View = 'overview' | 'tasks' | 'documents' | 'ai' | 'cron' +type View = 'tasks' | 'documents' | 'ai' | 'cron' type WorkspaceMode = 'workbench' | 'explore' type SavedSession = ApiSession & { user?: CurrentUser } type TaskWithProject = WorkspaceTask & { projectName: string } const navItems: Array<{ id: View; label: string; icon: React.ReactNode }> = [ - { id: 'overview', label: '概况', icon: }, { id: 'tasks', label: '计划', icon: }, { id: 'documents', label: '资料', icon: }, { id: 'ai', label: 'AI', icon: }, @@ -34,7 +33,7 @@ export function App() { const [workspaces, setWorkspaces] = useState>({}) const [projectId, setProjectId] = useState('') const [workspaceMode, setWorkspaceMode] = useState('workbench') - const [view, setView] = useState('overview') + const [view, setView] = useState('tasks') const [dark, setDark] = useState(false) const [loading, setLoading] = useState(Boolean(stored)) const [error, setError] = useState('') @@ -80,12 +79,14 @@ export function App() { const index = projects.findIndex((project) => project.id === projectId) const next = projectId ? (index + direction + projects.length) % projects.length : direction > 0 ? 0 : projects.length - 1 setProjectId(projects[next]?.id ?? '') + setWorkspaceMode('workbench') + setView('tasks') } function logout() { localStorage.removeItem(SESSION_KEY) localStorage.removeItem('senlin-mini-session') - setSession(null); setUser(null); setProjects([]); setWorkspaces({}); setProjectId(''); setView('overview') + setSession(null); setUser(null); setProjects([]); setWorkspaces({}); setProjectId(''); setView('tasks') } if (!session) return { setSession(next); setUser(next.user); persistSession(next) }} /> @@ -103,7 +104,7 @@ export function App() {
- { setProjectId(value === 'all' ? '' : value); setWorkspaceMode('workbench'); setView('tasks') }} triggerElement={() => }> 全部项目 {projects.map((project) => {project.name})} @@ -142,10 +143,12 @@ export function App() { } function Content({ view, title, workspaces, tasks, onEditTask, onLoadAI, experts }: { view: View; title: string; workspaces: Workspace[]; tasks: TaskWithProject[]; onEditTask: (task: TaskWithProject) => void; onLoadAI: () => void; experts: Expert[] }) { - if (view === 'tasks' || view === 'overview') return - if (view === 'documents') return - if (view === 'ai') return - return + let panel: React.ReactNode + if (view === 'tasks') panel = + else if (view === 'documents') panel = + else if (view === 'ai') panel = + else panel = + return
{title}
{panel}
} function TaskBoard({ title, subtitle, tasks, onEditTask, showCompleted = true }: { title: string; subtitle: string; tasks: TaskWithProject[]; onEditTask: (task: TaskWithProject) => void; showCompleted?: boolean }) { @@ -219,7 +222,7 @@ function CronPanel({ title, workspaces }: { title: string; workspaces: Workspace return {plans.map((item) =>
{item.title}

{item.schedule} · {item.enabled ? '已启用' : '已停用'}

{item.projectName}
)}{!plans.length && }
} -function Panel({ title, subtitle, children }: { title: string; subtitle: string; children: React.ReactNode }) { return
{subtitle}{title}
{children}
} +function Panel({ title, subtitle, children }: { title: string; subtitle: string; children: React.ReactNode }) { return
{subtitle ? {subtitle} : null}{title}
{children}
} function ProfileMenu({ user, onProfile, onLogout }: { user: CurrentUser | null; onProfile: () => void; onLogout: () => void }) { const menu = 修改资料退出登录 diff --git a/apps/desktop/src/styles.css b/apps/desktop/src/styles.css index 46a8236..cae6c61 100644 --- a/apps/desktop/src/styles.css +++ b/apps/desktop/src/styles.css @@ -27,6 +27,9 @@ button { font: inherit; } .app-shell.no-rail .app-main { grid-column: 1 / -1; } .app-main > .arco-spin { min-height: 100%; } .content-page { max-width: 650px; margin: 0 auto; } +.project-content { min-width: 0; } +.project-page-header { width: calc(100% + 30px); margin: -18px -15px 18px; padding: 20px 15px 17px; border-bottom: 1px solid var(--line); background: var(--surface); } +.project-page-header .arco-typography { margin: 0; font-size: 26px; line-height: 1.25; } .content-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; } .content-heading .arco-typography { margin: 0; } .content-heading h4 { margin-top: 2px; font-size: 20px; } @@ -72,4 +75,4 @@ button { font: inherit; } .login-page { display: grid; min-height: 100vh; place-items: center; padding: 20px; background: #edf2f9; }.login-card { display: grid; width: min(100%, 360px); gap: 12px; padding: 28px; border: 1px solid #e5e6eb; border-radius: 16px; background: #fff; box-shadow: 0 18px 48px rgba(31, 35, 41, .12); }.login-card > img { width: 34px; }.login-card .arco-typography { margin: 0; }.login-card label { display: grid; gap: 5px; color: #4e5969; font-size: 12px; } .theme-dark .project-strip, .theme-dark .app-header, .theme-dark .task-section, .theme-dark .detail-row, .theme-dark .tag-filter button { color: var(--text); background: var(--surface); }.theme-dark .project-pill { color: var(--muted); }.theme-dark .project-pill.active, .theme-dark .channel-rail button.active { color: #8ac7ff; background: #1d4d77; }.theme-dark .task-row:hover { background: #293847; border-color: #477da7; }.theme-dark .section-label span { color: #8ac7ff; background: #1d4d77; } -@media (max-width: 360px) { .profile-trigger > span { display: none; }.project-pill { max-width: 90px; }.project-strip { gap: 2px; padding-inline: 5px; }.app-main { padding: 13px 9px 20px; }.task-meta .arco-tag { max-width: 64px; overflow: hidden; }.content-heading h4 { font-size: 18px; }.stat-grid { grid-template-columns: repeat(2, 1fr); } } +@media (max-width: 360px) { .profile-trigger > span { display: none; }.project-pill { max-width: 90px; }.project-strip { gap: 2px; padding-inline: 5px; }.app-main { padding: 13px 9px 20px; }.project-page-header { width: calc(100% + 18px); margin: -13px -9px 15px; padding: 17px 9px 14px; }.task-meta .arco-tag { max-width: 64px; overflow: hidden; }.content-heading h4 { font-size: 18px; }.stat-grid { grid-template-columns: repeat(2, 1fr); } }