feat: 添加 husky 和 lint-staged 支持,配置 prettier 进行代码格式化
This commit is contained in:
+18
-17
@@ -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
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user