From 0c7752ca36cb7a7b1613b78f532d28fb7dd16a25 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Fri, 5 Apr 2024 09:23:13 -0600 Subject: [PATCH] More color changes to fit design --- web/src/pages/Logs.tsx | 53 ++++++++++-------------------------- web/tailwind.config.js | 8 +++--- web/themes/theme-default.css | 20 +++++++++++--- 3 files changed, 35 insertions(+), 46 deletions(-) diff --git a/web/src/pages/Logs.tsx b/web/src/pages/Logs.tsx index 48eaaa5d2..948fa8884 100644 --- a/web/src/pages/Logs.tsx +++ b/web/src/pages/Logs.tsx @@ -3,8 +3,6 @@ import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group"; import { LogData, LogLine, LogSeverity } from "@/types/log"; import copy from "copy-to-clipboard"; import { useCallback, useEffect, useMemo, useRef, useState } from "react"; -import { IoIosAlert } from "react-icons/io"; -import { GoAlertFill } from "react-icons/go"; import { LuCopy } from "react-icons/lu"; import axios from "axios"; @@ -334,9 +332,9 @@ function Logs() {
-
+
Type
Timestamp @@ -361,7 +359,6 @@ function Logs() { idx == logRange.start + 10 ? startLogRef : undefined } className={initialScroll ? "" : "invisible"} - offset={idx} line={logLines[idx - logRange.start]} /> ); @@ -379,70 +376,50 @@ type LogLineDataProps = { startRef?: (node: HTMLDivElement | null) => void; className: string; line: LogLine; - offset: number; }; -function LogLineData({ startRef, className, line, offset }: LogLineDataProps) { +function LogLineData({ startRef, className, line }: LogLineDataProps) { // long log message const contentRef = useRef(null); - const [expanded, setExpanded] = useState(false); - - const contentOverflows = useMemo(() => { - if (!contentRef.current) { - return false; - } - - return contentRef.current.scrollWidth > contentRef.current.clientWidth; - // update on ref change - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [contentRef.current]); // severity coloring const severityClassName = useMemo(() => { switch (line.severity) { case "info": - return "text-secondary-foreground rounded-md"; + return "text-primary-foreground/40 bg-muted"; case "warning": - return "text-yellow-400 rounded-md"; + return "text-warning-foreground bg-warning"; case "error": - return "text-danger rounded-md"; + return "text-destructive-foreground bg-destructive"; } }, [line]); return (
-
- {line.severity == "error" ? ( - - ) : ( - - )} - {line.severity} +
+
+ {line.severity} +
{line.dateStamp}
-
+
{line.section}
{line.content}
- {contentOverflows && ( - - )}
); diff --git a/web/tailwind.config.js b/web/tailwind.config.js index 916e625d4..ba4e69536 100644 --- a/web/tailwind.config.js +++ b/web/tailwind.config.js @@ -43,10 +43,6 @@ module.exports = { ring: "hsl(var(--ring))", danger: "#ef4444", success: "#22c55e", - // detection colors - motion: "#991b1b", - object: "#06b6d4", - audio: "#ea580c", background: "hsl(var(--background))", foreground: "hsl(var(--foreground))", selected: "hsl(var(--selected))", @@ -63,6 +59,10 @@ module.exports = { DEFAULT: "hsl(var(--destructive))", foreground: "hsl(var(--destructive-foreground))", }, + warning: { + DEFAULT: "hsl(var(--warning))", + foreground: "hsl(var(--warning-foreground))", + }, muted: { DEFAULT: "hsl(var(--muted))", foreground: "hsl(var(--muted-foreground))", diff --git a/web/themes/theme-default.css b/web/themes/theme-default.css index f0d793284..57c30fbee 100644 --- a/web/themes/theme-default.css +++ b/web/themes/theme-default.css @@ -48,8 +48,14 @@ --destructive: hsl(0 84.2% 60.2%); --destructive: 0 84.2% 60.2%; - --destructive-foreground: hsl(210 40% 98%); - --destructive-foreground: 210 40% 98%; + --destructive-foreground: hsl(0 100% 83%); + --destructive-foreground: 0 100% 83%; + + --warning: hsl(17 87% 18%); + --warning: 17 87% 18%; + + --warning-foreground: hsl(32 100% 74%); + --warning-foreground: 32 100% 74%; --border: hsl(214.3 31.8% 91.4%); --border: 214.3 31.8% 91.4%; @@ -133,8 +139,14 @@ --destructive: hsl(0 62.8% 30.6%); --destructive: 0 62.8% 30.6%; - --destructive-foreground: hsl(210 40% 98%); - --destructive-foreground: 210 40% 98%; + --destructive-foreground: hsl(0 100% 83%); + --destructive-foreground: 0 100% 83%; + + --warning: hsl(17 87% 18%); + --warning: 17 87% 18%; + + --warning-foreground: hsl(32 100% 74%); + --warning-foreground: 32 100% 74%; --border: hsl(0, 0%, 32%); --border: 0 0% 32%;