Skip to content

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

fix(sidebar): add move up/down to the department menu

koeriaf02e1e39d6ce
diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx
index 09ec7866e4..a9045abaaf 100644
--- a/src/components/Sidebar.tsx
+++ b/src/components/Sidebar.tsx
@@ -1524,6 +1524,8 @@ export const Sidebar = memo(function Sidebar({ open, onClose, collapseToIcons =
}}>
<TeamMenuItems
department={teamMotion.value!.name} onRead={closeTeamMenu} onAddBots={() => { closeTeamMenu(); setMoveToTeam(teamMotion.value!.name); }}
+ onMoveUp={sections.interactive ? () => { layout.header(userSectionId(teamMotion.value!.name)).onMove(-1); } : undefined}
+ onMoveDown={sections.interactive ? () => { layout.header(userSectionId(teamMotion.value!.name)).onMove(1); } : undefined}
onRename={() => { closeTeamMenu(); (advanced ? setRenameTeam : botDrag.startRename)(teamMotion.value!.name); }}
onShare={() => { closeTeamMenu(); setShareTeam(teamMotion.value!.name); }}
onDelete={() => { closeTeamMenu(); setDeletingTeam(teamMotion.value!.name); }}
diff --git a/src/components/SidebarTeamMenu.tsx b/src/components/SidebarTeamMenu.tsx
index 521f17f73d..3e446157d0 100644
--- a/src/components/SidebarTeamMenu.tsx
+++ b/src/components/SidebarTeamMenu.tsx
@@ -1,5 +1,5 @@
import { useState } from "react";
-import { CheckCheck, Loader2, Pause, Play, Share2, SlidersHorizontal, SquarePen, Trash2, Users } from "lucide-react";
+import { ArrowDown, ArrowUp, CheckCheck, Loader2, Pause, Play, Share2, SlidersHorizontal, SquarePen, Trash2, Users } from "lucide-react";
import { isPausedHere, setPaused } from "@/lib/bot-pause";
import { useOwnerOrAdmin } from "@/lib/use-owner-or-admin";
import { cn } from "@/lib/cn";
@@ -53,7 +53,7 @@ function PauseDepartment({ name, className, onDone }: { name: string; className:
</button>;
}
-export function TeamMenuItems({ onAddBots, onRename, onShare, onDelete, onSetForAll, department, onRead }: {
+export function TeamMenuItems({ onAddBots, onRename, onShare, onDelete, onSetForAll, onMoveUp, onMoveDown, department, onRead }: {
/** The department this menu is for: with it, the menu offers Mark all as read. */
department?: string;
onRead?: () => void;
@@ -62,11 +62,16 @@ export function TeamMenuItems({ onAddBots, onRename, onShare, onDelete, onSetFor
onShare: () => void;
onDelete: () => void;
onSetForAll?: () => void;
+ /** Reorder the department where dragging can't: on a phone, or from a menu. */
+ onMoveUp?: () => void;
+ onMoveDown?: () => void;
}) {
const item = cn(MENU_ITEM, "hover:bg-menu-hover [&>svg]:text-ink-secondary");
return (
<>
<button type="button" role="menuitem" autoFocus className={item} onClick={onAddBots}><Users size={16} />{t("team.addBots")}</button>
+ {onMoveUp && <button type="button" role="menuitem" data-team-move-up className={item} onClick={onMoveUp}><ArrowUp size={16} />{t("team.moveUp")}</button>}
+ {onMoveDown && <button type="button" role="menuitem" data-team-move-down className={item} onClick={onMoveDown}><ArrowDown size={16} />{t("team.moveDown")}</button>}
{department !== undefined && <MarkDepartmentRead name={department} className={cn(item, "disabled:opacity-60")} onDone={onRead ?? (() => {})} />}
{department !== undefined && <PauseDepartment name={department} className={cn(item, "disabled:opacity-60")} onDone={onRead ?? (() => {})} />}
{onSetForAll && <button type="button" role="menuitem" className={item} onClick={onSetForAll}><SlidersHorizontal size={16} />{t("teamSettings.menu")}</button>}
diff --git a/src/locales/en.json b/src/locales/en.json
index 914f8d3ce2..9acbef7b91 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -2182,6 +2182,8 @@
"team.moveMany": "Move {count} bots",
"team.moveSelected": "Move selected bots",
"team.addBots": "Add bots",
+ "team.moveUp": "Move up",
+ "team.moveDown": "Move down",
"team.markAllRead": "Mark all as read",
"team.markingAllRead": "Marking as read…",
"team.manageBots": "Add or remove bots",