Library: fix folder rename (render the inline input in folder rows)
release gate / check (push) Failing after 5m27s
release gate / check (push) Failing after 5m27s
startRename set state but only page rows rendered the rename input, so folder Rename did nothing. Folder rows now show the same inline input.
This commit is contained in:
@@ -629,6 +629,24 @@ function SidebarNav({ open, pathname, isAdmin = false }: { open: boolean; pathna
|
|||||||
const renderFolderRow = (f: PageSummary, depth: number): React.ReactNode => {
|
const renderFolderRow = (f: PageSummary, depth: number): React.ReactNode => {
|
||||||
const open = !collapsedPages.has(f.id)
|
const open = !collapsedPages.has(f.id)
|
||||||
const kids = childrenOf(f.id)
|
const kids = childrenOf(f.id)
|
||||||
|
if (renamingId === f.id) {
|
||||||
|
return (
|
||||||
|
<div key={f.id} className="px-1 py-0.5" style={{ paddingLeft: depth * 12 }}>
|
||||||
|
<Input
|
||||||
|
autoFocus
|
||||||
|
value={renameValue}
|
||||||
|
onChange={(e) => setRenameValue(e.target.value)}
|
||||||
|
onBlur={() => commitRename(f)}
|
||||||
|
onKeyDown={(e) => {
|
||||||
|
if (e.key === 'Enter') { e.preventDefault(); (e.target as HTMLInputElement).blur() }
|
||||||
|
if (e.key === 'Escape') setRenamingId(null)
|
||||||
|
}}
|
||||||
|
className="h-7 text-sm"
|
||||||
|
aria-label={`Rename folder ${f.title}`}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<div key={f.id}>
|
<div key={f.id}>
|
||||||
<div className="group/row flex items-center rounded-lg pr-1 hover:bg-accent/50" style={{ paddingLeft: depth * 12 }}>
|
<div className="group/row flex items-center rounded-lg pr-1 hover:bg-accent/50" style={{ paddingLeft: depth * 12 }}>
|
||||||
|
|||||||
Reference in New Issue
Block a user