feat: update package.json to remove lint-staged, add eslint configuration and dependencies
feat: add state management for recording in RecordeReplayPage component refactor: remove bridge and storage services as they are no longer needed chore: update tsconfig.json for improved type checking and module resolution fix: update downloadHtml function to use eventWithTime type and improve formatting fix: add error logging in formatWithZone function for better debugging
This commit is contained in:
@@ -21,7 +21,7 @@ const CopyButton = ({
|
||||
return () => clearTimeout(timer);
|
||||
}, [status]);
|
||||
|
||||
const performCopy = async () => {
|
||||
const performCopy = useCallback(async () => {
|
||||
if (!text) {
|
||||
console.warn('没有提供要复制的文本');
|
||||
return false;
|
||||
@@ -38,7 +38,9 @@ const CopyButton = ({
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return false;
|
||||
}, [text]);
|
||||
|
||||
const handleClick = useCallback(async () => {
|
||||
setStatus('copying');
|
||||
@@ -50,7 +52,7 @@ const CopyButton = ({
|
||||
console.error('复制时出错:', error);
|
||||
setStatus('error');
|
||||
}
|
||||
}, [text]);
|
||||
}, [performCopy]);
|
||||
|
||||
// 根据状态计算当前显示的文本
|
||||
const currentText =
|
||||
|
||||
@@ -77,6 +77,7 @@ export function DatetimeToTimestamp() {
|
||||
|
||||
setResult(finalResult.toString());
|
||||
} catch (err) {
|
||||
console.error('转换错误:', err);
|
||||
setError('转换失败,请检查输入格式');
|
||||
setResult('');
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ const TIMESTAMP_UNITS = [
|
||||
|
||||
export function TimestampToDatetime() {
|
||||
/** @type {[string, function]} 输入的时间戳值 */
|
||||
const [timestampValue, setTimestampValue] = useState(Date.now());
|
||||
const [timestampValue, setTimestampValue] = useState(() => Date.now());
|
||||
|
||||
/** @type {[string, function]} 转换结果 */
|
||||
const [timestampResult, setTimestampResult] = useState('');
|
||||
@@ -87,6 +87,7 @@ export function TimestampToDatetime() {
|
||||
const result = formatWithZone(numericValue, selectedZone, unit);
|
||||
setTimestampResult(result);
|
||||
} catch (err) {
|
||||
console.error('转换时间戳出错:', err);
|
||||
setError('转换失败,请检查输入格式');
|
||||
setTimestampResult('');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user