@@ -4,12 +4,14 @@ import { useEffect, useState } from "react";
44import { useRouter } from "next/navigation" ;
55import { House } from "lucide-react" ;
66import { useAuth } from "@/components/dashboard/AuthContext" ;
7+ import { getOrgFleet } from "@/lib/dashboard/org-fleet" ;
78import DashboardPageHeader from "@/components/dashboard/DashboardPageHeader" ;
89import FirstRunChecklist , {
910 FIRST_RUN_CHANGED_EVENT ,
1011 FIRST_RUN_DISMISSED_KEY ,
1112} from "@/components/dashboard/FirstRunChecklist" ;
1213import HomeCommandBar from "@/components/dashboard/HomeCommandBar" ;
14+ import AppsHealthPanel from "@/components/dashboard/AppsHealthPanel" ;
1315import ConsumedAppsPanel from "@/components/dashboard/ConsumedAppsPanel" ;
1416import ActivityPanel from "@/components/dashboard/ActivityPanel" ;
1517import SectionHeader from "@/components/dashboard/SectionHeader" ;
@@ -26,14 +28,18 @@ function HomePageHeader() {
2628
2729// ─── Home Page ───
2830//
29- // The consumer home: what you're using on the network and what it costs.
30- // (Operator/publishing surfaces — deployed apps, deploy onboarding — live in a
31- // separate, stacked PR.) Composition:
32- // 1. Command bar — org readout + greeting
33- // 2. Get started — auto-detecting onboarding: create your account, get your
34- // API key, call an app
35- // 3. Usage (spend on the apps you call) beside Recent activity (your own
36- // calls — a live preview of /calls)
31+ // "Mission control" rethink: an organization has two relationships with the
32+ // network — apps it DEPLOYS (which orchestrators serve on its behalf) and apps
33+ // it CONSUMES (the calls it makes across the network, mostly to apps it didn't
34+ // deploy). The Home is organized around those two directions, not personas.
35+ // Composition:
36+ // 1. Command bar — org readout + greeting + an adaptive attention line
37+ // naming the single most urgent thing on arrival
38+ // 2. Get started — auto-detecting onboarding, until the loop is done
39+ // 3. Two ledgers — Deployed apps (count + their 7-day call volume) beside
40+ // Usage (spend on the apps you call). Each leads with its own summary.
41+ // 4. Recent activity — the organization's own calls (what counts toward
42+ // its usage); a live preview of /calls
3743
3844export default function HomePage ( ) {
3945 const { isConnected, isLoading, user } = useAuth ( ) ;
@@ -97,6 +103,10 @@ export default function HomePage() {
97103 const organization = "Flipbook" ;
98104 const firstName = user ?. name ?. split ( " " ) [ 0 ] ?? "there" ;
99105
106+ // The Fleet anchors the console split; a consumer-only org with no deployed
107+ // apps drops to a single column so the Vitals rail carries the page.
108+ const hasApps = getOrgFleet ( ) . count > 0 ;
109+
100110 // Signed-out users are redirected to / via the useEffect
101111 // above; render nothing in the meantime (one frame max) so they don't see
102112 // a flash of organization-mock data before the redirect lands.
@@ -131,8 +141,8 @@ export default function HomePage() {
131141 < HomeCommandBar organization = { organization } firstName = { firstName } />
132142 </ div >
133143
134- { /* Onboarding — auto-detecting: get your API key , then call an app .
135- Shown until dismissed; full-width above the panels . */ }
144+ { /* Onboarding — auto-detecting: deploy an example app , then call it .
145+ Shown until dismissed; full-width above the console split . */ }
136146 { showFirstRun && (
137147 < div className = "home-rise" style = { { animationDelay : "60ms" } } >
138148 < SectionHeader
@@ -151,13 +161,27 @@ export default function HomePage() {
151161 </ div >
152162 ) }
153163
154- { /* Usage (what you spend calling apps) beside Recent activity (your
155- own calls — a live preview of /calls). Even-height pair. */ }
156- < div
157- className = "home-rise mt-7 grid grid-cols-1 items-stretch gap-5 lg:grid-cols-2"
158- style = { { animationDelay : "120ms" } }
159- >
160- < ConsumedAppsPanel organization = { organization } />
164+ { /* The two ledgers — Deployed apps (what you've published to the
165+ network) beside Usage (what you consume from it). Each leads with
166+ its own summary, so there's no separate hero band. On a
167+ consumer-only org with no deployed apps, Usage carries the row. */ }
168+ { hasApps ? (
169+ < div
170+ className = "home-rise mt-7 grid grid-cols-1 items-stretch gap-5 lg:grid-cols-2"
171+ style = { { animationDelay : "120ms" } }
172+ >
173+ < AppsHealthPanel />
174+ < ConsumedAppsPanel organization = { organization } />
175+ </ div >
176+ ) : (
177+ < div className = "home-rise mt-7" style = { { animationDelay : "120ms" } } >
178+ < ConsumedAppsPanel organization = { organization } />
179+ </ div >
180+ ) }
181+
182+ { /* Recent activity — the organization's own recent calls (what
183+ counts toward its usage); a live preview of /calls. */ }
184+ < div className = "home-rise mt-7" style = { { animationDelay : "220ms" } } >
161185 < ActivityPanel />
162186 </ div >
163187 </ div >
0 commit comments