Multi-Agent Collaboration for Team and Friends
TypeScript agent-automationagent-orchestrationagent-workflowai-agentsai-collaborationai-memoryai-workforceautonomous-agentsclaude-codeclaude-code-skillscodexcoding-agentmulti-agentmultiple-agentone-person-businessone-person-companyone-person-teamopencodesolopreneur
feat(web): improve server onboarding and mobile settings
Gusa866887dc280
diff --git a/src/shared/src/db/queries/community/server.ts b/src/shared/src/db/queries/community/server.tsindex 2dac1816d..dadaa4b0b 100644--- a/src/shared/src/db/queries/community/server.ts+++ b/src/shared/src/db/queries/community/server.ts@@ -3,6 +3,7 @@ import {communityServer,communityCategory,communityChannel,+ communityChannelMember,communityServerMember,communityMention,communityMessage,@@ -56,23 +57,55 @@ export async function createServer(});- const [category] = await db+ const [publicCategory] = await db.insert(communityCategory).values({serverId: server.id,- name: "All",+ name: "Public",position: 0,+ private: 0,}).returning();await db.insert(communityChannel).values({serverId: server.id,- categoryId: category!.id,- name: "general",+ categoryId: publicCategory!.id,+ name: "all",type: "text",position: 0,});+ const [privateCategory] = await db+ .insert(communityCategory)+ .values({+ serverId: server.id,+ name: "Private",+ position: 1,+ private: 1,+ creatorId: data.ownerId,+ })+ .returning();++ const [privateChannel] = await db+ .insert(communityChannel)+ .values({+ serverId: server.id,+ categoryId: privateCategory!.id,+ name: "room",+ type: "text",+ position: 0,+ creatorId: data.ownerId,+ })+ .returning();++ await db.insert(communityChannelMember).values({+ channelId: privateChannel!.id,+ userId: data.ownerId,+ relation: "access",+ source: "added",+ addedBy: data.ownerId,+ });+const [memberRow] = await db.insert(communityServerMember).values({diff --git a/src/shared/test/queries/server.test.ts b/src/shared/test/queries/server.test.tsindex af467a1a2..9e1e2db52 100644--- a/src/shared/test/queries/server.test.ts+++ b/src/shared/test/queries/server.test.ts@@ -4,6 +4,7 @@ import {communityServer,communityCategory,communityChannel,+ communityChannelMember,communityServerMember,communityMention,communityMessage,@@ -86,7 +87,9 @@ describe("community/server exports", () => {describe("createServer", () => {const ownerId = "u_owner";const serverRow = { id: "srv_1", name: "My Server", ownerId };- const categoryRow = { id: "cat_1" };+ const publicCategoryRow = { id: "cat_public" };+ const privateCategoryRow = { id: "cat_private" };+ const privateChannelRow = { id: "ch_room" };const memberRow = {id: "mem_1",userId: ownerId,@@ -96,10 +99,13 @@ describe("createServer", () => {it("returns { server, ownerMember } with fields sourced from the seeded rows and user join", async () => {const { db } = createDbMock({insertReturns: [- [serverRow], // insert communityServer- [categoryRow], // insert communityCategory- [], // insert communityChannel (no returning)- [memberRow], // insert communityServerMember w/ returning+ [serverRow], // insert communityServer+ [publicCategoryRow], // insert public communityCategory+ [], // insert public communityChannel (no returning)+ [privateCategoryRow], // insert private communityCategory+ [privateChannelRow], // insert private communityChannel+ [], // insert private communityChannelMember+ [memberRow], // insert communityServerMember w/ returning],selectReturns: [[{ name: "Alice", image: "https://avatars/alice.png", discriminator: "0042" }], // select user@@ -129,7 +135,7 @@ describe("createServer", () => {// ownerId insert and this select) — return "" rather than null so the// caller doesn't have to null-check a field that's typed non-null.const { db } = createDbMock({- insertReturns: [[serverRow], [categoryRow], [], [memberRow]],+ insertReturns: [[serverRow], [publicCategoryRow], [], [privateCategoryRow], [privateChannelRow], [], [memberRow]],selectReturns: [[]],});@@ -142,9 +148,9 @@ describe("createServer", () => {expect(result.ownerMember.userImage).toBeNull();});- it("seeds category 'All', channel 'general' (text), and exactly one owner member row with railOrder=0", async () => {+ it("seeds Public/all and private Private/room with owner access", async () => {const { db, insertCalls } = createDbMock({- insertReturns: [[serverRow], [categoryRow], [], [memberRow]],+ insertReturns: [[serverRow], [publicCategoryRow], [], [privateCategoryRow], [privateChannelRow], [], [memberRow]],selectReturns: [[{ name: "Alice" }]],});@@ -154,7 +160,7 @@ describe("createServer", () => {ownerId,});- expect(insertCalls).toHaveLength(4);+ expect(insertCalls).toHaveLength(7);// 1) communityServerexpect(insertCalls[0].table).toBe(communityServer);@@ -164,39 +170,71 @@ describe("createServer", () => {ownerId,});- // 2) communityCategory+ // 2) public communityCategoryexpect(insertCalls[1].table).toBe(communityCategory);expect(insertCalls[1].values).toMatchObject({serverId: "srv_1",- name: "All",+ name: "Public",position: 0,+ private: 0,});- // 3) communityChannel — "general" text channel+ // 3) public communityChannel — /allexpect(insertCalls[2].table).toBe(communityChannel);expect(insertCalls[2].values).toMatchObject({serverId: "srv_1",- categoryId: "cat_1",- name: "general",+ categoryId: "cat_public",+ name: "all",type: "text",position: 0,});- // 4) communityServerMember — exactly one owner row, railOrder=0- expect(insertCalls[3].table).toBe(communityServerMember);+ // 4) private communityCategory+ expect(insertCalls[3].table).toBe(communityCategory);expect(insertCalls[3].values).toMatchObject({+ serverId: "srv_1",+ name: "Private",+ position: 1,+ private: 1,+ creatorId: ownerId,+ });++ // 5) private communityChannel — /room+ expect(insertCalls[4].table).toBe(communityChannel);+ expect(insertCalls[4].values).toMatchObject({+ serverId: "srv_1",+ categoryId: "cat_private",+ name: "room",+ type: "text",+ position: 0,+ creatorId: ownerId,+ });++ // 6) private channel roster includes the owner+ expect(insertCalls[5].table).toBe(communityChannelMember);+ expect(insertCalls[5].values).toMatchObject({+ channelId: "ch_room",+ userId: ownerId,+ relation: "access",+ source: "added",+ addedBy: ownerId,+ });++ // 7) communityServerMember — exactly one owner row, railOrder=0+ expect(insertCalls[6].table).toBe(communityServerMember);+ expect(insertCalls[6].values).toMatchObject({serverId: "srv_1",userId: ownerId,role: "owner",railOrder: 0,});// Member insert uses .returning({ id, userId, joinedAt })- expect(insertCalls[3].returningArg).toBeDefined();+ expect(insertCalls[6].returningArg).toBeDefined();});it("description defaults to empty string when omitted", async () => {const { db, insertCalls } = createDbMock({- insertReturns: [[serverRow], [categoryRow], [], [memberRow]],+ insertReturns: [[serverRow], [publicCategoryRow], [], [privateCategoryRow], [privateChannelRow], [], [memberRow]],selectReturns: [[{ name: "Alice" }]],});@@ -207,7 +245,7 @@ describe("createServer", () => {it("writes a 4-digit discriminator + an up-front id on the server insert (name#disc handle)", async () => {const { db, insertCalls } = createDbMock({- insertReturns: [[serverRow], [categoryRow], [], [memberRow]],+ insertReturns: [[serverRow], [publicCategoryRow], [], [privateCategoryRow], [privateChannelRow], [], [memberRow]],selectReturns: [[{ name: "Alice" }]],});diff --git a/src/web/src/app/c/channels/layout.tsx b/src/web/src/app/c/channels/layout.tsxindex 9109e6368..33406a565 100644--- a/src/web/src/app/c/channels/layout.tsx+++ b/src/web/src/app/c/channels/layout.tsx@@ -470,7 +470,7 @@ export default function ServerLayout({ children }: { children: ReactNode }) {const serverSettingsDialog = (<Dialog open={serverSettingsOpen} onOpenChange={(o) => { if (!o) closeSettings() }}>- <DialogContent className="flex h-[calc(100vh-4rem)] max-h-180 w-[calc(100vw-4rem)] sm:max-w-4xl flex-col gap-0 overflow-hidden rounded-xl p-0" showCloseButton={false}>+ <DialogContent className="flex h-dvh max-h-dvh w-screen max-w-none flex-col gap-0 overflow-hidden rounded-none p-0 sm:h-[calc(100vh-4rem)] sm:max-h-180 sm:w-[calc(100vw-4rem)] sm:max-w-4xl sm:rounded-xl" showCloseButton={false}><ServerSettingssection={settingsSection}setSection={setSettingsSection}diff --git a/src/web/src/components/community/channels/channel-sidebar.tsx b/src/web/src/components/community/channels/channel-sidebar.tsxindex 127940675..460e80ec9 100644--- a/src/web/src/components/community/channels/channel-sidebar.tsx+++ b/src/web/src/components/community/channels/channel-sidebar.tsx@@ -297,12 +297,12 @@ export const ChannelSidebar = memo(function ChannelSidebar({<header className="flex h-12 items-center gap-1 border-b border-border/40 px-2">{serverName && onOpenSettings ? (<DropdownMenu>- <DropdownMenuTrigger className="flex min-w-0 max-w-full items-center gap-2 rounded-md px-2 py-1 hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none">+ <DropdownMenuTrigger className="flex h-11 min-w-0 max-w-full items-center gap-2 rounded-md px-2 hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none sm:h-auto sm:py-1"><span className="min-w-0 truncate pr-1 font-brand text-[1.75rem] leading-none font-bold">{serverName}</span><ChevronDown className="size-4 shrink-0 text-muted-foreground" /></DropdownMenuTrigger><DropdownMenuContent align="start" className="w-48">- <DropdownMenuItem onClick={() => onOpenSettings("overview")}><Settings className="size-4" /> Overview</DropdownMenuItem>+ <DropdownMenuItem onClick={() => onOpenSettings("overview")} data-testid={tid.serverSettingsOpen}><Settings className="size-4" /> Overview</DropdownMenuItem><DropdownMenuItem onClick={() => onOpenSettings("members")}><Users className="size-4" /> Members</DropdownMenuItem><DropdownMenuItem onClick={() => onOpenSettings("invites")}><Link2 className="size-4" /> Invites</DropdownMenuItem><DropdownMenuItem onClick={() => onOpenSettings("notifications")}><Bell className="size-4" /> Notifications</DropdownMenuItem>diff --git a/src/web/src/components/community/settings/create-server-dialog.tsx b/src/web/src/components/community/settings/create-server-dialog.tsxindex 676627041..689ed2c61 100644--- a/src/web/src/components/community/settings/create-server-dialog.tsx+++ b/src/web/src/components/community/settings/create-server-dialog.tsx@@ -166,6 +166,7 @@ export function CreateServerDialog({ onClose, onCreateServer }: {placeholder="My community"autoFocusaria-label="Server name"+ data-testid={tid.createServerName}className="w-full border-0 bg-transparent p-0 text-[26px] font-medium leading-tight tracking-tight shadow-none outline-none placeholder:font-normal placeholder:text-muted-foreground/35 focus-visible:ring-0"/><SlugHint {...namePreview} />diff --git a/src/web/src/components/community/settings/server-settings.tsx b/src/web/src/components/community/settings/server-settings.tsxindex 9caa8b883..781b418d0 100644--- a/src/web/src/components/community/settings/server-settings.tsx+++ b/src/web/src/components/community/settings/server-settings.tsx@@ -1,7 +1,6 @@"use client"import { useEffect, useRef, useState } from "react"-import type { LucideIcon } from "lucide-react"import { useVirtualizer } from "@tanstack/react-virtual"import { Settings, Users, Link2, Bell, Trash2, X, Shield, Search, Camera } from "lucide-react"import {@@ -16,7 +15,6 @@ import { formatRelativeTime } from "@/lib/community/format-time"import { Input } from "@/components/ui/input"import { AutoResizeTextarea } from "@/components/ui/auto-resize-textarea"import { Badge, badgeVariants } from "@/components/ui/badge"-import { Tabs, TabsList, TabsTrigger, TabsContent } from "@/components/ui/tabs"import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem } from "@/components/ui/dropdown-menu"import { Skeleton } from "@/components/ui/skeleton"import { Avatar } from "../avatar"@@ -30,12 +28,7 @@ import { COMMUNITY_VIRTUALIZER_REACT_OPTIONS } from "@/hooks/community/virtualizimport type { SettingsSection } from "@/components/community/settings/settings-types"import type { Member, InviteRow } from "@/lib/community/models/people"import type { OpenProfile } from "@/components/community/social/profile-types"-import {- SETTINGS_NAV_CLASS,- SETTINGS_NAV_LABEL_CLASS,- SETTINGS_TAB_CLASS,- SETTINGS_TABS_LIST_CLASS,-} from "./settings-navigation"+import { SettingsShell, SettingsShellPanel, type SettingsShellTab } from "./settings-shell"const SETTABLE_ROLES: Role[] = ["admin", "member"]@@ -81,11 +74,11 @@ export function ServerSettings({// their tab is open, never on settings mount or via WS.const { invites, isLoading: invitesLoading } = useInvites(serverId, section === "invites")- const nav: { id: SettingsSection; label: string; icon: LucideIcon }[] = [- { id: "overview", label: "Overview", icon: Settings },- { id: "members", label: "Members", icon: Users },- { id: "invites", label: "Invites", icon: Link2 },- { id: "notifications", label: "Notifications", icon: Bell },+ const nav: SettingsShellTab<SettingsSection>[] = [+ { value: "overview", label: "Overview", icon: Settings },+ { value: "members", label: "Members", icon: Users },+ { value: "invites", label: "Invites", icon: Link2 },+ { value: "notifications", label: "Notifications", icon: Bell },]return (<>@@ -98,40 +91,19 @@ export function ServerSettings({confirmVariant="destructive"onConfirm={() => { setConfirmDelete(false); onDeleteServer?.() }}/>- <Tabs- orientation="vertical"+ <SettingsShellvalue={section}- onValueChange={(v) => setSection(v as SettingsSection)}- className="min-h-0 flex-1 flex-row gap-0"+ onValueChange={setSection}+ label={serverName}+ title={<span className="capitalize">{section}</span>}+ tabs={nav}+ onClose={onClose}>- {/* settings nav */}- <nav className={SETTINGS_NAV_CLASS} style={{ background: "var(--d-rail)" }}>- <div className={SETTINGS_NAV_LABEL_CLASS}>{serverName}</div>- <TabsList variant="line" className={SETTINGS_TABS_LIST_CLASS}>- {nav.map((n) => (- <TabsTrigger key={n.id} value={n.id} className={SETTINGS_TAB_CLASS}>- <n.icon className="size-4" /> {n.label}- </TabsTrigger>- ))}- </TabsList>- </nav>-- {/* settings body */}- <div className="flex min-w-0 flex-1 flex-col bg-background">- <header className="flex h-12 shrink-0 items-center border-b border-border px-4">- <h1 className="flex-1 text-lg font-semibold capitalize">{section}</h1>- <Button variant="ghost" size="icon-sm" onClick={onClose} aria-label="Close settings">- <X className="size-4" />- </Button>- </header>- <div className="flex-1 overflow-y-auto thin-scrollbar p-4">- <TabsContent value="overview"><SettingsOverview serverId={serverId} serverName={serverName} serverDescription={serverDescription} serverIcon={serverIcon} onUploadIcon={onUploadIcon} onUpdateServer={onUpdateServer} onRequestDelete={() => setConfirmDelete(true)} /></TabsContent>- <TabsContent value="members"><SettingsMembers members={members} loading={membersLoading} loadingMore={membersLoadingMore} hasMore={membersHasMore} total={membersTotal} onLoadMore={onLoadMoreMembers} onSearch={onSearchMembers} onOpenProfile={onOpenProfile} onKickMember={onKickMember} onSetRole={onSetRole} /></TabsContent>- <TabsContent value="invites"><SettingsInvites invites={invites} loading={invitesLoading} onRevokeInvite={onRevokeInvite} onCopyInvite={onCopyInvite} /></TabsContent>- <TabsContent value="notifications"><SettingsNotifications level={notifLevel ?? notifLevelDisplay("mentions")} onSetLevel={onSetNotifLevel} /></TabsContent>- </div>- </div>- </Tabs>+ <SettingsShellPanel value="overview"><SettingsOverview serverId={serverId} serverName={serverName} serverDescription={serverDescription} serverIcon={serverIcon} onUploadIcon={onUploadIcon} onUpdateServer={onUpdateServer} onRequestDelete={() => setConfirmDelete(true)} /></SettingsShellPanel>+ <SettingsShellPanel value="members"><SettingsMembers members={members} loading={membersLoading} loadingMore={membersLoadingMore} hasMore={membersHasMore} total={membersTotal} onLoadMore={onLoadMoreMembers} onSearch={onSearchMembers} onOpenProfile={onOpenProfile} onKickMember={onKickMember} onSetRole={onSetRole} /></SettingsShellPanel>+ <SettingsShellPanel value="invites"><SettingsInvites invites={invites} loading={invitesLoading} onRevokeInvite={onRevokeInvite} onCopyInvite={onCopyInvite} /></SettingsShellPanel>+ <SettingsShellPanel value="notifications"><SettingsNotifications level={notifLevel ?? notifLevelDisplay("mentions")} onSetLevel={onSetNotifLevel} /></SettingsShellPanel>+ </SettingsShell></>)}@@ -184,6 +156,7 @@ function SettingsOverview({ serverId, serverName, serverDescription, serverIcon,onChange={(e) => setName(e.target.value)}placeholder="Server name"aria-label="Server name"+ data-testid={tid.serverSettingsName}className="w-full border-0 bg-transparent px-0 py-1 text-2xl font-medium leading-[1.2] tracking-tight shadow-none outline-none placeholder:font-normal placeholder:text-muted-foreground/40 focus-visible:ring-0"/><SlugHint {...namePreview} />diff --git a/src/web/src/components/community/settings/settings-navigation.test.ts b/src/web/src/components/community/settings/settings-navigation.test.tsindex 2a495596b..e400bcd99 100644--- a/src/web/src/components/community/settings/settings-navigation.test.ts+++ b/src/web/src/components/community/settings/settings-navigation.test.ts@@ -2,20 +2,33 @@ import { describe, expect, it } from "vitest"import {SETTINGS_LOGOUT_CLASS,SETTINGS_NAV_CLASS,+ SETTINGS_NAV_FOOTER_CLASS,SETTINGS_NAV_LABEL_CLASS,SETTINGS_TAB_CLASS,SETTINGS_TABS_LIST_CLASS,} from "./settings-navigation"-describe("settings navigation density", () => {- it("keeps user and server settings narrow without changing the content inset", () => {- expect(SETTINGS_NAV_CLASS).toContain("w-44")+describe("responsive settings navigation", () => {+ it("uses a top tab strip on mobile and the compact left rail on desktop", () => {+ expect(SETTINGS_NAV_CLASS).toContain("border-b")+ expect(SETTINGS_NAV_CLASS).toContain("sm:w-44")expect(SETTINGS_NAV_CLASS).not.toContain("w-60")- expect(SETTINGS_NAV_CLASS).toContain("p-3")- expect(SETTINGS_TABS_LIST_CLASS).toContain("overflow-x-hidden")- expect(SETTINGS_TAB_CLASS).toContain("h-8")+ expect(SETTINGS_NAV_CLASS).toContain("sm:border-r")+ expect(SETTINGS_NAV_CLASS).toContain("sm:p-3")+ expect(SETTINGS_TABS_LIST_CLASS).toContain("overflow-x-auto")+ expect(SETTINGS_TABS_LIST_CLASS).toContain("thin-scrollbar")+ expect(SETTINGS_TABS_LIST_CLASS).toContain("group-data-horizontal/tabs:h-11")+ expect(SETTINGS_TABS_LIST_CLASS).toContain("sm:flex-col")+ expect(SETTINGS_TAB_CLASS).toContain("h-11")+ expect(SETTINGS_TAB_CLASS).toContain("sm:h-8")+ expect(SETTINGS_TAB_CLASS).toContain("sm:w-full")expect(SETTINGS_TAB_CLASS).not.toContain("px-0")- expect(SETTINGS_NAV_LABEL_CLASS).toContain("px-2")+ expect(SETTINGS_NAV_LABEL_CLASS).toContain("max-w-24")+ expect(SETTINGS_NAV_LABEL_CLASS).toContain("truncate")+ expect(SETTINGS_NAV_LABEL_CLASS).not.toContain("hidden")+ expect(SETTINGS_NAV_FOOTER_CLASS).toContain("border-l")+ expect(SETTINGS_NAV_FOOTER_CLASS).toContain("sm:border-t")+ expect(SETTINGS_LOGOUT_CLASS).toContain("h-11")expect(SETTINGS_LOGOUT_CLASS).not.toContain("px-0")})})diff --git a/src/web/src/components/community/settings/settings-navigation.ts b/src/web/src/components/community/settings/settings-navigation.tsindex 98cf59bf2..40a29dcfa 100644--- a/src/web/src/components/community/settings/settings-navigation.ts+++ b/src/web/src/components/community/settings/settings-navigation.ts@@ -1,13 +1,17 @@export const SETTINGS_NAV_CLASS =- "flex w-44 shrink-0 flex-col gap-2 overflow-y-auto thin-scrollbar border-r border-border p-3"+ "col-start-1 row-start-2 flex min-w-0 items-center gap-1 border-b border-border px-2 thin-scrollbar sm:row-span-2 sm:row-start-1 sm:w-44 sm:flex-col sm:items-stretch sm:gap-2 sm:overflow-y-auto sm:border-r sm:border-b-0 sm:p-3"export const SETTINGS_TABS_LIST_CLASS =- "h-auto w-full flex-col gap-1 overflow-x-hidden"+ "h-auto min-w-0 flex-1 flex-row gap-1 overflow-x-auto overflow-y-hidden thin-scrollbar group-data-horizontal/tabs:h-11 sm:w-full sm:flex-none sm:flex-col sm:overflow-x-hidden"-export const SETTINGS_TAB_CLASS = "h-8 w-full justify-start gap-2"+export const SETTINGS_TAB_CLASS =+ "h-11 w-auto justify-center gap-2 sm:h-8 sm:w-full sm:justify-start"export const SETTINGS_NAV_LABEL_CLASS =- "px-2 text-xs font-semibold text-muted-foreground"+ "max-w-24 shrink-0 truncate px-2 text-xs font-semibold text-muted-foreground sm:max-w-none"export const SETTINGS_LOGOUT_CLASS =- "justify-start text-destructive hover:text-destructive"+ "h-11 shrink-0 justify-start text-destructive hover:text-destructive sm:h-8 sm:w-full"++export const SETTINGS_NAV_FOOTER_CLASS =+ "shrink-0 border-l border-border pl-1 sm:mt-auto sm:w-full sm:border-t sm:border-l-0 sm:pt-2 sm:pl-0"diff --git a/src/web/src/components/community/settings/settings-shell.contract.test.ts b/src/web/src/components/community/settings/settings-shell.contract.test.tsnew file mode 100644index 000000000..69641f420--- /dev/null+++ b/src/web/src/components/community/settings/settings-shell.contract.test.ts@@ -0,0 +1,35 @@+import { readFileSync } from "node:fs"+import { dirname, resolve } from "node:path"+import { fileURLToPath } from "node:url"+import { describe, expect, it } from "vitest"++const settingsDirectory = dirname(fileURLToPath(import.meta.url))+const readSettings = (file: string) => readFileSync(resolve(settingsDirectory, file), "utf8")++describe("shared settings shell", () => {+ it("owns the responsive tabs, header, content frame, and test IDs", () => {+ const source = readSettings("settings-shell.tsx")++ expect(source).toContain("useBreakpoint()")+ expect(source).toContain('breakpoint === "mobile" ? "horizontal" : "vertical"')+ expect(source).toContain("grid-rows-[3rem_auto_minmax(0,1fr)]")+ expect(source).toContain("sm:grid-cols-[11rem_minmax(0,1fr)]")+ expect(source).toContain("data-testid={tid.settingsNav}")+ expect(source).toContain("data-testid={tid.settingsContent}")+ expect(source).toContain("data-testid={tid.settingsClose}")+ expect(source).toContain("data-testid={tid.settingsLabel}")+ expect(source).toContain('className="size-11 sm:size-8"')+ expect(source).toContain("<TabsContent {...props} keepMounted />")+ })++ it("is the only settings layout used by both user and server settings", () => {+ for (const file of ["user-settings.tsx", "server-settings.tsx"]) {+ const source = readSettings(file)+ expect(source).toContain("<SettingsShell")+ expect(source).toContain("<SettingsShellPanel")+ expect(source).not.toContain("<Tabs ")+ expect(source).not.toContain("SETTINGS_NAV_CLASS")+ expect(source).not.toContain("SETTINGS_TABS_LIST_CLASS")+ }+ })+})diff --git a/src/web/src/components/community/settings/settings-shell.tsx b/src/web/src/components/community/settings/settings-shell.tsxnew file mode 100644index 000000000..b446058d9--- /dev/null+++ b/src/web/src/components/community/settings/settings-shell.tsx@@ -0,0 +1,104 @@+"use client"++import type { LucideIcon } from "lucide-react"+import type { ComponentProps, ReactNode } from "react"+import { X } from "lucide-react"+import { Button } from "@/components/ui/button"+import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"+import { useBreakpoint } from "@/hooks/use-mobile"+import { tid } from "@/lib/community/testids"+import {+ SETTINGS_NAV_CLASS,+ SETTINGS_NAV_FOOTER_CLASS,+ SETTINGS_NAV_LABEL_CLASS,+ SETTINGS_TAB_CLASS,+ SETTINGS_TABS_LIST_CLASS,+} from "./settings-navigation"++export type SettingsShellTab<Value extends string> = {+ value: Value+ label: string+ icon: LucideIcon+}++export function SettingsShellPanel(+ props: Omit<ComponentProps<typeof TabsContent>, "keepMounted">,+) {+ return <TabsContent {...props} keepMounted />+}++export function SettingsShell<Value extends string>({+ value,+ onValueChange,+ label,+ title,+ tabs,+ onClose,+ navFooter,+ children,+}: {+ value: Value+ onValueChange: (value: Value) => void+ label: string+ title: ReactNode+ tabs: SettingsShellTab<Value>[]+ onClose: () => void+ navFooter?: ReactNode+ children: ReactNode+}) {+ const breakpoint = useBreakpoint()++ return (+ <Tabs+ orientation={breakpoint === "mobile" ? "horizontal" : "vertical"}+ value={value}+ onValueChange={(nextValue) => onValueChange(nextValue as Value)}+ className="grid min-h-0 flex-1 grid-cols-1 grid-rows-[3rem_auto_minmax(0,1fr)] gap-0 sm:grid-cols-[11rem_minmax(0,1fr)] sm:grid-rows-[3rem_minmax(0,1fr)]"+ data-testid={tid.settingsShell}+ >+ <header className="col-start-1 row-start-1 flex h-12 min-w-0 items-center border-b border-border px-4 sm:col-start-2">+ <h1 className="min-w-0 flex-1 truncate text-lg font-semibold">{title}</h1>+ <Button+ variant="ghost"+ size="icon-sm"+ className="size-11 sm:size-8"+ onClick={onClose}+ aria-label="Close settings"+ data-testid={tid.settingsClose}+ >+ <X className="size-4" />+ </Button>+ </header>++ <nav+ className={SETTINGS_NAV_CLASS}+ style={{ background: "var(--d-rail)" }}+ data-testid={tid.settingsNav}+ >+ <div className={SETTINGS_NAV_LABEL_CLASS} data-testid={tid.settingsLabel}>{label}</div>+ <TabsList variant="line" className={SETTINGS_TABS_LIST_CLASS}>+ {tabs.map(({ value: tabValue, label: tabLabel, icon: Icon }) => (+ <TabsTrigger+ key={tabValue}+ value={tabValue}+ className={SETTINGS_TAB_CLASS}+ data-testid={tid.settingsTab(tabValue)}+ >+ <Icon className="size-4" /> {tabLabel}+ </TabsTrigger>+ ))}+ </TabsList>+ {navFooter ? (+ <div className={SETTINGS_NAV_FOOTER_CLASS}>{navFooter}</div>+ ) : null}+ </nav>++ <div+ className="col-start-1 row-start-3 min-h-0 min-w-0 overflow-y-auto bg-background p-4 thin-scrollbar sm:col-start-2 sm:row-start-2"+ data-testid={tid.settingsContent}+ >+ {children}+ </div>+ </Tabs>+ )+}diff --git a/src/web/src/components/community/settings/user-settings.tsx b/src/web/src/components/community/settings/user-settings.tsxindex 5379e4a73..d62830b4b 100644--- a/src/web/src/components/community/settings/user-settings.tsx+++ b/src/web/src/components/community/settings/user-settings.tsx@@ -3,12 +3,10 @@import { useEffect, useState } from "react"import { toast } from "sonner"import { toastApiError } from "@/lib/api/client"-import { User, LogOut, X, Palette, Sun, Moon, Monitor, Database, Camera } from "lucide-react"+import { User, LogOut, Palette, Sun, Moon, Monitor, Database, Camera } from "lucide-react"import { useTheme } from "next-themes"import { Button } from "@/components/ui/button"import { AutoResizeTextarea } from "@/components/ui/auto-resize-textarea"-import { Separator } from "@/components/ui/separator"-import { Tabs, TabsList, TabsTrigger, TabsContent } from "@/components/ui/tabs"import { ConfirmDialog } from "@/components/ui/confirm-dialog"import { clearPersistedCache } from "@/lib/query-persister"import { Avatar } from "../avatar"@@ -16,11 +14,8 @@ import { Field } from "./field"import { StatusEditor, hasStatus } from "../social/status-editor"import {SETTINGS_LOGOUT_CLASS,- SETTINGS_NAV_CLASS,- SETTINGS_NAV_LABEL_CLASS,- SETTINGS_TAB_CLASS,- SETTINGS_TABS_LIST_CLASS,} from "./settings-navigation"+import { SettingsShell, SettingsShellPanel, type SettingsShellTab } from "./settings-shell"const THEME_OPTIONS = [{ value: "light", label: "Light", icon: Sun },@@ -28,6 +23,12 @@ const THEME_OPTIONS = [{ value: "system", label: "System", icon: Monitor },] as const+const USER_SETTINGS_TABS: SettingsShellTab<"profile" | "appearance" | "advanced">[] = [+ { value: "profile", label: "My Profile", icon: User },+ { value: "appearance", label: "Appearance", icon: Palette },+ { value: "advanced", label: "Advanced", icon: Database },+]+function AppearanceSettings() {const { theme, setTheme } = useTheme()const [mounted, setMounted] = useState(false)@@ -141,7 +142,7 @@ export function UserSettings({ onClose, userId, userName, aboutMe, avatar, statuemoji: statusEmoji ?? null,text: statusText ?? null,})- const [tab, setTab] = useState("profile")+ const [tab, setTab] = useState<"profile" | "appearance" | "advanced">("profile")const dirty =name !== baseline.name ||@@ -173,105 +174,81 @@ export function UserSettings({ onClose, userId, userName, aboutMe, avatar, statu}return (- <Tabs- orientation="vertical"+ <SettingsShellvalue={tab}onValueChange={setTab}- className="min-h-0 flex-1 flex-row gap-0"- >- <nav className={SETTINGS_NAV_CLASS} style={{ background: "var(--d-rail)" }}>- <div className={SETTINGS_NAV_LABEL_CLASS}>User Settings</div>- <TabsList variant="line" className={SETTINGS_TABS_LIST_CLASS}>- <TabsTrigger value="profile" className={SETTINGS_TAB_CLASS}>- <User className="size-4" /> My Profile- </TabsTrigger>- <TabsTrigger value="appearance" className={SETTINGS_TAB_CLASS}>- <Palette className="size-4" /> Appearance- </TabsTrigger>- <TabsTrigger value="advanced" className={SETTINGS_TAB_CLASS}>- <Database className="size-4" /> Advanced- </TabsTrigger>- </TabsList>- <Separator className="my-1" />+ label="User Settings"+ title={tab === "appearance" ? "Appearance" : tab === "advanced" ? "Advanced" : "My Profile"}+ tabs={USER_SETTINGS_TABS}+ onClose={onClose}+ navFooter={<Button variant="ghost" className={SETTINGS_LOGOUT_CLASS} size="sm" onClick={onLogout}><LogOut className="size-4" /> Log Out</Button>- </nav>-- <div className="flex min-w-0 flex-1 flex-col bg-background">- <header className="flex h-12 shrink-0 items-center border-b border-border px-4">- <h1 className="flex-1 text-lg font-semibold">- {tab === "appearance" ? "Appearance" : tab === "advanced" ? "Advanced" : "My Profile"}- </h1>- <Button variant="ghost" size="icon-sm" onClick={onClose} aria-label="Close settings">- <X className="size-4" />- </Button>- </header>- <div className="flex-1 overflow-y-auto thin-scrollbar p-4">- <TabsContent value="profile">- <div className="mx-auto max-w-md space-y-6">- {/* Avatar — centered in a soft rounded frame, with a hand-rolled- pill button beneath (matches the bot create/edit sheet; a stock- secondary Button reads as the old square style). */}- <div className="flex flex-col items-center gap-3">- <span className="block size-24 overflow-hidden rounded-full ring-1 ring-border/50">- <Avatar label={avatar} seed={userId ?? undefined} size={96} />- </span>- <button- type="button"- onClick={onUploadAvatar}- className="flex items-center gap-1.5 rounded-full border border-border/50 px-3 py-1.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none"- >- <Camera className="size-3.5" /> Change photo- </button>- </div>- {/* Display name — inline title input, borderless (name-as-heading,- like the agent name on the bot page). */}- <input- value={name}- onChange={(e) => setName(e.target.value)}- placeholder="Your name"- aria-label="Display name"- className="w-full border-0 bg-transparent px-0 py-1 text-2xl font-medium leading-[1.2] tracking-tight shadow-none outline-none placeholder:font-normal placeholder:text-muted-foreground/40 focus-visible:ring-0"- />- {/* About — borderless auto-resizing textarea. */}- <div>- <div className="mb-1 text-xs text-muted-foreground">About</div>- <AutoResizeTextarea- value={value}- onChange={(e) => setValue(e.target.value)}- placeholder="Add a bit about yourself…"- className="w-full border-0 bg-transparent px-0 py-1 text-sm text-foreground shadow-none outline-none placeholder:text-muted-foreground/40 focus-visible:ring-0"- />- </div>- {/* Status — quiet label + a soft chip (more formed than a bare- borderless button, still in the frameless language). */}- <div>- <div className="mb-1 text-xs text-muted-foreground">Status</div>- <StatusEditor emoji={status.emoji} text={status.text} onChange={(emoji, text) => setStatus({ emoji, text })}>- <button className="inline-flex items-center gap-1.5 rounded-full border border-border/50 px-3 py-1.5 text-sm transition-colors hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none">- {hasStatus(status.emoji, status.text) ? (- <span>{status.emoji} {status.text}</span>- ) : (- <span className="text-muted-foreground/60">Set a status</span>- )}- </button>- </StatusEditor>- </div>- <div className="flex items-center justify-end gap-2 pt-2">- <Button variant="ghost" size="sm" onClick={handleCancel} disabled={!dirty}>Cancel</Button>- <Button size="sm" onClick={handleSave} disabled={!dirty}>Save changes</Button>- </div>- </div>- </TabsContent>- <TabsContent value="appearance">- <AppearanceSettings />- </TabsContent>- <TabsContent value="advanced">- <AdvancedSettings userId={userId} />- </TabsContent>+ }+ >+ <SettingsShellPanel value="profile">+ <div className="mx-auto max-w-md space-y-6">+ {/* Avatar — centered in a soft rounded frame, with a hand-rolled+ pill button beneath (matches the bot create/edit sheet; a stock+ secondary Button reads as the old square style). */}+ <div className="flex flex-col items-center gap-3">+ <span className="block size-24 overflow-hidden rounded-full ring-1 ring-border/50">+ <Avatar label={avatar} seed={userId ?? undefined} size={96} />+ </span>+ <button+ type="button"+ onClick={onUploadAvatar}+ className="flex items-center gap-1.5 rounded-full border border-border/50 px-3 py-1.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none"+ >+ <Camera className="size-3.5" /> Change photo+ </button>+ </div>+ {/* Display name — inline title input, borderless (name-as-heading,+ like the agent name on the bot page). */}+ <input+ value={name}+ onChange={(e) => setName(e.target.value)}+ placeholder="Your name"+ aria-label="Display name"+ className="w-full border-0 bg-transparent px-0 py-1 text-2xl font-medium leading-[1.2] tracking-tight shadow-none outline-none placeholder:font-normal placeholder:text-muted-foreground/40 focus-visible:ring-0"+ />+ {/* About — borderless auto-resizing textarea. */}+ <div>+ <div className="mb-1 text-xs text-muted-foreground">About</div>+ <AutoResizeTextarea+ value={value}+ onChange={(e) => setValue(e.target.value)}+ placeholder="Add a bit about yourself…"+ className="w-full border-0 bg-transparent px-0 py-1 text-sm text-foreground shadow-none outline-none placeholder:text-muted-foreground/40 focus-visible:ring-0"+ />+ </div>+ {/* Status — quiet label + a soft chip (more formed than a bare+ borderless button, still in the frameless language). */}+ <div>+ <div className="mb-1 text-xs text-muted-foreground">Status</div>+ <StatusEditor emoji={status.emoji} text={status.text} onChange={(emoji, text) => setStatus({ emoji, text })}>+ <button className="inline-flex items-center gap-1.5 rounded-full border border-border/50 px-3 py-1.5 text-sm transition-colors hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none">+ {hasStatus(status.emoji, status.text) ? (+ <span>{status.emoji} {status.text}</span>+ ) : (+ <span className="text-muted-foreground/60">Set a status</span>+ )}+ </button>+ </StatusEditor>+ </div>+ <div className="flex items-center justify-end gap-2 pt-2">+ <Button variant="ghost" size="sm" onClick={handleCancel} disabled={!dirty}>Cancel</Button>+ <Button size="sm" onClick={handleSave} disabled={!dirty}>Save changes</Button>+ </div></div>- </div>- </Tabs>+ </SettingsShellPanel>+ <SettingsShellPanel value="appearance">+ <AppearanceSettings />+ </SettingsShellPanel>+ <SettingsShellPanel value="advanced">+ <AdvancedSettings userId={userId} />+ </SettingsShellPanel>+ </SettingsShell>)}diff --git a/src/web/src/components/community/shell/shell-frame-overlays.tsx b/src/web/src/components/community/shell/shell-frame-overlays.tsxindex 910b53a01..8d494b6d6 100644--- a/src/web/src/components/community/shell/shell-frame-overlays.tsx+++ b/src/web/src/components/community/shell/shell-frame-overlays.tsx@@ -57,7 +57,7 @@ export function ShellFrameOverlays({onOpenChange={controller.onUserSettingsOpenChange}><DialogContent- className="flex h-[calc(100vh-4rem)] max-h-180 w-[calc(100vw-4rem)] sm:max-w-4xl flex-col gap-0 overflow-hidden rounded-xl p-0"+ className="flex h-dvh max-h-dvh w-screen max-w-none flex-col gap-0 overflow-hidden rounded-none p-0 sm:h-[calc(100vh-4rem)] sm:max-h-180 sm:w-[calc(100vw-4rem)] sm:max-w-4xl sm:rounded-xl"showCloseButton={false}><UserSettings {...controller.userSettingsProps} />diff --git a/src/web/src/components/community/shell/sortable-server.tsx b/src/web/src/components/community/shell/sortable-server.tsxindex 88e3e420b..0e32e7ba5 100644--- a/src/web/src/components/community/shell/sortable-server.tsx+++ b/src/web/src/components/community/shell/sortable-server.tsx@@ -174,7 +174,7 @@ function SortableServerImpl({Create group</ContextMenuItem>)}- <ContextMenuItem onClick={onOpenSettings}>+ <ContextMenuItem onClick={onOpenSettings} data-testid={tid.serverSettingsOpen}>Server settings</ContextMenuItem>{!server.isOwner && !inFolder && (diff --git a/src/web/src/components/community/shell/user-bar.tsx b/src/web/src/components/community/shell/user-bar.tsxindex 8119d1286..590928dd7 100644--- a/src/web/src/components/community/shell/user-bar.tsx+++ b/src/web/src/components/community/shell/user-bar.tsx@@ -6,6 +6,7 @@ import { Popover, PopoverTrigger, PopoverContent } from "@/components/ui/popoverimport { Avatar } from "../avatar"import type { OpenProfile } from "@/components/community/social/profile-types"import { resolveProfilePresence } from "@/lib/community/presence"+import { tid } from "@/lib/community/testids"// UserBar always renders the signed-in viewer, so presence resolves through// the self → online branch and never consults an online set.@@ -64,8 +65,9 @@ function Inner({ user, onOpenProfile, onEditProfile, inbox, hasUnread, inboxOpen)}<buttononClick={onEditProfile}- className="grid size-7 place-items-center rounded-lg text-muted-foreground hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none"+ className="grid size-11 place-items-center rounded-lg text-muted-foreground hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none sm:size-7"aria-label="User settings"+ data-testid={tid.userSettingsOpen}><Settings className="size-4" /></button>diff --git a/src/web/src/lib/community/testids.ts b/src/web/src/lib/community/testids.tsindex c04747b48..da793bfe6 100644--- a/src/web/src/lib/community/testids.ts+++ b/src/web/src/lib/community/testids.ts@@ -9,7 +9,17 @@ export const tid = {serverRailScroll: "community-server-rail-scroll",channelSidebarScroll: "community-channel-sidebar-scroll",createServerSubmit: "community-create-server-submit",+ createServerName: "community-create-server-name",createChannelSubmit: "community-create-channel-submit",+ settingsShell: "community-settings-shell",+ settingsNav: "community-settings-nav",+ settingsContent: "community-settings-content",+ settingsClose: "community-settings-close",+ settingsLabel: "community-settings-label",+ settingsTab: (value: string) => `community-settings-tab-${value}`,+ userSettingsOpen: "community-user-settings-open",+ serverSettingsOpen: "community-server-settings-open",+ serverSettingsName: "community-server-settings-name",newDivider: "community-new-divider",typingIndicator: "community-typing-indicator",dmBlockedNotice: "community-dm-blocked-notice",