Line data Source code
1 : <template>
2 : <div :class="cn('flex flex-col gap-4 p-4', ui.body)">
3 : <p class="m-0 text-muted-foreground">{{ translate('opened.body') }}</p>
4 : <dl
5 : :class="
6 : cn('m-0 flex flex-col gap-1 rounded-lg bg-secondary p-3', ui.summary)
7 : "
8 : data-testid="add-credits-opened-summary"
9 : >
10 : <div class="flex justify-between">
11 : <dt class="text-muted-foreground">{{ translate('opened.credits') }}</dt>
12 : <dd class="m-0 tabular-nums">{{ credits }}</dd>
13 : </div>
14 : <div class="flex justify-between">
15 : <dt class="text-muted-foreground">{{ translate('opened.amount') }}</dt>
16 : <dd class="m-0 tabular-nums">{{ format.money(amountCents) }}</dd>
17 : </div>
18 : </dl>
19 : <AddCreditsNotice
20 : v-if="refusalCopy"
21 : :copy="refusalCopy"
22 : :kind="refusal?.kind"
23 : :support-url
24 : :support-label="translate('messageSupport')"
25 : :notice-class="ui.notice"
26 : />
27 : </div>
28 : <div :class="footerBarClass(ui, 'justify-end')">
29 : <button
30 : type="button"
31 : :class="
32 : cn(
33 : buttonVariants({ variant: 'muted-textonly', size: 'lg' }),
34 : ui.secondary
35 : )
36 : "
37 : :disabled="!canReopen"
38 : data-testid="add-credits-reopen"
39 : @click="emit('reopen')"
40 : >
41 : {{ translate('opened.reopen') }}
42 : <i class="icon-[lucide--arrow-up-right]" aria-hidden="true" />
43 : </button>
44 : <button
45 : type="button"
46 : :class="
47 : cn(buttonVariants({ variant: 'secondary', size: 'lg' }), ui.secondary)
48 : "
49 : @click="emit('close')"
50 : >
51 : {{ translate('close') }}
52 : </button>
53 : </div>
54 : </template>
55 :
56 : <script setup lang="ts">
57 : import { computed } from 'vue'
58 :
59 : import type {
60 : AddCreditsRefusal,
61 : AddCreditsTranslate
62 : } from '@comfyorg/account-core/billing'
63 : import { buttonVariants } from '@comfyorg/design-system/button.variants'
64 : import { cn } from '@comfyorg/tailwind-utils'
65 :
66 : import AddCreditsNotice from './AddCreditsNotice.vue'
67 : import type { AddCreditsFormat, AddCreditsUi } from './addCreditsPresentation'
68 : import { footerBarClass, noticeCopyFor } from './addCreditsPresentation'
69 :
70 : const {
71 : amountCents,
72 : credits,
73 : refusal,
74 : canReopen,
75 : supportUrl,
76 : translate,
77 : format,
78 : ui
79 : } = defineProps<{
80 : amountCents: number
81 : credits: string
82 : refusal: AddCreditsRefusal | undefined
83 : canReopen: boolean
84 : supportUrl: string
85 : translate: AddCreditsTranslate
86 : format: AddCreditsFormat
87 : ui: AddCreditsUi
88 : }>()
89 :
90 1 : const emit = defineEmits<{ reopen: []; close: [] }>()
91 :
92 1 : const refusalCopy = computed(() =>
93 : noticeCopyFor(refusal && { kind: 'refusal', refusal }, { translate, format })
94 : )
95 : </script>
|