diff --git a/apps/user/app/(main)/(content)/(user)/dashboard/components/SubscribeCard/index.tsx b/apps/user/app/(main)/(content)/(user)/dashboard/components/SubscribeCard/index.tsx index 285b246..b397f5b 100644 --- a/apps/user/app/(main)/(content)/(user)/dashboard/components/SubscribeCard/index.tsx +++ b/apps/user/app/(main)/(content)/(user)/dashboard/components/SubscribeCard/index.tsx @@ -28,9 +28,11 @@ import { import { Popover, PopoverContent, PopoverTrigger } from '@workspace/airo-ui/components/popover'; import { Tabs, TabsList, TabsTrigger } from '@workspace/airo-ui/components/tabs'; import { differenceInDays } from '@workspace/airo-ui/utils'; +import Link from 'next/link'; import { QRCodeCanvas } from 'qrcode.react'; import { useEffect, useState } from 'react'; import { CopyToClipboard } from 'react-copy-to-clipboard'; + interface SubscribeCardProps { userSubscribeData: API.UserSubscribe; protocol: string[]; @@ -53,7 +55,7 @@ const SubscribeCard = (props: SubscribeCardProps) => { if (list.length > 0) { setUserSubscribeProtocolCurrent(0); } - }, [props.userSubscribeData.token, protocol]); + }, [props.userSubscribeData?.token, protocol]); return (
@@ -69,11 +71,15 @@ const SubscribeCard = (props: SubscribeCardProps) => { {t('totalTraffic')}

- + {userSubscribeData?.token ? ( + + ) : ( + '0.00GB' + )}

@@ -81,9 +87,15 @@ const SubscribeCard = (props: SubscribeCardProps) => { {t('nextResetDays')}

- {userSubscribeData.reset_time - ? differenceInDays(new Date(userSubscribeData.reset_time), new Date()) - : t('noReset')} + {userSubscribeData?.token ? ( + <> + {userSubscribeData.reset_time + ? differenceInDays(new Date(userSubscribeData.reset_time), new Date()) + : t('noReset')} + + ) : ( + 'N/A' + )}

@@ -91,17 +103,28 @@ const SubscribeCard = (props: SubscribeCardProps) => { {t('expirationDays')}

- {userSubscribeData.expire_time - ? differenceInDays(new Date(userSubscribeData.expire_time), new Date()) || - t('unknown') - : t('noLimit')} + {userSubscribeData?.token ? ( + <> + {userSubscribeData.expire_time + ? differenceInDays(new Date(userSubscribeData.expire_time), new Date()) || + t('unknown') + : t('noLimit')} + + ) : ( + 'N/A' + )}

{/* 订阅链接 */} -
+
+
+ + 立即购买订阅 + +
{props.protocol.length > 1 && ( {
-
+
{userSubscribeProtocol[userSubscribeProtocolCurrent]} @@ -203,7 +226,7 @@ const SubscribeCard = (props: SubscribeCardProps) => {
- + {t('resetSubscription')} @@ -231,7 +254,7 @@ const SubscribeCard = (props: SubscribeCardProps) => {
diff --git a/apps/user/app/(main)/(content)/(user)/dashboard/content.tsx b/apps/user/app/(main)/(content)/(user)/dashboard/content.tsx index 6eb95fa..41e798c 100644 --- a/apps/user/app/(main)/(content)/(user)/dashboard/content.tsx +++ b/apps/user/app/(main)/(content)/(user)/dashboard/content.tsx @@ -27,7 +27,6 @@ import { Empty } from '@/components/empty'; import SvgIcon from '@/components/SvgIcon'; import { queryAnnouncement } from '@/services/user/announcement'; import { queryOrderList } from '@/services/user/order'; -import { default as Airo_Empty } from '@workspace/airo-ui/custom-components/empty'; import { formatDate } from '@workspace/airo-ui/utils'; const platforms: (keyof API.ApplicationPlatform)[] = [ @@ -202,20 +201,13 @@ export default function Content() { {t('beginnerTutorial')}
-
- {t('copySubscribeLink')} -
- {userSubscribe?.[0] && data?.protocol ? ( - - ) : ( - - )} + {/* 账户概况 Card */} @@ -264,7 +256,11 @@ export default function Content() { {t('inEffect')} - ) : null} + ) : ( + + 未生效 + + )}
- {userSubscribe?.length ? ( - <> -
- {t('planExpirationTime')} - {formatDate(userSubscribe?.[0]?.expire_time, false)} -
-
- - {userSubscribe?.[0]?.subscribe.name} - -
-
-
- {t('availableDevices')} -
- {Array.from({ length: userSubscribe?.[0]?.subscribe.device_limit }).map( - (_, index) => { - return ( -
1 ? 'bg-[#225BA9]' : 'bg-[#D9D9D9]'}`} - >
- ); - }, - )} -
+
+
+ {t('planExpirationTime')} + {formatDate(userSubscribe?.[0]?.expire_time, false) || '暂无'} +
+
+ + {userSubscribe?.[0]?.subscribe.name ? ( + userSubscribe?.[0]?.subscribe.name + ) : ( + 暂无套餐 + )} + +
+
+
+ {t('availableDevices')} +
+ {Array.from({ length: userSubscribe?.[0]?.subscribe.device_limit || 6 }).map( + (_, index) => { + return ( +
1 ? 'bg-[#225BA9]' : 'bg-[#D9D9D9]'}`} + >
+ ); + }, + )}
+
+ + {t('online')} + {data?.online_device || 0}/{userSubscribe?.[0]?.subscribe.device_limit || 0} + +
+
+
- {t('online')} - {data?.online_device} / {userSubscribe?.[0]?.subscribe.device_limit} + {t('usedTrafficTotalTraffic')} + {userSubscribe?.[0]?.subscribe.device_limit ? ( + <> + + / + + + ) : ( + '0GB/0GB' + )} + + + {t('remaining')} + {100 - + Math.round( + (((userSubscribe?.[0]?.upload || 0) + (userSubscribe?.[0]?.download || 0)) / + (userSubscribe?.[0]?.traffic || 1)) * + 100, + )} + %
-
-
- - {t('usedTrafficTotalTraffic')} - - /{' '} - - - - {t('remaining')} - {100 - - Math.round( - (((userSubscribe?.[0]?.upload || 0) + (userSubscribe?.[0]?.download || 0)) / - (userSubscribe?.[0]?.traffic || 1)) * - 100, - )} - % - -
-
-
-
+
+
- - ) : ( - - )} +
+
{/* 网站公告 Card */} diff --git a/apps/user/app/(main)/(content)/(user)/document/tutorial-button.tsx b/apps/user/app/(main)/(content)/(user)/document/tutorial-button.tsx index 807eeaa..a650597 100644 --- a/apps/user/app/(main)/(content)/(user)/document/tutorial-button.tsx +++ b/apps/user/app/(main)/(content)/(user)/document/tutorial-button.tsx @@ -168,7 +168,7 @@ export function TutorialButton({ items }: { items: Item[] }) { )}
-
+
{item.download ? (