import React, { useState } from 'react'; import { Search, Filter, ArrowUpDown, ChevronRight } from 'lucide-react'; import { TEAMS } from '../data/mock.js'; const BU_LIST = ['All', 'Digital Products', 'Network Operations', 'Customer Experience']; const STATUS_LIST = ['All', 'healthy', 'at-risk', 'blocked']; const MATURITY_LIST = ['All', 'Foundation', 'Developing', 'Performing', 'Leading']; const STATUS_STYLE = { healthy: { dot: 'bg-green-500', badge: 'bg-green-50 text-green-700', label: 'Healthy' }, 'at-risk':{ dot: 'bg-amber-400', badge: 'bg-amber-50 text-amber-700', label: 'At Risk' }, blocked: { dot: 'bg-red-500', badge: 'bg-red-50 text-red-600', label: 'Blocked' }, }; const MATURITY_COLOR = { Foundation: 'bg-gray-100 text-gray-600', Developing: 'bg-blue-50 text-blue-700', Performing: 'bg-emerald-50 text-emerald-700', Leading: 'bg-navy-50 text-navy-700', }; /* Mini sparkline — SVG */ function Sparkline({ history, size = 40 }) { if (!history || history.length < 2) return null; const max = 4, min = 0; const w = size, h = 20; const pts = history.map((p, i) => { const x = (i / (history.length - 1)) * w; const y = h - ((p.score - min) / (max - min)) * h; return `${x},${y}`; }).join(' '); const lastScore = history[history.length - 1].score; const firstScore = history[0].score; const trending = lastScore >= firstScore; return ( ); } function TeamRow({ team, navigate }) { const s = STATUS_STYLE[team.status] || STATUS_STYLE.healthy; return ( ); } export default function TeamPortfolio({ engagement, navigate }) { const [search, setSearch] = useState(''); const [bu, setBu] = useState('All'); const [status, setStatus] = useState('All'); const [maturity, setMaturity] = useState('All'); const [sortBy, setSortBy] = useState('status'); let teams = TEAMS; if (search) teams = teams.filter(t => t.name.toLowerCase().includes(search.toLowerCase()) || t.bu.toLowerCase().includes(search.toLowerCase())); if (bu !== 'All') teams = teams.filter(t => t.bu === bu); if (status !== 'All') teams = teams.filter(t => t.status === status); if (maturity !== 'All') teams = teams.filter(t => t.maturityLevel === maturity); const sortFns = { status: (a, b) => { const o = { blocked: 0, 'at-risk': 1, healthy: 2 }; return (o[a.status]??3) - (o[b.status]??3); }, name: (a, b) => a.name.localeCompare(b.name), maturity: (a, b) => a.maturityScore - b.maturityScore, actions: (a, b) => b.openActions - a.openActions, session: (a, b) => new Date(b.lastSession) - new Date(a.lastSession), }; teams = [...teams].sort(sortFns[sortBy] || sortFns.status); const counts = { blocked: TEAMS.filter(t=>t.status==='blocked').length, 'at-risk': TEAMS.filter(t=>t.status==='at-risk').length, healthy: TEAMS.filter(t=>t.status==='healthy').length }; return (
{engagement?.client} — {TEAMS.length} teams across 3 Business Units
Showing {teams.length} of {TEAMS.length} teams