refactor(portal): partner-mode customer switcher on real tenants

Migrate the partner-mode customer switcher, in-customer banner, sidebar tile and the team invite/teammate panels off the data/customers fixture onto the real /api/partner/tenants list (shared key, gated to partner-staff so the global shell doesn't 403 for other users). Active customer resolves by tenant _id (the key the customers page already passes to partnerMode.enter); partner-identity labels now use the real partner name from useMe. Removes the now-unused customers + CustomerOrg-list fixture export and the dead setCustomer helper. Verified in UI: switcher + enter/exit show real Baslund Test / Baslund Research ApS.
This commit is contained in:
Ronni Baslund
2026-05-30 14:51:14 +02:00
parent 60e0b2286c
commit 7720e4be83
7 changed files with 67 additions and 63 deletions
@@ -4,7 +4,8 @@
// • Activity — last 5 partner actions with timestamps + IPs
// • Security — MFA card, active sessions, API tokens, suspend callout
import { customers } from '~/data/customers'
const { tenants } = usePartnerTenants()
const PLAN_LABEL: Record<string, string> = { mvp: 'Starter', pro: 'Business', enterprise: 'Enterprise' }
export interface TeamMember {
id: string
@@ -59,10 +60,10 @@ const isOwner = computed(() => !!props.member?.isOwner)
const accessText = computed(() => {
if (!props.member) return ''
if (props.member.access === 'all') return `all (${customers.length})`
const total = tenants.value?.length ?? 0
if (props.member.access === 'all') return `all (${total})`
if (props.member.access === 'none') return 'no access'
// Specific: just say first N customers
return `${customers.length - 5} of ${customers.length}`
return `${props.member.accessCount ?? 0} of ${total}`
})
</script>
@@ -131,14 +132,14 @@ const accessText = computed(() => {
</div>
<div class="ac-list">
<div
v-for="c in customers.slice(0, member.access === 'all' ? customers.length : 3)"
:key="c.id"
v-for="c in tenants.slice(0, member.access === 'all' ? tenants.length : 3)"
:key="c._id"
class="ac-row"
>
<UiIcon name="check" :size="11" :stroke-width="2.5" />
<div class="cust-swatch" :style="{ background: c.brandColor }" />
<div class="cust-swatch" :style="{ background: c.brandColor || '#0A0A0A' }" />
<span class="cust-name">{{ c.name }}</span>
<Mono dim>{{ c.planLabel }}</Mono>
<Mono dim>{{ PLAN_LABEL[c.plan ?? 'pro'] }}</Mono>
</div>
</div>
</div>