bingocode 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/desktop/README.md +0 -30
- package/desktop/bunfig.toml +0 -1
- package/desktop/index.html +0 -17
- package/desktop/package.json +0 -55
- package/desktop/pnpm-lock.yaml +0 -3832
- package/desktop/public/app-icon.jpg +0 -0
- package/desktop/public/fonts/inter-latin-ext.woff2 +0 -0
- package/desktop/public/fonts/inter-latin.woff2 +0 -0
- package/desktop/public/fonts/jetbrains-mono-latin-ext.woff2 +0 -0
- package/desktop/public/fonts/jetbrains-mono-latin.woff2 +0 -0
- package/desktop/public/fonts/manrope-latin-ext.woff2 +0 -0
- package/desktop/public/fonts/manrope-latin.woff2 +0 -0
- package/desktop/public/fonts/material-symbols-outlined.woff2 +0 -0
- package/desktop/public/icons/bilibili.svg +0 -1
- package/desktop/public/icons/douyin.svg +0 -1
- package/desktop/public/icons/github.svg +0 -3
- package/desktop/public/icons/xiaohongshu.svg +0 -1
- package/desktop/scripts/build-macos-arm64.sh +0 -270
- package/desktop/scripts/build-sidecars.ts +0 -183
- package/desktop/scripts/build-windows-x64.ps1 +0 -295
- package/desktop/scripts/scan-missing-imports.ts +0 -235
- package/desktop/sidecars/claude-sidecar.ts +0 -156
- package/desktop/src/App.tsx +0 -5
- package/desktop/src/__tests__/agentsSettings.test.tsx +0 -349
- package/desktop/src/__tests__/pages.test.tsx +0 -290
- package/desktop/src/__tests__/skillsSettings.test.tsx +0 -205
- package/desktop/src/api/adapters.ts +0 -12
- package/desktop/src/api/agents.ts +0 -36
- package/desktop/src/api/cliTasks.ts +0 -28
- package/desktop/src/api/client.ts +0 -63
- package/desktop/src/api/computerUse.ts +0 -76
- package/desktop/src/api/filesystem.ts +0 -30
- package/desktop/src/api/hahaOAuth.ts +0 -38
- package/desktop/src/api/models.ts +0 -28
- package/desktop/src/api/providers.ts +0 -63
- package/desktop/src/api/search.ts +0 -29
- package/desktop/src/api/sessions.ts +0 -56
- package/desktop/src/api/settings.ts +0 -20
- package/desktop/src/api/skills.ts +0 -19
- package/desktop/src/api/tasks.ts +0 -36
- package/desktop/src/api/teams.ts +0 -44
- package/desktop/src/api/websocket.ts +0 -164
- package/desktop/src/components/chat/AskUserQuestion.tsx +0 -268
- package/desktop/src/components/chat/AssistantMessage.tsx +0 -29
- package/desktop/src/components/chat/AttachmentGallery.tsx +0 -113
- package/desktop/src/components/chat/ChatInput.tsx +0 -622
- package/desktop/src/components/chat/CodeViewer.tsx +0 -161
- package/desktop/src/components/chat/ComputerUsePermissionModal.test.tsx +0 -174
- package/desktop/src/components/chat/ComputerUsePermissionModal.tsx +0 -311
- package/desktop/src/components/chat/DiffViewer.tsx +0 -157
- package/desktop/src/components/chat/FileSearchMenu.tsx +0 -198
- package/desktop/src/components/chat/ImageGalleryModal.tsx +0 -91
- package/desktop/src/components/chat/InlineImageGallery.tsx +0 -106
- package/desktop/src/components/chat/InlineTaskSummary.tsx +0 -60
- package/desktop/src/components/chat/MermaidRenderer.test.tsx +0 -98
- package/desktop/src/components/chat/MermaidRenderer.tsx +0 -361
- package/desktop/src/components/chat/MessageActionBar.tsx +0 -27
- package/desktop/src/components/chat/MessageList.test.tsx +0 -313
- package/desktop/src/components/chat/MessageList.tsx +0 -249
- package/desktop/src/components/chat/PermissionDialog.tsx +0 -262
- package/desktop/src/components/chat/SessionTaskBar.test.tsx +0 -99
- package/desktop/src/components/chat/SessionTaskBar.tsx +0 -159
- package/desktop/src/components/chat/StreamingIndicator.tsx +0 -41
- package/desktop/src/components/chat/TerminalChrome.tsx +0 -35
- package/desktop/src/components/chat/ThinkingBlock.tsx +0 -87
- package/desktop/src/components/chat/ToolCallBlock.tsx +0 -247
- package/desktop/src/components/chat/ToolCallGroup.tsx +0 -617
- package/desktop/src/components/chat/ToolResultBlock.tsx +0 -107
- package/desktop/src/components/chat/UserMessage.tsx +0 -38
- package/desktop/src/components/chat/chatBlocks.test.tsx +0 -136
- package/desktop/src/components/chat/clipboard.ts +0 -25
- package/desktop/src/components/chat/composerUtils.test.ts +0 -55
- package/desktop/src/components/chat/composerUtils.ts +0 -149
- package/desktop/src/components/controls/ModelSelector.tsx +0 -156
- package/desktop/src/components/controls/PermissionModeSelector.tsx +0 -229
- package/desktop/src/components/layout/AppShell.tsx +0 -107
- package/desktop/src/components/layout/ContentRouter.tsx +0 -27
- package/desktop/src/components/layout/ProjectFilter.tsx +0 -126
- package/desktop/src/components/layout/Sidebar.test.tsx +0 -158
- package/desktop/src/components/layout/Sidebar.tsx +0 -384
- package/desktop/src/components/layout/StatusBar.tsx +0 -31
- package/desktop/src/components/layout/TabBar.test.tsx +0 -136
- package/desktop/src/components/layout/TabBar.tsx +0 -318
- package/desktop/src/components/layout/TitleBar.tsx +0 -96
- package/desktop/src/components/layout/WindowControls.test.tsx +0 -69
- package/desktop/src/components/layout/WindowControls.tsx +0 -89
- package/desktop/src/components/markdown/MarkdownRenderer.test.tsx +0 -100
- package/desktop/src/components/markdown/MarkdownRenderer.tsx +0 -229
- package/desktop/src/components/settings/ClaudeOfficialLogin.tsx +0 -107
- package/desktop/src/components/shared/Button.tsx +0 -63
- package/desktop/src/components/shared/CopyButton.tsx +0 -58
- package/desktop/src/components/shared/DirectoryPicker.tsx +0 -316
- package/desktop/src/components/shared/Dropdown.tsx +0 -91
- package/desktop/src/components/shared/Input.tsx +0 -38
- package/desktop/src/components/shared/Modal.tsx +0 -65
- package/desktop/src/components/shared/ProjectContextChip.tsx +0 -30
- package/desktop/src/components/shared/Spinner.tsx +0 -30
- package/desktop/src/components/shared/Textarea.tsx +0 -38
- package/desktop/src/components/shared/Toast.tsx +0 -47
- package/desktop/src/components/shared/UpdateChecker.tsx +0 -90
- package/desktop/src/components/skills/SkillDetail.test.tsx +0 -89
- package/desktop/src/components/skills/SkillDetail.tsx +0 -403
- package/desktop/src/components/skills/SkillList.tsx +0 -254
- package/desktop/src/components/tasks/DayOfWeekPicker.tsx +0 -57
- package/desktop/src/components/tasks/NewTaskModal.tsx +0 -407
- package/desktop/src/components/tasks/PromptEditor.tsx +0 -74
- package/desktop/src/components/tasks/TaskEmptyState.tsx +0 -30
- package/desktop/src/components/tasks/TaskList.tsx +0 -46
- package/desktop/src/components/tasks/TaskRow.tsx +0 -253
- package/desktop/src/components/tasks/TaskRunsPanel.tsx +0 -195
- package/desktop/src/components/teams/TeamStatusBar.tsx +0 -147
- package/desktop/src/config/providerPresets.ts +0 -78
- package/desktop/src/config/spinnerVerbs.ts +0 -193
- package/desktop/src/hooks/useKeyboardShortcuts.ts +0 -60
- package/desktop/src/i18n/index.ts +0 -54
- package/desktop/src/i18n/locales/en.ts +0 -670
- package/desktop/src/i18n/locales/zh.ts +0 -670
- package/desktop/src/lib/__tests__/cronDescribe.test.ts +0 -93
- package/desktop/src/lib/cronDescribe.ts +0 -188
- package/desktop/src/lib/desktopRuntime.ts +0 -54
- package/desktop/src/lib/parseRunOutput.ts +0 -79
- package/desktop/src/main.tsx +0 -13
- package/desktop/src/mocks/data.ts +0 -202
- package/desktop/src/pages/ActiveSession.test.tsx +0 -181
- package/desktop/src/pages/ActiveSession.tsx +0 -219
- package/desktop/src/pages/AdapterSettings.tsx +0 -375
- package/desktop/src/pages/AgentTeams.tsx +0 -200
- package/desktop/src/pages/ComputerUseSettings.tsx +0 -420
- package/desktop/src/pages/EmptySession.tsx +0 -518
- package/desktop/src/pages/NewTaskModal.tsx +0 -346
- package/desktop/src/pages/ScheduledTasks.tsx +0 -66
- package/desktop/src/pages/ScheduledTasksEmpty.tsx +0 -152
- package/desktop/src/pages/ScheduledTasksList.tsx +0 -416
- package/desktop/src/pages/SessionControls.tsx +0 -460
- package/desktop/src/pages/Settings.tsx +0 -1448
- package/desktop/src/pages/ToolInspection.tsx +0 -235
- package/desktop/src/stores/adapterStore.ts +0 -106
- package/desktop/src/stores/agentStore.ts +0 -34
- package/desktop/src/stores/chatStore.test.ts +0 -505
- package/desktop/src/stores/chatStore.ts +0 -850
- package/desktop/src/stores/cliTaskStore.ts +0 -152
- package/desktop/src/stores/hahaOAuthStore.test.ts +0 -77
- package/desktop/src/stores/hahaOAuthStore.ts +0 -97
- package/desktop/src/stores/providerStore.ts +0 -101
- package/desktop/src/stores/sessionStore.test.ts +0 -63
- package/desktop/src/stores/sessionStore.ts +0 -102
- package/desktop/src/stores/settingsStore.ts +0 -120
- package/desktop/src/stores/skillStore.ts +0 -51
- package/desktop/src/stores/tabStore.ts +0 -169
- package/desktop/src/stores/taskStore.ts +0 -68
- package/desktop/src/stores/teamStore.ts +0 -344
- package/desktop/src/stores/uiStore.ts +0 -100
- package/desktop/src/stores/updateStore.test.ts +0 -71
- package/desktop/src/stores/updateStore.ts +0 -221
- package/desktop/src/theme/globals.css +0 -465
- package/desktop/src/types/adapter.ts +0 -33
- package/desktop/src/types/chat.ts +0 -152
- package/desktop/src/types/cliTask.ts +0 -24
- package/desktop/src/types/provider.ts +0 -62
- package/desktop/src/types/session.ts +0 -27
- package/desktop/src/types/settings.ts +0 -22
- package/desktop/src/types/skill.ts +0 -38
- package/desktop/src/types/task.ts +0 -56
- package/desktop/src/types/team.ts +0 -38
- package/desktop/src-tauri/Cargo.lock +0 -5549
- package/desktop/src-tauri/Cargo.toml +0 -20
- package/desktop/src-tauri/app-icon.svg +0 -13
- package/desktop/src-tauri/build.rs +0 -3
- package/desktop/src-tauri/capabilities/default.json +0 -106
- package/desktop/src-tauri/icons/android/mipmap-anydpi-v26/ic_launcher.xml +0 -5
- package/desktop/src-tauri/icons/android/values/ic_launcher_background.xml +0 -4
- package/desktop/src-tauri/icons/icon.icns +0 -0
- package/desktop/src-tauri/icons/icon.ico +0 -0
- package/desktop/src-tauri/src/lib.rs +0 -408
- package/desktop/src-tauri/src/main.rs +0 -6
- package/desktop/src-tauri/tauri.conf.json +0 -78
- package/desktop/src-tauri/tauri.macos.conf.json +0 -18
- package/desktop/src-tauri/tauri.release-ci.json +0 -5
- package/desktop/src-tauri/tauri.windows.conf.json +0 -16
- package/desktop/src-tauri/windows-installer-hooks.nsh +0 -17
- package/desktop/tsconfig.json +0 -25
- package/desktop/vite.config.ts +0 -26
- package/desktop/vitest.config.ts +0 -18
|
@@ -1,316 +0,0 @@
|
|
|
1
|
-
import { useState, useEffect, useRef, useCallback } from 'react'
|
|
2
|
-
import { createPortal } from 'react-dom'
|
|
3
|
-
import { sessionsApi, type RecentProject } from '../../api/sessions'
|
|
4
|
-
import { filesystemApi } from '../../api/filesystem'
|
|
5
|
-
import { useTranslation } from '../../i18n'
|
|
6
|
-
|
|
7
|
-
type Props = {
|
|
8
|
-
value: string
|
|
9
|
-
onChange: (path: string) => void
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
type DirEntry = { name: string; path: string; isDirectory: boolean }
|
|
13
|
-
|
|
14
|
-
// Module-level cache for recent projects (shared across instances, survives re-renders)
|
|
15
|
-
let cachedProjects: RecentProject[] | null = null
|
|
16
|
-
let cacheTimestamp = 0
|
|
17
|
-
const CACHE_TTL = 30_000 // 30s
|
|
18
|
-
|
|
19
|
-
function isTauriRuntime() {
|
|
20
|
-
return typeof window !== 'undefined' && ('__TAURI_INTERNALS__' in window || '__TAURI__' in window)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function DirectoryPicker({ value, onChange }: Props) {
|
|
24
|
-
const t = useTranslation()
|
|
25
|
-
const [isOpen, setIsOpen] = useState(false)
|
|
26
|
-
const [mode, setMode] = useState<'recent' | 'browse'>('recent')
|
|
27
|
-
const [projects, setProjects] = useState<RecentProject[]>([])
|
|
28
|
-
const [browseEntries, setBrowseEntries] = useState<DirEntry[]>([])
|
|
29
|
-
const [browsePath, setBrowsePath] = useState('')
|
|
30
|
-
const [browseParent, setBrowseParent] = useState('')
|
|
31
|
-
const [loading, setLoading] = useState(false)
|
|
32
|
-
const [dropdownPos, setDropdownPos] = useState<{ top: number; left: number; direction: 'up' | 'down' } | null>(null)
|
|
33
|
-
const ref = useRef<HTMLDivElement>(null)
|
|
34
|
-
const triggerRef = useRef<HTMLButtonElement>(null)
|
|
35
|
-
|
|
36
|
-
const dropdownRef = useRef<HTMLDivElement>(null)
|
|
37
|
-
|
|
38
|
-
const updateDropdownPos = useCallback(() => {
|
|
39
|
-
if (!triggerRef.current) return
|
|
40
|
-
const rect = triggerRef.current.getBoundingClientRect()
|
|
41
|
-
const DROPDOWN_HEIGHT = 380 // approximate max height
|
|
42
|
-
const spaceAbove = rect.top
|
|
43
|
-
const spaceBelow = window.innerHeight - rect.bottom
|
|
44
|
-
const direction = spaceBelow >= DROPDOWN_HEIGHT || spaceBelow >= spaceAbove ? 'down' : 'up'
|
|
45
|
-
setDropdownPos({
|
|
46
|
-
top: direction === 'down' ? rect.bottom + 4 : rect.top - 4,
|
|
47
|
-
left: rect.left,
|
|
48
|
-
direction,
|
|
49
|
-
})
|
|
50
|
-
}, [])
|
|
51
|
-
|
|
52
|
-
// Close on outside click (checks both trigger and portal dropdown)
|
|
53
|
-
useEffect(() => {
|
|
54
|
-
if (!isOpen) return
|
|
55
|
-
const handleClick = (e: MouseEvent) => {
|
|
56
|
-
const target = e.target as Node
|
|
57
|
-
if (ref.current?.contains(target)) return
|
|
58
|
-
if (dropdownRef.current?.contains(target)) return
|
|
59
|
-
setIsOpen(false)
|
|
60
|
-
}
|
|
61
|
-
document.addEventListener('mousedown', handleClick)
|
|
62
|
-
return () => document.removeEventListener('mousedown', handleClick)
|
|
63
|
-
}, [isOpen])
|
|
64
|
-
|
|
65
|
-
// Recalculate position on scroll/resize while open
|
|
66
|
-
useEffect(() => {
|
|
67
|
-
if (!isOpen) return
|
|
68
|
-
updateDropdownPos()
|
|
69
|
-
window.addEventListener('scroll', updateDropdownPos, true)
|
|
70
|
-
window.addEventListener('resize', updateDropdownPos)
|
|
71
|
-
return () => {
|
|
72
|
-
window.removeEventListener('scroll', updateDropdownPos, true)
|
|
73
|
-
window.removeEventListener('resize', updateDropdownPos)
|
|
74
|
-
}
|
|
75
|
-
}, [isOpen, updateDropdownPos])
|
|
76
|
-
|
|
77
|
-
// Load recent projects when opened (with client-side cache)
|
|
78
|
-
useEffect(() => {
|
|
79
|
-
if (!isOpen || mode !== 'recent') return
|
|
80
|
-
// Use cache if fresh
|
|
81
|
-
if (cachedProjects && Date.now() - cacheTimestamp < CACHE_TTL) {
|
|
82
|
-
setProjects(cachedProjects)
|
|
83
|
-
return
|
|
84
|
-
}
|
|
85
|
-
setLoading(true)
|
|
86
|
-
sessionsApi.getRecentProjects()
|
|
87
|
-
.then(({ projects: p }) => {
|
|
88
|
-
cachedProjects = p
|
|
89
|
-
cacheTimestamp = Date.now()
|
|
90
|
-
setProjects(p)
|
|
91
|
-
})
|
|
92
|
-
.catch(() => setProjects([]))
|
|
93
|
-
.finally(() => setLoading(false))
|
|
94
|
-
}, [isOpen, mode])
|
|
95
|
-
|
|
96
|
-
const loadBrowseDir = async (path?: string) => {
|
|
97
|
-
setLoading(true)
|
|
98
|
-
try {
|
|
99
|
-
const result = await filesystemApi.browse(path)
|
|
100
|
-
setBrowsePath(result.currentPath)
|
|
101
|
-
setBrowseParent(result.parentPath)
|
|
102
|
-
setBrowseEntries(result.entries)
|
|
103
|
-
} catch { /* API not available */ }
|
|
104
|
-
setLoading(false)
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const handleSelect = (path: string) => {
|
|
108
|
-
onChange(path)
|
|
109
|
-
setIsOpen(false)
|
|
110
|
-
setMode('recent')
|
|
111
|
-
// Invalidate cache so next open reflects the new selection
|
|
112
|
-
cachedProjects = null
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
const handleChooseFolder = async () => {
|
|
116
|
-
if (isTauriRuntime()) {
|
|
117
|
-
// Desktop: native OS folder dialog
|
|
118
|
-
setIsOpen(false)
|
|
119
|
-
try {
|
|
120
|
-
const { open } = await import('@tauri-apps/plugin-dialog')
|
|
121
|
-
const selected = await open({
|
|
122
|
-
directory: true,
|
|
123
|
-
multiple: false,
|
|
124
|
-
title: t('dirPicker.chooseProjectFolder'),
|
|
125
|
-
})
|
|
126
|
-
if (selected) onChange(selected)
|
|
127
|
-
} catch (err) {
|
|
128
|
-
console.error('[DirectoryPicker] Failed to open folder dialog:', err)
|
|
129
|
-
}
|
|
130
|
-
} else {
|
|
131
|
-
// Web browser: directory tree via backend API
|
|
132
|
-
setMode('browse')
|
|
133
|
-
loadBrowseDir(value || undefined)
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
// Find selected project info
|
|
138
|
-
const selectedProject = projects.find((p) => p.realPath === value)
|
|
139
|
-
|
|
140
|
-
return (
|
|
141
|
-
<div ref={ref} className="relative">
|
|
142
|
-
{/* Trigger — shows selected project chip or placeholder */}
|
|
143
|
-
{value ? (
|
|
144
|
-
<button
|
|
145
|
-
ref={triggerRef}
|
|
146
|
-
onClick={() => { setIsOpen(!isOpen); setMode('recent') }}
|
|
147
|
-
className="flex items-center gap-2 px-3 py-1.5 bg-[var(--color-surface-container-low)] hover:bg-[var(--color-surface-hover)] rounded-full text-xs transition-colors border border-[var(--color-border)]"
|
|
148
|
-
>
|
|
149
|
-
{selectedProject?.isGit ? (
|
|
150
|
-
<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor" className="text-[var(--color-text-secondary)]">
|
|
151
|
-
<path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z" />
|
|
152
|
-
</svg>
|
|
153
|
-
) : (
|
|
154
|
-
<span className="material-symbols-outlined text-[14px] text-[var(--color-text-secondary)]">folder</span>
|
|
155
|
-
)}
|
|
156
|
-
<span className="font-medium text-[var(--color-text-primary)]">
|
|
157
|
-
{selectedProject?.repoName || selectedProject?.projectName || value.split('/').pop()}
|
|
158
|
-
</span>
|
|
159
|
-
{selectedProject?.branch && (
|
|
160
|
-
<>
|
|
161
|
-
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" className="text-[var(--color-text-tertiary)]">
|
|
162
|
-
<circle cx="18" cy="18" r="3" /><circle cx="6" cy="6" r="3" />
|
|
163
|
-
<path d="M13 6h3a2 2 0 0 1 2 2v7" /><line x1="6" y1="9" x2="6" y2="21" />
|
|
164
|
-
</svg>
|
|
165
|
-
<span className="text-[var(--color-text-tertiary)]">{selectedProject.branch}</span>
|
|
166
|
-
</>
|
|
167
|
-
)}
|
|
168
|
-
<span className="material-symbols-outlined text-[12px] text-[var(--color-text-tertiary)]">expand_more</span>
|
|
169
|
-
</button>
|
|
170
|
-
) : (
|
|
171
|
-
<button
|
|
172
|
-
ref={triggerRef}
|
|
173
|
-
onClick={() => { setIsOpen(!isOpen); setMode('recent') }}
|
|
174
|
-
className="flex items-center gap-2 text-xs text-[var(--color-text-tertiary)] hover:text-[var(--color-text-secondary)] transition-colors"
|
|
175
|
-
>
|
|
176
|
-
<span className="material-symbols-outlined text-[14px]">folder_open</span>
|
|
177
|
-
{t('dirPicker.selectProject')}
|
|
178
|
-
</button>
|
|
179
|
-
)}
|
|
180
|
-
|
|
181
|
-
{/* Dropdown — rendered via portal to escape overflow clipping */}
|
|
182
|
-
{isOpen && dropdownPos && createPortal(
|
|
183
|
-
<div
|
|
184
|
-
ref={dropdownRef}
|
|
185
|
-
className="w-[400px] bg-[var(--color-surface-container-lowest)] border border-[var(--color-border)] rounded-xl shadow-[var(--shadow-dropdown)] overflow-hidden"
|
|
186
|
-
style={{
|
|
187
|
-
position: 'fixed',
|
|
188
|
-
left: dropdownPos.left,
|
|
189
|
-
...(dropdownPos.direction === 'down'
|
|
190
|
-
? { top: dropdownPos.top }
|
|
191
|
-
: { bottom: window.innerHeight - dropdownPos.top }),
|
|
192
|
-
zIndex: 9999,
|
|
193
|
-
}}
|
|
194
|
-
>
|
|
195
|
-
{mode === 'recent' ? (
|
|
196
|
-
<>
|
|
197
|
-
<div className="px-4 py-2 text-[10px] font-bold uppercase tracking-widest text-[var(--color-outline)]">
|
|
198
|
-
{t('dirPicker.recent')}
|
|
199
|
-
</div>
|
|
200
|
-
<div className="max-h-[300px] overflow-y-auto">
|
|
201
|
-
{loading ? (
|
|
202
|
-
<div className="px-4 py-6 text-center text-xs text-[var(--color-text-tertiary)]">{t('common.loading')}</div>
|
|
203
|
-
) : projects.length === 0 ? (
|
|
204
|
-
<div className="px-4 py-6 text-center text-xs text-[var(--color-text-tertiary)]">{t('dirPicker.noRecent')}</div>
|
|
205
|
-
) : (
|
|
206
|
-
projects.map((project) => {
|
|
207
|
-
const isSelected = project.realPath === value
|
|
208
|
-
return (
|
|
209
|
-
<button
|
|
210
|
-
key={project.projectPath}
|
|
211
|
-
onClick={() => handleSelect(project.realPath)}
|
|
212
|
-
className={`w-full flex items-center gap-3 px-4 py-3 text-left transition-colors hover:bg-[var(--color-surface-hover)] ${
|
|
213
|
-
isSelected ? 'bg-[var(--color-surface-selected)]' : ''
|
|
214
|
-
}`}
|
|
215
|
-
>
|
|
216
|
-
{project.isGit ? (
|
|
217
|
-
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="var(--color-text-secondary)" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" className="flex-shrink-0">
|
|
218
|
-
<circle cx="18" cy="18" r="3" /><circle cx="6" cy="6" r="3" />
|
|
219
|
-
<path d="M13 6h3a2 2 0 0 1 2 2v7" /><line x1="6" y1="9" x2="6" y2="21" />
|
|
220
|
-
</svg>
|
|
221
|
-
) : (
|
|
222
|
-
<span className="material-symbols-outlined text-[20px] text-[var(--color-text-secondary)] flex-shrink-0">folder</span>
|
|
223
|
-
)}
|
|
224
|
-
<div className="flex-1 min-w-0">
|
|
225
|
-
<div className="text-sm font-semibold text-[var(--color-text-primary)] truncate">
|
|
226
|
-
{project.repoName || project.projectName}
|
|
227
|
-
</div>
|
|
228
|
-
<div className="text-[11px] text-[var(--color-text-tertiary)] truncate font-[var(--font-mono)]">
|
|
229
|
-
{project.realPath}
|
|
230
|
-
</div>
|
|
231
|
-
</div>
|
|
232
|
-
{isSelected && (
|
|
233
|
-
<span className="material-symbols-outlined text-[18px] text-[var(--color-brand)] flex-shrink-0" style={{ fontVariationSettings: "'FILL' 1" }}>
|
|
234
|
-
check
|
|
235
|
-
</span>
|
|
236
|
-
)}
|
|
237
|
-
</button>
|
|
238
|
-
)
|
|
239
|
-
})
|
|
240
|
-
)}
|
|
241
|
-
</div>
|
|
242
|
-
|
|
243
|
-
{/* Divider + Choose different folder */}
|
|
244
|
-
<div className="border-t border-[var(--color-border)]">
|
|
245
|
-
<button
|
|
246
|
-
onClick={handleChooseFolder}
|
|
247
|
-
className="w-full flex items-center gap-3 px-4 py-3 text-left hover:bg-[var(--color-surface-hover)] transition-colors"
|
|
248
|
-
>
|
|
249
|
-
<span className="material-symbols-outlined text-[20px] text-[var(--color-text-tertiary)]">create_new_folder</span>
|
|
250
|
-
<span className="text-sm text-[var(--color-text-secondary)]">{t('dirPicker.chooseFolder')}</span>
|
|
251
|
-
</button>
|
|
252
|
-
</div>
|
|
253
|
-
</>
|
|
254
|
-
) : (
|
|
255
|
-
/* Directory tree browser (web only) */
|
|
256
|
-
<>
|
|
257
|
-
<div className="px-3 py-2 border-b border-[var(--color-border)] flex items-center gap-1 flex-wrap">
|
|
258
|
-
<button onClick={() => setMode('recent')} className="text-xs text-[var(--color-text-accent)] hover:underline mr-2">
|
|
259
|
-
{'← ' + t('dirPicker.recent')}
|
|
260
|
-
</button>
|
|
261
|
-
<button onClick={() => loadBrowseDir('/')} className="text-[10px] text-[var(--color-text-tertiary)] hover:text-[var(--color-text-primary)]">/</button>
|
|
262
|
-
{browsePath.split('/').filter(Boolean).map((seg, i, arr) => (
|
|
263
|
-
<span key={i} className="flex items-center gap-1">
|
|
264
|
-
<span className="text-[10px] text-[var(--color-text-tertiary)]">/</span>
|
|
265
|
-
<button
|
|
266
|
-
onClick={() => loadBrowseDir('/' + arr.slice(0, i + 1).join('/'))}
|
|
267
|
-
className="text-[10px] text-[var(--color-text-accent)] hover:underline"
|
|
268
|
-
>{seg}</button>
|
|
269
|
-
</span>
|
|
270
|
-
))}
|
|
271
|
-
</div>
|
|
272
|
-
|
|
273
|
-
<div className="max-h-[240px] overflow-y-auto">
|
|
274
|
-
{loading ? (
|
|
275
|
-
<div className="px-3 py-4 text-center text-xs text-[var(--color-text-tertiary)]">{t('common.loading')}</div>
|
|
276
|
-
) : (
|
|
277
|
-
<>
|
|
278
|
-
{browseParent && browseParent !== browsePath && (
|
|
279
|
-
<button onClick={() => loadBrowseDir(browseParent)} className="w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-[var(--color-surface-hover)]">
|
|
280
|
-
<span className="material-symbols-outlined text-[16px] text-[var(--color-text-tertiary)]">arrow_upward</span>
|
|
281
|
-
<span className="text-xs text-[var(--color-text-secondary)]">..</span>
|
|
282
|
-
</button>
|
|
283
|
-
)}
|
|
284
|
-
{browseEntries.length === 0 ? (
|
|
285
|
-
<div className="px-3 py-4 text-center text-xs text-[var(--color-text-tertiary)]">{t('dirPicker.noSubdirs')}</div>
|
|
286
|
-
) : browseEntries.map((entry) => (
|
|
287
|
-
<button
|
|
288
|
-
key={entry.path}
|
|
289
|
-
className="w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-[var(--color-surface-hover)]"
|
|
290
|
-
>
|
|
291
|
-
<span className="material-symbols-outlined text-[16px] text-[var(--color-text-tertiary)]" onClick={() => loadBrowseDir(entry.path)}>folder</span>
|
|
292
|
-
<span className="text-xs text-[var(--color-text-primary)] flex-1" onClick={() => loadBrowseDir(entry.path)}>{entry.name}</span>
|
|
293
|
-
<button onClick={() => handleSelect(entry.path)} className="px-2 py-0.5 text-[10px] font-semibold text-[var(--color-brand)] hover:bg-[var(--color-primary-fixed)] rounded transition-colors">
|
|
294
|
-
{t('common.select')}
|
|
295
|
-
</button>
|
|
296
|
-
</button>
|
|
297
|
-
))}
|
|
298
|
-
</>
|
|
299
|
-
)}
|
|
300
|
-
</div>
|
|
301
|
-
|
|
302
|
-
{/* Use current folder */}
|
|
303
|
-
<div className="px-3 py-2 border-t border-[var(--color-border)] flex justify-between items-center">
|
|
304
|
-
<span className="text-[10px] text-[var(--color-text-tertiary)] font-[var(--font-mono)] truncate">{browsePath}</span>
|
|
305
|
-
<button onClick={() => handleSelect(browsePath)} className="px-3 py-1.5 bg-[var(--color-brand)] text-white text-xs font-semibold rounded-lg hover:opacity-90">
|
|
306
|
-
{t('dirPicker.useThisFolder')}
|
|
307
|
-
</button>
|
|
308
|
-
</div>
|
|
309
|
-
</>
|
|
310
|
-
)}
|
|
311
|
-
</div>,
|
|
312
|
-
document.body
|
|
313
|
-
)}
|
|
314
|
-
</div>
|
|
315
|
-
)
|
|
316
|
-
}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { useState, useRef, useEffect, type ReactNode } from 'react'
|
|
2
|
-
|
|
3
|
-
type DropdownItem<T extends string> = {
|
|
4
|
-
value: T
|
|
5
|
-
label: string
|
|
6
|
-
description?: string
|
|
7
|
-
icon?: ReactNode
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
type DropdownProps<T extends string> = {
|
|
11
|
-
items: DropdownItem<T>[]
|
|
12
|
-
value: T
|
|
13
|
-
onChange: (value: T) => void
|
|
14
|
-
trigger: ReactNode
|
|
15
|
-
width?: number
|
|
16
|
-
align?: 'left' | 'right'
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export function Dropdown<T extends string>({
|
|
20
|
-
items,
|
|
21
|
-
value,
|
|
22
|
-
onChange,
|
|
23
|
-
trigger,
|
|
24
|
-
width = 320,
|
|
25
|
-
align = 'left',
|
|
26
|
-
}: DropdownProps<T>) {
|
|
27
|
-
const [open, setOpen] = useState(false)
|
|
28
|
-
const ref = useRef<HTMLDivElement>(null)
|
|
29
|
-
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
if (!open) return
|
|
32
|
-
const handleClick = (e: MouseEvent) => {
|
|
33
|
-
if (ref.current && !ref.current.contains(e.target as Node)) {
|
|
34
|
-
setOpen(false)
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
const handleEsc = (e: KeyboardEvent) => {
|
|
38
|
-
if (e.key === 'Escape') setOpen(false)
|
|
39
|
-
}
|
|
40
|
-
document.addEventListener('mousedown', handleClick)
|
|
41
|
-
document.addEventListener('keydown', handleEsc)
|
|
42
|
-
return () => {
|
|
43
|
-
document.removeEventListener('mousedown', handleClick)
|
|
44
|
-
document.removeEventListener('keydown', handleEsc)
|
|
45
|
-
}
|
|
46
|
-
}, [open])
|
|
47
|
-
|
|
48
|
-
return (
|
|
49
|
-
<div ref={ref} className="relative inline-block">
|
|
50
|
-
<div onClick={() => setOpen(!open)} className="cursor-pointer">
|
|
51
|
-
{trigger}
|
|
52
|
-
</div>
|
|
53
|
-
|
|
54
|
-
{open && (
|
|
55
|
-
<div
|
|
56
|
-
className={`
|
|
57
|
-
absolute z-50 mt-1 py-1 rounded-[var(--radius-lg)]
|
|
58
|
-
bg-[var(--color-surface)] border border-[var(--color-border)]
|
|
59
|
-
shadow-[var(--shadow-dropdown)]
|
|
60
|
-
animate-in fade-in slide-in-from-top-1
|
|
61
|
-
${align === 'right' ? 'right-0' : 'left-0'}
|
|
62
|
-
`}
|
|
63
|
-
style={{ width }}
|
|
64
|
-
>
|
|
65
|
-
{items.map((item, i) => (
|
|
66
|
-
<button
|
|
67
|
-
key={item.value}
|
|
68
|
-
onClick={() => { onChange(item.value); setOpen(false) }}
|
|
69
|
-
className={`
|
|
70
|
-
w-full flex items-center gap-3 px-4 py-3 text-left transition-colors
|
|
71
|
-
hover:bg-[var(--color-surface-hover)]
|
|
72
|
-
${i > 0 ? 'border-t border-[var(--color-border-separator)]' : ''}
|
|
73
|
-
`}
|
|
74
|
-
>
|
|
75
|
-
{item.icon && <span className="text-lg flex-shrink-0">{item.icon}</span>}
|
|
76
|
-
<div className="flex-1 min-w-0">
|
|
77
|
-
<div className="text-sm font-medium text-[var(--color-text-primary)]">{item.label}</div>
|
|
78
|
-
{item.description && (
|
|
79
|
-
<div className="text-xs text-[var(--color-text-secondary)] mt-0.5">{item.description}</div>
|
|
80
|
-
)}
|
|
81
|
-
</div>
|
|
82
|
-
{item.value === value && (
|
|
83
|
-
<span className="text-[var(--color-text-primary)] text-sm flex-shrink-0">✓</span>
|
|
84
|
-
)}
|
|
85
|
-
</button>
|
|
86
|
-
))}
|
|
87
|
-
</div>
|
|
88
|
-
)}
|
|
89
|
-
</div>
|
|
90
|
-
)
|
|
91
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { InputHTMLAttributes } from 'react'
|
|
2
|
-
|
|
3
|
-
type InputProps = InputHTMLAttributes<HTMLInputElement> & {
|
|
4
|
-
label?: string
|
|
5
|
-
error?: string
|
|
6
|
-
required?: boolean
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function Input({ label, error, required, className = '', id, ...props }: InputProps) {
|
|
10
|
-
const inputId = id || label?.toLowerCase().replace(/\s+/g, '-')
|
|
11
|
-
return (
|
|
12
|
-
<div className="flex flex-col gap-1">
|
|
13
|
-
{label && (
|
|
14
|
-
<label htmlFor={inputId} className="text-sm font-medium text-[var(--color-text-primary)]">
|
|
15
|
-
{label}
|
|
16
|
-
{required && <span className="text-[var(--color-error)] ml-0.5">*</span>}
|
|
17
|
-
</label>
|
|
18
|
-
)}
|
|
19
|
-
<input
|
|
20
|
-
id={inputId}
|
|
21
|
-
className={`
|
|
22
|
-
h-10 px-3 rounded-[var(--radius-md)] border text-sm
|
|
23
|
-
bg-[var(--color-surface)] text-[var(--color-text-primary)]
|
|
24
|
-
placeholder:text-[var(--color-text-tertiary)]
|
|
25
|
-
transition-colors duration-150
|
|
26
|
-
${error
|
|
27
|
-
? 'border-[var(--color-error)] focus:shadow-[var(--shadow-error-ring)]'
|
|
28
|
-
: 'border-[var(--color-border)] focus:border-[var(--color-border-focus)] focus:shadow-[var(--shadow-focus-ring)]'
|
|
29
|
-
}
|
|
30
|
-
outline-none
|
|
31
|
-
${className}
|
|
32
|
-
`}
|
|
33
|
-
{...props}
|
|
34
|
-
/>
|
|
35
|
-
{error && <p className="text-xs text-[var(--color-error)]">{error}</p>}
|
|
36
|
-
</div>
|
|
37
|
-
)
|
|
38
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { useEffect, type ReactNode } from 'react'
|
|
2
|
-
|
|
3
|
-
type ModalProps = {
|
|
4
|
-
open: boolean
|
|
5
|
-
onClose: () => void
|
|
6
|
-
title?: string
|
|
7
|
-
children: ReactNode
|
|
8
|
-
width?: number
|
|
9
|
-
footer?: ReactNode
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function Modal({ open, onClose, title, children, width = 560, footer }: ModalProps) {
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
if (!open) return
|
|
15
|
-
const handleEsc = (e: KeyboardEvent) => {
|
|
16
|
-
if (e.key === 'Escape') onClose()
|
|
17
|
-
}
|
|
18
|
-
document.addEventListener('keydown', handleEsc)
|
|
19
|
-
return () => document.removeEventListener('keydown', handleEsc)
|
|
20
|
-
}, [open, onClose])
|
|
21
|
-
|
|
22
|
-
if (!open) return null
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<div className="fixed inset-0 z-50 flex items-center justify-center">
|
|
26
|
-
{/* Backdrop */}
|
|
27
|
-
<div
|
|
28
|
-
className="absolute inset-0 bg-[var(--color-overlay-scrim)] transition-opacity duration-200"
|
|
29
|
-
onClick={onClose}
|
|
30
|
-
/>
|
|
31
|
-
|
|
32
|
-
{/* Modal content */}
|
|
33
|
-
<div
|
|
34
|
-
className="glass-panel relative rounded-[var(--radius-xl)] max-h-[85vh] flex flex-col"
|
|
35
|
-
style={{ width, maxWidth: 'calc(100vw - 48px)' }}
|
|
36
|
-
role="dialog"
|
|
37
|
-
aria-modal="true"
|
|
38
|
-
>
|
|
39
|
-
{title && (
|
|
40
|
-
<div className="flex items-start justify-between gap-4 px-6 pt-6 pb-0">
|
|
41
|
-
<h2 className="text-xl font-bold text-[var(--color-text-primary)]">{title}</h2>
|
|
42
|
-
<button
|
|
43
|
-
type="button"
|
|
44
|
-
onClick={onClose}
|
|
45
|
-
aria-label="Close dialog"
|
|
46
|
-
className="flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-[var(--color-text-secondary)] transition-colors hover:bg-[var(--color-surface-hover)] hover:text-[var(--color-text-primary)]"
|
|
47
|
-
>
|
|
48
|
-
<span className="material-symbols-outlined text-[18px]">close</span>
|
|
49
|
-
</button>
|
|
50
|
-
</div>
|
|
51
|
-
)}
|
|
52
|
-
|
|
53
|
-
<div className="px-6 py-4 overflow-y-auto flex-1">
|
|
54
|
-
{children}
|
|
55
|
-
</div>
|
|
56
|
-
|
|
57
|
-
{footer && (
|
|
58
|
-
<div className="px-6 pb-6 pt-0 flex justify-end gap-2">
|
|
59
|
-
{footer}
|
|
60
|
-
</div>
|
|
61
|
-
)}
|
|
62
|
-
</div>
|
|
63
|
-
</div>
|
|
64
|
-
)
|
|
65
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
type Props = {
|
|
2
|
-
workDir?: string | null
|
|
3
|
-
repoName?: string | null
|
|
4
|
-
branch?: string | null
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export function ProjectContextChip({ workDir, repoName, branch }: Props) {
|
|
8
|
-
const label = branch ? (repoName || workDir?.split('/').pop() || '') : (workDir?.split('/').pop() || repoName || '')
|
|
9
|
-
|
|
10
|
-
if (!label) return null
|
|
11
|
-
|
|
12
|
-
return (
|
|
13
|
-
<div className="inline-flex max-w-full items-center gap-2 rounded-full border border-[var(--color-border)] bg-[var(--color-surface-container-lowest)] px-4 py-2 text-sm text-[var(--color-text-secondary)]">
|
|
14
|
-
{branch ? (
|
|
15
|
-
<svg width="18" height="18" viewBox="0 0 16 16" fill="currentColor" className="shrink-0 text-[var(--color-text-secondary)]">
|
|
16
|
-
<path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z" />
|
|
17
|
-
</svg>
|
|
18
|
-
) : (
|
|
19
|
-
<span className="material-symbols-outlined text-[18px] text-[var(--color-text-secondary)]">folder</span>
|
|
20
|
-
)}
|
|
21
|
-
<span className="truncate font-medium text-[var(--color-text-primary)]">{label}</span>
|
|
22
|
-
{branch ? (
|
|
23
|
-
<>
|
|
24
|
-
<span className="text-[var(--color-text-tertiary)]">|</span>
|
|
25
|
-
<span className="truncate">{branch}</span>
|
|
26
|
-
</>
|
|
27
|
-
) : null}
|
|
28
|
-
</div>
|
|
29
|
-
)
|
|
30
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
type SpinnerProps = {
|
|
2
|
-
size?: number
|
|
3
|
-
className?: string
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export function Spinner({ size = 20, className = '' }: SpinnerProps) {
|
|
7
|
-
return (
|
|
8
|
-
<svg
|
|
9
|
-
className={`animate-spin ${className}`}
|
|
10
|
-
width={size}
|
|
11
|
-
height={size}
|
|
12
|
-
viewBox="0 0 24 24"
|
|
13
|
-
fill="none"
|
|
14
|
-
>
|
|
15
|
-
<circle
|
|
16
|
-
className="opacity-25"
|
|
17
|
-
cx="12"
|
|
18
|
-
cy="12"
|
|
19
|
-
r="10"
|
|
20
|
-
stroke="currentColor"
|
|
21
|
-
strokeWidth="4"
|
|
22
|
-
/>
|
|
23
|
-
<path
|
|
24
|
-
className="opacity-75"
|
|
25
|
-
fill="currentColor"
|
|
26
|
-
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"
|
|
27
|
-
/>
|
|
28
|
-
</svg>
|
|
29
|
-
)
|
|
30
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { TextareaHTMLAttributes } from 'react'
|
|
2
|
-
|
|
3
|
-
type TextareaProps = TextareaHTMLAttributes<HTMLTextAreaElement> & {
|
|
4
|
-
label?: string
|
|
5
|
-
error?: string
|
|
6
|
-
required?: boolean
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function Textarea({ label, error, required, className = '', id, ...props }: TextareaProps) {
|
|
10
|
-
const inputId = id || label?.toLowerCase().replace(/\s+/g, '-')
|
|
11
|
-
return (
|
|
12
|
-
<div className="flex flex-col gap-1">
|
|
13
|
-
{label && (
|
|
14
|
-
<label htmlFor={inputId} className="text-sm font-medium text-[var(--color-text-primary)]">
|
|
15
|
-
{label}
|
|
16
|
-
{required && <span className="text-[var(--color-error)] ml-0.5">*</span>}
|
|
17
|
-
</label>
|
|
18
|
-
)}
|
|
19
|
-
<textarea
|
|
20
|
-
id={inputId}
|
|
21
|
-
className={`
|
|
22
|
-
min-h-[120px] px-3 py-2 rounded-[var(--radius-lg)] border text-sm resize-y
|
|
23
|
-
bg-[var(--color-surface)] text-[var(--color-text-primary)]
|
|
24
|
-
placeholder:text-[var(--color-text-tertiary)]
|
|
25
|
-
transition-colors duration-150
|
|
26
|
-
${error
|
|
27
|
-
? 'border-[var(--color-error)]'
|
|
28
|
-
: 'border-[var(--color-border)] focus:border-[var(--color-border-focus)] focus:shadow-[var(--shadow-focus-ring)]'
|
|
29
|
-
}
|
|
30
|
-
outline-none
|
|
31
|
-
${className}
|
|
32
|
-
`}
|
|
33
|
-
{...props}
|
|
34
|
-
/>
|
|
35
|
-
{error && <p className="text-xs text-[var(--color-error)]">{error}</p>}
|
|
36
|
-
</div>
|
|
37
|
-
)
|
|
38
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { useUIStore, type Toast as ToastType } from '../../stores/uiStore'
|
|
2
|
-
|
|
3
|
-
const typeStyles: Record<ToastType['type'], string> = {
|
|
4
|
-
success: 'border-l-4 border-l-[var(--color-success)]',
|
|
5
|
-
error: 'border-l-4 border-l-[var(--color-error)]',
|
|
6
|
-
warning: 'border-l-4 border-l-[var(--color-warning)]',
|
|
7
|
-
info: 'border-l-4 border-l-[var(--color-text-accent)]',
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
function ToastItem({ toast }: { toast: ToastType }) {
|
|
11
|
-
const removeToast = useUIStore((s) => s.removeToast)
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<div
|
|
15
|
-
className={`
|
|
16
|
-
bg-[var(--color-surface)] rounded-[var(--radius-md)] shadow-[var(--shadow-dropdown)]
|
|
17
|
-
px-4 py-3 text-sm text-[var(--color-text-primary)]
|
|
18
|
-
${typeStyles[toast.type]}
|
|
19
|
-
animate-in slide-in-from-right fade-in duration-200
|
|
20
|
-
`}
|
|
21
|
-
>
|
|
22
|
-
<div className="flex items-center justify-between gap-2">
|
|
23
|
-
<span>{toast.message}</span>
|
|
24
|
-
<button
|
|
25
|
-
onClick={() => removeToast(toast.id)}
|
|
26
|
-
className="text-[var(--color-text-tertiary)] hover:text-[var(--color-text-primary)] text-lg leading-none"
|
|
27
|
-
>
|
|
28
|
-
×
|
|
29
|
-
</button>
|
|
30
|
-
</div>
|
|
31
|
-
</div>
|
|
32
|
-
)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export function ToastContainer() {
|
|
36
|
-
const toasts = useUIStore((s) => s.toasts)
|
|
37
|
-
|
|
38
|
-
if (toasts.length === 0) return null
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<div className="fixed bottom-4 right-4 z-[100] flex flex-col gap-2 max-w-sm">
|
|
42
|
-
{toasts.map((toast) => (
|
|
43
|
-
<ToastItem key={toast.id} toast={toast} />
|
|
44
|
-
))}
|
|
45
|
-
</div>
|
|
46
|
-
)
|
|
47
|
-
}
|