fix(admin): fehlende RenameInline-Komponente implementiert (Inline-Umbenennen)
This commit is contained in:
parent
ed4439ae6f
commit
33866a1fa5
1 changed files with 23 additions and 0 deletions
|
|
@ -376,6 +376,29 @@ class ErrorBoundary extends React.Component<{ children: React.ReactNode }, { err
|
|||
}
|
||||
}
|
||||
|
||||
// Inline-Komponente für Umbenennen (nur bei genau 1 Selektion sichtbar)
|
||||
type RenameInlineProps = { onSubmit: (newName: string) => void | Promise<void> };
|
||||
function RenameInline({ onSubmit }: RenameInlineProps) {
|
||||
const [val, setVal] = useState('');
|
||||
async function submit() {
|
||||
const n = val.trim();
|
||||
if (!n) return;
|
||||
await onSubmit(n);
|
||||
setVal('');
|
||||
}
|
||||
return (
|
||||
<div style={{ display: 'flex', gap: 8, alignItems: 'center' }}>
|
||||
<input
|
||||
value={val}
|
||||
onChange={(e) => setVal(e.target.value)}
|
||||
placeholder="Neuer Name"
|
||||
onKeyDown={(e) => { if (e.key === 'Enter') void submit(); }}
|
||||
/>
|
||||
<button type="button" className="tab" onClick={() => void submit()}>Umbenennen</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue