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)' : ''}`"
>
+6 -4
View File
@@ -8,14 +8,16 @@
// Decorative MRR sparkline shape only — historical MRR isn't stored yet (a
// daily-snapshot job lands later). The live numbers below are all real.
import { partnerMrrSparkline } from '~/data/customers'
import type { CustomerOrg, CustomerStatus } from '~/types/partner'
import type { TaskContext } from '~/components/partner/CustomerTaskPanel.vue'
const toast = useToast()
// Decorative MRR sparkline shape only — historical MRR isn't stored yet (a
// daily-snapshot job lands later; see useMrrTrendline). The live numbers
// below are all real.
const mrrTrend = useMrrTrendline()
// ── Real data sources ─────────────────────────────────────────────────────
const { tenants } = usePartnerTenants()
const { mrrByTenant } = usePartnerMrr()
@@ -450,7 +452,7 @@ onMounted(() => {
</div>
</div>
<div class="big-chart">
<PartnerSparkline :values="partnerMrrSparkline" :width="1080" :height="160" stroke="var(--text)" fill="var(--row-hover)" />
<PartnerSparkline :values="mrrTrend" :width="1080" :height="160" stroke="var(--text)" fill="var(--row-hover)" />
<div class="chart-foot">
<span>90-day trend · illustrative</span>
<span>{{ totalMrr.toLocaleString('da-DK') }} DKK / mo now</span>