From 726de0396b44a48f7c189b7039ded396c5ecc5da Mon Sep 17 00:00:00 2001 From: archer <545436317@qq.com> Date: Thu, 13 Jul 2023 15:17:01 +0800 Subject: [PATCH] ui --- client/src/components/Layout/index.tsx | 2 +- client/src/components/{SlideTabs => SideTabs}/index.tsx | 4 ++-- .../pages/app/detail/components/Charts/TokenUsage.tsx | 8 -------- client/src/pages/app/detail/index.tsx | 4 ++-- client/src/pages/app/list/index.tsx | 9 +++++++-- client/src/service/models/bill.ts | 2 +- 6 files changed, 13 insertions(+), 16 deletions(-) rename client/src/components/{SlideTabs => SideTabs}/index.tsx (92%) diff --git a/client/src/components/Layout/index.tsx b/client/src/components/Layout/index.tsx index 2eeff4c3d..f81c690c7 100644 --- a/client/src/components/Layout/index.tsx +++ b/client/src/components/Layout/index.tsx @@ -57,7 +57,7 @@ const Layout = ({ children }: { children: JSX.Element }) => { const { data: unread = 0 } = useQuery(['getUnreadCount'], getUnreadCount, { enabled: !!userInfo, - refetchInterval: 5000 + refetchInterval: 10000 }); return ( diff --git a/client/src/components/SlideTabs/index.tsx b/client/src/components/SideTabs/index.tsx similarity index 92% rename from client/src/components/SlideTabs/index.tsx rename to client/src/components/SideTabs/index.tsx index 88ec690e6..34f7ba24e 100644 --- a/client/src/components/SlideTabs/index.tsx +++ b/client/src/components/SideTabs/index.tsx @@ -11,7 +11,7 @@ export interface Props extends GridProps { onChange: (id: string) => void; } -const SlideTabs = ({ list, size = 'md', activeId, onChange, ...props }: Props) => { +const SideTabs = ({ list, size = 'md', activeId, onChange, ...props }: Props) => { const sizeMap = useMemo(() => { switch (size) { case 'sm': @@ -68,4 +68,4 @@ const SlideTabs = ({ list, size = 'md', activeId, onChange, ...props }: Props) = ); }; -export default React.memo(SlideTabs); +export default React.memo(SideTabs); diff --git a/client/src/pages/app/detail/components/Charts/TokenUsage.tsx b/client/src/pages/app/detail/components/Charts/TokenUsage.tsx index 137d1f9c8..4b91eccd8 100644 --- a/client/src/pages/app/detail/components/Charts/TokenUsage.tsx +++ b/client/src/pages/app/detail/components/Charts/TokenUsage.tsx @@ -110,8 +110,6 @@ const TokenUsage = ({ appId }: { appId: string }) => { }, yAxis: { type: 'value', - boundaryGap: false, - splitNumber: 5, max: Math.max(...data.map((item) => item.tokenLen)), min: 0 }, @@ -180,12 +178,6 @@ const TokenUsage = ({ appId }: { appId: string }) => { myChart.current.setOption(option); }, [data, option]); - // limit changed, update - useEffect(() => { - if (!myChart.current || !myChart?.current?.getOption()) return; - myChart.current.setOption(option); - }, [option]); - // resize chart useEffect(() => { if (!myChart.current || !myChart.current.getOption()) return; diff --git a/client/src/pages/app/detail/index.tsx b/client/src/pages/app/detail/index.tsx index ef8576fb9..2275db6b2 100644 --- a/client/src/pages/app/detail/index.tsx +++ b/client/src/pages/app/detail/index.tsx @@ -6,7 +6,7 @@ import dynamic from 'next/dynamic'; import { defaultApp } from '@/constants/model'; import Tabs from '@/components/Tabs'; -import SlideTabs from '@/components/SlideTabs'; +import SideTabs from '@/components/SideTabs'; import Settings from './components/Settings'; import Avatar from '@/components/Avatar'; import MyIcon from '@/components/Icon'; @@ -81,7 +81,7 @@ const AppDetail = ({ currentTab }: { currentTab: `${TabEnum}` }) => { {appDetail.name} - import('./component/CreateModal')); import styles from './index.module.scss'; +import MyTooltip from '@/components/MyTooltip'; const MyApps = () => { const { toast } = useToast(); @@ -117,7 +118,7 @@ const MyApps = () => { aria-label={'delete'} display={['', 'none']} _hover={{ - bg: 'myGray.100' + bg: 'red.100' }} onClick={(e) => { e.stopPropagation(); @@ -140,7 +141,11 @@ const MyApps = () => { right={4} bottom={4} size={'sm'} - icon={} + icon={ + + + + } variant={'base'} borderRadius={'md'} aria-label={'delete'} diff --git a/client/src/service/models/bill.ts b/client/src/service/models/bill.ts index 697db4c93..e1ce02db8 100644 --- a/client/src/service/models/bill.ts +++ b/client/src/service/models/bill.ts @@ -45,7 +45,7 @@ const BillSchema = new Schema({ try { BillSchema.index({ userId: 1 }); // BillSchema.index({ time: -1 }); - // BillSchema.index({ time: 1 }, { expireAfterSeconds: 90 * 24 * 60 }); + BillSchema.index({ time: 1 }, { expireAfterSeconds: 90 * 24 * 60 }); } catch (error) { console.log(error); }