v2-ui #75

Merged
Vishnu merged 33 commits from v2-ui into main 2025-05-03 12:47:21 +00:00
Showing only changes of commit f8abd71116 - Show all commits

View File

@@ -1,4 +1,5 @@
import React, { createContext, useContext, useState, useCallback, useMemo } from "react";
import { MathUtils } from "three";
export type LogType = "log" | "info" | "warning" | "error" | "success";
@@ -30,22 +31,17 @@ export const LoggerProvider: React.FC<{ children: React.ReactNode }> = ({
const [logs, setLogs] = useState<LogEntry[]>([]);
const [isLogListVisible, setIsLogListVisible] = useState<boolean>(false);
const generateId = useCallback(
() => Math.random().toString(36).substring(2, 9),
[]
);
const addLog = useCallback(
(type: LogType, message: string) => {
const newLog: LogEntry = {
id: generateId(),
id: MathUtils.generateUUID(),
type,
message,
timestamp: new Date(),
};
setLogs((prevLogs) => [...prevLogs, newLog]);
},
[generateId]
[]
);
const loggerMethods: LoggerContextValue = useMemo(() => ({