refactor: change website config tabs to shadcn ui and improve ui
This commit is contained in:
parent
35a6e20717
commit
f112adc696
@ -1,5 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { LuGithub, LuPlug } from 'react-icons/lu';
|
import { LuCloudy, LuGithub, LuPlug } from 'react-icons/lu';
|
||||||
|
|
||||||
interface FeedIconProps {
|
interface FeedIconProps {
|
||||||
source: string;
|
source: string;
|
||||||
@ -9,6 +9,9 @@ export const FeedIcon: React.FC<FeedIconProps> = React.memo((props) => {
|
|||||||
if (props.source === 'github') {
|
if (props.source === 'github') {
|
||||||
return <LuGithub size={props.size} />;
|
return <LuGithub size={props.size} />;
|
||||||
}
|
}
|
||||||
|
if (props.source === 'tencent-cloud') {
|
||||||
|
return <LuCloudy size={props.size} />;
|
||||||
|
}
|
||||||
|
|
||||||
return <LuPlug size={props.size} />;
|
return <LuPlug size={props.size} />;
|
||||||
});
|
});
|
||||||
|
@ -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 React from 'react';
|
||||||
import { deleteWorkspaceWebsite } from '../../api/model/website';
|
import { deleteWorkspaceWebsite } from '../../api/model/website';
|
||||||
import { useRequest } from '../../hooks/useRequest';
|
import { useRequest } from '../../hooks/useRequest';
|
||||||
@ -16,6 +16,8 @@ import { useEvent } from '../../hooks/useEvent';
|
|||||||
import { hostnameValidator } from '../../utils/validator';
|
import { hostnameValidator } from '../../utils/validator';
|
||||||
import { useTranslation } from '@i18next-toolkit/react';
|
import { useTranslation } from '@i18next-toolkit/react';
|
||||||
import { useNavigate } from '@tanstack/react-router';
|
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(
|
export const WebsiteConfig: React.FC<{ websiteId: string }> = React.memo(
|
||||||
(props) => {
|
(props) => {
|
||||||
@ -83,8 +85,12 @@ export const WebsiteConfig: React.FC<{ websiteId: string }> = React.memo(
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div>
|
<div>
|
||||||
<Tabs>
|
<Tabs defaultValue="detail">
|
||||||
<Tabs.TabPane key={'detail'} tab={'Detail'}>
|
<TabsList>
|
||||||
|
<TabsTrigger value="detail">{t('Detail')}</TabsTrigger>
|
||||||
|
<TabsTrigger value="data">{t('Data')}</TabsTrigger>
|
||||||
|
</TabsList>
|
||||||
|
<TabsContent value="detail">
|
||||||
<Form
|
<Form
|
||||||
layout="vertical"
|
layout="vertical"
|
||||||
initialValues={{
|
initialValues={{
|
||||||
@ -134,18 +140,17 @@ export const WebsiteConfig: React.FC<{ websiteId: string }> = React.memo(
|
|||||||
</Button>
|
</Button>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Form>
|
</Form>
|
||||||
</Tabs.TabPane>
|
</TabsContent>
|
||||||
|
<TabsContent value="data">
|
||||||
<Tabs.TabPane key={'data'} tab={'Data'}>
|
<AlertConfirm
|
||||||
<Popconfirm
|
|
||||||
title={t('Delete Website')}
|
title={t('Delete Website')}
|
||||||
onConfirm={() => handleDeleteWebsite()}
|
onConfirm={() => handleDeleteWebsite()}
|
||||||
>
|
>
|
||||||
<Button type="primary" danger={true}>
|
<Button type="primary" danger={true}>
|
||||||
{t('Delete Website')}
|
{t('Delete Website')}
|
||||||
</Button>
|
</Button>
|
||||||
</Popconfirm>
|
</AlertConfirm>
|
||||||
</Tabs.TabPane>
|
</TabsContent>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -32,17 +32,22 @@ function PageComponent() {
|
|||||||
channelId,
|
channelId,
|
||||||
});
|
});
|
||||||
|
|
||||||
const { data, hasNextPage, fetchNextPage, isFetchingNextPage } =
|
const {
|
||||||
trpc.feed.fetchEventsByCursor.useInfiniteQuery(
|
data,
|
||||||
{
|
isInitialLoading,
|
||||||
workspaceId,
|
hasNextPage,
|
||||||
channelId,
|
fetchNextPage,
|
||||||
},
|
isFetchingNextPage,
|
||||||
{
|
} = trpc.feed.fetchEventsByCursor.useInfiniteQuery(
|
||||||
refetchOnWindowFocus: false,
|
{
|
||||||
getNextPageParam: (lastPage) => lastPage.nextCursor,
|
workspaceId,
|
||||||
}
|
channelId,
|
||||||
);
|
},
|
||||||
|
{
|
||||||
|
refetchOnWindowFocus: false,
|
||||||
|
getNextPageParam: (lastPage) => lastPage.nextCursor,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
const deleteMutation = trpc.feed.deleteChannel.useMutation({
|
const deleteMutation = trpc.feed.deleteChannel.useMutation({
|
||||||
onSuccess: defaultSuccessHandler,
|
onSuccess: defaultSuccessHandler,
|
||||||
@ -128,7 +133,7 @@ function PageComponent() {
|
|||||||
)}
|
)}
|
||||||
renderEmpty={() => (
|
renderEmpty={() => (
|
||||||
<div className="w-full overflow-hidden p-4">
|
<div className="w-full overflow-hidden p-4">
|
||||||
<FeedApiGuide channelId={channelId} />
|
{!isInitialLoading && <FeedApiGuide channelId={channelId} />}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
Loading…
Reference in New Issue
Block a user