144 files moved with git mv (pure renames). Root package.json delegates dev/typecheck/test:run/lint/build to the packages; Node 24 LTS and pnpm 10.13.1 pinned (.nvmrc, .node-version, engines, packageManager, root devDependency, engine-strict). Dockerfile builds @faunosteo/app on node:24-alpine and copies apps/app/dist; nginx and runtime config unchanged. CI workflow for Gitea Actions. packages/ reserved (README only). Docs synced: WORKSPACE.md, CLAUDE.md, README, DEPLOY, CHANGELOG, plan. 271/271 tests, typecheck, lint, build green from the root.
71 lines
1.8 KiB
TypeScript
71 lines
1.8 KiB
TypeScript
import { useState } from 'react'
|
|
import Input from '@/components/ui/Input'
|
|
import Button from '@/components/ui/Button'
|
|
import Badge from '@/components/ui/Badge'
|
|
import { useT } from '@/i18n/useT'
|
|
|
|
export interface FreeTextFindingInputProps {
|
|
items: string[]
|
|
onChange: (next: string[]) => void
|
|
}
|
|
|
|
export default function FreeTextFindingInput({
|
|
items,
|
|
onChange,
|
|
}: FreeTextFindingInputProps) {
|
|
const [v, setV] = useState('')
|
|
const t = useT()
|
|
|
|
function add() {
|
|
const trimmed = v.trim()
|
|
if (!trimmed) return
|
|
onChange([...items, trimmed])
|
|
setV('')
|
|
}
|
|
|
|
function remove(i: number) {
|
|
onChange(items.filter((_, k) => k !== i))
|
|
}
|
|
|
|
return (
|
|
<div className="space-y-2">
|
|
<div className="flex gap-2">
|
|
<Input
|
|
value={v}
|
|
onChange={(e) => setV(e.target.value)}
|
|
placeholder={t('observation.free_placeholder')}
|
|
onKeyDown={(e) => {
|
|
if (e.key === 'Enter') {
|
|
e.preventDefault()
|
|
add()
|
|
}
|
|
}}
|
|
aria-label={t('observation.free_aria')}
|
|
/>
|
|
<Button onClick={add} variant="secondary">
|
|
{t('common.add')}
|
|
</Button>
|
|
</div>
|
|
{items.length > 0 && (
|
|
<ul className="flex flex-wrap gap-2">
|
|
{items.map((it, i) => (
|
|
<li key={`${it}-${i}`}>
|
|
<Badge tone="accent" className="gap-1">
|
|
{it}
|
|
<button
|
|
type="button"
|
|
aria-label={`${t('observation.remove_zone')} ${it}`}
|
|
onClick={() => remove(i)}
|
|
className="ml-1 text-[var(--color-accent-strong)] hover:text-[var(--color-danger)]"
|
|
>
|
|
✕
|
|
</button>
|
|
</Badge>
|
|
</li>
|
|
))}
|
|
</ul>
|
|
)}
|
|
</div>
|
|
)
|
|
}
|