fix: markdown echarts (#2101)

* fix: markdown echarts

* perf: packages
This commit is contained in:
Archer
2024-07-22 10:10:32 +08:00
committed by GitHub
parent 57ff38e16f
commit f452554663
10 changed files with 119 additions and 88 deletions

View File

@@ -27,9 +27,9 @@
"next": "14.2.5",
"nextjs-cors": "^2.2.0",
"node-cron": "^3.0.3",
"node-xlsx": "^0.23.0",
"node-xlsx": "^0.24.0",
"papaparse": "5.4.1",
"pdfjs-dist": "4.0.269",
"pdfjs-dist": "4.4.168",
"pg": "^8.10.0",
"tiktoken": "^1.0.15",
"tunnel": "^0.0.6",

View File

@@ -1,5 +1,5 @@
import React from 'react';
import { Box, Flex, useTheme, Grid, type GridProps } from '@chakra-ui/react';
import { Box, Flex, useTheme, Grid, type GridProps, HStack } from '@chakra-ui/react';
import { useTranslation } from 'next-i18next';
import MyTooltip from '../MyTooltip';
import QuestionTip from '../MyTooltip/QuestionTip';
@@ -90,16 +90,17 @@ const LeftRadio = ({
</Box>
<Box flex={'1 0 0'}>
<Flex alignItems={'center'}>
<Box
<HStack
spacing={1}
color={'myGray.900'}
fontWeight={item.desc ? '500' : 'normal'}
whiteSpace={'nowrap'}
fontSize={'sm'}
>
{typeof item.title === 'string' ? t(item.title as any) : item.title}
</Box>
<Box>{typeof item.title === 'string' ? t(item.title as any) : item.title}</Box>
{!!item.tooltip && <QuestionTip label={item.tooltip} ml={1} color={'myGray.600'} />}
</HStack>
</Flex>
{!!item.tooltip && <QuestionTip label={item.tooltip} ml={1} color={'myGray.600'} />}
{!!item.desc && (
<Box fontSize={'xs'} color={'myGray.500'} lineHeight={1.2}>
{t(item.desc as any)}

View File

@@ -0,0 +1,25 @@
import { useState, useEffect } from 'react';
export const useScreen = () => {
const [screenWidth, setScreenWidth] = useState(window?.innerWidth || 0);
const [screenHeight, setScreenHeight] = useState(window?.innerHeight || 0);
useEffect(() => {
function handleResize() {
setScreenWidth(window.innerWidth);
setScreenHeight(window.innerHeight);
}
window.addEventListener('resize', handleResize);
// 清理函数
return () => {
window.removeEventListener('resize', handleResize);
};
}, []); // 空数组表示这个effect只在组件挂载和卸载时运行
return {
screenWidth,
screenHeight
};
};