Init 2
This commit is contained in:
@@ -404,9 +404,8 @@ function NativeSelect({ value, onChange, children, className }: {
|
||||
return (
|
||||
<select value={value} onChange={(e) => onChange(e.target.value)}
|
||||
className={cn(
|
||||
"h-8 w-full rounded-lg border border-input bg-transparent px-2.5 text-sm outline-none",
|
||||
"h-8 w-full rounded-lg border border-input bg-background px-2.5 text-sm text-foreground outline-none",
|
||||
"focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50",
|
||||
"dark:bg-input/30",
|
||||
className,
|
||||
)}>
|
||||
{children}
|
||||
@@ -647,7 +646,7 @@ function ExportSheet({ open, onClose, rules }: {
|
||||
// Derived from open — new timestamp each time modal opens, undefined when closed
|
||||
const timestamp = useMemo(
|
||||
() => open ? new Date().toLocaleString("ru") : undefined,
|
||||
[open], // eslint-disable-line react-hooks/exhaustive-deps
|
||||
[open],
|
||||
)
|
||||
|
||||
const code = useMemo(() => generateRsc(rules, timestamp), [rules, timestamp])
|
||||
@@ -973,16 +972,16 @@ function ScenarioSheet({ open, onClose, initial, onSave }: {
|
||||
const [addForm, setAddForm]= useState<Omit<ScenarioRule, "id">>(DEFAULT_SRULE)
|
||||
|
||||
// Reset form fields each time the sheet opens — standard modal initialization pattern
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
|
||||
useEffect(() => {
|
||||
if (!open) return
|
||||
// eslint-disable-next-line react-hooks/set-state-in-effect
|
||||
setName(initial?.name ?? ""); setDesc(initial?.description ?? "")
|
||||
// eslint-disable-next-line react-hooks/set-state-in-effect
|
||||
|
||||
setPkt2(initial?.packet ?? DEFAULT_PKT); setRules(initial?.rules ?? [])
|
||||
// eslint-disable-next-line react-hooks/set-state-in-effect
|
||||
|
||||
setAddForm(DEFAULT_SRULE); setAddOpen(false)
|
||||
}, [open])
|
||||
}, [open, initial])
|
||||
|
||||
const setP = <K extends keyof PacketDef>(k: K, v: PacketDef[K]) =>
|
||||
setPkt2(p => ({ ...p, [k]: v }))
|
||||
|
||||
Reference in New Issue
Block a user