fix: 删除赞助商模块,删除新版本模块
This commit is contained in:
parent
4a4c3aa88a
commit
6e62353096
@ -1,11 +1,9 @@
|
||||
import Billing from '@/components/billing';
|
||||
import Statistics from '@/components/dashboard/statistics';
|
||||
|
||||
export default function Dashboard() {
|
||||
return (
|
||||
<div className='flex flex-1 flex-col gap-3'>
|
||||
<Statistics />
|
||||
<Billing type='dashboard' />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@ -1,13 +1,9 @@
|
||||
import Billing from '@/components/billing';
|
||||
import PaymentTable from './payment-table';
|
||||
|
||||
export default async function Page() {
|
||||
return (
|
||||
<>
|
||||
<PaymentTable />
|
||||
<div className='mt-5 flex flex-col gap-3'>
|
||||
<Billing type='payment' />
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@ -210,30 +210,8 @@ export default function Page() {
|
||||
<Badge variant='default' className='px-1.5 py-0.5 text-xs'>
|
||||
V{packageJson.version}
|
||||
</Badge>
|
||||
{hasNewVersion && (
|
||||
<Badge variant='destructive' className='animate-pulse px-1.5 py-0.5 text-xs'>
|
||||
{t('newVersionAvailable')}
|
||||
</Badge>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
{hasNewVersion && (
|
||||
<Button
|
||||
variant='outline'
|
||||
size='sm'
|
||||
className='h-6 px-2 text-xs'
|
||||
onClick={() =>
|
||||
window.open(
|
||||
latestReleases?.web?.url ||
|
||||
'https://github.com/perfect-panel/ppanel-web/releases',
|
||||
'_blank',
|
||||
)
|
||||
}
|
||||
>
|
||||
<Icon icon='mdi:open-in-new' className='mr-1 h-3 w-3' />
|
||||
{t('viewNewVersion')}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* 服务端版本 */}
|
||||
@ -251,11 +229,6 @@ export default function Page() {
|
||||
<span className='ml-1'>{t('developmentVersion')}</span>
|
||||
)}
|
||||
</Badge>
|
||||
{hasServerNewVersion && (
|
||||
<Badge variant='destructive' className='animate-pulse px-1.5 py-0.5 text-xs'>
|
||||
{t('newVersionAvailable')}
|
||||
</Badge>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className='flex items-center space-x-2'>
|
||||
|
||||
@ -1,86 +0,0 @@
|
||||
import { Avatar, AvatarFallback, AvatarImage } from '@workspace/ui/components/avatar';
|
||||
import { Card, CardDescription, CardHeader, CardTitle } from '@workspace/ui/components/card';
|
||||
import { getTranslations } from 'next-intl/server';
|
||||
import Link from 'next/link';
|
||||
|
||||
interface BillingProps {
|
||||
type: 'dashboard' | 'payment';
|
||||
}
|
||||
|
||||
interface ItemType {
|
||||
logo: string;
|
||||
title: string;
|
||||
description: string;
|
||||
expiryDate: string;
|
||||
href: string;
|
||||
}
|
||||
|
||||
async function getBillingURL() {
|
||||
try {
|
||||
const response = await fetch(
|
||||
'https://api.github.com/repos/perfect-panel/ppanel-assets/commits',
|
||||
);
|
||||
const json = await response.json();
|
||||
const version = json[0]?.sha;
|
||||
const url = new URL('https://cdn.jsdelivr.net/gh/perfect-panel/ppanel-assets');
|
||||
url.pathname += `@${version}/billing/index.json`;
|
||||
return url.toString();
|
||||
} catch (error) {
|
||||
return 'https://cdn.jsdelivr.net/gh/perfect-panel/ppanel-assets/billing/index.json';
|
||||
}
|
||||
}
|
||||
|
||||
export default async function Billing({ type }: BillingProps) {
|
||||
const t = await getTranslations('common.billing');
|
||||
let list: ItemType[] = [];
|
||||
|
||||
try {
|
||||
const url = await getBillingURL();
|
||||
const response = await fetch(url, {
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
},
|
||||
});
|
||||
const data = await response.json();
|
||||
const now = Date.now();
|
||||
|
||||
list = Array.isArray(data[type])
|
||||
? data[type].filter((item: { expiryDate: string }) => {
|
||||
const expiryDate = Date.parse(item.expiryDate);
|
||||
return !isNaN(expiryDate) && expiryDate > now;
|
||||
})
|
||||
: [];
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!list?.length) return null;
|
||||
|
||||
return (
|
||||
<>
|
||||
<h1 className='text mt-2 font-bold'>
|
||||
<span>{t('title')}</span>
|
||||
<span className='text-muted-foreground ml-2 text-xs'>{t('description')}</span>
|
||||
</h1>
|
||||
<div className='grid gap-3 md:grid-cols-3 lg:grid-cols-6'>
|
||||
{list.map((item, index) => (
|
||||
<Link href={item.href} target='_blank' key={index}>
|
||||
<Card className='h-full cursor-pointer'>
|
||||
<CardHeader className='flex flex-row gap-2 p-3'>
|
||||
<Avatar>
|
||||
<AvatarImage src={item.logo} />
|
||||
<AvatarFallback>{item.title}</AvatarFallback>
|
||||
</Avatar>
|
||||
<div>
|
||||
<CardTitle>{item.title}</CardTitle>
|
||||
<CardDescription className='mt-2'>{item.description}</CardDescription>
|
||||
</div>
|
||||
</CardHeader>
|
||||
</Card>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@ -121,7 +121,7 @@ export default function Content() {
|
||||
</div>
|
||||
</div>
|
||||
<div className='flex flex-wrap justify-between gap-4'>
|
||||
<Tabs
|
||||
{/*<Tabs
|
||||
value={platform}
|
||||
onValueChange={(value) => setPlatform(value as keyof API.ApplicationPlatform)}
|
||||
className='w-full max-w-full md:w-auto'
|
||||
@ -145,7 +145,7 @@ export default function Content() {
|
||||
</TabsTrigger>
|
||||
))}
|
||||
</TabsList>
|
||||
</Tabs>
|
||||
</Tabs>*/}
|
||||
{data?.protocol && data?.protocol.length > 1 && (
|
||||
<Tabs
|
||||
value={protocol}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user