perf: optimize simple app history (#2782)

* simple app history

* ui

* extract context content into hooks
This commit is contained in:
heheer
2024-09-24 21:09:59 +08:00
committed by shilin66
parent 5cfdfabd4e
commit d4d3be34a6
18 changed files with 736 additions and 893 deletions

View File

@@ -2,6 +2,7 @@ import { Box, BoxProps, Flex } from '@chakra-ui/react';
import { ParentTreePathItemType } from '@fastgpt/global/common/parentFolder/type';
import React, { useMemo } from 'react';
import { useTranslation } from 'next-i18next';
import MyIcon from '@fastgpt/web/components/common/Icon';
const FolderPath = (props: {
paths: ParentTreePathItemType[];
@@ -35,7 +36,7 @@ const FolderPath = (props: {
return paths.length === 0 && !!FirstPathDom ? (
<>{FirstPathDom}</>
) : (
<Flex flex={1} ml={-1.5}>
<Flex flex={1}>
{concatPaths.map((item, i) => (
<Flex key={item.parentId || i} alignItems={'center'}>
<Box
@@ -51,6 +52,7 @@ const FolderPath = (props: {
}
: {
cursor: 'pointer',
fontWeight: 'medium',
color: 'myGray.500',
_hover: {
bg: 'myGray.100',
@@ -64,9 +66,7 @@ const FolderPath = (props: {
{item.parentName}
</Box>
{i !== concatPaths.length - 1 && (
<Box mx={1.5} color={'myGray.500'}>
/
</Box>
<MyIcon name={'common/line'} color={'myGray.500'} mx={1} width={'5px'} />
)}
</Flex>
))}