import { useState } from 'react' import { IconLoader2 } from '@tabler/icons-react' import { useLocation } from 'wouter' import { useAppConfig } from '@/client/api/app-config' import { Button } from '@/client/components/ui/button' import { Input } from '@/client/components/ui/input' import { useWorkspaceLayoutCtx } from '@/client/features/workspace/WorkspaceLayoutContext' import { useRemoveWorkspace } from '@/client/features/home/api' import { useSaveWorkspaceName } from './api' import { IconPicker } from './IconPicker' import { SettingsPage, SettingsRow, SettingsSection } from './SettingsLayout' export function GeneralSettings() { const { cloudDemo } = useAppConfig() const { name, icon, cwd, workspaceId } = useWorkspaceLayoutCtx() const [, navigate] = useLocation() const saveName = useSaveWorkspaceName(workspaceId) const removeWorkspace = useRemoveWorkspace() const [draft, setDraft] = useState(name ?? '') const commit = () => { const next = draft.trim() if (next === (name ?? '')) return saveName.mutate(next === '' ? null : next) } const remove = () => { const label = name ?? cwd ?? 'this space' const message = `Remove "${label}" from your workspaces?\n\nThis only removes it from your list. The folder and its sessions stay on disk. You can add it back any time.` if (!window.confirm(message)) return removeWorkspace.mutate(workspaceId, { onSuccess: () => navigate('/') }) } return ( setDraft(event.target.value)} onBlur={commit} onKeyDown={event => { if (event.key === 'Enter') event.currentTarget.blur() }} placeholder="Space name" className="w-56" /> } /> } />
Icon Pick an emoji or a glyph on a generated background, or upload an image.
{!cloudDemo && ( {removeWorkspace.isPending && ( )} Remove } /> {removeWorkspace.isError && (

{removeWorkspace.error.message}

)}
)}
) }