Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

fix(community): move private-category copy out of switch, suppress empty context menus

Gener7ded7c12c254
diff --git a/src/web/src/components/community/channel-sidebar.tsx b/src/web/src/components/community/channel-sidebar.tsx
index 9cfcaa0c3..27e71b38f 100644
--- a/src/web/src/components/community/channel-sidebar.tsx
+++ b/src/web/src/components/community/channel-sidebar.tsx
@@ -155,6 +155,70 @@ export const ChannelSidebar = memo(function ChannelSidebar({
if (id) setActiveChannel(id)
}
+ // one DndContext spans everything: categories sort among themselves, channels across categories
+ const channelTree = (
+ <DndContext id="d-channels" sensors={sensors} collisionDetection={closestCenter} onDragStart={onDragStart} onDragOver={onDragOver} onDragEnd={onDragEnd}>
+ {/* uncategorized channels (empty-name category) render bare at the top — no header */}
+ {noneCatId && order[noneCatId]?.length > 0 && (
+ <SortableContext items={order[noneCatId].map((c) => c.id)} strategy={verticalListSortingStrategy}>
+ <div className="mb-4 space-y-1">
+ {order[noneCatId].map((ch) => (
+ <SortableChannel
+ key={ch.id}
+ ch={withMute(ch)}
+ active={ch.id === activeChannel}
+ canReorder={isAdmin}
+ onClick={() => setActiveChannel(ch.id)}
+ onEdit={isAdmin ? () => setDialog({ kind: "edit-channel", id: ch.id, categoryId: noneCatId, name: ch.name, type: ch.type ?? "text" }) : undefined}
+ onDelete={isAdmin ? () => { removeChannel(ch.id); onDeleteChannel?.(ch.id) } : undefined}
+ />
+ ))}
+ </div>
+ </SortableContext>
+ )}
+ <SortableContext items={catOrder.filter((id) => catNames[id] !== "").map((id) => catId(id))} strategy={verticalListSortingStrategy}>
+ {catOrder.filter((id) => catNames[id] !== "").map((id) => (
+ <SortableCategory
+ key={id}
+ id={catId(id)}
+ name={catNames[id] ?? id}
+ open={!collapsed.has(id)}
+ onToggle={() => toggleCat(id)}
+ onAddChannel={canCreateInCategory(id) ? () => requestCreateChannel(id) : undefined}
+ onSettings={isAdmin ? () => setDialog({ kind: "category-settings", categoryId: id }) : undefined}
+ onDelete={isAdmin ? () => { removeCategory(id); onDeleteCategory?.(id) } : undefined}
+ isPrivate={catPrivate[id]}
+ canReorder={isAdmin}
+ >
+ <SortableContext items={(order[id] ?? []).map((c) => c.id)} strategy={verticalListSortingStrategy}>
+ <div className="mt-1 min-h-2 space-y-1">
+ {(order[id] ?? []).map((ch) => {
+ // Manage/edit rights:
+ // - admins everywhere
+ // - private category: the channel creator too
+ // Public-category channels are admin-managed only.
+ const canManageChannel = isAdmin || (!!catPrivate[id] && ch.creatorId === currentUserId)
+ return (
+ <SortableChannel
+ key={ch.id}
+ ch={withMute(ch)}
+ active={ch.id === activeChannel}
+ canReorder={isAdmin}
+ onClick={() => setActiveChannel(ch.id)}
+ onEdit={canManageChannel ? () => setDialog({ kind: "edit-channel", id: ch.id, categoryId: id, name: ch.name, type: ch.type ?? "text" }) : undefined}
+ onDelete={canManageChannel ? () => { removeChannel(ch.id); onDeleteChannel?.(ch.id) } : undefined}
+ onManageMembers={(catPrivate[id] && canManageChannel) ? () => setDialog({ kind: "manage-members", channelId: ch.id, channelName: ch.name }) : undefined}
+ />
+ )
+ })}
+ </div>
+ </SortableContext>
+ </SortableCategory>
+ ))}
+ </SortableContext>
+ </DndContext>
+ )
+
return (
<aside className="flex min-w-0 flex-1 flex-col">
{!noHeader && (
@@ -200,82 +264,23 @@ export const ChannelSidebar = memo(function ChannelSidebar({
)}
</header>
)}
- {/* right-click anywhere in the list (incl. empty space) → create channel / category */}
+ {/* right-click anywhere in the list (incl. empty space) → create channel / category.
+ Non-admins have no actions, so the menu is skipped entirely (no empty popover). */}
+ {isAdmin ? (
<ContextMenu>
<ContextMenuTrigger
render={<div className="flex-1 overflow-y-auto thin-scrollbar px-2 py-4" />}
>
- {/* one DndContext spans everything: categories sort among themselves, channels across categories */}
- <DndContext id="d-channels" sensors={sensors} collisionDetection={closestCenter} onDragStart={onDragStart} onDragOver={onDragOver} onDragEnd={onDragEnd}>
- {/* uncategorized channels (empty-name category) render bare at the top — no header */}
- {noneCatId && order[noneCatId]?.length > 0 && (
- <SortableContext items={order[noneCatId].map((c) => c.id)} strategy={verticalListSortingStrategy}>
- <div className="mb-4 space-y-1">
- {order[noneCatId].map((ch) => (
- <SortableChannel
- key={ch.id}
- ch={withMute(ch)}
- active={ch.id === activeChannel}
- canReorder={isAdmin}
- onClick={() => setActiveChannel(ch.id)}
- onEdit={isAdmin ? () => setDialog({ kind: "edit-channel", id: ch.id, categoryId: noneCatId, name: ch.name, type: ch.type ?? "text" }) : undefined}
- onDelete={isAdmin ? () => { removeChannel(ch.id); onDeleteChannel?.(ch.id) } : undefined}
- />
- ))}
- </div>
- </SortableContext>
- )}
- <SortableContext items={catOrder.filter((id) => catNames[id] !== "").map((id) => catId(id))} strategy={verticalListSortingStrategy}>
- {catOrder.filter((id) => catNames[id] !== "").map((id) => (
- <SortableCategory
- key={id}
- id={catId(id)}
- name={catNames[id] ?? id}
- open={!collapsed.has(id)}
- onToggle={() => toggleCat(id)}
- onAddChannel={canCreateInCategory(id) ? () => requestCreateChannel(id) : undefined}
- onSettings={isAdmin ? () => setDialog({ kind: "category-settings", categoryId: id }) : undefined}
- onDelete={isAdmin ? () => { removeCategory(id); onDeleteCategory?.(id) } : undefined}
- isPrivate={catPrivate[id]}
- canReorder={isAdmin}
- >
- <SortableContext items={(order[id] ?? []).map((c) => c.id)} strategy={verticalListSortingStrategy}>
- <div className="mt-1 min-h-2 space-y-1">
- {(order[id] ?? []).map((ch) => {
- // Manage/edit rights:
- // - admins everywhere
- // - private category: the channel creator too
- // Public-category channels are admin-managed only.
- const canManageChannel = isAdmin || (!!catPrivate[id] && ch.creatorId === currentUserId)
- return (
- <SortableChannel
- key={ch.id}
- ch={withMute(ch)}
- active={ch.id === activeChannel}
- canReorder={isAdmin}
- onClick={() => setActiveChannel(ch.id)}
- onEdit={canManageChannel ? () => setDialog({ kind: "edit-channel", id: ch.id, categoryId: id, name: ch.name, type: ch.type ?? "text" }) : undefined}
- onDelete={canManageChannel ? () => { removeChannel(ch.id); onDeleteChannel?.(ch.id) } : undefined}
- onManageMembers={(catPrivate[id] && canManageChannel) ? () => setDialog({ kind: "manage-members", channelId: ch.id, channelName: ch.name }) : undefined}
- />
- )
- })}
- </div>
- </SortableContext>
- </SortableCategory>
- ))}
- </SortableContext>
- </DndContext>
+ {channelTree}
</ContextMenuTrigger>
<ContextMenuContent className="w-48">
- {isAdmin && (
- <>
- <ContextMenuItem onClick={() => requestCreateChannel(noneCatId)}>Create channel</ContextMenuItem>
- <ContextMenuItem onClick={() => setDialog({ kind: "create-category" })}>Create category</ContextMenuItem>
- </>
- )}
+ <ContextMenuItem onClick={() => requestCreateChannel(noneCatId)}>Create channel</ContextMenuItem>
+ <ContextMenuItem onClick={() => setDialog({ kind: "create-category" })}>Create category</ContextMenuItem>
</ContextMenuContent>
</ContextMenu>
+ ) : (
+ <div className="flex-1 overflow-y-auto thin-scrollbar px-2 py-4">{channelTree}</div>
+ )}
{dialog?.kind === "create-channel" && (
<CreateChannelDialog
diff --git a/src/web/src/components/community/create-category-dialog.tsx b/src/web/src/components/community/create-category-dialog.tsx
index 2520cd371..d5d3c1e71 100644
--- a/src/web/src/components/community/create-category-dialog.tsx
+++ b/src/web/src/components/community/create-category-dialog.tsx
@@ -42,18 +42,18 @@ export function CreateCategoryDialog({ onClose, onCreate, canTogglePrivate = tru
/>
</Field>
{canTogglePrivate && (
- <label className="flex items-center gap-3 rounded-md border border-border bg-card px-3 py-2">
- <Lock className="size-4 shrink-0 text-muted-foreground" />
- <div className="min-w-0 flex-1">
- <div className="text-sm font-medium">Private category</div>
- <div className="text-xs text-muted-foreground">
- {isPrivate
- ? "Members create their own channels here, visible only to invited members."
- : "Channels here are admin-managed and visible to everyone."}
- </div>
- </div>
- <Switch checked={isPrivate} onCheckedChange={setIsPrivate} />
- </label>
+ <div className="space-y-2">
+ <label className="flex items-center gap-3 rounded-md border border-border bg-card px-3 py-2">
+ <Lock className="size-4 shrink-0 text-muted-foreground" />
+ <div className="min-w-0 flex-1 text-sm font-medium">Private category</div>
+ <Switch checked={isPrivate} onCheckedChange={setIsPrivate} />
+ </label>
+ <p className="text-right text-xs text-muted-foreground">
+ {isPrivate
+ ? "Members create their own channels here, visible only to invited members."
+ : "Channels here are admin-managed and visible to everyone."}
+ </p>
+ </div>
)}
</div>
<DialogFooter className="mx-0 mb-0 flex-row items-center justify-end gap-2 rounded-b-xl border-t border-border bg-card px-4 py-3">
diff --git a/src/web/src/components/community/member-list.test.ts b/src/web/src/components/community/member-list.test.ts
index 2d2f8c004..7e09c7ef4 100644
--- a/src/web/src/components/community/member-list.test.ts
+++ b/src/web/src/components/community/member-list.test.ts
@@ -1,5 +1,5 @@
import { describe, it, expect } from "vitest"
-import { computeDuplicateNames } from "./member-list"
+import { computeDuplicateNames, hasMemberMenu } from "./member-list"
import type { Member } from "./_types"
const member = (id: string, name: string, discriminator?: string): Member => ({
@@ -47,3 +47,20 @@ describe("computeDuplicateNames", () => {
expect(dupes.has("alex")).toBe(true)
})
})
+
+describe("hasMemberMenu", () => {
+ it("is false when the viewer can't manage — any role", () => {
+ expect(hasMemberMenu(false, "member")).toBe(false)
+ expect(hasMemberMenu(false, "admin")).toBe(false)
+ expect(hasMemberMenu(false, "owner")).toBe(false)
+ })
+
+ it("is false for the owner even when the viewer can manage", () => {
+ expect(hasMemberMenu(true, "owner")).toBe(false)
+ })
+
+ it("is true when the viewer can manage a non-owner", () => {
+ expect(hasMemberMenu(true, "member")).toBe(true)
+ expect(hasMemberMenu(true, "admin")).toBe(true)
+ })
+})
diff --git a/src/web/src/components/community/member-list.tsx b/src/web/src/components/community/member-list.tsx
index 8e77c0ac1..c84bea288 100644
--- a/src/web/src/components/community/member-list.tsx
+++ b/src/web/src/components/community/member-list.tsx
@@ -227,6 +227,13 @@ export function MemberList({
)
}
+// True when the row has at least one right-click action (role change / kick). Owners
+// can't be managed, so their row — and any row for a non-manager — skips the ContextMenu
+// wrapper rather than opening an empty popover strip.
+export function hasMemberMenu(canManage: boolean, role: Role) {
+ return canManage && role !== "owner"
+}
+
function MemberRow({
mem,
canManage,
@@ -246,53 +253,49 @@ function MemberRow({
onSetRole?: (name: string, role: Role) => void
onKick: (name: string) => void
}) {
- return (
- <ContextMenu>
- <ContextMenuTrigger
- render={
- <button
- onClick={(e) => onOpenProfile?.(mem.name, e, undefined, mem.userId)}
- className="flex w-full items-center gap-3 rounded-md px-2 py-2 hover:bg-accent"
- />
- }
- >
- <Avatar label={mem.avatar} seed={mem.userId} size={32} presence={mem.status} dim={mem.status === "offline"} />
- <div className="min-w-0 flex-1 text-left">
- <div className={`truncate text-sm leading-tight ${mem.status === "offline" ? "text-muted-foreground" : ""}`}>
- {mem.name}
- {showDiscriminator && mem.discriminator && (
- <span className="text-muted-foreground">#{mem.discriminator}</span>
- )}
- </div>
- {hasStatus(mem.statusEmoji, mem.statusText) && (
- <div className="truncate text-xs leading-tight text-muted-foreground">{mem.statusEmoji} {mem.statusText}</div>
+ const button = (
+ <button
+ onClick={(e) => onOpenProfile?.(mem.name, e, undefined, mem.userId)}
+ className="flex w-full items-center gap-3 rounded-md px-2 py-2 select-none hover:bg-accent"
+ >
+ <Avatar label={mem.avatar} seed={mem.userId} size={32} presence={mem.status} dim={mem.status === "offline"} />
+ <div className="min-w-0 flex-1 text-left">
+ <div className={`truncate text-sm leading-tight ${mem.status === "offline" ? "text-muted-foreground" : ""}`}>
+ {mem.name}
+ {showDiscriminator && mem.discriminator && (
+ <span className="text-muted-foreground">#{mem.discriminator}</span>
)}
</div>
- </ContextMenuTrigger>
+ {hasStatus(mem.statusEmoji, mem.statusText) && (
+ <div className="truncate text-xs leading-tight text-muted-foreground">{mem.statusEmoji} {mem.statusText}</div>
+ )}
+ </div>
+ </button>
+ )
+ if (!hasMemberMenu(canManage, mem.role)) return button
+ return (
+ <ContextMenu>
+ <ContextMenuTrigger render={button} />
<ContextMenuContent className="w-48">
<div className="truncate px-2 py-1 text-xs font-semibold text-muted-foreground">{mem.name}</div>
- {canManage && mem.role !== "owner" && (
- <>
- <ContextMenuSub>
- <ContextMenuSubTrigger>
- <Shield className="size-4" />
- Role
- </ContextMenuSubTrigger>
- <ContextMenuSubContent>
- {SETTABLE_ROLES.map((r) => (
- <ContextMenuItem key={r} onClick={() => onSetRole?.(mem.name, r)}>
- <span className="flex-1">{capitalize(r)}</span>
- {mem.role === r && <Check className="size-4" />}
- </ContextMenuItem>
- ))}
- </ContextMenuSubContent>
- </ContextMenuSub>
- <ContextMenuSeparator />
- <ContextMenuItem onClick={() => onKick(mem.name)} className="text-destructive data-highlighted:bg-destructive/10 data-highlighted:text-destructive">
- <UserMinus className="size-4" /> Kick {mem.name}
- </ContextMenuItem>
- </>
- )}
+ <ContextMenuSub>
+ <ContextMenuSubTrigger>
+ <Shield className="size-4" />
+ Role
+ </ContextMenuSubTrigger>
+ <ContextMenuSubContent>
+ {SETTABLE_ROLES.map((r) => (
+ <ContextMenuItem key={r} onClick={() => onSetRole?.(mem.name, r)}>
+ <span className="flex-1">{capitalize(r)}</span>
+ {mem.role === r && <Check className="size-4" />}
+ </ContextMenuItem>
+ ))}
+ </ContextMenuSubContent>
+ </ContextMenuSub>
+ <ContextMenuSeparator />
+ <ContextMenuItem onClick={() => onKick(mem.name)} className="text-destructive data-highlighted:bg-destructive/10 data-highlighted:text-destructive">
+ <UserMinus className="size-4" /> Kick {mem.name}
+ </ContextMenuItem>
</ContextMenuContent>
</ContextMenu>
)
diff --git a/src/web/src/components/community/sortable-category.test.ts b/src/web/src/components/community/sortable-category.test.ts
new file mode 100644
index 000000000..a38f03fff
--- /dev/null
+++ b/src/web/src/components/community/sortable-category.test.ts
@@ -0,0 +1,16 @@
+import { describe, it, expect } from "vitest"
+import { hasCategoryMenu } from "./sortable-category"
+
+const noop = () => {}
+
+describe("hasCategoryMenu", () => {
+ it("is false when no action handlers are provided", () => {
+ expect(hasCategoryMenu({})).toBe(false)
+ })
+
+ it("is true when any one action handler is provided", () => {
+ expect(hasCategoryMenu({ onAddChannel: noop })).toBe(true)
+ expect(hasCategoryMenu({ onSettings: noop })).toBe(true)
+ expect(hasCategoryMenu({ onDelete: noop })).toBe(true)
+ })
+})
diff --git a/src/web/src/components/community/sortable-category.tsx b/src/web/src/components/community/sortable-category.tsx
index 0ace71c7e..aaf8b9835 100644
--- a/src/web/src/components/community/sortable-category.tsx
+++ b/src/web/src/components/community/sortable-category.tsx
@@ -10,6 +10,12 @@ import { ContextMenu, ContextMenuTrigger, ContextMenuContent, ContextMenuItem, C
import { ConfirmDialog } from "@/components/ui/confirm-dialog"
import { DropLine } from "./drop-line"
+// True when the category header has at least one right-click action. With none, we skip
+// the ContextMenu wrapper so a non-admin doesn't get an empty popover strip.
+export function hasCategoryMenu(h: { onAddChannel?: () => void; onSettings?: () => void; onDelete?: () => void }) {
+ return !!(h.onAddChannel || h.onSettings || h.onDelete)
+}
+
// A drag-sortable category. The whole header is the drag surface (no handle) — a 5px
// activation distance distinguishes a click (collapse) from a drag. It is also a drop
// target so channels can be dropped onto it (including its empty space). Right-click
@@ -32,43 +38,48 @@ export function SortableCategory({ id: catDndId, name, open, onToggle, onAddChan
const style = { transform: CSS.Transform.toString(transform), transition, opacity: isDragging ? 0.4 : 1, zIndex: isDragging ? 10 : undefined }
const showLine = isOver && !isDragging
const lineSide: "top" | "bottom" = activeIndex !== -1 && activeIndex < index ? "bottom" : "top"
+ // The header div is the drag surface; it renders bare (no ContextMenu) when there are no
+ // actions, so share its props/children across both branches to avoid drift.
+ const headerProps = {
+ ...attributes,
+ ...listeners,
+ onClick: onToggle,
+ className: `group flex w-full touch-none items-center gap-1 rounded px-1 py-1 text-xs font-semibold text-muted-foreground/80 select-none hover:text-foreground ${canReorder ? "cursor-grab active:cursor-grabbing" : "cursor-pointer"}`,
+ }
+ const headerInner = (
+ <>
+ {isPrivate && <Lock className="size-3 shrink-0" />}
+ <span className="flex-1 truncate text-left">{name}</span>
+ {onSettings && (
+ <button
+ onPointerDown={(e) => e.stopPropagation()}
+ onClick={(e) => { e.stopPropagation(); onSettings() }}
+ className="grid size-4 place-items-center rounded opacity-0 hover:bg-accent group-hover:opacity-100"
+ aria-label={`Category settings for ${name}`}
+ >
+ <Settings className="size-3.5" />
+ </button>
+ )}
+ {onAddChannel && (
+ <button
+ onPointerDown={(e) => e.stopPropagation()}
+ onClick={(e) => { e.stopPropagation(); onAddChannel() }}
+ className="grid size-4 place-items-center rounded opacity-0 hover:bg-accent group-hover:opacity-100"
+ aria-label={`Create channel in ${name}`}
+ >
+ <Plus className="size-3.5" />
+ </button>
+ )}
+ <ChevronDown className={`size-3 shrink-0 transition-transform ${open ? "" : "-rotate-90"}`} />
+ </>
+ )
return (
<div ref={setNodeRef} style={style} className="relative mb-4">
{showLine && <DropLine side={lineSide} />}
+ {hasCategoryMenu({ onAddChannel, onSettings, onDelete }) ? (
<ContextMenu>
- <ContextMenuTrigger
- render={
- <div
- {...attributes}
- {...listeners}
- onClick={onToggle}
- className={`group flex w-full touch-none items-center gap-1 rounded px-1 py-1 text-xs font-semibold text-muted-foreground/80 hover:text-foreground ${canReorder ? "cursor-grab active:cursor-grabbing" : "cursor-pointer"}`}
- />
- }
- >
- {isPrivate && <Lock className="size-3 shrink-0" />}
- <span className="flex-1 truncate text-left">{name}</span>
- {onSettings && (
- <button
- onPointerDown={(e) => e.stopPropagation()}
- onClick={(e) => { e.stopPropagation(); onSettings() }}
- className="grid size-4 place-items-center rounded opacity-0 hover:bg-accent group-hover:opacity-100"
- aria-label={`Category settings for ${name}`}
- >
- <Settings className="size-3.5" />
- </button>
- )}
- {onAddChannel && (
- <button
- onPointerDown={(e) => e.stopPropagation()}
- onClick={(e) => { e.stopPropagation(); onAddChannel() }}
- className="grid size-4 place-items-center rounded opacity-0 hover:bg-accent group-hover:opacity-100"
- aria-label={`Create channel in ${name}`}
- >
- <Plus className="size-3.5" />
- </button>
- )}
- <ChevronDown className={`size-3 shrink-0 transition-transform ${open ? "" : "-rotate-90"}`} />
+ <ContextMenuTrigger render={<div {...headerProps} />}>
+ {headerInner}
</ContextMenuTrigger>
<ContextMenuContent className="w-48">
<div className="truncate px-2 py-2 text-xs font-semibold text-muted-foreground">{name}</div>
@@ -85,6 +96,9 @@ export function SortableCategory({ id: catDndId, name, open, onToggle, onAddChan
)}
</ContextMenuContent>
</ContextMenu>
+ ) : (
+ <div {...headerProps}>{headerInner}</div>
+ )}
{open && (
<div ref={setDropRef} className={`rounded-md transition-colors ${isChannelOver ? "bg-accent/40" : ""}`}>
{children}
diff --git a/src/web/src/components/community/sortable-channel.test.ts b/src/web/src/components/community/sortable-channel.test.ts
new file mode 100644
index 000000000..333b874d2
--- /dev/null
+++ b/src/web/src/components/community/sortable-channel.test.ts
@@ -0,0 +1,16 @@
+import { describe, it, expect } from "vitest"
+import { hasChannelMenu } from "./sortable-channel"
+
+const noop = () => {}
+
+describe("hasChannelMenu", () => {
+ it("is false when no action handlers are provided", () => {
+ expect(hasChannelMenu({})).toBe(false)
+ })
+
+ it("is true when any one action handler is provided", () => {
+ expect(hasChannelMenu({ onEdit: noop })).toBe(true)
+ expect(hasChannelMenu({ onManageMembers: noop })).toBe(true)
+ expect(hasChannelMenu({ onDelete: noop })).toBe(true)
+ })
+})
diff --git a/src/web/src/components/community/sortable-channel.tsx b/src/web/src/components/community/sortable-channel.tsx
index 42b3c542b..dad1a889e 100644
--- a/src/web/src/components/community/sortable-channel.tsx
+++ b/src/web/src/components/community/sortable-channel.tsx
@@ -10,6 +10,12 @@ import { ConfirmDialog } from "@/components/ui/confirm-dialog"
import { DropLine } from "./drop-line"
import type { Channel } from "./_types"
+// True when the row has at least one right-click action. With none, we skip the
+// ContextMenu wrapper entirely so a non-manager doesn't get an empty popover strip.
+export function hasChannelMenu(h: { onEdit?: () => void; onManageMembers?: () => void; onDelete?: () => void }) {
+ return !!(h.onEdit || h.onManageMembers || h.onDelete)
+}
+
// A single drag-sortable channel row. The whole row is the drag surface (no handle);
// a 5px activation distance keeps a tap = "switch channel" and a drag = reorder.
// Right-click opens an edit/mute/delete menu.
@@ -35,7 +41,7 @@ export function SortableChannel({ ch, active, onClick, onEdit, onDelete, onManag
{...attributes}
{...listeners}
className={[
- "group relative flex h-8 w-full cursor-pointer touch-none items-center gap-2 rounded-md px-2 text-sm",
+ "group relative flex h-8 w-full cursor-pointer touch-none items-center gap-2 rounded-md px-2 text-sm select-none",
canReorder ? "active:cursor-grabbing" : "",
active
? "bg-sidebar-accent text-foreground"
@@ -58,6 +64,7 @@ export function SortableChannel({ ch, active, onClick, onEdit, onDelete, onManag
) : null}
</div>
)
+ if (!hasChannelMenu({ onEdit, onManageMembers, onDelete })) return row
return (
<>
<ContextMenu>