🐛 fix(ui): Improve dashboard layout and enhance button functionality; open checkout URLs in a new tab

This commit is contained in:
web@ppanel 2025-03-10 18:32:07 +07:00
parent 136a1abd8b
commit fc0da761b5
5 changed files with 37 additions and 14 deletions

View File

@ -57,7 +57,11 @@ export default function Content() {
const [protocol, setProtocol] = useState(''); const [protocol, setProtocol] = useState('');
const { data: userSubscribe = [], refetch } = useQuery({ const {
data: userSubscribe = [],
refetch,
isLoading,
} = useQuery({
queryKey: ['queryUserSubscribe'], queryKey: ['queryUserSubscribe'],
queryFn: async () => { queryFn: async () => {
const { data } = await queryUserSubscribe(); const { data } = await queryUserSubscribe();
@ -88,10 +92,27 @@ export default function Content() {
<> <>
{userSubscribe.length ? ( {userSubscribe.length ? (
<> <>
<h2 className='flex items-center gap-1.5 font-semibold'> <div className='flex items-center justify-between'>
<Icon icon='uil:servers' className='size-5' /> <h2 className='flex items-center gap-1.5 font-semibold'>
{t('mySubscriptions')} <Icon icon='uil:servers' className='size-5' />
</h2> {t('mySubscriptions')}
</h2>
<div className='flex gap-2'>
<Button
size='sm'
variant='outline'
onClick={() => {
refetch();
}}
className={isLoading ? 'animate-pulse' : ''}
>
<Icon icon='uil:sync' />
</Button>
<Button size='sm' asChild>
<Link href='/subscribe'>{t('purchaseSubscription')}</Link>
</Button>
</div>
</div>
<div className='flex flex-wrap justify-between gap-4'> <div className='flex flex-wrap justify-between gap-4'>
<Tabs <Tabs
value={platform} value={platform}

View File

@ -56,7 +56,7 @@ export default function Page() {
returnUrl: window.location.href, returnUrl: window.location.href,
}); });
if (data.data?.type === 'url' && data.data.checkout_url) { if (data.data?.type === 'url' && data.data.checkout_url) {
window.location.href = data.data.checkout_url; window.open(data.data.checkout_url, '_blank');
} }
return data?.data; return data?.data;
}, },

View File

@ -60,7 +60,7 @@ export default function Page() {
returnUrl: window.location.href, returnUrl: window.location.href,
}); });
if (data.data?.type === 'url' && data.data?.checkout_url) { if (data.data?.type === 'url' && data.data?.checkout_url) {
window.location.href = data.data?.checkout_url; window.open(data.data.checkout_url, '_blank');
} }
return data?.data; return data?.data;
}, },

View File

@ -67,12 +67,14 @@ export default function Footer() {
</nav> </nav>
<div> <div>
<strong className='text-foreground'>{site.site_name}</strong> © All rights reserved. <strong className='text-foreground'>{site.site_name}</strong> © All rights reserved.
<Link href='/tos' className='ml-2 underline'> <div>
{t('tos')} <Link href='/tos' className='underline'>
</Link> {t('tos')}
<Link href='/privacy-policy' className='ml-2 underline'> </Link>
{t('privacyPolicy')} <Link href='/privacy-policy' className='ml-2 underline'>
</Link> {t('privacyPolicy')}
</Link>
</div>
</div> </div>
</div> </div>
</footer> </footer>

View File

@ -19,7 +19,7 @@ export default function Header() {
{site.site_logo && ( {site.site_logo && (
<Image src={site.site_logo} width={48} height={48} alt='logo' unoptimized /> <Image src={site.site_logo} width={48} height={48} alt='logo' unoptimized />
)} )}
<span>{site.site_name}</span> <span className=''>{site.site_name}</span>
</Link> </Link>
); );
return ( return (