Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

style(sidebar): state the rail restriction in the hook doc, not in narrating comments

pepeneif3db6d0f6c825
diff --git a/src/components/Sidebar.departments.test.ts b/src/components/Sidebar.departments.test.ts
index 0336e8f827..0cf4b600f4 100644
--- a/src/components/Sidebar.departments.test.ts
+++ b/src/components/Sidebar.departments.test.ts
@@ -179,7 +179,6 @@ describe("Simple's sidebar before anyone drags", () => {
});
it("reorders inside the rail's own list, and nothing else: no department is created or left unseen", () => {
- // The rail hides department names and its naming field, so a drop there must only move a tile within its list.
fixture.storage.set(SIDEBAR_DENSITY_KEY, "avatars");
drag("cleo");
row("atlas").botDrag!.row("atlas").onDrop(at(5) as never);
@@ -187,7 +186,6 @@ describe("Simple's sidebar before anyone drags", () => {
expect(sections()).not.toContain(userSectionId(NEW_DEPARTMENT));
fixture.dispatch.mockClear();
- // Onto the middle of a bot: a place above or below, never a new department whose name field the rail hides.
drag("cleo");
row("atlas").botDrag!.row("atlas").onDragOver(at() as never);
expect(row("atlas").botDrop).toBe("after");
diff --git a/src/components/SidebarBotDrag.tsx b/src/components/SidebarBotDrag.tsx
index f07b5ddcda..28e6714ead 100644
--- a/src/components/SidebarBotDrag.tsx
+++ b/src/components/SidebarBotDrag.tsx
@@ -36,7 +36,9 @@ export function BotDropLine({ place }: { place: BotDropPlace | null | undefined
}
/** Dragging bots between the rows outside any department and each department's, onto a bot to start a department,
- * Alt+Up/Down, and the name field a new or renamed department shows in its heading. */
+ * Alt+Up/Down, and the name field a new or renamed department shows in its heading. With `withinList` a drop may only
+ * reorder the bot inside the list it already belongs to: the icons-only rail draws no department heading, so it shows
+ * neither the department a bot would join nor the field that names a new one. */
export function useSidebarBotDrag({ dispatch, announce, onNamed, onRenamed, onError, onCancelled }: {
dispatch: Dispatch<Action>;
announce: (text: string) => void;
@@ -78,7 +80,6 @@ export function useSidebarBotDrag({ dispatch, announce, onNamed, onRenamed, onEr
};
const allowed = (botId: string, move: BotMove | null): BotMove | null => {
if (!move) return null;
- // The icon rail shows no department names, so there a drop only reorders inside the bot's own list.
if (!latest.current.withinList) return move;
const from = botListOf(latest.current.lists, botId);
if (move.kind !== "move" || move.section !== from) return null;