Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
feat(apps): give every app card the same height (MUL-9872) (#11208)
Jiayuan Zhange4b3fd1226f8
diff --git a/packages/views/apps/components/app-card.tsx b/packages/views/apps/components/app-card.tsxindex ef171215ed..b81c4f377e 100644--- a/packages/views/apps/components/app-card.tsx+++ b/packages/views/apps/components/app-card.tsx@@ -1,47 +1,54 @@"use client";import type { ReactNode } from "react";+import { ChevronRight } from "@multica/ui/icons";import { ComposioToolkitLogo } from "../../common/composio-toolkit-logo";import { AppLink } from "../../navigation";/**- * One app in the directory. The name is the card's link and covers the whole- * card; `action` sits above it so its button keeps its own click.+ * One app in the directory. Every card is the same height whatever it holds —+ * the name, at most one `meta` line, and one trailing slot — so the grid's rows+ * line up. The name is the card's link and covers the whole card; `action`+ * sits above it so its controls keep their own clicks. A card without an+ * action shows a chevron on hover instead.*/export function AppCard({slug,name,logo,href,- subtitle,+ meta,action,- children,}: {slug: string;name: string;logo?: string;href: string;- subtitle?: ReactNode;+ /** One line under the name; it must truncate itself. */+ meta?: ReactNode;action?: ReactNode;- children?: ReactNode;}) {return (- <li className="relative flex min-w-0 flex-col gap-2 rounded-lg border border-surface-border bg-surface p-3 transition-colors hover:bg-surface-hover">- <div className="flex min-w-0 items-start gap-3">- <ComposioToolkitLogo slug={slug} name={name} fallbackLogo={logo} />- <div className="min-w-0 flex-1">- <AppLink- href={href}- newTabTitle={name}- className="block truncate text-body font-medium outline-none after:absolute after:inset-0 after:rounded-lg focus-visible:after:ring-2 focus-visible:after:ring-ring"- >- {name}- </AppLink>- {subtitle ? <p className="truncate text-caption text-muted-foreground">{subtitle}</p> : null}- </div>- {action ? <div className="relative z-10 shrink-0">{action}</div> : null}+ <li className="group/app-card relative flex h-16 min-w-0 items-center gap-3 rounded-lg border border-surface-border bg-surface px-3 transition-colors hover:bg-surface-hover">+ <ComposioToolkitLogo slug={slug} name={name} fallbackLogo={logo} className="h-9 w-9 rounded-sm" />+ <div className="min-w-0 flex-1">+ <AppLink+ href={href}+ newTabTitle={name}+ className="block truncate text-body font-medium outline-none after:absolute after:inset-0 after:rounded-lg focus-visible:after:ring-2 focus-visible:after:ring-ring"+ >+ {name}+ </AppLink>+ {meta ? <p className="flex min-w-0 text-caption text-muted-foreground">{meta}</p> : null}</div>- {children ? <div className="min-w-0 space-y-1 text-caption text-muted-foreground">{children}</div> : null}+ {action ? (+ <div className="relative z-10 flex shrink-0 items-center">{action}</div>+ ) : (+ <ChevronRight+ aria-hidden="true"+ className="size-4 shrink-0 text-faint-foreground opacity-0 transition-opacity group-focus-within/app-card:opacity-100 group-hover/app-card:opacity-100"+ />+ )}</li>);}diff --git a/packages/views/apps/components/apps-page.test.tsx b/packages/views/apps/components/apps-page.test.tsxindex 3599656776..c06e589337 100644--- a/packages/views/apps/components/apps-page.test.tsx+++ b/packages/views/apps/components/apps-page.test.tsx@@ -20,7 +20,11 @@ vi.mock("@multica/core/paths", () => ({useWorkspacePaths: () => ({ apps: () => "/acme/apps", appDetail: (slug: string) => `/acme/apps/${slug}` }),}));vi.mock("@multica/core/workspace/hooks", () => ({- useActorName: () => ({ getActorName: (_type: string, id: string) => `Name ${id}` }),+ useActorName: () => ({+ getActorName: (_type: string, id: string) => `Name ${id}`,+ getActorInitials: () => "N",+ getActorAvatarUrl: () => null,+ }),}));vi.mock("@multica/core/auth", () => {const state = { user: { id: "me" } };@@ -106,6 +110,9 @@ describe("AppsPage", () => {const list = screen.getAllByRole("list")[0];expect(screen.getByRole("tab", { name: /Needs attention/ })).toHaveTextContent("2");expect(within(list!).getByRole("link", { name: "Notion" })).toHaveAttribute("href", "/acme/apps/notion");+ // A card with nothing to do names its agents in place of an action.+ expect(within(list!).getAllByRole("img", { name: /^Used by / }).map((el) => el.getAttribute("aria-label")))+ .toEqual(["Used by Name a1"]);expect(screen.getByRole("heading", { name: "Popular in Acme" })).toBeInTheDocument();expect(screen.getByRole("link", { name: "Linear" })).toBeInTheDocument();});diff --git a/packages/views/apps/components/directory-card.tsx b/packages/views/apps/components/directory-card.tsxindex 9c50b74a16..06a88cc97d 100644--- a/packages/views/apps/components/directory-card.tsx+++ b/packages/views/apps/components/directory-card.tsx@@ -1,10 +1,12 @@"use client";import { Loader2 } from "@multica/ui/icons";-import { Button, buttonVariants } from "@multica/ui/components/ui/button";+import { Button } from "@multica/ui/components/ui/button";+import { Tooltip, TooltipContent, TooltipTrigger } from "@multica/ui/components/ui/tooltip";import { useWorkspacePaths } from "@multica/core/paths";import { useActorName } from "@multica/core/workspace/hooks";import type { AppAccountScope } from "@multica/core/types";+import { AgentAvatarStack } from "../../agents/components/agent-avatar-stack";import { UpgradeToAddLink } from "../../billing";import { useT } from "../../i18n";import type { DirectoryApp } from "../lib/directory";@@ -21,7 +23,7 @@ export interface DirectoryCardHandlers {needsUpgrade: (slug: string) => boolean;}-/** An app in use: whose account it acts as, where that stands, and who uses it. */+/** An app in use: where its account stands, whose it is, and what to do or who uses it. */export function DirectoryCard({ app, handlers }: { app: DirectoryApp; handlers: DirectoryCardHandlers }) {const { t } = useT("settings");const paths = useWorkspacePaths();@@ -38,14 +40,14 @@ export function DirectoryCard({ app, handlers }: { app: DirectoryApp; handlers:const asked = app.request && app.status === "requested"? t(($) => $.connected_apps.hub.members_asked, { count: app.request.requested_by.length }): undefined;- const usage =- app.agentIds.length > 0- ? t(($) => $.connected_apps.hub.used_by, { agents: app.agentIds.map((id) => getActorName("agent", id)).join(", ") })- : app.request && app.request.agent_ids.length > 0- ? t(($) => $.connected_apps.hub.wanted_by, { agents: app.request.agent_ids.map((id) => getActorName("agent", id)).join(", ") })- : app.request- ? t(($) => $.connected_apps.hub.asked_by, { names: app.request.requested_by.map((id) => getActorName("member", id)).join(", ") })- : null;+ const hasAction = !!app.action && app.action.kind !== "set_up";+ // With nothing to do, the trailing slot shows the agents behind the app.+ const using = app.agentIds.length > 0;+ const agentIds = using ? app.agentIds : (app.request?.agent_ids ?? []);+ const agents = agentIds.map((id) => getActorName("agent", id)).join(", ");+ const usage = using+ ? t(($) => $.connected_apps.hub.used_by, { agents })+ : t(($) => $.connected_apps.hub.wanted_by, { agents });return (<AppCard@@ -53,31 +55,46 @@ export function DirectoryCard({ app, handlers }: { app: DirectoryApp; handlers:name={app.name}logo={app.entry?.logo}href={paths.appDetail(app.slug)}- subtitle={scopeLine}- action={<DirectoryAction app={app} handlers={handlers} />}- >- {app.status ? <p className="flex min-w-0"><AppStatusLabel status={app.status} detail={asked} /></p> : null}- {usage ? <p className="truncate">{usage}</p> : null}- </AppCard>+ meta={+ app.status+ ? <AppStatusLabel status={app.status} detail={asked ?? scopeLine} />+ : <span className="truncate">{scopeLine}</span>+ }+ action={+ hasAction ? (+ <DirectoryAction app={app} handlers={handlers} />+ ) : agentIds.length > 0 ? (+ <Tooltip>+ <TooltipTrigger+ render={+ <span+ role="img"+ tabIndex={0}+ aria-label={usage}+ className="inline-flex rounded-full outline-none focus-visible:ring-2 focus-visible:ring-ring"+ />+ }+ >+ <AgentAvatarStack agentIds={agentIds} />+ </TooltipTrigger>+ <TooltipContent>{usage}</TooltipContent>+ </Tooltip>+ ) : undefined+ }+ />);}export function SetUpCard({ app }: { app: DirectoryApp }) {- const { t } = useT("settings");const paths = useWorkspacePaths();+ const category = app.entry?.category;return (<AppCardslug={app.slug}name={app.name}logo={app.entry?.logo}href={paths.appDetail(app.slug)}- subtitle={app.entry?.category}- // The whole card already links to the app; this only labels it.- action={- <span aria-hidden="true" className={buttonVariants({ variant: "outline", size: "xs" })}>- {t(($) => $.connected_apps.hub.set_up)}- </span>- }+ meta={category ? <span className="truncate">{category}</span> : undefined}/>);}diff --git a/packages/views/locales/en/settings.json b/packages/views/locales/en/settings.jsonindex b5a1232d5c..e73df9d2ce 100644--- a/packages/views/locales/en/settings.json+++ b/packages/views/locales/en/settings.json@@ -2042,10 +2042,8 @@"scope_both": "Team and personal accounts","used_by": "Used by {{agents}}","wanted_by": "Wanted by {{agents}}",- "asked_by": "Asked for by {{names}}","members_asked_one": "{{count}} member asked","members_asked_other": "{{count}} members asked",- "set_up": "Set up","connect": "Connect","reconnect": "Reconnect","ask_admin": "Ask an admin",diff --git a/packages/views/locales/es/settings.json b/packages/views/locales/es/settings.jsonindex b47773dd38..8bbee0cc3a 100644--- a/packages/views/locales/es/settings.json+++ b/packages/views/locales/es/settings.json@@ -2042,10 +2042,8 @@"scope_both": "Cuentas del equipo y personales","used_by": "La usan {{agents}}","wanted_by": "La quieren {{agents}}",- "asked_by": "Solicitada por {{names}}","members_asked_one": "{{count}} miembro la solicitó","members_asked_other": "{{count}} miembros la solicitaron",- "set_up": "Configurar","connect": "Conectar","reconnect": "Volver a conectar","ask_admin": "Pedir a un administrador",diff --git a/packages/views/locales/fr/settings.json b/packages/views/locales/fr/settings.jsonindex eb147f5b3e..ea6dda3690 100644--- a/packages/views/locales/fr/settings.json+++ b/packages/views/locales/fr/settings.json@@ -2042,10 +2042,8 @@"scope_both": "Comptes d'équipe et personnels","used_by": "Utilisée par {{agents}}","wanted_by": "Demandée par {{agents}}",- "asked_by": "Demandée par {{names}}","members_asked_one": "{{count}} membre l'a demandée","members_asked_other": "{{count}} membres l'ont demandée",- "set_up": "Configurer","connect": "Connecter","reconnect": "Reconnecter","ask_admin": "Demander à un admin",diff --git a/packages/views/locales/ja/settings.json b/packages/views/locales/ja/settings.jsonindex 102ac8ffac..1ec47f1351 100644--- a/packages/views/locales/ja/settings.json+++ b/packages/views/locales/ja/settings.json@@ -2021,9 +2021,7 @@"scope_both": "チームと個人のアカウント","used_by": "{{agents}} が使用中","wanted_by": "{{agents}} が使用を希望",- "asked_by": "{{names}} が依頼","members_asked_other": "{{count}} 人のメンバーが依頼",- "set_up": "設定","connect": "接続","reconnect": "再接続","ask_admin": "管理者に依頼",diff --git a/packages/views/locales/ko/settings.json b/packages/views/locales/ko/settings.jsonindex 7c279b8b08..63d392db2a 100644--- a/packages/views/locales/ko/settings.json+++ b/packages/views/locales/ko/settings.json@@ -2021,9 +2021,7 @@"scope_both": "팀 계정 및 개인 계정","used_by": "{{agents}} 사용 중","wanted_by": "{{agents}}이(가) 사용 희망",- "asked_by": "{{names}}의 요청","members_asked_other": "멤버 {{count}}명이 요청함",- "set_up": "설정","connect": "연결","reconnect": "다시 연결","ask_admin": "관리자에게 요청",diff --git a/packages/views/locales/ru/settings.json b/packages/views/locales/ru/settings.jsonindex 5ac7129e74..8f8e431725 100644--- a/packages/views/locales/ru/settings.json+++ b/packages/views/locales/ru/settings.json@@ -2084,12 +2084,10 @@"scope_both": "Аккаунты команды и личные","used_by": "Используют: {{agents}}","wanted_by": "Нужно агентам: {{agents}}",- "asked_by": "Запросили: {{names}}","members_asked_one": "Запросил {{count}} участник","members_asked_few": "Запросили {{count}} участника","members_asked_many": "Запросили {{count}} участников","members_asked_other": "Запросили {{count}} участника",- "set_up": "Настроить","connect": "Подключить","reconnect": "Переподключить","ask_admin": "Попросить администратора",diff --git a/packages/views/locales/zh-Hans/settings.json b/packages/views/locales/zh-Hans/settings.jsonindex 3bb52fcb54..d56db07e27 100644--- a/packages/views/locales/zh-Hans/settings.json+++ b/packages/views/locales/zh-Hans/settings.json@@ -2021,9 +2021,7 @@"scope_both": "团队和个人账号","used_by": "{{agents}} 在用","wanted_by": "{{agents}} 想用",- "asked_by": "{{names}} 发起了请求","members_asked_other": "{{count}} 位成员发起了请求",- "set_up": "设置","connect": "连接","reconnect": "重新连接","ask_admin": "请管理员连接",diff --git a/packages/views/locales/zh-Hant/settings.json b/packages/views/locales/zh-Hant/settings.jsonindex f56b651af2..816930e730 100644--- a/packages/views/locales/zh-Hant/settings.json+++ b/packages/views/locales/zh-Hant/settings.json@@ -2021,9 +2021,7 @@"scope_both": "團隊和個人帳號","used_by": "{{agents}} 在用","wanted_by": "{{agents}} 想用",- "asked_by": "{{names}} 提出了請求","members_asked_other": "{{count}} 位成員提出了請求",- "set_up": "設定","connect": "連線","reconnect": "重新連線","ask_admin": "請管理員連線",