Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Studio: drop Move up / Move down from sidebar row menus (#12000)

Daniel Hanf6bc6c535069
diff --git a/studio/frontend/src/components/app-sidebar.tsx b/studio/frontend/src/components/app-sidebar.tsx
index e2ca20a86e5..c0871ae8616 100644
--- a/studio/frontend/src/components/app-sidebar.tsx
+++ b/studio/frontend/src/components/app-sidebar.tsx
@@ -127,7 +127,7 @@ import {
} from "@/components/ui/tooltip";
import { Tooltip as TooltipPrimitive } from "radix-ui";
import { HugeiconsIcon } from "@hugeicons/react";
-import { ArrowRightIcon, ChevronDown, ChevronUp, GitBranchIcon, Moon } from "lucide-react";
+import { ArrowRightIcon, ChevronDown, GitBranchIcon, Moon } from "lucide-react";
import {
Link,
useNavigate,
@@ -238,7 +238,6 @@ import {
} from "react";
import { isDownloadCancelled } from "@/lib/native-files";
import { toast } from "@/lib/toast";
-import { useIsCoarsePointer } from "@/hooks/use-mobile";
import {
folderRingKey,
sectionRingKey,
@@ -1920,8 +1919,6 @@ export function AppSidebar() {
const chatMovesRef = useRef(
new Map<string, { generation: number; chain: Promise<unknown> }>(),
);
- // A touch browser never fires dragstart, so its row menus keep Move up and Move down.
- const coarsePointer = useIsCoarsePointer();
const dnd = useSidebarDrag({
context: dropContext,
// A closed folder or section the pointer rests on opens.
@@ -2071,36 +2068,6 @@ export function AppSidebar() {
};
}
- /** Move up and Move down in a row menu, for touch screens only: the browser starts no drag
- * there, and a list would be stuck in its order. */
- function renderMoveRowItems(
- item: SidebarDragItem,
- orderedIds: string[],
- sort: RowSort | undefined,
- P: RowMenuParts,
- ) {
- if (!coarsePointer) return null;
- const at = orderedIds.indexOf(item.id);
- return (
- <>
- <P.Item
- disabled={at <= 0}
- onSelect={() => reorderRowBy(item, orderedIds, sort, -1)}
- >
- <ChevronUp strokeWidth={1.75} className="size-icon" />
- <span>{t("shell.organize.moveUp")}</span>
- </P.Item>
- <P.Item
- disabled={at === -1 || at >= orderedIds.length - 1}
- onSelect={() => reorderRowBy(item, orderedIds, sort, 1)}
- >
- <ChevronDown strokeWidth={1.75} className="size-icon" />
- <span>{t("shell.organize.moveDown")}</span>
- </P.Item>
- </>
- );
- }
-
useEffect(() => {
const activeVisibleThreadIdSet = new Set(
activeVisibleThreadIdKey ? activeVisibleThreadIdKey.split("\n") : [],
@@ -3217,14 +3184,11 @@ export function AppSidebar() {
/** A folder row's right-click menu. One row gets the same menu its 3-dot opens; a real
* selection of several gets the bulk actions, which right-click is the only pointer way to. */
- function renderProjectContextMenu(
- project: ProjectRecord,
- order: ProjectOrderContext,
- ) {
+ function renderProjectContextMenu(project: ProjectRecord) {
if (projectSelectionCount <= 1) {
return (
<ContextMenuContent className="unsloth-plus-menu sidebar-row-menu menu-flat-destructive w-52">
- {renderProjectRowMenuItems(project, order, CONTEXT_ROW_MENU)}
+ {renderProjectRowMenuItems(project, CONTEXT_ROW_MENU)}
</ContextMenuContent>
);
}
@@ -3344,18 +3308,6 @@ export function AppSidebar() {
<HugeiconsIcon icon={isPinned ? PinOffIcon : PinIcon} strokeWidth={1.75} className="size-icon" />
<span>{isPinned ? "Unpin" : "Pin"}</span>
</P.Item>
- {renderMoveRowItems(
- {
- kind: "chat",
- id: item.id,
- section: list.section,
- scope: list.scope,
- projectId: item.projectId ?? null,
- },
- list.orderIds ?? list.ids,
- list.sort,
- P,
- )}
{/* The dot a finished reply leaves, put back or taken off by hand. */}
<P.Item
onSelect={() =>
@@ -3821,7 +3773,6 @@ export function AppSidebar() {
/** Every action a folder row offers, for its 3-dot menu and its right-click menu alike. */
function renderProjectRowMenuItems(
project: ProjectRecord,
- order: ProjectOrderContext,
P: RowMenuParts,
) {
const isProjectPinned = pinnedProjectIdSet.has(project.id);
@@ -3841,18 +3792,6 @@ export function AppSidebar() {
<HugeiconsIcon icon={Edit03Icon} strokeWidth={1.75} className="size-icon" />
<span>Edit</span>
</P.Item>
- {renderMoveRowItems(
- {
- kind: "project",
- id: project.id,
- section: order.section,
- scope: order.scope,
- projectId: null,
- },
- order.orderedIds,
- order.sort,
- P,
- )}
<P.Separator />
<P.Item
variant="destructive"
@@ -4003,11 +3942,11 @@ export function AppSidebar() {
</button>
)}
>
- {renderProjectRowMenuItems(project, order, DROPDOWN_ROW_MENU)}
+ {renderProjectRowMenuItems(project, DROPDOWN_ROW_MENU)}
</NonModalDropdownMenu>
</SidebarMenuItem>
</ContextMenuTrigger>
- {renderProjectContextMenu(project, order)}
+ {renderProjectContextMenu(project)}
</ContextMenu>
{expanded &&
visibleChats.map((chat) =>
diff --git a/studio/frontend/src/features/chat/hooks/use-sidebar-drag.ts b/studio/frontend/src/features/chat/hooks/use-sidebar-drag.ts
index 448436a8345..b0311690396 100644
--- a/studio/frontend/src/features/chat/hooks/use-sidebar-drag.ts
+++ b/studio/frontend/src/features/chat/hooks/use-sidebar-drag.ts
@@ -297,8 +297,8 @@ export function useSidebarDrag(options: UseSidebarDragOptions): SidebarDragApi {
const dragHandleProps = useCallback(
(item: SidebarDragItem) => ({
onPointerDown: (event: React.PointerEvent) => {
- // Touch scrolls the list and keeps Move up and Move down. The right button opens the
- // row menu, and a control with its own press keeps it.
+ // Touch scrolls the list. The right button opens the row menu, and a control with its
+ // own press keeps it.
if (event.button !== 0 || event.pointerType === "touch") return;
if (!event.isPrimary) return;
if ((event.target as Element | null)?.closest?.(NO_DRAG_SELECTOR)) {
diff --git a/studio/frontend/src/hooks/use-mobile.ts b/studio/frontend/src/hooks/use-mobile.ts
index c6904e35775..15f5739e42f 100644
--- a/studio/frontend/src/hooks/use-mobile.ts
+++ b/studio/frontend/src/hooks/use-mobile.ts
@@ -27,26 +27,6 @@ export function useIsMobile(): boolean {
return useSyncExternalStore(subscribe, getSnapshot, () => false);
}
-// any-pointer, not pointer: a laptop with a touchscreen and a trackpad still has a finger.
-const COARSE_POINTER_QUERY = "(any-pointer: coarse)";
-
-function getCoarseSnapshot(): boolean {
- if (typeof window === "undefined") return false;
- return window.matchMedia(COARSE_POINTER_QUERY).matches;
-}
-
-function subscribeCoarse(callback: () => void): () => void {
- if (typeof window === "undefined") return () => {};
- const mql = window.matchMedia(COARSE_POINTER_QUERY);
- mql.addEventListener("change", callback);
- return () => mql.removeEventListener("change", callback);
-}
-
-/** A touch screen is present, where the browser never starts a native drag from it. */
-export function useIsCoarsePointer(): boolean {
- return useSyncExternalStore(subscribeCoarse, getCoarseSnapshot, () => false);
-}
-
/**
* Whether to swap in the mobile shell: a sheet sidebar over a dimmed page, its
* own width, its own header. Never in the desktop app, where a narrowed window
diff --git a/studio/frontend/src/i18n/locales/ar.ts b/studio/frontend/src/i18n/locales/ar.ts
index 424b8aed6b5..97468c589af 100644
--- a/studio/frontend/src/i18n/locales/ar.ts
+++ b/studio/frontend/src/i18n/locales/ar.ts
@@ -227,8 +227,6 @@ export const ar = {
organizeChats: "تنظيم المحادثات",
organizeProjects: "تنظيم المشاريع",
sortPinnedChats: "ترتيب المحادثات المثبتة",
- moveUp: "تحريك لأعلى",
- moveDown: "تحريك لأسفل",
},
dialog: {
deleteChat: {
diff --git a/studio/frontend/src/i18n/locales/de.ts b/studio/frontend/src/i18n/locales/de.ts
index a9afaf3e92c..7a7ddf49dc4 100644
--- a/studio/frontend/src/i18n/locales/de.ts
+++ b/studio/frontend/src/i18n/locales/de.ts
@@ -230,8 +230,6 @@ export const de = {
organizeChats: "Chats organisieren",
organizeProjects: "Projekte organisieren",
sortPinnedChats: "Angeheftete Chats sortieren",
- moveUp: "Nach oben",
- moveDown: "Nach unten",
},
dialog: {
deleteChat: {
diff --git a/studio/frontend/src/i18n/locales/en.ts b/studio/frontend/src/i18n/locales/en.ts
index b7748490cfb..a3494b4c0dc 100644
--- a/studio/frontend/src/i18n/locales/en.ts
+++ b/studio/frontend/src/i18n/locales/en.ts
@@ -236,8 +236,6 @@ export const en = {
organizeChats: "Organize chats",
organizeProjects: "Organize projects",
sortPinnedChats: "Sort pinned chats",
- moveUp: "Move up",
- moveDown: "Move down",
},
dialog: {
deleteChat: {
diff --git a/studio/frontend/src/i18n/locales/es.ts b/studio/frontend/src/i18n/locales/es.ts
index 4a384ecf853..5bf21fd1bf1 100644
--- a/studio/frontend/src/i18n/locales/es.ts
+++ b/studio/frontend/src/i18n/locales/es.ts
@@ -229,8 +229,6 @@ export const es = {
organizeChats: "Organizar chats",
organizeProjects: "Organizar proyectos",
sortPinnedChats: "Ordenar chats fijados",
- moveUp: "Subir",
- moveDown: "Bajar",
},
dialog: {
deleteChat: {
diff --git a/studio/frontend/src/i18n/locales/fr.ts b/studio/frontend/src/i18n/locales/fr.ts
index 95aaf3fad6b..da65d076389 100644
--- a/studio/frontend/src/i18n/locales/fr.ts
+++ b/studio/frontend/src/i18n/locales/fr.ts
@@ -230,8 +230,6 @@ export const fr = {
organizeChats: "Organiser les discussions",
organizeProjects: "Organiser les projets",
sortPinnedChats: "Trier les discussions épinglées",
- moveUp: "Monter",
- moveDown: "Descendre",
},
dialog: {
deleteChat: {
diff --git a/studio/frontend/src/i18n/locales/hi.ts b/studio/frontend/src/i18n/locales/hi.ts
index d5632a9bd11..3092381ad60 100644
--- a/studio/frontend/src/i18n/locales/hi.ts
+++ b/studio/frontend/src/i18n/locales/hi.ts
@@ -230,8 +230,6 @@ export const hi = {
organizeChats: "चैट व्यवस्थित करें",
organizeProjects: "प्रोजेक्ट व्यवस्थित करें",
sortPinnedChats: "पिन की गई चैट क्रमबद्ध करें",
- moveUp: "ऊपर ले जाएँ",
- moveDown: "नीचे ले जाएँ",
},
dialog: {
deleteChat: {
diff --git a/studio/frontend/src/i18n/locales/it.ts b/studio/frontend/src/i18n/locales/it.ts
index 0437b83be4b..26ada571168 100644
--- a/studio/frontend/src/i18n/locales/it.ts
+++ b/studio/frontend/src/i18n/locales/it.ts
@@ -194,8 +194,6 @@ export const it = {
organizeChats: "Organizza le chat",
organizeProjects: "Organizza i progetti",
sortPinnedChats: "Ordina le chat fissate",
- moveUp: "Sposta su",
- moveDown: "Sposta giù",
},
dialog: {
deleteChat: {
diff --git a/studio/frontend/src/i18n/locales/ja.ts b/studio/frontend/src/i18n/locales/ja.ts
index 0d236adb99b..2ab9faacf4e 100644
--- a/studio/frontend/src/i18n/locales/ja.ts
+++ b/studio/frontend/src/i18n/locales/ja.ts
@@ -229,8 +229,6 @@ export const ja = {
organizeChats: "チャットを整理",
organizeProjects: "プロジェクトを整理",
sortPinnedChats: "ピン留めチャットを並べ替え",
- moveUp: "上へ移動",
- moveDown: "下へ移動",
},
dialog: {
deleteChat: {
diff --git a/studio/frontend/src/i18n/locales/ko.ts b/studio/frontend/src/i18n/locales/ko.ts
index 114222ef49b..c26674de6dd 100644
--- a/studio/frontend/src/i18n/locales/ko.ts
+++ b/studio/frontend/src/i18n/locales/ko.ts
@@ -227,8 +227,6 @@ export const ko = {
organizeChats: "채팅 정리",
organizeProjects: "프로젝트 정리",
sortPinnedChats: "고정된 채팅 정렬",
- moveUp: "위로 이동",
- moveDown: "아래로 이동",
},
dialog: {
deleteChat: {
diff --git a/studio/frontend/src/i18n/locales/pt-br.ts b/studio/frontend/src/i18n/locales/pt-br.ts
index 75b36fc903e..18f2140b8f6 100644
--- a/studio/frontend/src/i18n/locales/pt-br.ts
+++ b/studio/frontend/src/i18n/locales/pt-br.ts
@@ -229,8 +229,6 @@ export const ptBR = {
organizeChats: "Organizar conversas",
organizeProjects: "Organizar projetos",
sortPinnedChats: "Ordenar conversas fixadas",
- moveUp: "Mover para cima",
- moveDown: "Mover para baixo",
},
dialog: {
deleteChat: {
diff --git a/studio/frontend/src/i18n/locales/ru.ts b/studio/frontend/src/i18n/locales/ru.ts
index 39db36eef7d..f19945a9481 100644
--- a/studio/frontend/src/i18n/locales/ru.ts
+++ b/studio/frontend/src/i18n/locales/ru.ts
@@ -229,8 +229,6 @@ export const ru = {
organizeChats: "Настроить чаты",
organizeProjects: "Настроить проекты",
sortPinnedChats: "Сортировать закреплённые чаты",
- moveUp: "Переместить вверх",
- moveDown: "Переместить вниз",
},
dialog: {
deleteChat: {
diff --git a/studio/frontend/src/i18n/locales/zh-CN.ts b/studio/frontend/src/i18n/locales/zh-CN.ts
index e8deb54c426..d105f30e92f 100644
--- a/studio/frontend/src/i18n/locales/zh-CN.ts
+++ b/studio/frontend/src/i18n/locales/zh-CN.ts
@@ -225,8 +225,6 @@ export const zhCN = {
organizeChats: "整理对话",
organizeProjects: "整理项目",
sortPinnedChats: "对置顶对话排序",
- moveUp: "上移",
- moveDown: "下移",
},
dialog: {
deleteChat: {
diff --git a/studio/frontend/tests/sidebar-row-drag.test.ts b/studio/frontend/tests/sidebar-row-drag.test.ts
index 2ff1f88e370..72730ea0d77 100644
--- a/studio/frontend/tests/sidebar-row-drag.test.ts
+++ b/studio/frontend/tests/sidebar-row-drag.test.ts
@@ -174,7 +174,7 @@ test("a reorder in a sorted list switches it to Manual order", () => {
// A folder drop switches a sorted Projects list to Manual.
test("a folder reorder or unpin switches a sorted Projects list to Manual", () => {
- // Alt + arrow and Move up/down take the same switch.
+ // Alt + arrow takes the same switch.
assert.ok(APP_SIDEBAR.includes("sort: { value: projectSort, set: setProjectSort }"));
const home = folder("home", "projects", PROJECT_ORDER_SCOPE);
const miscRow = folderRow("projects", PROJECT_ORDER_SCOPE, "misc");
@@ -892,7 +892,7 @@ test("the gesture is pointer events, not the HTML5 drag API", () => {
assert.match(HOOK, /window\.addEventListener\("pointerup", onUp\);/);
// A press is only a drag once it travels, or a click on a row would never open the chat.
assert.match(HOOK, /export const DRAG_THRESHOLD_PX = \d+;/);
- // Touch scrolls the list; its rows keep Move up and Move down.
+ // Touch scrolls the list rather than lifting a row.
assert.match(HOOK, /event\.pointerType === "touch"\) return;/);
});
@@ -975,7 +975,7 @@ test("every drop cue is drawn inside its row", () => {
});
// Alt + arrow is the keyboard's reorder.
-test("alt and an arrow reorder a row without a pointer", async () => {
+test("alt and an arrow reorder a row without a pointer", () => {
assert.match(
APP_SIDEBAR,
/onKeyDown: \(event: React\.KeyboardEvent\) => \{\n\s*if \(\n\s*!event\.altKey \|\|\n\s*\(event\.key !== "ArrowUp" && event\.key !== "ArrowDown"\)\n\s*\)/,
@@ -986,35 +986,19 @@ test("alt and an arrow reorder a row without a pointer", async () => {
);
// Same rule as a drop: a sorted list switches to Manual.
assert.match(APP_SIDEBAR, /if \(resorts\) \{\n\s*sort\.set\("manual"\);/);
- // A touch browser starts no drag, so its row menus keep Move up and Move down.
- assert.match(APP_SIDEBAR, /function renderMoveRowItems\(/);
- // A pinned folder moves under Pinned's sort rule, from the keyboard and the touch menu alike:
+ // No Move up / Move down in row menus: drag and alt + arrow reorder.
+ assert.ok(!APP_SIDEBAR.includes("renderMoveRowItems"));
+ assert.ok(!EN.includes("moveUp:") && !EN.includes("moveDown:"));
+ // A pinned folder moves under Pinned's sort rule from the keyboard:
// a sorted list switches to Manual, or refuses, exactly as a drop does.
assert.match(
APP_SIDEBAR,
/orderedIds: order\.orderedIds,\n\s*sort: order\.sort,\n\s*\}\)\}/,
);
- assert.match(APP_SIDEBAR, /order\.orderedIds,\n\s*order\.sort,\n\s*P,\n\s*\)\}/);
assert.match(
APP_SIDEBAR,
/selectionIds: pinnedProjectRowIds,\n\s*section: "pinned",\n\s*sort: \{ value: pinnedSort, set: setPinnedSort \},/,
);
- assert.match(APP_SIDEBAR, /if \(!coarsePointer\) return null;/);
- assert.match(APP_SIDEBAR, /const coarsePointer = useIsCoarsePointer\(\);/);
- // Any touch pointer counts: a laptop with a touchscreen keeps the items too.
- const MOBILE = await readSrcAsync("hooks/use-mobile.ts");
- assert.match(
- MOBILE,
- /const COARSE_POINTER_QUERY = "\(any-pointer: coarse\)";/,
- );
- for (const key of ["moveUp", "moveDown"]) {
- assert.ok(EN.includes(`${key}:`), `${key} is missing from the en locale`);
- }
- // Both paths share the reorder, so both honour the sort rule.
- assert.equal(
- (APP_SIDEBAR.match(/reorderRowBy\(item, orderedIds, sort, /g) ?? []).length,
- 3,
- );
});
// The line on the landing edge and the ring around a folder already say where the row goes, so
diff --git a/studio/frontend/tests/sidebar-selection-coverage.test.ts b/studio/frontend/tests/sidebar-selection-coverage.test.ts
index bb9fb0536a3..51452a30350 100644
--- a/studio/frontend/tests/sidebar-selection-coverage.test.ts
+++ b/studio/frontend/tests/sidebar-selection-coverage.test.ts
@@ -33,7 +33,7 @@ test("folder rows select too, and open their own bulk menu", async () => {
/handleProjectSelectionClick\(\n\s*event,\n\s*project\.id,\n\s*order\.selectionIds \?\? order\.orderedIds,\n\s*\)/,
);
assert.match(source, /selectProjectForContextMenu\(project\.id\)/);
- assert.match(source, /\{renderProjectContextMenu\(project, order\)\}/);
+ assert.match(source, /\{renderProjectContextMenu\(project\)\}/);
assert.match(source, /selectedProjectIds\.has\(project\.id\)/);
});
@@ -221,8 +221,7 @@ test("the shared menu items are written against the injected family", () => {
);
assert.match(body, /<P\.Item/);
}
- // The two helpers these bodies call take the family too, rather than hardcoding the dropdown.
- assert.match(APP_SIDEBAR, /function renderMoveRowItems\([^)]*P: RowMenuParts,\n\s*\)/s);
+ // The helper these bodies call takes the family too, rather than hardcoding the dropdown.
assert.match(APP_SIDEBAR, /<OpenChatFolderUnavailableItem Item=\{P\.Item\} \/>/);
});