Gradient Team view: a product's AI agents as live gradient cards
A new "Team" page (route /team, sidebar entry) showing a product and its AI agents as gradient cards: a hero card with the product's shared identity summary + team/agent counts, then one gradient card per AI agent (role-themed gradient, monogram, role/team, autonomy, skills) with live run status via useAgentActivity. Gradients are a deliberate, scoped exception to the app's flat house style, used only on this showcase view. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -13,6 +13,7 @@ import { ReviewsPage } from '@/pages/ReviewsPage'
|
||||
import { SeatsPage } from '@/pages/SeatsPage'
|
||||
import { SkillsPage } from '@/pages/SkillsPage'
|
||||
import { StructurePage } from '@/pages/StructurePage'
|
||||
import { TeamPage } from '@/pages/TeamPage'
|
||||
import { useAuth } from '@/store/auth'
|
||||
|
||||
export default function App() {
|
||||
@@ -23,6 +24,7 @@ export default function App() {
|
||||
<Routes>
|
||||
<Route path="/login" element={token ? <Navigate to="/" replace /> : <LoginPage />} />
|
||||
<Route path="/" element={token ? <BoardPage /> : <Navigate to="/login" replace />} />
|
||||
<Route path="/team" element={token ? <TeamPage /> : <Navigate to="/login" replace />} />
|
||||
<Route path="/seats" element={token ? <SeatsPage /> : <Navigate to="/login" replace />} />
|
||||
<Route path="/reviews" element={token ? <ReviewsPage /> : <Navigate to="/login" replace />} />
|
||||
<Route path="/analytics" element={token ? <AnalyticsPage /> : <Navigate to="/login" replace />} />
|
||||
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
Network,
|
||||
Package,
|
||||
ShieldCheck,
|
||||
Sparkles,
|
||||
Users,
|
||||
} from 'lucide-react'
|
||||
import { Button } from '@/components/ui/button'
|
||||
@@ -42,6 +43,7 @@ export function AppShell({ children }: { children: ReactNode }) {
|
||||
|
||||
<nav className="flex flex-1 flex-col gap-1 p-3">
|
||||
<NavItem icon={LayoutDashboard} label="Board" to="/" />
|
||||
<NavItem icon={Sparkles} label="Team" to="/team" />
|
||||
<NavItem icon={Inbox} label="Cartable" to="/cartable" />
|
||||
<NavItem icon={ShieldCheck} label="Review inbox" to="/reviews" />
|
||||
<NavItem icon={Bot} label="AI seats" to="/seats" />
|
||||
|
||||
@@ -0,0 +1,201 @@
|
||||
import { useCallback, useEffect, useMemo, useState } from 'react'
|
||||
import { Sparkles } from 'lucide-react'
|
||||
import { toast } from 'sonner'
|
||||
import { AppShell } from '@/components/AppShell'
|
||||
import type { FaceState } from '@/components/AgentFace'
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectGroup,
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from '@/components/ui/select'
|
||||
import { api } from '@/lib/api'
|
||||
import { useAgentActivity } from '@/lib/useAgentActivity'
|
||||
import { useAuth } from '@/store/auth'
|
||||
import './team.css'
|
||||
|
||||
interface Product {
|
||||
id: string
|
||||
name: string
|
||||
kind: string
|
||||
}
|
||||
|
||||
interface Team {
|
||||
id: string
|
||||
name: string
|
||||
productId: string | null
|
||||
}
|
||||
|
||||
interface SeatRow {
|
||||
id: string
|
||||
teamId: string
|
||||
roleName: string
|
||||
state: string
|
||||
agentId: string | null
|
||||
}
|
||||
|
||||
interface Agent {
|
||||
id: string
|
||||
name: string
|
||||
monogram: string | null
|
||||
autonomy: string
|
||||
skillKeys: string[]
|
||||
}
|
||||
|
||||
interface AgentCard {
|
||||
seatId: string
|
||||
role: string
|
||||
team: string
|
||||
agent: Agent
|
||||
}
|
||||
|
||||
/** Deterministic gradient + avatar ink per role family. Gradients are a deliberate exception to the
|
||||
* app's flat house style — used only on this showcase team view. */
|
||||
function styleFor(role: string): { bg: string; ink: string } {
|
||||
const n = role.toLowerCase()
|
||||
if (/(product|owner|\bpo\b|\bpm\b)/.test(n)) return { bg: 'linear-gradient(135deg,#6366f1,#8b5cf6)', ink: '#5b21b6' }
|
||||
if (/(analyst|analysis|business)/.test(n)) return { bg: 'linear-gradient(135deg,#3b82f6,#06b6d4)', ink: '#0e7490' }
|
||||
if (/(backend|\bapi\b|server)/.test(n)) return { bg: 'linear-gradient(135deg,#4f46e5,#2563eb)', ink: '#3730a3' }
|
||||
if (/(frontend|front|web|client)/.test(n)) return { bg: 'linear-gradient(135deg,#7c3aed,#db2777)', ink: '#9d174d' }
|
||||
if (/(design|ux|ui)/.test(n)) return { bg: 'linear-gradient(135deg,#c026d3,#f43f5e)', ink: '#9d174d' }
|
||||
if (/(qa|test|quality)/.test(n)) return { bg: 'linear-gradient(135deg,#0d9488,#10b981)', ink: '#0f766e' }
|
||||
return { bg: 'linear-gradient(135deg,#475569,#6366f1)', ink: '#334155' }
|
||||
}
|
||||
|
||||
const STATUS_LABEL: Record<FaceState, string> = {
|
||||
idle: 'idle · awaiting work',
|
||||
thinking: 'queued',
|
||||
working: 'working…',
|
||||
review: 'awaiting review',
|
||||
done: 'just delivered',
|
||||
failed: 'run failed',
|
||||
}
|
||||
|
||||
function summaryOf(identity: string | null): string {
|
||||
if (!identity) return 'No product identity yet — set a PRODUCT.md to give the team shared context.'
|
||||
const m = identity.match(/^summary:\s*(.+)$/m)
|
||||
return m ? m[1].trim() : 'Shared PRODUCT.md identity is set for this product.'
|
||||
}
|
||||
|
||||
/** A gradient-card overview of a product and its AI team — the product, its agents, and live status. */
|
||||
export function TeamPage() {
|
||||
const organizationId = useAuth((s) => s.organizationId)
|
||||
const [products, setProducts] = useState<Product[]>([])
|
||||
const [productId, setProductId] = useState<string | null>(null)
|
||||
const [summary, setSummary] = useState('')
|
||||
const [cards, setCards] = useState<AgentCard[]>([])
|
||||
const [teamCount, setTeamCount] = useState(0)
|
||||
|
||||
useEffect(() => {
|
||||
if (!organizationId) return
|
||||
void (async () => {
|
||||
try {
|
||||
const list = await api.get<Product[]>(`/api/orgboard/products?organizationId=${organizationId}`)
|
||||
setProducts(list)
|
||||
setProductId((cur) => cur ?? list[0]?.id ?? null)
|
||||
} catch (err) {
|
||||
toast.error((err as Error).message)
|
||||
}
|
||||
})()
|
||||
}, [organizationId])
|
||||
|
||||
const loadProduct = useCallback(async (pid: string) => {
|
||||
try {
|
||||
const [teams, identity] = await Promise.all([
|
||||
api.get<Team[]>(`/api/orgboard/teams?organizationId=${organizationId}`),
|
||||
api.get<{ identity: string | null }>(`/api/orgboard/products/${pid}/identity`).catch(() => ({ identity: null })),
|
||||
])
|
||||
const productTeams = teams.filter((t) => t.productId === pid)
|
||||
setTeamCount(productTeams.length)
|
||||
setSummary(summaryOf(identity.identity))
|
||||
|
||||
const built: AgentCard[] = []
|
||||
for (const team of productTeams) {
|
||||
const seats = await api.get<SeatRow[]>(`/api/orgboard/seats?teamId=${team.id}`)
|
||||
for (const seat of seats.filter((s) => s.state === 'Ai' && s.agentId)) {
|
||||
const agent = await api.get<Agent>(`/api/orgboard/seats/${seat.id}/agent`).catch(() => null)
|
||||
if (agent) built.push({ seatId: seat.id, role: seat.roleName, team: team.name, agent })
|
||||
}
|
||||
}
|
||||
setCards(built)
|
||||
} catch (err) {
|
||||
toast.error((err as Error).message)
|
||||
}
|
||||
}, [organizationId])
|
||||
|
||||
useEffect(() => {
|
||||
if (productId) void loadProduct(productId)
|
||||
}, [productId, loadProduct])
|
||||
|
||||
const product = products.find((p) => p.id === productId) ?? null
|
||||
const stateFor = useAgentActivity(organizationId, useMemo(() => cards.map((c) => c.agent.id), [cards]))
|
||||
|
||||
return (
|
||||
<AppShell>
|
||||
<div className="mx-auto max-w-5xl p-6">
|
||||
<header className="mb-5 flex items-center justify-between gap-4">
|
||||
<h1 className="flex items-center gap-2 text-2xl font-semibold tracking-tight">
|
||||
<Sparkles className="size-6" /> Team
|
||||
</h1>
|
||||
{products.length > 0 && (
|
||||
<Select value={productId ?? ''} onValueChange={setProductId}>
|
||||
<SelectTrigger className="w-56"><SelectValue placeholder="Pick a product" /></SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectGroup>
|
||||
{products.map((p) => <SelectItem key={p.id} value={p.id}>{p.name}</SelectItem>)}
|
||||
</SelectGroup>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
)}
|
||||
</header>
|
||||
|
||||
{product && (
|
||||
<div className="team-hero">
|
||||
<div className="team-orb" />
|
||||
<span className="team-tag">Product · shared identity</span>
|
||||
<h3>{product.name}</h3>
|
||||
<p>{summary}</p>
|
||||
<div className="team-stats">
|
||||
<div><b>{teamCount}</b><span>teams</span></div>
|
||||
<div><b>{cards.length}</b><span>AI agents</span></div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="team-grid">
|
||||
{cards.map((c) => {
|
||||
const s = styleFor(c.role)
|
||||
const face = stateFor(c.agent.id)
|
||||
const active = face === 'working' || face === 'thinking'
|
||||
return (
|
||||
<div key={c.seatId} className="team-card" style={{ background: s.bg }}>
|
||||
<div className="team-sheen" />
|
||||
<div className="team-top">
|
||||
<div className="team-avatar" style={{ color: s.ink }}>{c.agent.monogram || c.agent.name.slice(0, 2).toUpperCase()}</div>
|
||||
<span className="team-auto">{c.agent.autonomy}</span>
|
||||
</div>
|
||||
<div className="team-name">{c.agent.name}</div>
|
||||
<div className="team-role">{c.role} · {c.team}</div>
|
||||
<div className="team-chips">
|
||||
{c.agent.skillKeys.slice(0, 3).map((k) => <span key={k}>{k}</span>)}
|
||||
{c.agent.skillKeys.length === 0 && <span>no skills yet</span>}
|
||||
</div>
|
||||
<div className="team-status">
|
||||
<span className={`team-dot${active ? ' team-dot-on' : ''}`} /> {STATUS_LABEL[face]}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
|
||||
{cards.length === 0 && product && (
|
||||
<p className="mt-4 text-sm text-muted-foreground">
|
||||
No AI agents on {product.name} yet — staff its seats on the AI seats page.
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</AppShell>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
/* Gradient team view. Gradients are a deliberate exception to the app's flat house style, used only
|
||||
* on this showcase page (per the user's request). Cards carry their own saturated background, so they
|
||||
* read on any host theme. */
|
||||
.team-hero {
|
||||
position: relative;
|
||||
border-radius: 20px;
|
||||
padding: 22px 24px;
|
||||
color: #fff;
|
||||
overflow: hidden;
|
||||
margin-bottom: 18px;
|
||||
background: linear-gradient(135deg, #1e1b4b 0%, #4338ca 55%, #6366f1 100%);
|
||||
}
|
||||
.team-orb {
|
||||
position: absolute;
|
||||
right: -40px;
|
||||
top: -40px;
|
||||
width: 180px;
|
||||
height: 180px;
|
||||
border-radius: 50%;
|
||||
background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.25), transparent 60%);
|
||||
}
|
||||
.team-tag {
|
||||
display: inline-block;
|
||||
font-size: 11px;
|
||||
letter-spacing: 0.12em;
|
||||
text-transform: uppercase;
|
||||
background: rgba(255, 255, 255, 0.18);
|
||||
padding: 4px 10px;
|
||||
border-radius: 999px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.team-hero h3 { margin: 0 0 6px; font-size: 22px; font-weight: 600; }
|
||||
.team-hero p { margin: 0 0 14px; font-size: 13.5px; line-height: 1.55; color: rgba(255, 255, 255, 0.85); max-width: 600px; }
|
||||
.team-stats { display: flex; gap: 22px; flex-wrap: wrap; }
|
||||
.team-stats > div b { font-size: 20px; font-weight: 600; display: block; line-height: 1; }
|
||||
.team-stats > div span { font-size: 11.5px; color: rgba(255, 255, 255, 0.75); }
|
||||
|
||||
.team-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
|
||||
gap: 14px;
|
||||
}
|
||||
.team-card {
|
||||
position: relative;
|
||||
border-radius: 18px;
|
||||
padding: 16px 16px 14px;
|
||||
color: #fff;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 8px 24px -12px rgba(30, 27, 75, 0.5);
|
||||
transition: transform 0.18s ease, box-shadow 0.18s ease;
|
||||
}
|
||||
.team-card:hover { transform: translateY(-4px); box-shadow: 0 16px 30px -14px rgba(30, 27, 75, 0.6); }
|
||||
.team-sheen {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
pointer-events: none;
|
||||
background: radial-gradient(120px 80px at 85% 0%, rgba(255, 255, 255, 0.22), transparent 70%);
|
||||
}
|
||||
.team-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
|
||||
.team-avatar {
|
||||
width: 46px;
|
||||
height: 46px;
|
||||
border-radius: 30%;
|
||||
background: rgba(255, 255, 255, 0.92);
|
||||
display: grid;
|
||||
place-items: center;
|
||||
font-weight: 700;
|
||||
font-size: 15px;
|
||||
animation: team-breathe 3.6s ease-in-out infinite;
|
||||
}
|
||||
.team-auto {
|
||||
font-size: 10.5px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.04em;
|
||||
text-transform: uppercase;
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
padding: 4px 9px;
|
||||
border-radius: 999px;
|
||||
}
|
||||
.team-name { font-size: 17px; font-weight: 600; line-height: 1.1; }
|
||||
.team-role { font-size: 12px; color: rgba(255, 255, 255, 0.82); margin: 2px 0 12px; }
|
||||
.team-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
|
||||
.team-chips span { font-size: 10.5px; background: rgba(255, 255, 255, 0.18); padding: 3px 8px; border-radius: 7px; }
|
||||
.team-status { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: rgba(255, 255, 255, 0.85); }
|
||||
.team-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, 0.85); }
|
||||
.team-dot-on { animation: team-pulse 1.6s infinite; }
|
||||
|
||||
@keyframes team-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
|
||||
@keyframes team-pulse {
|
||||
0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.55); }
|
||||
70% { box-shadow: 0 0 0 7px rgba(255, 255, 255, 0); }
|
||||
100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.team-avatar, .team-dot-on { animation: none; }
|
||||
}
|
||||
Reference in New Issue
Block a user