feat: 添加 husky 和 lint-staged 支持,配置 prettier 进行代码格式化

This commit is contained in:
雨霖铃
2026-01-28 20:26:48 +08:00
parent 4edb2f1a47
commit 710bffd2f8
10 changed files with 338 additions and 112 deletions
+18 -17
View File
@@ -1,14 +1,14 @@
import React from 'react';
// import {sendRecordCommand} from '../services/bridge'
// import {storage} from "../services/storage";
import {useRecorder} from "../hooks/useRecorder";
import {downloadHtml} from '../utils/recordUtils';
import { useRecorder } from '../hooks/useRecorder';
import { downloadHtml } from '../utils/recordUtils';
const RecordeReplayPage = () => {
// const [isRecording, setIsRecording] = useState(false);
const {startRecord, stopRecord, getEvents, isRecording} = useRecorder();
const { startRecord, stopRecord, getEvents, isRecording } = useRecorder();
const handleStart = async () => {
try {
// await sendRecordCommand("START_RECORD");
@@ -20,10 +20,10 @@ const RecordeReplayPage = () => {
// await storage.set({isRecording: true, recordingStartTime: Date.now()});
// console.log('events', events);
} catch (e) {
console.error("Error starting recording:", e);
console.error('Error starting recording:', e);
}
}
};
const handleStop = async () => {
try {
// await sendRecordCommand("STOP_RECORD");
@@ -35,24 +35,25 @@ const RecordeReplayPage = () => {
downloadHtml(getEvents());
// console.log('events', getEvents());
} catch (e) {
console.error("Error stopping recording:", e)
console.error('Error stopping recording:', e);
}
};
return (
<div style={{width: "300px", padding: "16px"}}>
<div style={{ width: '300px', padding: '16px' }}>
<h3>RRWeb Recorder</h3>
{/* 3. 选择标签页逻辑:默认为当前页,如果需要跨页,需先列出 chrome.tabs.query */}
<div style={{display: "flex", gap: "10px", marginBottom: "20px"}}>
<div style={{ display: 'flex', gap: '10px', marginBottom: '20px' }}>
{!isRecording ? (
<button onClick={handleStart} className={"action-btn"}>
<button onClick={handleStart} className={'action-btn'}>
</button>
) : (
<button className={"action-btn stop-btn"}
onClick={handleStop}></button>
<button className={'action-btn stop-btn'} onClick={handleStop}>
</button>
)}
</div>
</div>
+10 -10
View File
@@ -1,15 +1,15 @@
import {TimestampToDatetime} from "../components/TimestampToDatetime";
import {DatetimeToTimestamp} from "../components/DatetimeToTimestamp";
import {TimestampExecution} from "../components/TimestampExecution";
import { TimestampToDatetime } from '../components/TimestampToDatetime';
import { DatetimeToTimestamp } from '../components/DatetimeToTimestamp';
import { TimestampExecution } from '../components/TimestampExecution';
const TimestampPage = () => {
return (<div className="timestamp-utils">
<TimestampExecution/>
<TimestampToDatetime/>
<DatetimeToTimestamp/>
</div>);
return (
<div className="timestamp-utils">
<TimestampExecution />
<TimestampToDatetime />
<DatetimeToTimestamp />
</div>
);
};
export default TimestampPage;