feat(subscribe): Add unit time

This commit is contained in:
web@ppanel
2024-12-20 18:52:30 +07:00
parent d8b0bd9c2d
commit 39d07ecee5
80 changed files with 553 additions and 165 deletions
+16 -14
View File
@@ -112,27 +112,29 @@ export default function Purchase({
}}
className='flex flex-wrap gap-0.5 *:w-20 md:gap-2'
>
<div className='relative'>
<RadioGroupItem value='1' id='1' className='peer sr-only' />
<Label
htmlFor='1'
className='border-muted bg-popover hover:bg-accent hover:text-accent-foreground peer-data-[state=checked]:border-primary relative flex h-full flex-col items-center justify-center gap-2 rounded-md border-2 p-2'
>
1 {t('month')}
</Label>
</div>
{subscribe?.unit_time !== 'Minute' && (
<div className='relative'>
<RadioGroupItem value='1' id='1' className='peer sr-only' />
<Label
htmlFor='1'
className='border-muted bg-popover hover:bg-accent hover:text-accent-foreground peer-data-[state=checked]:border-primary relative flex h-full flex-col items-center justify-center gap-2 rounded-md border-2 p-2'
>
1 / {t(subscribe?.unit_time || 'Month')}
</Label>
</div>
)}
{subscribe?.discount?.map((item) => (
<div key={item.months}>
<div key={item.quantity}>
<RadioGroupItem
value={String(item.months)}
id={String(item.months)}
value={String(item.quantity)}
id={String(item.quantity)}
className='peer sr-only'
/>
<Label
htmlFor={String(item.months)}
htmlFor={String(item.quantity)}
className='border-muted bg-popover hover:bg-accent hover:text-accent-foreground peer-data-[state=checked]:border-primary relative flex h-full flex-col items-center justify-center gap-2 rounded-md border-2 p-2'
>
{item.months} {t('months')}
{item.quantity} / {t(subscribe?.unit_time || 'Month')}
{item.discount < 100 && (
<Badge variant='destructive'>-{100 - item.discount}%</Badge>
)}
+16 -14
View File
@@ -107,27 +107,29 @@ export default function Renewal({ token, subscribe }: { token: string; subscribe
}}
className='flex flex-wrap gap-2'
>
<div className='relative'>
<RadioGroupItem value='1' id='1' className='peer sr-only' />
<Label
htmlFor='1'
className='border-muted bg-popover hover:bg-accent hover:text-accent-foreground peer-data-[state=checked]:border-primary relative flex h-full flex-col items-center justify-center gap-2 rounded-md border-2 p-2'
>
1 {t('month')}
</Label>
</div>
{subscribe?.unit_time !== 'Minute' && (
<div className='relative'>
<RadioGroupItem value='1' id='1' className='peer sr-only' />
<Label
htmlFor='1'
className='border-muted bg-popover hover:bg-accent hover:text-accent-foreground peer-data-[state=checked]:border-primary relative flex h-full flex-col items-center justify-center gap-2 rounded-md border-2 p-2'
>
1 / {t(subscribe?.unit_time || 'Month')}
</Label>
</div>
)}
{subscribe?.discount?.map((item) => (
<div key={item.months}>
<div key={item.quantity}>
<RadioGroupItem
value={String(item.months)}
id={String(item.months)}
value={String(item.quantity)}
id={String(item.quantity)}
className='peer sr-only'
/>
<Label
htmlFor={String(item.months)}
htmlFor={String(item.quantity)}
className='border-muted bg-popover hover:bg-accent hover:text-accent-foreground peer-data-[state=checked]:border-primary relative flex h-full flex-col items-center justify-center gap-2 rounded-md border-2 p-2'
>
{item.months} {t('months')}
{item.quantity} / {t(subscribe?.unit_time || 'Month')}
{item.discount < 100 && (
<Badge variant='destructive'>-{100 - item.discount}%</Badge>
)}