Compare commits

..

15 Commits

Author SHA1 Message Date
semantic-release-bot 47f66030db 🔖 chore(release): v1.4.8 [skip ci]
## [1.4.8](https://github.com/perfect-panel/ppanel-web/compare/v1.4.7...v1.4.8) (2025-09-23)

### 🐛 Bug Fixes

* Rename 'server_id' to 'protocol' in NodesPage and clean up unused imports and code in ServerConfig ([70b3484](https://github.com/perfect-panel/ppanel-web/commit/70b3484))
* Update announcement page to display timeline of announcements with Markdown content ([3c036eb](https://github.com/perfect-panel/ppanel-web/commit/3c036eb))
* Update Empty component to support border prop and adjust usage in various pages ([ce9ab89](https://github.com/perfect-panel/ppanel-web/commit/ce9ab89))
2025-09-23 13:11:32 +00:00
web 70b3484f98 🐛 fix: Rename 'server_id' to 'protocol' in NodesPage and clean up unused imports and code in ServerConfig 2025-09-23 06:08:36 -07:00
web 3c036eb09c 🐛 fix: Update announcement page to display timeline of announcements with Markdown content 2025-09-23 05:48:25 -07:00
web ce9ab89c1c 🐛 fix: Update Empty component to support border prop and adjust usage in various pages 2025-09-23 05:46:21 -07:00
semantic-release-bot bb0a811432 🔖 chore(release): v1.4.7 [skip ci]
## [1.4.7](https://github.com/perfect-panel/ppanel-web/compare/v1.4.6...v1.4.7) (2025-09-23)

### 🐛 Bug Fixes

* Add unique key to ProTable for improved rendering with user ID filters ([2bff15f](https://github.com/perfect-panel/ppanel-web/commit/2bff15f))
* Adjust layout spacing and chart aspect ratio in ServerConfig component ([05a61d8](https://github.com/perfect-panel/ppanel-web/commit/05a61d8))
* Refactor server ID cell rendering for improved readability and consistency ([0345b7c](https://github.com/perfect-panel/ppanel-web/commit/0345b7c))
* Update announcement page to format creation date and enhance content display ([8445e30](https://github.com/perfect-panel/ppanel-web/commit/8445e30))
* Update OnlineUsersCell to display user count with icon instead of badge ([7a4ebdf](https://github.com/perfect-panel/ppanel-web/commit/7a4ebdf))
* Update subscribe name fallback to return '--' instead of 'Unknown' ([0a07d25](https://github.com/perfect-panel/ppanel-web/commit/0a07d25))
2025-09-23 12:16:40 +00:00
web 8445e302e6 🐛 fix: Update announcement page to format creation date and enhance content display 2025-09-23 05:12:36 -07:00
web 2bff15fd13 🐛 fix: Add unique key to ProTable for improved rendering with user ID filters 2025-09-23 05:04:33 -07:00
web 0345b7cced 🐛 fix: Refactor server ID cell rendering for improved readability and consistency 2025-09-23 05:01:17 -07:00
web 7a4ebdf985 🐛 fix: Update OnlineUsersCell to display user count with icon instead of badge 2025-09-23 04:46:33 -07:00
web 05a61d8bf2 🐛 fix: Adjust layout spacing and chart aspect ratio in ServerConfig component 2025-09-23 04:42:55 -07:00
web 0a07d2578e 🐛 fix: Update subscribe name fallback to return '--' instead of 'Unknown' 2025-09-23 04:40:35 -07:00
semantic-release-bot ee05a73834 🔖 chore(release): v1.4.6 [skip ci]
## [1.4.6](https://github.com/perfect-panel/ppanel-web/compare/v1.4.5...v1.4.6) (2025-09-17)

### 🎫 Chores

* Merge branch 'main' into develop ([41f06bf](https://github.com/perfect-panel/ppanel-web/commit/41f06bf))

### 🐛 Bug Fixes

* Add loaded state to node, server, and subscribe stores for better loading management ([13dce0c](https://github.com/perfect-panel/ppanel-web/commit/13dce0c))
* Removed node metadata fields in subscription schema to simplify structure ([0cadd83](https://github.com/perfect-panel/ppanel-web/commit/0cadd83))
2025-09-17 14:29:53 +00:00
web 13dce0c20b 🐛 fix: Add loaded state to node, server, and subscribe stores for better loading management 2025-09-17 07:26:56 -07:00
web 41f06bfe54 🔧 chore: Merge branch 'main' into develop 2025-09-17 03:21:49 -07:00
web 0cadd83e45 🐛 fix: Removed node metadata fields in subscription schema to simplify structure 2025-09-17 03:19:31 -07:00
17 changed files with 119 additions and 175 deletions
+34
View File
@@ -1,6 +1,40 @@
<a name="readme-top"></a> <a name="readme-top"></a>
# Changelog # Changelog
## [1.4.8](https://github.com/perfect-panel/ppanel-web/compare/v1.4.7...v1.4.8) (2025-09-23)
### 🐛 Bug Fixes
* Rename 'server_id' to 'protocol' in NodesPage and clean up unused imports and code in ServerConfig ([70b3484](https://github.com/perfect-panel/ppanel-web/commit/70b3484))
* Update announcement page to display timeline of announcements with Markdown content ([3c036eb](https://github.com/perfect-panel/ppanel-web/commit/3c036eb))
* Update Empty component to support border prop and adjust usage in various pages ([ce9ab89](https://github.com/perfect-panel/ppanel-web/commit/ce9ab89))
## [1.4.7](https://github.com/perfect-panel/ppanel-web/compare/v1.4.6...v1.4.7) (2025-09-23)
### 🐛 Bug Fixes
* Add unique key to ProTable for improved rendering with user ID filters ([2bff15f](https://github.com/perfect-panel/ppanel-web/commit/2bff15f))
* Adjust layout spacing and chart aspect ratio in ServerConfig component ([05a61d8](https://github.com/perfect-panel/ppanel-web/commit/05a61d8))
* Refactor server ID cell rendering for improved readability and consistency ([0345b7c](https://github.com/perfect-panel/ppanel-web/commit/0345b7c))
* Update announcement page to format creation date and enhance content display ([8445e30](https://github.com/perfect-panel/ppanel-web/commit/8445e30))
* Update OnlineUsersCell to display user count with icon instead of badge ([7a4ebdf](https://github.com/perfect-panel/ppanel-web/commit/7a4ebdf))
* Update subscribe name fallback to return '--' instead of 'Unknown' ([0a07d25](https://github.com/perfect-panel/ppanel-web/commit/0a07d25))
## [1.4.6](https://github.com/perfect-panel/ppanel-web/compare/v1.4.5...v1.4.6) (2025-09-17)
### 🎫 Chores
* Merge branch 'main' into develop ([41f06bf](https://github.com/perfect-panel/ppanel-web/commit/41f06bf))
### 🐛 Bug Fixes
* Add loaded state to node, server, and subscribe stores for better loading management ([13dce0c](https://github.com/perfect-panel/ppanel-web/commit/13dce0c))
* Removed node metadata fields in subscription schema to simplify structure ([0cadd83](https://github.com/perfect-panel/ppanel-web/commit/0cadd83))
## [1.4.5](https://github.com/perfect-panel/ppanel-web/compare/v1.4.4...v1.4.5) (2025-09-17) ## [1.4.5](https://github.com/perfect-panel/ppanel-web/compare/v1.4.4...v1.4.5) (2025-09-17)
+9 -13
View File
@@ -88,24 +88,20 @@ export default function NodesPage() {
{ {
id: 'address_port', id: 'address_port',
header: `${t('address')}:${t('port')}`, header: `${t('address')}:${t('port')}`,
cell: ({ row }) => (row.original.address || '—') + ':' + (row.original.port ?? '—'), cell: ({ row }) => `${row.original.address || '—'}:${row.original.port || '—'}`,
}, },
{ {
id: 'server_id', id: 'server_id',
header: t('server'), header: t('server'),
cell: ({ row }) => ( cell: ({ row }) =>
<div className='space-y-1'> `${getServerName(row.original.server_id)}:${getServerAddress(row.original.server_id)}`,
<Badge variant='outline'> },
{getServerName(row.original.server_id)} : {getServerAddress(row.original.server_id)} {
</Badge> id: 'protocol',
<br /> header: ` ${t('protocol')}:${t('port')}`,
<Badge variant='outline'> cell: ({ row }) =>
{row.original.protocol || '—'} :{' '} `${row.original.protocol}:${getProtocolPort(row.original.server_id, row.original.protocol)}`,
{getProtocolPort(row.original.server_id, row.original.protocol)}
</Badge>
</div>
),
}, },
{ {
accessorKey: 'tags', accessorKey: 'tags',
+3
View File
@@ -58,6 +58,9 @@ export default function Page() {
accessorKey: 'subscribe_id', accessorKey: 'subscribe_id',
header: t('subscribe'), header: t('subscribe'),
cell: ({ row }) => { cell: ({ row }) => {
if (row.original.type === 4) {
return t(`type.${row.getValue('type')}`);
}
const name = getSubscribeName(row.getValue('subscribe_id')); const name = getSubscribeName(row.getValue('subscribe_id'));
const quantity = row.original.quantity; const quantity = row.original.quantity;
return name ? `${name} × ${quantity}` : ''; return name ? `${name} × ${quantity}` : '';
@@ -15,6 +15,7 @@ import {
SheetTrigger, SheetTrigger,
} from '@workspace/ui/components/sheet'; } from '@workspace/ui/components/sheet';
import { formatBytes } from '@workspace/ui/utils'; import { formatBytes } from '@workspace/ui/utils';
import { Users } from 'lucide-react';
import { useTranslations } from 'next-intl'; import { useTranslations } from 'next-intl';
import { useState } from 'react'; import { useState } from 'react';
@@ -92,8 +93,7 @@ export default function OnlineUsersCell({ status }: { status?: API.ServerStatus
<Sheet open={open} onOpenChange={setOpen}> <Sheet open={open} onOpenChange={setOpen}>
<SheetTrigger asChild> <SheetTrigger asChild>
<button className='hover:text-foreground text-muted-foreground flex items-center gap-2 bg-transparent p-0 text-sm'> <button className='hover:text-foreground text-muted-foreground flex items-center gap-2 bg-transparent p-0 text-sm'>
<Badge variant='secondary'>{status?.online.length}</Badge> <Users className='h-4 w-4' /> {status?.online.length}
<span>{t('onlineUsers')}</span>
</button> </button>
</SheetTrigger> </SheetTrigger>
<SheetContent className='h-screen w-screen max-w-none sm:h-auto sm:w-[900px] sm:max-w-[90vw]'> <SheetContent className='h-screen w-screen max-w-none sm:h-auto sm:w-[900px] sm:max-w-[90vw]'>
@@ -9,7 +9,7 @@ import {
import { zodResolver } from '@hookform/resolvers/zod'; import { zodResolver } from '@hookform/resolvers/zod';
import { useQuery } from '@tanstack/react-query'; import { useQuery } from '@tanstack/react-query';
import { Button } from '@workspace/ui/components/button'; import { Button } from '@workspace/ui/components/button';
import { ChartContainer, ChartTooltip } from '@workspace/ui/components/chart';
import { import {
Form, Form,
FormControl, FormControl,
@@ -35,65 +35,11 @@ import { Icon } from '@workspace/ui/custom-components/icon';
import { DicesIcon } from 'lucide-react'; import { DicesIcon } from 'lucide-react';
import { useTranslations } from 'next-intl'; import { useTranslations } from 'next-intl';
import { uid } from 'radash'; import { uid } from 'radash';
import { useEffect, useMemo, useState } from 'react'; import { useEffect, useState } from 'react';
import { useForm } from 'react-hook-form'; import { useForm } from 'react-hook-form';
import { Cell, Legend, Pie, PieChart } from 'recharts';
import { toast } from 'sonner'; import { toast } from 'sonner';
import { z } from 'zod'; import { z } from 'zod';
const COLORS = [
'hsl(var(--chart-1))',
'hsl(var(--chart-2))',
'hsl(var(--chart-3))',
'hsl(var(--chart-4))',
'hsl(var(--chart-5))',
];
const MINUTES_IN_DAY = 1440;
function getTimeRangeData(slots: API.TimePeriod[]) {
const timePoints = slots
.filter((slot) => slot.start_time && slot.end_time)
.flatMap((slot) => {
const [startH = 0, startM = 0] = slot.start_time.split(':').map(Number);
const [endH = 0, endM = 0] = slot.end_time.split(':').map(Number);
const start = startH * 60 + startM;
let end = endH * 60 + endM;
if (end < start) end += MINUTES_IN_DAY;
return { start, end, multiplier: slot.multiplier };
})
.sort((a, b) => a.start - b.start);
const result: { name: string; value: number; multiplier: number }[] = [];
let currentMinute = 0;
timePoints.forEach((point) => {
if (point.start > currentMinute) {
result.push({
name: `${Math.floor(currentMinute / 60)}:${String(currentMinute % 60).padStart(2, '0')} - ${Math.floor(point.start / 60)}:${String(point.start % 60).padStart(2, '0')}`,
value: point.start - currentMinute,
multiplier: 1,
});
}
result.push({
name: `${Math.floor(point.start / 60)}:${String(point.start % 60).padStart(2, '0')} - ${Math.floor((point.end / 60) % 24)}:${String(point.end % 60).padStart(2, '0')}`,
value: point.end - point.start,
multiplier: point.multiplier,
});
currentMinute = point.end % MINUTES_IN_DAY;
});
if (currentMinute < MINUTES_IN_DAY) {
result.push({
name: `${Math.floor(currentMinute / 60)}:${String(currentMinute % 60).padStart(2, '0')} - 24:00`,
value: MINUTES_IN_DAY - currentMinute,
multiplier: 1,
});
}
return result;
}
const nodeConfigSchema = z.object({ const nodeConfigSchema = z.object({
node_secret: z.string().optional(), node_secret: z.string().optional(),
node_pull_interval: z.number().optional(), node_pull_interval: z.number().optional(),
@@ -150,20 +96,6 @@ export default function ServerConfig() {
} }
}, [periodsResp]); }, [periodsResp]);
const chartTimeSlots = useMemo(() => getTimeRangeData(timeSlots), [timeSlots]);
const chartConfig = useMemo(() => {
return chartTimeSlots.reduce(
(acc, item, index) => {
acc[item.name] = {
label: item.name,
color: COLORS[index % COLORS.length] || 'hsl(var(--default-chart-color))',
};
return acc;
},
{} as Record<string, { label: string; color: string }>,
);
}, [chartTimeSlots]);
async function onSubmit(values: NodeConfigFormData) { async function onSubmit(values: NodeConfigFormData) {
setSaving(true); setSaving(true);
try { try {
@@ -293,8 +225,8 @@ export default function ServerConfig() {
{t('config.dynamicMultiplierDescription')} {t('config.dynamicMultiplierDescription')}
</p> </p>
<div className='flex flex-col-reverse gap-8 md:flex-row md:items-start'> <div className='flex flex-col gap-2'>
<div className='w-full md:w-1/2'> <div className='w-full'>
<ArrayInput<API.TimePeriod> <ArrayInput<API.TimePeriod>
fields={[ fields={[
{ name: 'start_time', prefix: t('config.startTime'), type: 'time' }, { name: 'start_time', prefix: t('config.startTime'), type: 'time' },
@@ -311,74 +243,18 @@ export default function ServerConfig() {
/> />
<div className='mt-3 flex gap-2'> <div className='mt-3 flex gap-2'>
<Button <Button
type='button'
size='sm' size='sm'
variant='outline' variant='outline'
onClick={() => setTimeSlots(periodsResp || [])} onClick={() => setTimeSlots(periodsResp || [])}
> >
{t('config.reset')} {t('config.reset')}
</Button> </Button>
<Button size='sm' onClick={savePeriods}> <Button size='sm' type='button' onClick={savePeriods}>
{t('config.save')} {t('config.save')}
</Button> </Button>
</div> </div>
</div> </div>
<div className='w-full md:w-1/2'>
<ChartContainer
config={chartConfig}
className='mx-auto aspect-[4/3] max-w-[400px]'
>
<PieChart>
<Pie
data={chartTimeSlots}
cx='50%'
cy='50%'
labelLine={false}
outerRadius='80%'
fill='#8884d8'
dataKey='value'
label={({ percent, multiplier }) =>
`${(multiplier || 0)?.toFixed(2)}x (${(percent * 100).toFixed(0)}%)`
}
>
{chartTimeSlots.map((entry, index) => (
<Cell key={`cell-${index}`} fill={COLORS[index % COLORS.length]} />
))}
</Pie>
<ChartTooltip
content={({ payload }) => {
if (payload && payload.length) {
const d = payload[0]?.payload as any;
return (
<div className='bg-background rounded-lg border p-2 shadow-sm'>
<div className='grid grid-cols-2 gap-2'>
<div className='flex flex-col'>
<span className='text-muted-foreground text-[0.70rem] uppercase'>
{t('config.timeSlot')}
</span>
<span className='text-muted-foreground font-bold'>
{d.name || '—'}
</span>
</div>
<div className='flex flex-col'>
<span className='text-muted-foreground text-[0.70rem] uppercase'>
{t('config.multiplier')}
</span>
<span className='font-bold'>
{Number(d.multiplier).toFixed(2)}x
</span>
</div>
</div>
</div>
);
}
return null;
}}
/>
<Legend />
</PieChart>
</ChartContainer>
</div>
</div> </div>
</div> </div>
</form> </form>
@@ -189,19 +189,6 @@ export const subscribeSchema = {
type: 'boolean', type: 'boolean',
description: 'Whether this protocol is enabled', description: 'Whether this protocol is enabled',
}, },
// Node metadata
Country: {
type: 'string',
description: 'Node country',
},
City: {
type: 'string',
description: 'Node city',
},
Ratio: {
type: 'number',
description: 'Traffic ratio multiplier',
},
// UUID for vmess/vless // UUID for vmess/vless
UUID: { UUID: {
type: 'string', type: 'string',
+1
View File
@@ -60,6 +60,7 @@ export default function Page() {
return ( return (
<ProTable<API.User, API.GetUserListParams> <ProTable<API.User, API.GetUserListParams>
key={initialFilters.user_id}
action={ref} action={ref}
initialFilters={initialFilters} initialFilters={initialFilters}
header={{ header={{
+18 -4
View File
@@ -9,6 +9,8 @@ interface NodeState {
// Loading states // Loading states
loading: boolean; loading: boolean;
loadingTags: boolean; loadingTags: boolean;
loaded: boolean;
loadedTags: boolean;
// Actions // Actions
fetchNodes: () => Promise<void>; fetchNodes: () => Promise<void>;
@@ -30,6 +32,8 @@ export const useNodeStore = create<NodeState>((set, get) => ({
tags: [], tags: [],
loading: false, loading: false,
loadingTags: false, loadingTags: false,
loaded: false,
loadedTags: false,
// Actions // Actions
fetchNodes: async () => { fetchNodes: async () => {
@@ -38,9 +42,13 @@ export const useNodeStore = create<NodeState>((set, get) => ({
set({ loading: true }); set({ loading: true });
try { try {
const { data } = await filterNodeList({ page: 1, size: 999999999 }); const { data } = await filterNodeList({ page: 1, size: 999999999 });
set({ nodes: data?.data?.list || [] }); set({
nodes: data?.data?.list || [],
loaded: true,
});
} catch (error) { } catch (error) {
// Handle error silently // Handle error silently
set({ loaded: true });
} finally { } finally {
set({ loading: false }); set({ loading: false });
} }
@@ -52,9 +60,13 @@ export const useNodeStore = create<NodeState>((set, get) => ({
set({ loadingTags: true }); set({ loadingTags: true });
try { try {
const { data } = await queryNodeTag(); const { data } = await queryNodeTag();
set({ tags: data?.data?.tags || [] }); set({
tags: data?.data?.tags || [],
loadedTags: true,
});
} catch (error) { } catch (error) {
// Handle error silently // Handle error silently
set({ loadedTags: true });
} finally { } finally {
set({ loadingTags: false }); set({ loadingTags: false });
} }
@@ -104,10 +116,10 @@ export const useNode = () => {
const store = useNodeStore(); const store = useNodeStore();
// Auto-fetch nodes and tags // Auto-fetch nodes and tags
if (store.nodes.length === 0 && !store.loading) { if (!store.loaded && !store.loading) {
store.fetchNodes(); store.fetchNodes();
} }
if (store.tags.length === 0 && !store.loadingTags) { if (!store.loadedTags && !store.loadingTags) {
store.fetchTags(); store.fetchTags();
} }
@@ -116,6 +128,8 @@ export const useNode = () => {
tags: store.tags, tags: store.tags,
loading: store.loading, loading: store.loading,
loadingTags: store.loadingTags, loadingTags: store.loadingTags,
loaded: store.loaded,
loadedTags: store.loadedTags,
fetchNodes: store.fetchNodes, fetchNodes: store.fetchNodes,
fetchTags: store.fetchTags, fetchTags: store.fetchTags,
getNodeById: store.getNodeById, getNodeById: store.getNodeById,
+9 -2
View File
@@ -7,6 +7,7 @@ interface ServerState {
// Loading states // Loading states
loading: boolean; loading: boolean;
loaded: boolean;
// Actions // Actions
fetchServers: () => Promise<void>; fetchServers: () => Promise<void>;
@@ -24,6 +25,7 @@ export const useServerStore = create<ServerState>((set, get) => ({
// Initial state // Initial state
servers: [], servers: [],
loading: false, loading: false,
loaded: false,
// Actions // Actions
fetchServers: async () => { fetchServers: async () => {
@@ -32,9 +34,13 @@ export const useServerStore = create<ServerState>((set, get) => ({
set({ loading: true }); set({ loading: true });
try { try {
const { data } = await filterServerList({ page: 1, size: 999999999 }); const { data } = await filterServerList({ page: 1, size: 999999999 });
set({ servers: data?.data?.list || [] }); set({
servers: data?.data?.list || [],
loaded: true,
});
} catch (error) { } catch (error) {
// Handle error silently // Handle error silently
set({ loaded: true });
} finally { } finally {
set({ loading: false }); set({ loading: false });
} }
@@ -84,13 +90,14 @@ export const useServer = () => {
const store = useServerStore(); const store = useServerStore();
// Auto-fetch servers // Auto-fetch servers
if (store.servers.length === 0 && !store.loading) { if (!store.loaded && !store.loading) {
store.fetchServers(); store.fetchServers();
} }
return { return {
servers: store.servers, servers: store.servers,
loading: store.loading, loading: store.loading,
loaded: store.loaded,
fetchServers: store.fetchServers, fetchServers: store.fetchServers,
getServerById: store.getServerById, getServerById: store.getServerById,
getServerName: store.getServerName, getServerName: store.getServerName,
+10 -3
View File
@@ -7,6 +7,7 @@ interface SubscribeState {
// Loading states // Loading states
loading: boolean; loading: boolean;
loaded: boolean;
// Actions // Actions
fetchSubscribes: () => Promise<void>; fetchSubscribes: () => Promise<void>;
@@ -20,6 +21,7 @@ export const useSubscribeStore = create<SubscribeState>((set, get) => ({
// Initial state // Initial state
subscribes: [], subscribes: [],
loading: false, loading: false,
loaded: false,
// Actions // Actions
fetchSubscribes: async () => { fetchSubscribes: async () => {
@@ -28,9 +30,13 @@ export const useSubscribeStore = create<SubscribeState>((set, get) => ({
set({ loading: true }); set({ loading: true });
try { try {
const { data } = await getSubscribeList({ page: 1, size: 999999999 }); const { data } = await getSubscribeList({ page: 1, size: 999999999 });
set({ subscribes: data?.data?.list || [] }); set({
subscribes: data?.data?.list || [],
loaded: true,
});
} catch (error) { } catch (error) {
// Handle error silently // Handle error silently
set({ loaded: true });
} finally { } finally {
set({ loading: false }); set({ loading: false });
} }
@@ -38,7 +44,7 @@ export const useSubscribeStore = create<SubscribeState>((set, get) => ({
// Getters // Getters
getSubscribeName: (subscribeId?: number) => { getSubscribeName: (subscribeId?: number) => {
if (!subscribeId) return 'Unknown'; if (!subscribeId) return '--';
const subscribe = get().subscribes.find((s) => s.id === subscribeId); const subscribe = get().subscribes.find((s) => s.id === subscribeId);
return subscribe?.name ?? `Subscribe ${subscribeId}`; return subscribe?.name ?? `Subscribe ${subscribeId}`;
}, },
@@ -52,13 +58,14 @@ export const useSubscribe = () => {
const store = useSubscribeStore(); const store = useSubscribeStore();
// Auto-fetch subscribes // Auto-fetch subscribes
if (store.subscribes.length === 0 && !store.loading) { if (!store.loaded && !store.loading) {
store.fetchSubscribes(); store.fetchSubscribes();
} }
return { return {
subscribes: store.subscribes, subscribes: store.subscribes,
loading: store.loading, loading: store.loading,
loaded: store.loaded,
fetchSubscribes: store.fetchSubscribes, fetchSubscribes: store.fetchSubscribes,
getSubscribeName: store.getSubscribeName, getSubscribeName: store.getSubscribeName,
getSubscribeById: store.getSubscribeById, getSubscribeById: store.getSubscribeById,
@@ -29,6 +29,6 @@ export default function Page() {
} }
/> />
) : ( ) : (
<Empty /> <Empty border />
); );
} }
@@ -100,7 +100,7 @@ export function DocumentButton({ items }: { items: API.Document[] }) {
layoutId={`card-${item.id}-${id}`} layoutId={`card-${item.id}-${id}`}
key={`card-${item.id}-${id}`} key={`card-${item.id}-${id}`}
onClick={() => setActive(item)} onClick={() => setActive(item)}
className='bg-background hover:bg-accent flex cursor-pointer items-center justify-between rounded border p-4' className='bg-background hover:bg-accent flex cursor-pointer items-center justify-between rounded-xl border p-4'
> >
<div className='flex flex-row items-center gap-4'> <div className='flex flex-row items-center gap-4'>
<motion.div layoutId={`image-${item.id}-${id}`}> <motion.div layoutId={`image-${item.id}-${id}`}>
@@ -1,5 +1,6 @@
'use client'; 'use client';
import { Empty } from '@/components/empty';
import { NEXT_PUBLIC_HIDDEN_TUTORIAL_DOCUMENT } from '@/config/constants'; import { NEXT_PUBLIC_HIDDEN_TUTORIAL_DOCUMENT } from '@/config/constants';
import { queryDocumentList } from '@/services/user/document'; import { queryDocumentList } from '@/services/user/document';
import { getTutorialList } from '@/utils/tutorial'; import { getTutorialList } from '@/utils/tutorial';
@@ -35,6 +36,13 @@ export default function Page() {
enabled: NEXT_PUBLIC_HIDDEN_TUTORIAL_DOCUMENT !== 'true', enabled: NEXT_PUBLIC_HIDDEN_TUTORIAL_DOCUMENT !== 'true',
}); });
if (
(!DocumentList || DocumentList.length === 0) &&
(!TutorialList || TutorialList.length === 0)
) {
return <Empty border />;
}
return ( return (
<div className='space-y-4'> <div className='space-y-4'>
{DocumentList?.length > 0 && ( {DocumentList?.length > 0 && (
@@ -121,7 +121,7 @@ export function TutorialButton({ items }: { items: Item[] }) {
layoutId={`card-${item.title}-${id}`} layoutId={`card-${item.title}-${id}`}
key={`card-${item.title}-${id}`} key={`card-${item.title}-${id}`}
onClick={() => setActive(item)} onClick={() => setActive(item)}
className='bg-background hover:bg-accent flex cursor-pointer items-center justify-between rounded border p-4' className='bg-background hover:bg-accent flex cursor-pointer items-center justify-between rounded-xl border p-4'
> >
<div className='flex flex-row items-center gap-4'> <div className='flex flex-row items-center gap-4'>
<motion.div layoutId={`image-${item.title}-${id}`}> <motion.div layoutId={`image-${item.title}-${id}`}>
+5 -2
View File
@@ -4,7 +4,10 @@ import { default as _Empty } from '@workspace/ui/custom-components/empty';
import { useTranslations } from 'next-intl'; import { useTranslations } from 'next-intl';
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
export function Empty() { interface EmptyProps {
border?: boolean;
}
export function Empty({ border }: EmptyProps) {
const t = useTranslations('common'); const t = useTranslations('common');
const [description, setDescription] = useState(''); const [description, setDescription] = useState('');
@@ -14,5 +17,5 @@ export function Empty() {
setDescription(t(`empty.${random}`)); setDescription(t(`empty.${random}`));
}, [t]); }, [t]);
return <_Empty description={description} />; return <_Empty description={description} border={border} />;
} }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "ppanel-web", "name": "ppanel-web",
"version": "1.4.5", "version": "1.4.8",
"private": true, "private": true,
"homepage": "https://github.com/perfect-panel/ppanel-web", "homepage": "https://github.com/perfect-panel/ppanel-web",
"bugs": { "bugs": {
+10 -2
View File
@@ -1,6 +1,14 @@
export default function Empty({ description }: { description?: React.ReactNode }) { export default function Empty({
description,
border,
}: {
description?: React.ReactNode;
border?: boolean;
}) {
return ( return (
<div className='flex flex-col items-center justify-center p-6 py-16'> <div
className={`flex flex-col items-center justify-center p-6 py-16 ${border ? 'rounded-xl border' : ''}`}
>
<svg <svg
width='64' width='64'
height='41' height='41'