refactor(portal): delete data/customers.ts fixture entirely

Replace the last two holdouts: the dashboard partner-identity fallback now uses the real useMe().partner name, and the decorative MRR sparkline (dashboard + reports) moves to a generated useMrrTrendline() — deterministic, clearly placeholder-only, until a daily MRR-snapshot job exists. Removes the dead sparkLast/sparkTrendPct vars. The data/customers.ts fixture module is now fully deleted; the partner portal carries no mock business data.
This commit is contained in:
Ronni Baslund
2026-05-30 14:56:47 +02:00
parent 7720e4be83
commit 9c08973e46
5 changed files with 33 additions and 51 deletions
+7 -12
View File
@@ -6,18 +6,16 @@
import { partnerMrrSparkline, partner as fixturePartner } from '~/data/customers'
import type { CustomerOrg } from '~/types/partner'
const toast = useToast()
const router = useRouter()
const partnerMode = usePartnerMode()
// Real partner identity from /api/me; falls back to the fixture if the user
// somehow lands here without partner data (middleware should've redirected
// them, but defending the read keeps the page from crashing).
// Real partner identity from /api/me. Middleware redirects non-partner users
// away, but we default the name defensively so the header never crashes.
const { partner: realPartner } = useMe()
const partner = computed(() => realPartner.value ?? fixturePartner)
const partnerName = computed(() => realPartner.value?.name ?? 'Partner')
const wizardOpen = ref(false)
const entryCustomer = ref<CustomerOrg | null>(null)
@@ -102,12 +100,9 @@ const newUsers30d = computed(
const customersDelta = computed(() => (newCustomers30d.value > 0 ? `+${newCustomers30d.value} / 30d` : ''))
const usersDelta = computed(() => (newUsers30d.value > 0 ? `+${newUsers30d.value} / 30d` : ''))
// Sparkline is still fixture-driven — historical MRR isn't stored yet, so
// the chart shape is decorative. Keep it for the design until we wire a
// daily MRR snapshot job.
const sparkline = partnerMrrSparkline
const sparkLast = sparkline[sparkline.length - 1]
const sparkTrendPct = '18.2' // matches source label
// Decorative MRR sparkline shape — historical MRR isn't stored yet (see
// useMrrTrendline). Purely visual until a daily MRR-snapshot job exists.
const sparkline = useMrrTrendline()
// Attention list — derived from real tenant state (no fixtures). Surfaces
// suspended customers, provisioning errors, seat pressure, and pending/trial
@@ -270,7 +265,7 @@ function provisioned() {
<template>
<div>
<PageHeader
:eyebrow="`${partner.name} · Partner console`"
:eyebrow="`${partnerName} · Partner console`"
title="Portfolio overview"
:subtitle="`${totalCustomers} customer organizations · ${totalUsers} end users · ${totalsLine} MRR${hasCustomPriced ? ' (+ custom-priced)' : ''}`"
>