}) {
const isGroup = node.kind === "shortcuts";
return (
{isGroup ? (
onSetNameDraft(node.id, event.target.value)}
onBlur={() => onCommitName(node.id, node.name ?? "")}
disabled={readOnly}
className="min-h-7 min-w-0 flex-1 max-md:min-h-11 [@media(pointer:coarse)]:min-h-11"
/>
) : (
{nodeTitle(node, projected, t)}
)}
{isGroup && (
)}
);
}
function SidebarLayoutShortcutList({
node,
projected,
sections,
catalog,
loading,
catalogError,
canvasError,
readOnly,
pickerOpen,
query,
onQueryChange,
onOpenPicker,
onClosePicker,
onAdd,
onRemoveShortcut,
onMoveShortcut,
onMoveShortcutToSection,
onFocus,
t,
}: NodeEditorProps) {
const { setNodeRef } = useDroppable({
id: groupDropId(node.id),
disabled: readOnly,
data: { type: "group", nodeId: node.id } satisfies SidebarLayoutDragData,
});
if (node.kind !== "shortcuts") return null;
const shortcuts = projected?.shortcuts ?? [];
return (
shortcutDragId(node.id, shortcut.id))}
strategy={verticalListSortingStrategy}
>
{shortcuts.map((shortcut, shortcutIndex) => (
))}
{pickerOpen && !readOnly && (
`${shortcut.target.kind}:${shortcut.target.id}`)}
t={t}
/>
)}
);
}
function SortableSidebarShortcut({
nodeId,
shortcut,
readOnly,
shortcutIndex,
shortcutCount,
sections,
t,
onMoveShortcut,
onRemoveShortcut,
onMoveShortcutToSection,
}: {
nodeId: string;
shortcut: ProjectedShortcut;
readOnly: boolean;
shortcutIndex: number;
shortcutCount: number;
sections: SidebarLayoutNode[];
t: (key: string, options?: Record) => string;
onMoveShortcut: (shortcutId: string, position: number) => void;
onRemoveShortcut: (shortcutId: string) => void;
onMoveShortcutToSection: (shortcutId: string, destinationNodeId: string) => void;
}) {
const sortable = useSortable({
id: shortcutDragId(nodeId, shortcut.id),
disabled: readOnly,
data: { type: "shortcut", nodeId, shortcutId: shortcut.id } satisfies SidebarLayoutDragData,
});
const Icon = shortcut.icon;
return (
{shortcut.label}
{!shortcut.available && (
{t("common:unavailable")}
)}
{!readOnly && (
onMoveShortcutToSection(shortcut.id, destinationNodeId)}
t={t}
/>
)}
);
}