Line data Source code
1 5 : <template>
2 : <section
3 5 : v-if="audience === 'owner' || href"
4 : class="flex flex-col gap-3"
5 : data-testid="billing-handoff"
6 : >
7 : <h2 class="m-0 text-base font-medium text-foreground">
8 : {{ $t(`workspacePanel.billingTab.handoff.${audience}.label`) }}
9 : </h2>
10 : <div
11 : class="flex items-center gap-4 rounded-xl border border-border px-5 py-4"
12 : data-testid="billing-handoff-card"
13 : >
14 : <i18n-t
15 : v-if="audience === 'owner'"
16 : keypath="workspacePanel.billingTab.handoff.owner.line"
17 : tag="p"
18 : class="m-0 text-sm text-muted-foreground"
19 : >
20 : <template #platform>
21 : <component
22 : :is="href ? 'a' : 'button'"
23 : v-bind="
24 : href
25 : ? { href, target: '_blank', rel: 'noopener' }
26 : : { type: 'button' }
27 : "
28 : :class="
29 : cn(
30 : 'text-muted-foreground underline hover:text-foreground',
31 : !href &&
32 : 'cursor-pointer appearance-none border-none bg-transparent p-0 font-[inherit]'
33 : )
34 : "
35 : @click="open"
36 : >
37 : {{ $t('workspacePanel.billingTab.handoff.owner.platform') }}
38 : </component>
39 : </template>
40 : </i18n-t>
41 : <Button
42 : v-bind="button"
43 : variant="secondary"
44 : size="md"
45 : class="ml-auto shrink-0 no-underline"
46 : @click="open"
47 : >
48 : {{ $t(`workspacePanel.billingTab.handoff.${audience}.action`) }}
49 : <i class="icon-[lucide--arrow-up-right]" aria-hidden="true" />
50 : </Button>
51 : </div>
52 : </section>
53 : </template>
54 :
55 : <script setup lang="ts">
56 : import Button from '@comfyorg/design-system/button/Button'
57 : import { cn } from '@comfyorg/tailwind-utils'
58 :
59 : import { usePlatformBillingLink } from '@/platform/billing/composables/usePlatformHandoff'
60 :
61 : const { audience } = defineProps<{ audience: 'owner' | 'member' }>()
62 :
63 5 : const HANDOFF = {
64 : owner: { path: '/profile/billing', target: 'open_billing' },
65 : member: { path: '/profile/usage', target: 'usage' }
66 : } as const
67 :
68 5 : const { href, button, open } = usePlatformBillingLink(
69 : () => HANDOFF[audience].path,
70 : () => ({ target: HANDOFF[audience].target })
71 : )
72 : </script>
|