You've already forked AstralRinth
forked from didirus/AstralRinth
78aca7e5c0
* feat: base content card component * fix: tooltips + colors * feat: fix orgs * feat: add ContentModpackCard * fix: extract types * feat: selection v-model * add show icon in selected for combobox with stories * feat: add project combobox * clean up project combobox * feat: start install to play modal * fix: events * feat: figma alignments * feat: migrate toggle to tailwind * fix: row borders * feat: disabled state * feat: virtual list impl for card table based on window scroll * fix: lint * feat: virtualization + smaller contentcard items * feat: fix gap + border issues on last elm * fix: use TeleportOverflowMenu * fix: hasUpdate type * fix: fallback to svg if src is invalid on avatar component * fix: storybook * feat: start on updater modal * feat: finish content updater modal * feat: i18n pass * remove install to play modal from ui package * pnpm prepr * feat: reusable table component * feat: add column width prop for table and fix stories * feat: add table overflow menu story example * feat: add surface-1.5 and use in table * chore: export table in index * fix: allow more loose typing on columns * feat: update table component to derive key from column instead of data * feat: surface 1.5 for oled + refactor story for contentcardtable + yeet sorting funcs * fix: lint * feat: add no padding story for new modal --------- Signed-off-by: Calum H. <contact@cal.engineer> Co-authored-by: tdgao <mr.trumgao@gmail.com>
76 lines
2.1 KiB
Vue
76 lines
2.1 KiB
Vue
<script setup lang="ts">
|
|
import { PlusIcon, XIcon } from '@modrinth/assets'
|
|
import type Stripe from 'stripe'
|
|
import { nextTick, ref, useTemplateRef } from 'vue'
|
|
|
|
import { defineMessages, useVIntl } from '../../composables/i18n'
|
|
import { commonMessages } from '../../utils'
|
|
import { ButtonStyled, NewModal } from '../index'
|
|
import type { AddPaymentMethodProps } from './AddPaymentMethod.vue'
|
|
import AddPaymentMethod from './AddPaymentMethod.vue'
|
|
|
|
const { formatMessage } = useVIntl()
|
|
|
|
const modal = useTemplateRef<InstanceType<typeof NewModal>>('modal')
|
|
const addPaymentMethod = useTemplateRef<InstanceType<typeof AddPaymentMethod>>('addPaymentMethod')
|
|
|
|
const props = defineProps<AddPaymentMethodProps>()
|
|
const loading = ref(false)
|
|
|
|
async function open(paymentMethods: Stripe.PaymentMethod[]) {
|
|
modal.value?.show()
|
|
await nextTick()
|
|
await addPaymentMethod.value?.reload(paymentMethods)
|
|
}
|
|
|
|
const messages = defineMessages({
|
|
addingPaymentMethod: {
|
|
id: 'modal.add-payment-method.title',
|
|
defaultMessage: 'Adding a payment method',
|
|
},
|
|
paymentMethodAdd: {
|
|
id: 'modal.add-payment-method.action',
|
|
defaultMessage: 'Add payment method',
|
|
},
|
|
})
|
|
|
|
defineExpose({
|
|
show: open,
|
|
})
|
|
</script>
|
|
|
|
<template>
|
|
<NewModal ref="modal">
|
|
<template #title>
|
|
<span class="text-lg font-extrabold text-contrast">
|
|
{{ formatMessage(messages.addingPaymentMethod) }}
|
|
</span>
|
|
</template>
|
|
<div class="w-[40rem] max-w-full">
|
|
<AddPaymentMethod
|
|
ref="addPaymentMethod"
|
|
:publishable-key="props.publishableKey"
|
|
:return-url="props.returnUrl"
|
|
:create-setup-intent="props.createSetupIntent"
|
|
:on-error="props.onError"
|
|
@start-loading="loading = true"
|
|
@stop-loading="loading = false"
|
|
/>
|
|
<div class="input-group mt-auto pt-4">
|
|
<ButtonStyled color="brand">
|
|
<button :disabled="loading" @click="addPaymentMethod.submit()">
|
|
<PlusIcon />
|
|
{{ formatMessage(messages.paymentMethodAdd) }}
|
|
</button>
|
|
</ButtonStyled>
|
|
<ButtonStyled>
|
|
<button @click="modal.hide()">
|
|
<XIcon />
|
|
{{ formatMessage(commonMessages.cancelButton) }}
|
|
</button>
|
|
</ButtonStyled>
|
|
</div>
|
|
</div>
|
|
</NewModal>
|
|
</template>
|