Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

community(frontend): pinned-message jump + right-panel polish + skeletons

Gusb4dee70a212e
diff --git a/src/web/src/app/c/channels/[serverId]/[channelId]/page.tsx b/src/web/src/app/c/channels/[serverId]/[channelId]/page.tsx
index 65f3aa243..aa2ee58af 100644
--- a/src/web/src/app/c/channels/[serverId]/[channelId]/page.tsx
+++ b/src/web/src/app/c/channels/[serverId]/[channelId]/page.tsx
@@ -929,10 +929,11 @@ function ChannelView() {
// toast source).
onKickMember: (memberId: string) =>
kickMemberMut.mutateAsync({ serverId, memberId }).then(() => toast("Member kicked")),
- onJumpToMessage: (id: string) => {
- setScrollToMessageId(id)
- setTimeout(() => setScrollToMessageId(null), 100)
- },
+ // Pinned-message click routes through the same message-ref jump flow
+ // (scroll-in-place if the message is loaded, else open the context sheet),
+ // so clicking a pin always gives feedback — even an old, out-of-window one
+ // that the scroll-only path used to silently no-op on.
+ onJumpToMessage: (seq: number) => jumpToSeq(seq),
}
// Add-members dialog (shared), mounted when the drawer's Add button fires.
diff --git a/src/web/src/components/community/avatar.tsx b/src/web/src/components/community/avatar.tsx
index 3b6cce0c3..7a10215f9 100644
--- a/src/web/src/components/community/avatar.tsx
+++ b/src/web/src/components/community/avatar.tsx
@@ -65,7 +65,14 @@ export function Avatar({ label, seed, src, size = 40, dim = false, presence, rin
</>
) : beamSeed ? (
<span className="size-full rounded-full overflow-hidden">
- <BoringAvatar seed={beamSeed} size={size} className="size-full" />
+ {/* rounded-full must live on BoringAvatar's OWN wrapper (which carries
+ overflow-hidden), not only on this outer span: the beam SVG has a
+ `<g transform>`, and WebKit/Safari does not clip a transformed
+ descendant to an ancestor's border-radius — so an outer-only
+ radius leaks the beam's square background as a rounded-square
+ (the pinned-panel "clipped avatar" bug, WebKit-only). Every other
+ BoringAvatar caller co-locates the radius on it for this reason. */}
+ <BoringAvatar seed={beamSeed} size={size} className="size-full rounded-full" />
</span>
) : (
<AvatarFallback className="font-medium" style={{ fontSize: size * 0.4 }}>
diff --git a/src/web/src/components/community/bots/bot-list.tsx b/src/web/src/components/community/bots/bot-list.tsx
index 0764b3d2a..b04e79d8a 100644
--- a/src/web/src/components/community/bots/bot-list.tsx
+++ b/src/web/src/components/community/bots/bot-list.tsx
@@ -2,13 +2,14 @@
import { useEffect, useMemo, useRef, useState } from "react"
import { useRouter, useSearchParams } from "next/navigation"
-import { ChevronLeft, Monitor, MoreVertical, HelpCircle, RotateCcw } from "lucide-react"
+import { ChevronLeft, Monitor, MoreVertical, HelpCircle, RotateCcw, Activity } from "lucide-react"
import { toast } from "sonner"
import { toastApiError } from "@/lib/api/client"
import { isPresenceOnline, formatModelLabel } from "@alook/shared"
import { machineName as resolveMachineName } from "@/lib/community/machine-name"
import { Button } from "@/components/ui/button"
import { Card } from "@/components/ui/card"
+import { Skeleton } from "@/components/ui/skeleton"
import {
DropdownMenu,
DropdownMenuContent,
@@ -47,6 +48,24 @@ import { AgentHelpGallery } from "@/components/community/onboarding-tiles/agent-
* status pill, meta line, and a kebab menu. Empty state matches the machine
* empty state so users don't learn two idioms.
*/
+// Loading placeholder shaped like a real bot Card (40px avatar + name row +
+// meta line + trailing kebab slot) so the list doesn't reflow when data lands
+// — replaces the old structureless muted box.
+function BotCardSkeleton() {
+ return (
+ <Card className="flex flex-col gap-3 p-4">
+ <div className="flex items-start justify-between gap-3">
+ <Skeleton className="size-10 shrink-0 rounded-full" />
+ <div className="flex min-w-0 flex-1 flex-col gap-2 py-0.5">
+ <Skeleton className="h-3.5 w-28 rounded" />
+ <Skeleton className="h-3 w-48 rounded" />
+ </div>
+ <Skeleton className="size-8 shrink-0 rounded-md" />
+ </div>
+ </Card>
+ )
+}
+
export function BotList({ onBack }: { onBack?: () => void } = {}) {
const router = useRouter()
const searchParams = useSearchParams()
@@ -152,9 +171,9 @@ export function BotList({ onBack }: { onBack?: () => void } = {}) {
<div className="flex min-h-0 flex-1 flex-col">
{backBar}
<div className="flex flex-col gap-3 p-6">
- {Array.from({ length: 3 }).map((_, i) => (
- <div key={i} className="h-21 animate-pulse rounded-lg border bg-muted/30" />
- ))}
+ <BotCardSkeleton />
+ <BotCardSkeleton />
+ <BotCardSkeleton />
</div>
</div>
)
@@ -370,9 +389,14 @@ export function BotList({ onBack }: { onBack?: () => void } = {}) {
</button>
}
/>
- <DropdownMenuContent align="end">
+ {/* Nav-icon pattern from message-menu (uiux #14,
+ Gus "less is more"): icon ONLY on the high-freq
+ actions (View activity, Reset) as scan anchors;
+ the rest render an icon-width placeholder so
+ every label shares one left edge. */}
+ <DropdownMenuContent align="end" className="w-auto min-w-36 max-w-56">
<DropdownMenuItem onClick={() => chatWithBot(bot)}>
- Chat
+ <span className="size-4" aria-hidden /> Chat
</DropdownMenuItem>
<DropdownMenuItem
onClick={() => {
@@ -380,7 +404,7 @@ export function BotList({ onBack }: { onBack?: () => void } = {}) {
setActivityOpen(true)
}}
>
- View activity
+ <Activity className="size-4" /> View activity
</DropdownMenuItem>
<DropdownMenuItem
onClick={() => {
@@ -388,19 +412,19 @@ export function BotList({ onBack }: { onBack?: () => void } = {}) {
setEditOpen(true)
}}
>
- Edit
+ <span className="size-4" aria-hidden /> Edit
</DropdownMenuItem>
<DropdownMenuItem
data-testid={`bot-reset-session-item`}
onClick={() => setConfirmReset(bot)}
>
- Reset
+ <RotateCcw className="size-4" /> Reset
</DropdownMenuItem>
<DropdownMenuItem
variant="destructive"
onClick={() => setConfirmDelete(bot)}
>
- Delete
+ <span className="size-4" aria-hidden /> Delete
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
diff --git a/src/web/src/components/community/community-panel-sheet.tsx b/src/web/src/components/community/community-panel-sheet.tsx
index 711eaca4b..0f9d1b119 100644
--- a/src/web/src/components/community/community-panel-sheet.tsx
+++ b/src/web/src/components/community/community-panel-sheet.tsx
@@ -57,7 +57,7 @@ export function CommunityPanelSheet({
onSetRole?: (name: string, role: Role) => void
onKickMember?: (memberId: string) => Promise<unknown> | void
myRole?: Role
- onJumpToMessage?: (id: string) => void
+ onJumpToMessage?: (seq: number) => void
onSearch?: (query: string) => void
}) {
const { width, onPointerDown, onPointerMove, onPointerUp } = useSheetResize({
diff --git a/src/web/src/components/community/machines/machine-list.tsx b/src/web/src/components/community/machines/machine-list.tsx
index 0ace2ab6e..e28a76905 100644
--- a/src/web/src/components/community/machines/machine-list.tsx
+++ b/src/web/src/components/community/machines/machine-list.tsx
@@ -8,6 +8,8 @@ import { useQueryClient } from "@tanstack/react-query"
import type { CommunityMachineSummary } from "@alook/shared"
import { isPresenceOnline } from "@alook/shared"
import { Button } from "@/components/ui/button"
+import { Card } from "@/components/ui/card"
+import { Skeleton } from "@/components/ui/skeleton"
import {
AlertDialog,
AlertDialogContent,
@@ -27,6 +29,27 @@ import { useBots } from "@/hooks/community/use-bots"
import { useCommunityStore, usePendingMachineTokenId } from "@/stores/community"
import { communityKeys } from "@/lib/query-keys"
+// Loading placeholder shaped like a real MachineCard (size-10 rounded-xl icon +
+// name row + meta lines + trailing kebab slot) so the list doesn't reflow when
+// data lands — replaces the old structureless muted box.
+function MachineCardSkeleton() {
+ return (
+ <Card className="flex flex-col gap-3 p-4">
+ <div className="flex items-start justify-between gap-3">
+ <div className="flex items-start gap-3">
+ <Skeleton className="size-10 shrink-0 rounded-xl" />
+ <div className="flex flex-col gap-2 py-0.5">
+ <Skeleton className="h-3.5 w-32 rounded" />
+ <Skeleton className="h-3 w-44 rounded" />
+ <Skeleton className="h-3 w-24 rounded" />
+ </div>
+ </div>
+ <Skeleton className="size-8 shrink-0 rounded-md" />
+ </div>
+ </Card>
+ )
+}
+
export function MachineList({ onBack }: { onBack?: () => void } = {}) {
const router = useRouter()
const searchParams = useSearchParams()
@@ -153,9 +176,9 @@ export function MachineList({ onBack }: { onBack?: () => void } = {}) {
<div className="flex min-h-0 flex-1 flex-col">
{backBar}
<div className="flex flex-col gap-3 p-6">
- {Array.from({ length: 3 }).map((_, i) => (
- <div key={i} className="h-22 animate-pulse rounded-lg border bg-muted/30" />
- ))}
+ <MachineCardSkeleton />
+ <MachineCardSkeleton />
+ <MachineCardSkeleton />
</div>
</div>
)
diff --git a/src/web/src/components/community/right-panel.tsx b/src/web/src/components/community/right-panel.tsx
index 926b315c3..8ae28f7da 100644
--- a/src/web/src/components/community/right-panel.tsx
+++ b/src/web/src/components/community/right-panel.tsx
@@ -4,8 +4,8 @@ import { useState } from "react"
import { Users, Pin, Search, MessagesSquare } from "lucide-react"
import { Input } from "@/components/ui/input"
import { onEnterSubmit } from "@/lib/ime"
-import { avatarInitial } from "@/lib/community/avatar"
import { Skeleton } from "@/components/ui/skeleton"
+import { Avatar } from "./avatar"
import { PanelShell } from "./panel-shell"
import { MemberList } from "./member-list"
import { Message } from "./message"
@@ -44,7 +44,10 @@ export function RightPanelContent({
onSetRole?: (name: string, role: Role) => void
onKickMember?: (memberId: string) => Promise<unknown> | void
myRole?: Role
- onJumpToMessage?: (id: string) => void
+ // Jump to a pinned message by its per-channel seq — routes through the same
+ // message-ref jump flow (scroll-in-place if loaded, else open the context
+ // sheet), so a click always gives feedback even for an out-of-window pin.
+ onJumpToMessage?: (seq: number) => void
onSearch?: (query: string) => void
}) {
if (kind === "members")
@@ -77,12 +80,13 @@ export function RightPanelContent({
pinned.map((m) => (
<button
key={m.id}
- onClick={() => onJumpToMessage?.(m.id)}
- className="flex w-full gap-2 rounded-md px-2 py-2 text-left hover:bg-accent"
+ onClick={() => m.seq != null && onJumpToMessage?.(m.seq)}
+ className="flex w-full items-center gap-2 rounded-md px-2 py-2 text-left hover:bg-accent"
>
- <div className="size-6 shrink-0 rounded-full bg-muted grid place-items-center text-xs font-medium">
- {m.authorAvatar ?? avatarInitial(m.authorName ?? "")}
- </div>
+ <span className="shrink-0">
+ <Avatar label={m.authorAvatar ?? "?"} seed={m.authorId} size={24} />
+ </span>
+
<div className="min-w-0 flex-1">
<div className="flex items-baseline gap-2">
<span className="text-sm font-medium">{m.authorName}</span>
@@ -104,14 +108,14 @@ export function RightPanelContent({
) : (
<>
<div className="mb-2 text-xs text-muted-foreground">{threads.length} threads</div>
- <div className="space-y-2">
+ <div className="space-y-1">
{threads.map((t) => (
<button
key={t.id}
onClick={() => onOpenThread(t.id)}
- className="flex w-full items-start gap-3 rounded-md border border-border bg-card p-3 text-left hover:bg-accent"
+ className="flex w-full items-start gap-3 rounded-md px-2 py-2 text-left hover:bg-accent"
>
- <MessagesSquare className="mt-1 size-4 shrink-0 text-muted-foreground" />
+ <MessagesSquare className="mt-0.5 size-4 shrink-0 text-muted-foreground" />
<div className="min-w-0 flex-1">
<div className="truncate text-sm font-medium">{t.name}</div>
<div className="truncate text-xs text-muted-foreground">
@@ -151,10 +155,10 @@ function PinnedListSkeleton() {
function ThreadListSkeleton() {
return (
- <div className="space-y-2">
+ <div className="space-y-1">
{Array.from({ length: 3 }).map((_, i) => (
- <div key={i} className="flex items-start gap-3 rounded-md border border-border bg-card p-3">
- <Skeleton className="mt-1 size-4 shrink-0 rounded" />
+ <div key={i} className="flex items-start gap-3 rounded-md px-2 py-2">
+ <Skeleton className="mt-0.5 size-4 shrink-0 rounded" />
<div className="flex min-w-0 flex-1 flex-col gap-2">
<Skeleton className="h-3.5 w-3/5 rounded" />
<Skeleton className="h-3 w-11/12 rounded" />