Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

feat: relocate channel picker to agent chat tab, add mobile top bar

Gus6ca8ae895cb0
diff --git a/src/web/src/app/(app)/w/[slug]/agents/[id]/layout.tsx b/src/web/src/app/(app)/w/[slug]/agents/[id]/layout.tsx
index 3293a26a2..ec8a100b3 100644
--- a/src/web/src/app/(app)/w/[slug]/agents/[id]/layout.tsx
+++ b/src/web/src/app/(app)/w/[slug]/agents/[id]/layout.tsx
@@ -8,10 +8,10 @@ import { useWorkspace } from "@/contexts/workspace-context";
import { Button } from "@/components/ui/button";
import { ConfirmDialog } from "@/components/ui/confirm-dialog";
import { AgentEditForm } from "@/components/agent-edit-form";
+import { ChannelBar } from "@/components/channel-bar";
import { Skeleton } from "@/components/ui/skeleton";
import { AgentStatusBadge } from "@/components/agent-status-badge";
import { CalendarDays, FolderOpen, History, Mail, MessageSquare, MoreHorizontal, Pencil, Trash2, Video, X } from "lucide-react";
-import { MobileSidebarLogo } from "@/components/mobile-sidebar-logo";
import {
DropdownMenu,
DropdownMenuTrigger,
@@ -300,7 +300,10 @@ export default function AgentDetailLayout({ children }: { children: ReactNode })
/>
) : (
- <div className="flex-1 min-h-0 overflow-hidden flex flex-col">{children}</div>
+ <div className="flex-1 min-h-0 overflow-hidden flex flex-col">
+ {currentTab === "chat" && <ChannelBar />}
+ {children}
+ </div>
)}
{/* Delete agent confirmation */}
diff --git a/src/web/src/components/channel-bar.tsx b/src/web/src/components/channel-bar.tsx
index f4e974acc..00ee1a1ce 100644
--- a/src/web/src/components/channel-bar.tsx
+++ b/src/web/src/components/channel-bar.tsx
@@ -1,10 +1,8 @@
"use client";
import { useState, useRef, useEffect, useCallback } from "react";
-import Image from "next/image";
import { Plus, Pencil, Trash2 } from "lucide-react";
import { useChannel } from "@/contexts/channel-context";
-import { useSidebarTrigger } from "@/components/workspace-shell";
import { cn } from "@/lib/utils";
import {
ContextMenu,
@@ -22,7 +20,7 @@ import { Tooltip, TooltipTrigger, TooltipContent } from "@/components/ui/tooltip
import { Button } from "@/components/ui/button";
import { toast } from "sonner";
-export function ChannelBar({ isMobile = false }: { isMobile?: boolean }) {
+export function ChannelBar() {
const {
channels,
activeChannel,
@@ -40,7 +38,6 @@ export function ChannelBar({ isMobile = false }: { isMobile?: boolean }) {
if (loading) {
return (
<div className="h-8 flex items-center gap-1.5 px-2 mb-1 shrink-0">
- {isMobile && <BarLogo />}
<div className="h-5 w-14 rounded-md bg-muted animate-pulse" />
<div className="h-5 w-12 rounded-md bg-muted animate-pulse" />
<div className="h-5 w-16 rounded-md bg-muted animate-pulse" />
@@ -50,7 +47,6 @@ export function ChannelBar({ isMobile = false }: { isMobile?: boolean }) {
return (
<div className="h-8 flex items-center gap-1.5 px-2 mb-1 overflow-x-auto thin-scrollbar shrink-0">
- {isMobile && <BarLogo />}
{channels.map((ch) =>
renamingId === ch.id ? (
<RenameInput
@@ -157,7 +153,7 @@ function ChannelPill({
if (isDefault) {
return (
<button onClick={onSelect} className={pillClasses}>
- {name}
+ #{name}
</button>
);
}
@@ -176,7 +172,7 @@ function ChannelPill({
<button onClick={onSelect} className={pillClasses} />
}
>
- {name}
+ #{name}
</PopoverTrigger>
</TooltipTrigger>
<ContextMenuContent>
@@ -303,28 +299,3 @@ function RenameInput({
);
}
-function BarLogo() {
- const openSidebar = useSidebarTrigger();
- const [mounted, setMounted] = useState(false);
- useEffect(() => { setMounted(true); }, []);
-
- if (!openSidebar) return null;
-
- const img = mounted ? (
- <>
- <Image src="/alook.svg" alt="Alook" width={20} height={20} className="dark:hidden" />
- <Image src="/alook-dark.svg" alt="Alook" width={20} height={20} className="hidden dark:block" />
- </>
- ) : (
- <span className="size-5" />
- );
-
- return (
- <button
- onClick={openSidebar}
- className="shrink-0 cursor-pointer transition-opacity hover:opacity-70 mr-1"
- >
- {img}
- </button>
- );
-}
diff --git a/src/web/src/components/mobile-sidebar-logo.tsx b/src/web/src/components/mobile-sidebar-logo.tsx
deleted file mode 100644
index c405deb56..000000000
--- a/src/web/src/components/mobile-sidebar-logo.tsx
+++ /dev/null
@@ -1,18 +0,0 @@
-"use client";
-
-import { Logo } from "@/components/logo";
-import { useSidebarTrigger } from "@/components/workspace-shell";
-
-export function MobileSidebarLogo() {
- const openSidebar = useSidebarTrigger();
- if (!openSidebar) return null;
-
- return (
- <div
- onClickCapture={(e) => { e.stopPropagation(); e.preventDefault(); openSidebar(); }}
- className="cursor-pointer shrink-0"
- >
- <Logo size="sm" iconOnly />
- </div>
- );
-}
diff --git a/src/web/src/components/mobile-top-bar.tsx b/src/web/src/components/mobile-top-bar.tsx
new file mode 100644
index 000000000..a115982c3
--- /dev/null
+++ b/src/web/src/components/mobile-top-bar.tsx
@@ -0,0 +1,116 @@
+"use client";
+
+import { useRouter, usePathname } from "next/navigation";
+import { GitBranch } from "lucide-react";
+import { useSidebarTrigger } from "@/components/workspace-shell";
+import { useAgentContext } from "@/contexts/agent-context";
+import { useWorkspace } from "@/contexts/workspace-context";
+import { AnimatedAvatar, parseAvatarUrl } from "@/components/avatar";
+import { Logo } from "@/components/logo";
+import { Skeleton } from "@/components/ui/skeleton";
+import { cn } from "@/lib/utils";
+
+export function MobileTopBar() {
+ const router = useRouter();
+ const pathname = usePathname();
+ const openSidebar = useSidebarTrigger();
+ const { slug } = useWorkspace();
+ const { agents, pins, unpinnedOrder, runtimes, loading } = useAgentContext();
+
+ const isTracesActive = pathname.includes("/traces");
+ const activeAgentMatch = pathname.match(/^\/w\/[^/]+\/agents\/([^/]+)/);
+ const activeAgentId = activeAgentMatch?.[1] ?? null;
+
+ const pinned = agents
+ .filter((a) => pins.has(a.id))
+ .sort((a, b) => pins.get(a.id)!.position - pins.get(b.id)!.position);
+
+ const unpinned = agents
+ .filter((a) => !pins.has(a.id))
+ .sort((a, b) => {
+ const posA = unpinnedOrder.get(a.id);
+ const posB = unpinnedOrder.get(b.id);
+ if (posA !== undefined && posB !== undefined) return posA - posB;
+ if (posA !== undefined) return -1;
+ if (posB !== undefined) return 1;
+ return a.name.localeCompare(b.name);
+ });
+
+ const ordered = [...pinned, ...unpinned];
+
+ return (
+ <div className="h-10 flex items-center gap-2 px-2 shrink-0">
+ {openSidebar && (
+ <div
+ role="button"
+ tabIndex={0}
+ aria-label="Open sidebar"
+ onClick={openSidebar}
+ onKeyDown={(e) => {
+ if (e.key === "Enter" || e.key === " ") {
+ e.preventDefault();
+ openSidebar();
+ }
+ }}
+ className="shrink-0 cursor-pointer transition-opacity hover:opacity-70 [&>button]:pointer-events-none"
+ >
+ <Logo size="sm" iconOnly />
+ </div>
+ )}
+
+ <button
+ onClick={() => router.push(`/w/${slug}/traces`)}
+ aria-label="Traces"
+ className={cn(
+ "shrink-0 p-1 rounded-md transition-colors",
+ isTracesActive
+ ? "text-foreground bg-muted"
+ : "text-muted-foreground hover:text-foreground"
+ )}
+ >
+ <GitBranch className="size-4" />
+ </button>
+
+ <div className="flex-1 overflow-x-auto flex items-center gap-1.5 py-1 px-0.5 scrollbar-none">
+ {loading ? (
+ <Skeleton className="size-7 rounded-full" />
+ ) : (
+ ordered.map((agent) => {
+ const runtime = runtimes.find((r) => r.id === agent.runtime_id);
+ const isOnline = runtime?.status === "online";
+ const isActive = activeAgentId === agent.id;
+ const avatarConfig = parseAvatarUrl(agent.avatar_url);
+
+ return (
+ <button
+ key={agent.id}
+ onClick={() => router.push(`/w/${slug}/agents/${agent.id}`)}
+ aria-label={agent.name}
+ className={cn(
+ "shrink-0 relative rounded-full transition-all",
+ isActive && "ring-2 ring-primary"
+ )}
+ >
+ <div className="size-7">
+ {avatarConfig ? (
+ <AnimatedAvatar config={avatarConfig} size={28} className="rounded-full" isHovered={false} />
+ ) : (
+ <div className="size-7 rounded-full bg-muted flex items-center justify-center text-[10px] font-medium">
+ {agent.name.charAt(0).toUpperCase()}
+ </div>
+ )}
+ </div>
+ <span
+ className={cn(
+ "absolute -bottom-0.5 -right-0.5 size-2 rounded-full border border-background",
+ isOnline ? "bg-emerald-500" : "bg-muted-foreground/40"
+ )}
+ />
+ </button>
+ );
+ })
+ )}
+ </div>
+ </div>
+ );
+}
diff --git a/src/web/src/components/workspace-shell.tsx b/src/web/src/components/workspace-shell.tsx
index 03bc7b401..bbda8db3f 100644
--- a/src/web/src/components/workspace-shell.tsx
+++ b/src/web/src/components/workspace-shell.tsx
@@ -2,7 +2,7 @@
import { createContext, useContext, type ReactNode, useState } from "react";
import { AppSidebar } from "@/components/app-sidebar";
-import { ChannelBar } from "@/components/channel-bar";
+import { MobileTopBar } from "@/components/mobile-top-bar";
import { GradientBackground } from "@/components/gradient-background";
import { useIsMobile } from "@/hooks/use-mobile";
import {
@@ -27,7 +27,7 @@ export function WorkspaceShell({ children }: { children: ReactNode }) {
<div className="flex flex-col h-dvh overflow-hidden relative">
<GradientBackground />
<div className="flex-1 min-h-0 px-2 pb-2 pt-2 flex flex-col">
- <ChannelBar isMobile />
+ <MobileTopBar />
<main className="flex-1 min-h-0 rounded-xl bg-card/80 backdrop-blur-xl shadow-lg ring-1 ring-border/40 overflow-hidden flex flex-col">
{children}
</main>
@@ -48,7 +48,6 @@ export function WorkspaceShell({ children }: { children: ReactNode }) {
<GradientBackground />
<AppSidebar />
<div className="flex-1 flex flex-col min-w-0 pt-1 pr-2 pb-2">
- <ChannelBar />
<main className="flex-1 min-h-0 rounded-xl bg-card/80 backdrop-blur-xl shadow-lg ring-1 ring-border/40 overflow-hidden flex flex-col">
{children}
</main>