Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions app/(shell)/focus/FocusModeClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ interface FocusModeClientProps {
founderReadiness?: FounderReadiness | null;
/** Owner-facing First-Light readiness (ALL owners) — drives the momentum strip. */
firstLightReadiness?: FirstLightReadiness | null;
/** F2: brief continuity — carry-over since the owner's last visit (counts only). */
briefContinuity?: { snoozedCount: number; awaitingReplyCount: number } | null;
}

type ActionDecision = "approved" | "skipped" | "dismissed";
Expand Down Expand Up @@ -269,6 +271,7 @@ export function FocusModeClient({
isFounder = false,
founderReadiness = null,
firstLightReadiness = null,
briefContinuity = null,
}: FocusModeClientProps) {
const router = useRouter();
const copy = getVerticalCopy(vertical);
Expand Down Expand Up @@ -926,6 +929,29 @@ export function FocusModeClient({
{!isFounder && firstLightReadiness && (
<FirstLightMomentumStrip readiness={firstLightReadiness} />
)}
{/* F2: brief continuity — the brief "remembers" overnight. Static, counts only,
renders ONLY when there's real carry-over (no clutter on an empty board). */}
{briefContinuity &&
(briefContinuity.awaitingReplyCount > 0 || briefContinuity.snoozedCount > 0) && (
<div
data-brf="brief-continuity"
className="mb-4 flex flex-wrap items-center gap-x-4 gap-y-1.5 rounded-xl border border-stone-700/50 bg-stone-900/40 px-4 py-2.5 text-xs text-stone-300"
>
<span className="font-semibold text-stone-200">Since you were last here</span>
{briefContinuity.awaitingReplyCount > 0 && (
<span className="inline-flex items-center gap-1.5">
<Send className="h-3.5 w-3.5 text-amber-400" aria-hidden />
{briefContinuity.awaitingReplyCount} awaiting reply
</span>
)}
{briefContinuity.snoozedCount > 0 && (
<span className="inline-flex items-center gap-1.5">
<Clock className="h-3.5 w-3.5 text-stone-400" aria-hidden />
{briefContinuity.snoozedCount} snoozed, coming back
</span>
)}
</div>
)}
{simpleView ? (
<>
{/* Simple mode (reframe v2): greeting + the Single-Action Queue ONLY - ONE
Expand Down
53 changes: 37 additions & 16 deletions app/(shell)/focus/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -248,29 +248,49 @@ export default async function FocusPage({ searchParams }: { searchParams: Search
let clientCount = 0;
let pendingRecoveryCount = 0;
let approvedCount = 0;
let snoozedCount = 0;
let awaitingReplyCount = 0;
if (profile?.tenant_id) {
const [clientCountRes, pendingCountRes, approvedCountRes] = await Promise.all([
supabase
.from("pulse_clients")
.select("id", { count: "exact", head: true })
.eq("tenant_id", profile.tenant_id),
supabase
.from("recovery_items")
.select("id", { count: "exact", head: true })
.eq("tenant_id", profile.tenant_id)
.not("status", "in", '("approved","dismissed")'),
supabase
.from("recovery_items")
.select("id", { count: "exact", head: true })
.eq("tenant_id", profile.tenant_id)
.eq("status", "approved"),
]);
const [clientCountRes, pendingCountRes, approvedCountRes, snoozedCountRes, sentCountRes] =
await Promise.all([
supabase
.from("pulse_clients")
.select("id", { count: "exact", head: true })
.eq("tenant_id", profile.tenant_id),
supabase
.from("recovery_items")
.select("id", { count: "exact", head: true })
.eq("tenant_id", profile.tenant_id)
.not("status", "in", '("approved","dismissed")'),
supabase
.from("recovery_items")
.select("id", { count: "exact", head: true })
.eq("tenant_id", profile.tenant_id)
.eq("status", "approved"),
// F2: brief continuity — items the owner snoozed (coming back) ...
supabase
.from("recovery_items")
.select("id", { count: "exact", head: true })
.eq("tenant_id", profile.tenant_id)
.eq("status", "snoozed"),
// ... and items already sent, awaiting a client reply.
supabase
.from("recovery_items")
.select("id", { count: "exact", head: true })
.eq("tenant_id", profile.tenant_id)
.eq("status", "sent"),
]);
clientCount = clientCountRes.count ?? 0;
pendingRecoveryCount = pendingCountRes.count ?? 0;
approvedCount = approvedCountRes.count ?? 0;
snoozedCount = snoozedCountRes.count ?? 0;
awaitingReplyCount = sentCountRes.count ?? 0;
}
const firstLightAchieved = lifetimeRecoveredCents > 0;
const firstLightReadiness = { clientCount, pendingRecoveryCount, approvedCount, firstLightAchieved };
// F2: brief continuity — the brief "remembers" overnight so the owner sees carry-over,
// not just a flat list (counts only, honest).
const briefContinuity = { snoozedCount, awaitingReplyCount };
// Founder panel keeps its exact shape + founder-only gating.
const founderReadiness:
| { pulseConnected: boolean; clientCount: number; pendingRecoveryCount: number; firstLightAchieved: boolean }
Expand Down Expand Up @@ -425,6 +445,7 @@ export default async function FocusPage({ searchParams }: { searchParams: Search
isFounder={isFounder}
founderReadiness={founderReadiness}
firstLightReadiness={firstLightReadiness}
briefContinuity={briefContinuity}
/>
</ErrorBoundary>
);
Expand Down