fix: 修复 ESLint 配置及组件弃用属性警告,优化代码格式

1. 工程配置:
- 更新 tsconfig.json include 规则,解决 eslint.config.ts 未被包含的问题。

2. 组件重构 (Material UI 适配):
- Navbar: 替换已弃用的 PaperProps 为 slotProps.paper。
- TimestampToDatetime / DatetimeToTimestamp: 替换已弃用的 InputProps 为 slotProps.input。

3. 类型与逻辑修复:
- utils/recordUtils.tsx: 引入缺失依赖,忽略 UNSAFE_replayCanvas 等类型报错,修复构建问题。
- utils/messages.tsx: 完善事件参数类型定义。

4. 其他优化:
- 统一 App.css 代码格式。
- 补充部分组件 (CopyButton, TimestampExecution) 的 React 导入和类型定义。
This commit is contained in:
雨霖铃
2026-02-13 23:46:16 +08:00
parent 50034331bc
commit 3ece5e2e96
9 changed files with 37 additions and 45 deletions
+6 -23
View File
@@ -1,22 +1,12 @@
import { useEffect, useState, useCallback } from 'react';
import { useEffect, useState, useCallback, JSX } from 'react';
import CopyButton from './CopyButton';
import { Button, Paper, Typography, Stack, Box } from '@mui/material';
/**
* 时间戳显示和执行组件
*
* @component
* @example
* ```jsx
* <TimestampExecution />
* ```
*
* @returns {JSX.Element} 时间戳组件
*/
export function TimestampExecution() {
const [currentTimestamp, setCurrentTimestamp] = useState(() =>
Math.floor(Date.now()),
);
export function TimestampExecution(): JSX.Element {
const [currentTimestamp, setCurrentTimestamp] = useState(() => Math.floor(Date.now()));
const [showMilliseconds, setShowMilliseconds] = useState(true);
const [isRunningTimestamp, setIsRunningTimestamp] = useState(true);
@@ -45,19 +35,12 @@ export function TimestampExecution() {
setIsRunningTimestamp((prev) => !prev);
}, []);
const unitButtonLabel = showMilliseconds
? '切换为秒显示'
: '切换为毫秒显示';
const toggleButtonLabel = isRunningTimestamp
? '停止时间戳自动更新'
: '开始时间戳自动更新';
const unitButtonLabel = showMilliseconds ? '切换为秒显示' : '切换为毫秒显示';
const toggleButtonLabel = isRunningTimestamp ? '停止时间戳自动更新' : '开始时间戳自动更新';
const toggleButtonText = isRunningTimestamp ? '停止' : '开始';
return (
<Paper
elevation={3}
sx={{ p: 2, my: 2, borderRadius: 2, minWidth: 320, textAlign: 'center' }}
>
<Paper elevation={3} sx={{ p: 2, my: 2, borderRadius: 2, minWidth: 320, textAlign: 'center' }}>
<Box
sx={{
display: 'flex',