Skip to content

Commit

Permalink
Action logs v2 (#74)
Browse files Browse the repository at this point in the history
* init

* new log components

* new log fixes

* Update greToClientInterpreter.ts

* cast controller fix

* log time fix

* target line

* misc fixes

* Update index.tsx
  • Loading branch information
Manwe-777 authored Jan 7, 2024
1 parent 1f82847 commit c182553
Show file tree
Hide file tree
Showing 35 changed files with 1,347 additions and 272 deletions.
28 changes: 7 additions & 21 deletions src/background/actionLog.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,14 @@
import format from "date-fns/format";

import postChannelMessage from "../broadcastChannel/postChannelMessage";
import { ActionLogLine } from "../components/action-log-v2/types";
import globalStore from "./store";

const actionLog = (
seat: number,
time = new Date(),
str: string,
_grpId = 0
): void => {
if (seat == -99) {
globalStore.currentActionLog = "version: 1\r\n";
} else {
// const parsedStr = str.replace(/(<([^>]+)>)/gi, "");

globalStore.currentActionLog += `${seat}\r\n`;
globalStore.currentActionLog += `${format(time, "HH:mm:ss")}\r\n`;
globalStore.currentActionLog += `${str}\r\n`;
const actionLog = (line: ActionLogLine): void => {
globalStore.currentActionLog.lines.push(line);

postChannelMessage({
type: "ACTION_LOG",
value: globalStore.currentActionLog,
});
}
postChannelMessage({
type: "ACTION_LOG",
value: globalStore.currentActionLog,
});
};

export default actionLog;
Loading

0 comments on commit c182553

Please sign in to comment.