chore: remove old code pt 2
This commit is contained in:
@@ -1,361 +0,0 @@
|
||||
export const DATA: LogEntry[] = [
|
||||
{
|
||||
id: "1",
|
||||
timestamp: "2025-10-01T12:00:00Z",
|
||||
level: "info",
|
||||
msg: "User said: Hello, Pepper!",
|
||||
type: "speech",
|
||||
},
|
||||
{
|
||||
id: "2",
|
||||
timestamp: "2025-10-01T12:00:05Z",
|
||||
level: "debug",
|
||||
msg: "Proximity sensor value: 0.85",
|
||||
type: "sensor",
|
||||
},
|
||||
{
|
||||
id: "3",
|
||||
timestamp: "2025-10-01T12:00:10Z",
|
||||
level: "warn",
|
||||
msg: "Battery level low: 15%",
|
||||
type: "system",
|
||||
},
|
||||
{
|
||||
id: "4",
|
||||
timestamp: "2025-10-01T12:00:15Z",
|
||||
level: "info",
|
||||
msg: "User requested weather update.",
|
||||
type: "speech",
|
||||
},
|
||||
{
|
||||
id: "5",
|
||||
timestamp: "2025-10-01T12:00:20Z",
|
||||
level: "debug",
|
||||
msg: "Microphone activated.",
|
||||
type: "system",
|
||||
},
|
||||
{
|
||||
id: "6",
|
||||
timestamp: "2025-10-01T12:00:25Z",
|
||||
level: "warn",
|
||||
msg: "Obstacle detected in front.",
|
||||
type: "sensor",
|
||||
},
|
||||
{
|
||||
id: "7",
|
||||
timestamp: "2025-10-01T12:00:30Z",
|
||||
level: "info",
|
||||
msg: "User said: Thank you!",
|
||||
type: "speech",
|
||||
},
|
||||
{
|
||||
id: "8",
|
||||
timestamp: "2025-10-01T12:00:35Z",
|
||||
level: "debug",
|
||||
msg: "Network latency: 120ms",
|
||||
type: "system",
|
||||
},
|
||||
{
|
||||
id: "9",
|
||||
timestamp: "2025-10-01T12:00:40Z",
|
||||
level: "warn",
|
||||
msg: "High CPU usage detected.",
|
||||
type: "system",
|
||||
},
|
||||
{
|
||||
id: "10",
|
||||
timestamp: "2025-10-01T12:00:45Z",
|
||||
level: "info",
|
||||
msg: "User started a new session.",
|
||||
type: "system",
|
||||
},
|
||||
{
|
||||
id: "11",
|
||||
timestamp: "2025-10-01T12:01:00Z",
|
||||
level: "info",
|
||||
msg: "User asked: What's the weather?",
|
||||
type: "speech",
|
||||
},
|
||||
{
|
||||
id: "12",
|
||||
timestamp: "2025-10-01T12:01:05Z",
|
||||
level: "debug",
|
||||
msg: "Camera initialized.",
|
||||
type: "system",
|
||||
},
|
||||
{
|
||||
id: "13",
|
||||
timestamp: "2025-10-01T12:01:10Z",
|
||||
level: "warn",
|
||||
msg: "Temperature sensor disconnected.",
|
||||
type: "sensor",
|
||||
},
|
||||
{
|
||||
id: "14",
|
||||
timestamp: "2025-10-01T12:01:15Z",
|
||||
level: "info",
|
||||
msg: "User said: Play some music.",
|
||||
type: "speech",
|
||||
},
|
||||
{
|
||||
id: "15",
|
||||
timestamp: "2025-10-01T12:01:20Z",
|
||||
level: "debug",
|
||||
msg: "Audio output device selected: Speaker.",
|
||||
type: "system",
|
||||
},
|
||||
{
|
||||
id: "16",
|
||||
timestamp: "2025-10-01T12:01:25Z",
|
||||
level: "warn",
|
||||
msg: "Low light detected in room.",
|
||||
type: "sensor",
|
||||
},
|
||||
{
|
||||
id: "17",
|
||||
timestamp: "2025-10-01T12:01:30Z",
|
||||
level: "info",
|
||||
msg: "User said: Turn on the lights.",
|
||||
type: "speech",
|
||||
},
|
||||
{
|
||||
id: "18",
|
||||
timestamp: "2025-10-01T12:01:35Z",
|
||||
level: "debug",
|
||||
msg: "Light control signal sent.",
|
||||
type: "system",
|
||||
},
|
||||
{
|
||||
id: "19",
|
||||
timestamp: "2025-10-01T12:01:40Z",
|
||||
level: "warn",
|
||||
msg: "Light bulb not responding.",
|
||||
type: "system",
|
||||
},
|
||||
{
|
||||
id: "20",
|
||||
timestamp: "2025-10-01T12:01:45Z",
|
||||
level: "info",
|
||||
msg: "User said: Good night.",
|
||||
type: "speech",
|
||||
},
|
||||
{
|
||||
id: "21",
|
||||
timestamp: "2025-10-01T12:02:00Z",
|
||||
level: "info",
|
||||
msg: "User asked: What's the time?",
|
||||
type: "speech",
|
||||
},
|
||||
{
|
||||
id: "22",
|
||||
timestamp: "2025-10-01T12:02:05Z",
|
||||
level: "debug",
|
||||
msg: "Time module loaded.",
|
||||
type: "system",
|
||||
},
|
||||
{
|
||||
id: "23",
|
||||
timestamp: "2025-10-01T12:02:10Z",
|
||||
level: "warn",
|
||||
msg: "WiFi signal weak.",
|
||||
type: "system",
|
||||
},
|
||||
{
|
||||
id: "24",
|
||||
timestamp: "2025-10-01T12:02:15Z",
|
||||
level: "info",
|
||||
msg: "User said: Set an alarm for 7 AM.",
|
||||
type: "speech",
|
||||
},
|
||||
{
|
||||
id: "25",
|
||||
timestamp: "2025-10-01T12:02:20Z",
|
||||
level: "debug",
|
||||
msg: "Alarm scheduled for 7:00 AM.",
|
||||
type: "system",
|
||||
},
|
||||
{
|
||||
id: "26",
|
||||
timestamp: "2025-10-01T12:02:25Z",
|
||||
level: "warn",
|
||||
msg: "Alarm module not responding.",
|
||||
type: "system",
|
||||
},
|
||||
{
|
||||
id: "27",
|
||||
timestamp: "2025-10-01T12:02:30Z",
|
||||
level: "info",
|
||||
msg: "User said: Cancel the alarm.",
|
||||
type: "speech",
|
||||
},
|
||||
{
|
||||
id: "28",
|
||||
timestamp: "2025-10-01T12:02:35Z",
|
||||
level: "debug",
|
||||
msg: "Alarm cancellation requested.",
|
||||
type: "system",
|
||||
},
|
||||
{
|
||||
id: "29",
|
||||
timestamp: "2025-10-01T12:02:40Z",
|
||||
level: "warn",
|
||||
msg: "Alarm cancellation failed.",
|
||||
type: "system",
|
||||
},
|
||||
{
|
||||
id: "30",
|
||||
timestamp: "2025-10-01T12:02:45Z",
|
||||
level: "info",
|
||||
msg: "User said: Open the window.",
|
||||
type: "speech",
|
||||
},
|
||||
{
|
||||
id: "31",
|
||||
timestamp: "2025-10-01T12:03:00Z",
|
||||
level: "info",
|
||||
msg: "User asked: What's on my calendar?",
|
||||
type: "speech",
|
||||
},
|
||||
{
|
||||
id: "32",
|
||||
timestamp: "2025-10-01T12:03:05Z",
|
||||
level: "debug",
|
||||
msg: "Calendar module loaded.",
|
||||
type: "system",
|
||||
},
|
||||
{
|
||||
id: "33",
|
||||
timestamp: "2025-10-01T12:03:10Z",
|
||||
level: "warn",
|
||||
msg: "Calendar sync failed.",
|
||||
type: "system",
|
||||
},
|
||||
{
|
||||
id: "34",
|
||||
timestamp: "2025-10-01T12:03:15Z",
|
||||
level: "info",
|
||||
msg: "User said: Remind me to call John.",
|
||||
type: "speech",
|
||||
},
|
||||
{
|
||||
id: "35",
|
||||
timestamp: "2025-10-01T12:03:20Z",
|
||||
level: "debug",
|
||||
msg: "Reminder set for John.",
|
||||
type: "system",
|
||||
},
|
||||
{
|
||||
id: "36",
|
||||
timestamp: "2025-10-01T12:03:25Z",
|
||||
level: "warn",
|
||||
msg: "Reminder module not available.",
|
||||
type: "system",
|
||||
},
|
||||
{
|
||||
id: "37",
|
||||
timestamp: "2025-10-01T12:03:30Z",
|
||||
level: "info",
|
||||
msg: "User said: What's the news?",
|
||||
type: "speech",
|
||||
},
|
||||
{
|
||||
id: "38",
|
||||
timestamp: "2025-10-01T12:03:35Z",
|
||||
level: "debug",
|
||||
msg: "News API request sent.",
|
||||
type: "system",
|
||||
},
|
||||
{
|
||||
id: "39",
|
||||
timestamp: "2025-10-01T12:03:40Z",
|
||||
level: "warn",
|
||||
msg: "News API rate limit reached.",
|
||||
type: "system",
|
||||
},
|
||||
{
|
||||
id: "40",
|
||||
timestamp: "2025-10-01T12:03:45Z",
|
||||
level: "info",
|
||||
msg: "User said: Tell me a joke.",
|
||||
type: "speech",
|
||||
},
|
||||
{
|
||||
id: "41",
|
||||
timestamp: "2025-10-01T12:04:00Z",
|
||||
level: "info",
|
||||
msg: "User asked: What's the temperature?",
|
||||
type: "speech",
|
||||
},
|
||||
{
|
||||
id: "42",
|
||||
timestamp: "2025-10-01T12:04:05Z",
|
||||
level: "debug",
|
||||
msg: "Temperature sensor reading: 22°C.",
|
||||
type: "sensor",
|
||||
},
|
||||
{
|
||||
id: "43",
|
||||
timestamp: "2025-10-01T12:04:10Z",
|
||||
level: "warn",
|
||||
msg: "Temperature sensor calibration needed.",
|
||||
type: "sensor",
|
||||
},
|
||||
{
|
||||
id: "44",
|
||||
timestamp: "2025-10-01T12:04:15Z",
|
||||
level: "info",
|
||||
msg: "User said: Start cleaning.",
|
||||
type: "speech",
|
||||
},
|
||||
{
|
||||
id: "45",
|
||||
timestamp: "2025-10-01T12:04:20Z",
|
||||
level: "debug",
|
||||
msg: "Vacuum motor started.",
|
||||
type: "system",
|
||||
},
|
||||
{
|
||||
id: "46",
|
||||
timestamp: "2025-10-01T12:04:25Z",
|
||||
level: "warn",
|
||||
msg: "Vacuum bin full.",
|
||||
type: "system",
|
||||
},
|
||||
{
|
||||
id: "47",
|
||||
timestamp: "2025-10-01T12:04:30Z",
|
||||
level: "info",
|
||||
msg: "User said: Stop cleaning.",
|
||||
type: "speech",
|
||||
},
|
||||
{
|
||||
id: "48",
|
||||
timestamp: "2025-10-01T12:04:35Z",
|
||||
level: "debug",
|
||||
msg: "Vacuum motor stopped.",
|
||||
type: "system",
|
||||
},
|
||||
{
|
||||
id: "49",
|
||||
timestamp: "2025-10-01T12:04:40Z",
|
||||
level: "warn",
|
||||
msg: "Obstacle detected during cleaning.",
|
||||
type: "sensor",
|
||||
},
|
||||
{
|
||||
id: "50",
|
||||
timestamp: "2025-10-01T12:04:45Z",
|
||||
level: "info",
|
||||
msg: "User said: Goodbye!",
|
||||
type: "speech",
|
||||
},
|
||||
];
|
||||
|
||||
interface LogEntry {
|
||||
id: string;
|
||||
type?: string;
|
||||
timestamp: string;
|
||||
level: "info" | "debug" | "warn";
|
||||
msg?: string;
|
||||
}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
.DivToScroll{
|
||||
background-color: color-mix(in srgb, canvas, #000 5%);
|
||||
border: 1px solid color-mix(in srgb, canvas, #000 15%);
|
||||
border-radius: 4px 0 4px 0;
|
||||
color: #3B3C3E;
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
left: -1px;
|
||||
padding: 10px 7px 5px;
|
||||
}
|
||||
|
||||
.DivWithScroll{
|
||||
height:50vh;
|
||||
width:100vh;
|
||||
overflow:scroll;
|
||||
overflow-x:hidden;
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
import { useState } from 'react';
|
||||
import { DATA } from "../../assets/data";
|
||||
import styles from './Logging.module.css';
|
||||
|
||||
|
||||
// const dataType = DATA as { id: string; level: "debug"|"info"|"warn"|"error"; msg: string; timestamp?: string };
|
||||
type Level = "debug" | "info" | "warn" | "error";
|
||||
|
||||
// make optional fields optional
|
||||
type LogEntry = {
|
||||
id: string;
|
||||
level: Level;
|
||||
timestamp?: string;
|
||||
msg?: string;
|
||||
type?: "speech" | "sensor" | "system" | string;
|
||||
|
||||
};
|
||||
|
||||
function getLevelColor(level: Level) {
|
||||
switch (level) {
|
||||
case "debug":
|
||||
return "gray";
|
||||
case "info":
|
||||
return "blue";
|
||||
case "warn":
|
||||
return "red";
|
||||
case "error":
|
||||
return "red";
|
||||
default:
|
||||
return "black";
|
||||
}
|
||||
}
|
||||
|
||||
function Logging() {
|
||||
const [logs, setLogs] = useState<LogEntry[]>([]);
|
||||
|
||||
const logDiv = (
|
||||
<div className={styles.DivToScroll}>
|
||||
<div className={styles.DivWithScroll}>
|
||||
{logs.map((log) => (
|
||||
<div
|
||||
key={log.id}
|
||||
style={{
|
||||
display: "flex",
|
||||
justifyContent: "space-between",
|
||||
alignItems: "center",
|
||||
padding: "4px 0",
|
||||
}}
|
||||
>
|
||||
<span style={{ color: "darkgrey", minWidth: 120, textAlign: "left" }}>
|
||||
[{log.timestamp}]
|
||||
</span>
|
||||
<span style={{ flex: 1, textAlign: "center" }}>
|
||||
{log.msg ? log.msg : "No message"}
|
||||
</span>
|
||||
<span style={{ color: getLevelColor(log.level), minWidth: 80, textAlign: "right" }}>
|
||||
({log.level})
|
||||
</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
return (
|
||||
<>
|
||||
<h1>Log Screen</h1>
|
||||
{ logDiv }
|
||||
<div className="card">
|
||||
<button onClick={() => setLogs(DATA)}>
|
||||
Load sample logs
|
||||
</button>
|
||||
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export default Logging
|
||||
Reference in New Issue
Block a user