From f112adc696f7d2ded5d7619cf900e8156ea92d37 Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Wed, 24 Jul 2024 02:42:20 +0800 Subject: [PATCH] refactor: change website config tabs to shadcn ui and improve ui --- src/client/components/feed/FeedIcon.tsx | 5 +++- .../components/website/WebsiteConfig.tsx | 23 +++++++++------ src/client/routes/feed/$channelId/index.tsx | 29 +++++++++++-------- 3 files changed, 35 insertions(+), 22 deletions(-) diff --git a/src/client/components/feed/FeedIcon.tsx b/src/client/components/feed/FeedIcon.tsx index 3adaed1..5c35aac 100644 --- a/src/client/components/feed/FeedIcon.tsx +++ b/src/client/components/feed/FeedIcon.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { LuGithub, LuPlug } from 'react-icons/lu'; +import { LuCloudy, LuGithub, LuPlug } from 'react-icons/lu'; interface FeedIconProps { source: string; @@ -9,6 +9,9 @@ export const FeedIcon: React.FC = React.memo((props) => { if (props.source === 'github') { return ; } + if (props.source === 'tencent-cloud') { + return ; + } return ; }); diff --git a/src/client/components/website/WebsiteConfig.tsx b/src/client/components/website/WebsiteConfig.tsx index 6476758..4a4a2f3 100644 --- a/src/client/components/website/WebsiteConfig.tsx +++ b/src/client/components/website/WebsiteConfig.tsx @@ -1,4 +1,4 @@ -import { Button, Form, Input, message, Popconfirm, Tabs } from 'antd'; +import { Button, Form, Input, message, Popconfirm } from 'antd'; import React from 'react'; import { deleteWorkspaceWebsite } from '../../api/model/website'; import { useRequest } from '../../hooks/useRequest'; @@ -16,6 +16,8 @@ import { useEvent } from '../../hooks/useEvent'; import { hostnameValidator } from '../../utils/validator'; import { useTranslation } from '@i18next-toolkit/react'; import { useNavigate } from '@tanstack/react-router'; +import { Tabs, TabsContent, TabsList, TabsTrigger } from '../ui/tabs'; +import { AlertConfirm } from '../AlertConfirm'; export const WebsiteConfig: React.FC<{ websiteId: string }> = React.memo( (props) => { @@ -83,8 +85,12 @@ export const WebsiteConfig: React.FC<{ websiteId: string }> = React.memo( return (
- - + + + {t('Detail')} + {t('Data')} + +
= React.memo(
-
- - - + + handleDeleteWebsite()} > - - + +
diff --git a/src/client/routes/feed/$channelId/index.tsx b/src/client/routes/feed/$channelId/index.tsx index d416a9c..3aef7d9 100644 --- a/src/client/routes/feed/$channelId/index.tsx +++ b/src/client/routes/feed/$channelId/index.tsx @@ -32,17 +32,22 @@ function PageComponent() { channelId, }); - const { data, hasNextPage, fetchNextPage, isFetchingNextPage } = - trpc.feed.fetchEventsByCursor.useInfiniteQuery( - { - workspaceId, - channelId, - }, - { - refetchOnWindowFocus: false, - getNextPageParam: (lastPage) => lastPage.nextCursor, - } - ); + const { + data, + isInitialLoading, + hasNextPage, + fetchNextPage, + isFetchingNextPage, + } = trpc.feed.fetchEventsByCursor.useInfiniteQuery( + { + workspaceId, + channelId, + }, + { + refetchOnWindowFocus: false, + getNextPageParam: (lastPage) => lastPage.nextCursor, + } + ); const deleteMutation = trpc.feed.deleteChannel.useMutation({ onSuccess: defaultSuccessHandler, @@ -128,7 +133,7 @@ function PageComponent() { )} renderEmpty={() => (
- + {!isInitialLoading && }
)} />