feat(desktop): information architecture overhaul — home, records, meetings first
Wave 2 of the 2026-09-28 design overhaul ("records are the main
character, a quiet instrument"). Decisions: design.md.
- Shell: sidebar with primary Home / Records / Meetings (Ctrl+1..3) and a
secondary "Tools" group; every item is a button with aria-current.
The status bar is removed — its "100% LOCAL PRIVACY · ZERO CLOUD SYNC"
claim contradicted device sync; the sidebar shows only queried state.
- Navigation context (routes, params, back, useRouteRequest) so Home can
open a specific meeting or record.
- Home replaces the dashboard: dictation key, start actions, only real
problems, one-line summary, recent records and meetings, file
transcription, free-tier limits.
- Settings become a full-screen route with vertical tabs (tabs no longer
clip) and a shared row grammar; long-standing bugs fixed: team and
enterprise tiers crashed the license tab (currentTier undefined),
first-run onboarding could not be left, Pro+ saw "upgrade to Pro+".
- Records: date-grouped single list with in-place expansion, search and
tags together, mode/favorite filters, load more past 50, undoable
delete. Meetings: list with search/rename/delete, summary-first detail
(summary | transcript | documents | my notes), notes persisted locally
instead of being lost. Tools pages cleaned up; stale-closure example
chips and a 1550x mouse-distance bug fixed.
- Shared pieces: PageHeader, EmptyStateCard, SearchInput ("/" works),
ConfirmDialog, notify with undo; display-labels maps domain values to
typed i18n keys so missing keys fail to compile.
- Mono font stack falls back to Pretendard for Hangul (Korean labels no
longer render spaced out).
- i18n: new ko/en keys via scripts/i18n-add-keys.mjs (one read-merge-
write so parallel editors cannot clobber locale files).
Some renderer files also carried pre-existing in-flight changes (error
recovery deep links, meeting document hooks); they are included as-is.
This commit is contained in:
parent
ba9ef9741e
commit
f064c93197
96 changed files with 12886 additions and 8924 deletions
189
apps/desktop/src/renderer/pages/tools/ToolSection.tsx
Normal file
189
apps/desktop/src/renderer/pages/tools/ToolSection.tsx
Normal file
|
|
@ -0,0 +1,189 @@
|
|||
// src/renderer/pages/tools/ToolSection.tsx
|
||||
// 도구 화면의 구획·목록 행·탭 모양 — 카드·글로우 없이 제목(h2)과 1px 선으로 나눈다(홈과 같은 문법).
|
||||
// 접히는 구획은 머리 전체가 버튼(aria-expanded)이다.
|
||||
|
||||
import React, { useId, useState } from 'react'
|
||||
import { Alert, Box, Button, ButtonBase, Typography } from '@mui/material'
|
||||
import { ChevronRight } from 'lucide-react'
|
||||
import { d3roPalette, d3roRadius, d3roFocusRing, d3roTransition, typoSx } from '@d3ro/ui/theme'
|
||||
import { useI18n } from '@d3ro/i18n'
|
||||
|
||||
/** 도구 화면 본문 폭 — 홈과 같다 */
|
||||
export const TOOL_PAGE_SX = { maxWidth: 1000, mx: 'auto', px: 5, py: 4 } as const
|
||||
|
||||
interface ToolSectionProps {
|
||||
title: string
|
||||
/** 제목 옆 개수 */
|
||||
count?: number
|
||||
/** 제목 아래 한 줄 설명 */
|
||||
description?: React.ReactNode
|
||||
/** 오른쪽 행동 (접히는 구획이면 펼쳤을 때만 보인다) */
|
||||
action?: React.ReactNode
|
||||
/** 접을 수 있는 구획 */
|
||||
collapsible?: boolean
|
||||
defaultOpen?: boolean
|
||||
children: React.ReactNode
|
||||
sx?: object
|
||||
}
|
||||
|
||||
export function ToolSection({
|
||||
title,
|
||||
count,
|
||||
description,
|
||||
action,
|
||||
collapsible = false,
|
||||
defaultOpen = true,
|
||||
children,
|
||||
sx,
|
||||
}: ToolSectionProps): React.ReactElement {
|
||||
const titleId = useId()
|
||||
const bodyId = useId()
|
||||
const [open, setOpen] = useState(defaultOpen)
|
||||
const expanded = !collapsible || open
|
||||
|
||||
const heading = (
|
||||
<Box sx={{ display: 'flex', alignItems: 'baseline', gap: 1 }}>
|
||||
<Typography id={titleId} component="h2" sx={{ ...typoSx('heading'), color: d3roPalette.text.primary }}>
|
||||
{title}
|
||||
</Typography>
|
||||
{count !== undefined && (
|
||||
<Box
|
||||
component="span"
|
||||
sx={{ ...typoSx('compact'), color: d3roPalette.text.tertiary, fontVariantNumeric: 'tabular-nums' }}
|
||||
>
|
||||
{count}
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
)
|
||||
|
||||
return (
|
||||
<Box component="section" aria-labelledby={titleId} sx={{ minWidth: 0, ...sx }}>
|
||||
<Box
|
||||
sx={{
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'space-between',
|
||||
gap: 2,
|
||||
pb: 1,
|
||||
mb: expanded ? 1 : 0,
|
||||
borderBottom: `1px solid ${d3roPalette.border.default}`,
|
||||
}}
|
||||
>
|
||||
{collapsible ? (
|
||||
<ButtonBase
|
||||
onClick={() => setOpen((v) => !v)}
|
||||
aria-expanded={open}
|
||||
aria-controls={bodyId}
|
||||
sx={{
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
gap: 0.75,
|
||||
borderRadius: d3roRadius.xs,
|
||||
pr: 1,
|
||||
'&:focus-visible': d3roFocusRing,
|
||||
}}
|
||||
>
|
||||
<ChevronRight
|
||||
size={16}
|
||||
aria-hidden
|
||||
style={{
|
||||
color: d3roPalette.text.tertiary,
|
||||
transform: open ? 'rotate(90deg)' : 'none',
|
||||
transition: d3roTransition('transform'),
|
||||
}}
|
||||
/>
|
||||
{heading}
|
||||
</ButtonBase>
|
||||
) : (
|
||||
heading
|
||||
)}
|
||||
{expanded && action ? <Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>{action}</Box> : null}
|
||||
</Box>
|
||||
{expanded && (
|
||||
<Box id={bodyId}>
|
||||
{description && (
|
||||
<Typography sx={{ ...typoSx('compact'), color: d3roPalette.text.secondary, mb: 1.5 }}>{description}</Typography>
|
||||
)}
|
||||
{children}
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
|
||||
/** 목록 한 줄 — 안에 버튼이 있으므로 행 자체는 버튼이 아니다 */
|
||||
export function ToolRow({ children, selected = false }: { children: React.ReactNode; selected?: boolean }): React.ReactElement {
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
gap: 1.5,
|
||||
px: 1,
|
||||
py: 1,
|
||||
minHeight: 48,
|
||||
borderBottom: `1px solid ${d3roPalette.border.subtle}`,
|
||||
bgcolor: selected ? d3roPalette.surface.overlaySoft : 'transparent',
|
||||
transition: d3roTransition('background-color'),
|
||||
'&:hover': { bgcolor: d3roPalette.surface.overlaySoft },
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
|
||||
/** 탭 모양 한 가지 — 지식 베이스 탭과 입력 인사이트 하위 탭이 같은 글자·색을 쓴다 */
|
||||
export const TOOL_TABS_SX = {
|
||||
minHeight: 36,
|
||||
borderBottom: `1px solid ${d3roPalette.border.subtle}`,
|
||||
'& .MuiTab-root': {
|
||||
minHeight: 36,
|
||||
minWidth: 0,
|
||||
px: 1.5,
|
||||
py: 0.5,
|
||||
textTransform: 'none',
|
||||
...typoSx('compact'),
|
||||
fontWeight: 500,
|
||||
color: d3roPalette.text.secondary,
|
||||
'&.Mui-selected': { color: d3roPalette.text.primary },
|
||||
'&.Mui-focusVisible': d3roFocusRing,
|
||||
},
|
||||
'& .MuiTabs-indicator': { bgcolor: d3roPalette.accent.main, height: 2 },
|
||||
} as const
|
||||
|
||||
/** 목록 줄의 글자 두 단 */
|
||||
export const TOOL_TEXT_SX = {
|
||||
meta: { ...typoSx('small'), color: d3roPalette.text.tertiary },
|
||||
secondary: { ...typoSx('compact'), color: d3roPalette.text.secondary },
|
||||
} as const
|
||||
|
||||
/** 목록을 읽지 못했을 때 — 무엇이 실패했는지 + 다시 시도 */
|
||||
export function ToolLoadError({ message, onRetry }: { message: string; onRetry: () => void }): React.ReactElement {
|
||||
const { t } = useI18n()
|
||||
return (
|
||||
<Alert
|
||||
severity="error"
|
||||
variant="outlined"
|
||||
sx={{ mb: 2, alignItems: 'center' }}
|
||||
action={
|
||||
<Button size="small" color="inherit" onClick={onRetry}>
|
||||
{t('common.retry')}
|
||||
</Button>
|
||||
}
|
||||
>
|
||||
{message}
|
||||
</Alert>
|
||||
)
|
||||
}
|
||||
|
||||
/** 불러오는 중 한 줄 */
|
||||
export function ToolLoading(): React.ReactElement {
|
||||
const { t } = useI18n()
|
||||
return (
|
||||
<Typography role="status" sx={{ ...typoSx('compact'), color: d3roPalette.text.tertiary, px: 1, py: 3 }}>
|
||||
{t('common.loading')}
|
||||
</Typography>
|
||||
)
|
||||
}
|
||||
157
apps/desktop/src/renderer/pages/tools/tools-model.ts
Normal file
157
apps/desktop/src/renderer/pages/tools/tools-model.ts
Normal file
|
|
@ -0,0 +1,157 @@
|
|||
// src/renderer/pages/tools/tools-model.ts
|
||||
// 2급 "도구" 화면(AI 대화·명령어·사전·지식 베이스)이 함께 쓰는 순수 판단 — React·IPC 의존 없음.
|
||||
// 화면이 말하는 상태는 여기서 한 번만 정한다: 조회한 설정에서 나온 사실만 쓰고, 추측을 '정상'으로 쓰지 않는다.
|
||||
|
||||
import type { TranslationKey } from '@d3ro/i18n'
|
||||
import type { ConversationState, LLMAction, LLMActionSelection, LLMProcessParams } from '@d3ro/core/types'
|
||||
|
||||
/** 지연 삭제 중인 항목을 목록에서 뺀다 */
|
||||
export function withoutHidden<T extends { id: string }>(items: readonly T[], hidden: ReadonlySet<string>): T[] {
|
||||
if (hidden.size === 0) return [...items]
|
||||
return items.filter((item) => !hidden.has(item.id))
|
||||
}
|
||||
|
||||
// ── 명령어: 받아쓰기 후처리 경로 ─────────────────────────────
|
||||
|
||||
/** 명령어 목록의 "사용 안 함" 선택 값 (지시문 id 와 겹치지 않는다) */
|
||||
export const COMMAND_NONE = '__none__'
|
||||
|
||||
interface InstructionLike {
|
||||
id: string
|
||||
name: string
|
||||
prompt: string
|
||||
}
|
||||
|
||||
/**
|
||||
* 지금 받아쓰기에 실제로 적용되는 후처리 — main 의 resolveVoiceLlmRoute 와 같은 규칙:
|
||||
* 지시문은 기본 액션이 'custom' 일 때만 쓰인다(활성 지시문이 있어도 refine 등을 덮지 않는다).
|
||||
*/
|
||||
export type CommandPipeline<T extends InstructionLike> =
|
||||
| { kind: 'raw' }
|
||||
| { kind: 'instruction'; instruction: T }
|
||||
/** 'custom' 인데 활성 지시문이 없거나 지워졌다 */
|
||||
| { kind: 'instruction-missing' }
|
||||
| { kind: 'action'; action: Exclude<LLMAction, 'custom'> }
|
||||
|
||||
export function resolveCommandPipeline<T extends InstructionLike>(
|
||||
config: { defaultLLMAction: LLMActionSelection; activeInstructionId: string | null },
|
||||
instructions: readonly T[],
|
||||
): CommandPipeline<T> {
|
||||
const action = config.defaultLLMAction
|
||||
if (action === 'none') return { kind: 'raw' }
|
||||
if (action === 'custom') {
|
||||
const instruction = config.activeInstructionId
|
||||
? instructions.find((item) => item.id === config.activeInstructionId)
|
||||
: undefined
|
||||
return instruction ? { kind: 'instruction', instruction } : { kind: 'instruction-missing' }
|
||||
}
|
||||
return { kind: 'action', action }
|
||||
}
|
||||
|
||||
/** 목록 라디오의 선택 값 — 일반 액션(다듬기 등)이 기본이면 아무것도 고르지 않은 상태다 */
|
||||
export function commandSelection<T extends InstructionLike>(pipeline: CommandPipeline<T>): string {
|
||||
if (pipeline.kind === 'raw') return COMMAND_NONE
|
||||
if (pipeline.kind === 'instruction') return pipeline.instruction.id
|
||||
return ''
|
||||
}
|
||||
|
||||
/** 일반 후처리 액션 이름 */
|
||||
export function llmActionLabelKey(action: Exclude<LLMAction, 'custom'>): TranslationKey {
|
||||
switch (action) {
|
||||
case 'refine':
|
||||
return 'settings.action.refine'
|
||||
case 'translate':
|
||||
return 'settings.action.translate'
|
||||
case 'summarize':
|
||||
return 'settings.action.summarize'
|
||||
case 'grammar':
|
||||
return 'settings.action.grammar'
|
||||
case 'expand':
|
||||
return 'tools.commands.action.expand'
|
||||
case 'chain':
|
||||
return 'tools.commands.action.chain'
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 테스트 실행 요청 — 실제 받아쓰기와 같은 경로를 탄다. 실행할 수 없으면 이유를 돌려준다.
|
||||
* (예전엔 활성 명령이 없으면 무조건 'refine' 을 돌려, 원문을 그대로 넣는 설정에서도 다듬은 결과를 보여 줬다.)
|
||||
*/
|
||||
export function commandTestRequest<T extends InstructionLike>(
|
||||
pipeline: CommandPipeline<T>,
|
||||
text: string,
|
||||
): { ok: true; params: LLMProcessParams } | { ok: false; reason: 'raw' | 'chain' | 'missing' | 'empty' } {
|
||||
const trimmed = text.trim()
|
||||
if (!trimmed) return { ok: false, reason: 'empty' }
|
||||
switch (pipeline.kind) {
|
||||
case 'raw':
|
||||
return { ok: false, reason: 'raw' }
|
||||
case 'instruction-missing':
|
||||
return { ok: false, reason: 'missing' }
|
||||
case 'instruction':
|
||||
return { ok: true, params: { text: trimmed, action: 'custom', customPrompt: pipeline.instruction.prompt } }
|
||||
case 'action':
|
||||
// 체인은 여러 단계를 main 의 ChainService 가 실행한다 — 한 번의 LLM 호출로 흉내 내지 않는다
|
||||
if (pipeline.action === 'chain') return { ok: false, reason: 'chain' }
|
||||
return { ok: true, params: { text: trimmed, action: pipeline.action } }
|
||||
}
|
||||
}
|
||||
|
||||
// ── AI 대화: 상태 표지 ─────────────────────────────────────
|
||||
|
||||
export interface ConversationBadge {
|
||||
labelKey: TranslationKey
|
||||
tone: 'default' | 'accent'
|
||||
pulse: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* 머리의 상태 표지. 세션이 꺼져 있으면 아무것도 보이지 않는다 — 켜지지 않은 대화를 '대기'로 쓰지 않는다.
|
||||
* 강조색은 듣는 중(녹음)일 때만.
|
||||
*/
|
||||
export function conversationBadge(input: {
|
||||
active: boolean
|
||||
state: ConversationState
|
||||
connecting: boolean
|
||||
}): ConversationBadge | null {
|
||||
if (input.connecting) return { labelKey: 'conversation.realtime.connecting', tone: 'default', pulse: true }
|
||||
if (!input.active) return null
|
||||
switch (input.state) {
|
||||
case 'listening':
|
||||
return { labelKey: 'conversation.listening', tone: 'accent', pulse: true }
|
||||
case 'thinking':
|
||||
return { labelKey: 'conversation.thinking', tone: 'default', pulse: true }
|
||||
case 'speaking':
|
||||
return { labelKey: 'conversation.speaking', tone: 'default', pulse: true }
|
||||
case 'idle':
|
||||
return { labelKey: 'conversation.idle', tone: 'default', pulse: false }
|
||||
}
|
||||
}
|
||||
|
||||
// ── 지식 베이스 ────────────────────────────────────────────
|
||||
|
||||
/** 질문 예시 — 누르면 그 문장으로 바로 질문한다 */
|
||||
export const KNOWLEDGE_EXAMPLE_KEYS: readonly TranslationKey[] = [
|
||||
'tools.knowledge.example.summary',
|
||||
'tools.knowledge.example.schedule',
|
||||
'tools.knowledge.example.policy',
|
||||
]
|
||||
|
||||
/** 문서 색인 상태 — 진행 중인 문서만 '색인 중', 끝났는데 색인이 없으면 '색인 안 됨'(대기 중이라 쓰지 않는다) */
|
||||
export function documentIndexLabelKey(doc: { id: string; indexed: boolean }, indexingId: string | null): TranslationKey {
|
||||
if (doc.id === indexingId) return 'rag.indexing'
|
||||
return doc.indexed ? 'rag.indexed' : 'tools.knowledge.notIndexed'
|
||||
}
|
||||
|
||||
// ── 사전 ──────────────────────────────────────────────────
|
||||
|
||||
export function dictionaryCategoryLabelKey(category: 'user' | 'auto' | 'technical'): TranslationKey {
|
||||
switch (category) {
|
||||
case 'user':
|
||||
return 'mobile.dictionary.category.user'
|
||||
case 'auto':
|
||||
return 'mobile.dictionary.category.auto'
|
||||
case 'technical':
|
||||
return 'mobile.dictionary.category.technical'
|
||||
}
|
||||
}
|
||||
64
apps/desktop/src/renderer/pages/tools/useDeferredDelete.ts
Normal file
64
apps/desktop/src/renderer/pages/tools/useDeferredDelete.ts
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
// src/renderer/pages/tools/useDeferredDelete.ts
|
||||
// 한 건 삭제의 "삭제했습니다 · 되돌리기" — 목록에서 바로 숨기고, 알림이 시간 초과로 닫힐 때 실제로 지운다.
|
||||
// 되돌리기를 누르면 다시 보인다. 실제 삭제가 실패하면 항목을 되살리고 오류를 알린다.
|
||||
|
||||
import { useCallback, useState } from 'react'
|
||||
import { useI18n } from '@d3ro/i18n'
|
||||
import { useNotify } from '../../components/shared'
|
||||
|
||||
export interface DeferredDeleteRequest {
|
||||
id: string
|
||||
/** 알림 문구 (기본: "삭제했습니다.") */
|
||||
message?: string
|
||||
/** 실제 삭제. 성공하면 true */
|
||||
commit: () => Promise<boolean>
|
||||
/** 실제 삭제가 끝난 뒤 (목록 다시 읽기 등) */
|
||||
onCommitted?: () => void
|
||||
}
|
||||
|
||||
export interface DeferredDelete {
|
||||
/** 삭제 대기 중이라 숨긴 id */
|
||||
hidden: ReadonlySet<string>
|
||||
remove: (request: DeferredDeleteRequest) => void
|
||||
}
|
||||
|
||||
export function useDeferredDelete(): DeferredDelete {
|
||||
const { t } = useI18n()
|
||||
const notify = useNotify()
|
||||
const [hidden, setHidden] = useState<ReadonlySet<string>>(() => new Set())
|
||||
|
||||
const reveal = useCallback((id: string) => {
|
||||
setHidden((prev) => {
|
||||
if (!prev.has(id)) return prev
|
||||
const next = new Set(prev)
|
||||
next.delete(id)
|
||||
return next
|
||||
})
|
||||
}, [])
|
||||
|
||||
const remove = useCallback(
|
||||
(request: DeferredDeleteRequest) => {
|
||||
setHidden((prev) => new Set(prev).add(request.id))
|
||||
notify({
|
||||
message: request.message ?? t('common.deleted'),
|
||||
action: { label: t('common.undo'), onClick: () => reveal(request.id) },
|
||||
onExpire: () => {
|
||||
void request
|
||||
.commit()
|
||||
.catch(() => false)
|
||||
.then((ok) => {
|
||||
if (ok) {
|
||||
request.onCommitted?.()
|
||||
return
|
||||
}
|
||||
reveal(request.id)
|
||||
notify({ message: t('tools.deleteFailed'), severity: 'error' })
|
||||
})
|
||||
},
|
||||
})
|
||||
},
|
||||
[notify, reveal, t],
|
||||
)
|
||||
|
||||
return { hidden, remove }
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue