theme updates to match design corretly

This commit is contained in:
Nicolas Mowen 2024-04-04 14:38:59 -06:00
parent 001ee2afb1
commit d22d2d4de9
15 changed files with 52 additions and 148 deletions

View File

@ -87,7 +87,7 @@ export function CameraGroupSelector({ className }: CameraGroupSelectorProps) {
className={ className={
group == "default" group == "default"
? "text-selected bg-blue-900 focus:bg-blue-900 bg-opacity-60 focus:bg-opacity-60" ? "text-selected bg-blue-900 focus:bg-blue-900 bg-opacity-60 focus:bg-opacity-60"
: "text-muted-foreground bg-secondary focus:text-muted-foreground focus:bg-secondary" : "text-secondary-foreground bg-secondary focus:text-secondary-foreground focus:bg-secondary"
} }
size="xs" size="xs"
onClick={() => (group ? setGroup("default", true) : null)} onClick={() => (group ? setGroup("default", true) : null)}
@ -109,7 +109,7 @@ export function CameraGroupSelector({ className }: CameraGroupSelectorProps) {
className={ className={
group == name group == name
? "text-selected bg-blue-900 focus:bg-blue-900 bg-opacity-60 focus:bg-opacity-60" ? "text-selected bg-blue-900 focus:bg-blue-900 bg-opacity-60 focus:bg-opacity-60"
: "text-muted-foreground bg-secondary" : "text-secondary-foreground bg-secondary"
} }
size="xs" size="xs"
onClick={() => setGroup(name, group != "default")} onClick={() => setGroup(name, group != "default")}

View File

@ -35,7 +35,7 @@ export default function ReviewActionGroup({
}, [selectedReviews, setSelectedReviews, pullLatestData]); }, [selectedReviews, setSelectedReviews, pullLatestData]);
return ( return (
<div className="absolute inset-x-2 inset-y-0 md:left-auto md:right-2 p-2 flex gap-2 justify-between items-center bg-background"> <div className="absolute inset-x-2 inset-y-0 md:left-auto py-2 flex gap-2 justify-between items-center bg-background">
<div className="mx-1 flex justify-center items-center text-sm text-muted-foreground"> <div className="mx-1 flex justify-center items-center text-sm text-muted-foreground">
<div className="p-1">{`${selectedReviews.length} selected`}</div> <div className="p-1">{`${selectedReviews.length} selected`}</div>
<div className="p-1">{"|"}</div> <div className="p-1">{"|"}</div>
@ -58,7 +58,7 @@ export default function ReviewActionGroup({
}} }}
> >
<FaCompactDisc /> <FaCompactDisc />
{isDesktop && "Export"} {isDesktop && <div className="text-primary-foreground">Export</div>}
</Button> </Button>
)} )}
<Button <Button
@ -68,7 +68,9 @@ export default function ReviewActionGroup({
onClick={onMarkAsReviewed} onClick={onMarkAsReviewed}
> >
<FaCircleCheck /> <FaCircleCheck />
{isDesktop && "Mark as reviewed"} {isDesktop && (
<div className="text-primary-foreground">Mark as reviewed</div>
)}
</Button> </Button>
<Button <Button
className="p-2 flex items-center gap-1" className="p-2 flex items-center gap-1"
@ -77,7 +79,7 @@ export default function ReviewActionGroup({
onClick={onDelete} onClick={onDelete}
> >
<HiTrash /> <HiTrash />
{isDesktop && "Delete"} {isDesktop && <div className="text-primary-foreground">Delete</div>}
</Button> </Button>
</div> </div>
</div> </div>

View File

@ -223,8 +223,8 @@ function CamerasFilterButton({
variant="secondary" variant="secondary"
size="sm" size="sm"
> >
<FaVideo className="text-muted-foreground" /> <FaVideo className="text-secondary-foreground" />
<div className="hidden md:block"> <div className="hidden md:block text-primary-foreground">
{selectedCameras == undefined {selectedCameras == undefined
? "All Cameras" ? "All Cameras"
: `${selectedCameras.length} Cameras`} : `${selectedCameras.length} Cameras`}
@ -368,7 +368,7 @@ function ShowReviewFilter({
); );
return ( return (
<> <>
<div className="hidden h-9 md:flex p-2 justify-start items-center text-sm bg-secondary hover:bg-secondary/80 text-secondary-foreground rounded-md cursor-pointer"> <div className="hidden h-9 md:flex p-2 justify-start items-center text-sm bg-secondary hover:bg-secondary/80 text-primary-foreground rounded-md cursor-pointer">
<Switch <Switch
id="reviewed" id="reviewed"
checked={showReviewedSwitch == 1} checked={showReviewedSwitch == 1}
@ -412,8 +412,8 @@ function CalendarFilterButton({
const trigger = ( const trigger = (
<Button size="sm" className="flex items-center gap-2" variant="secondary"> <Button size="sm" className="flex items-center gap-2" variant="secondary">
<FaCalendarAlt className="text-muted-foreground" /> <FaCalendarAlt className="text-secondary-foreground" />
<div className="hidden md:block"> <div className="hidden md:block text-primary-foreground">
{day == undefined ? "Last 24 Hours" : selectedDate} {day == undefined ? "Last 24 Hours" : selectedDate}
</div> </div>
</Button> </Button>
@ -473,8 +473,8 @@ function GeneralFilterButton({
const trigger = ( const trigger = (
<Button size="sm" className="flex items-center gap-2" variant="secondary"> <Button size="sm" className="flex items-center gap-2" variant="secondary">
<FaFilter className="text-muted-foreground" /> <FaFilter className="text-secondary-foreground" />
<div className="hidden md:block">Filter</div> <div className="hidden md:block text-primary-foreground">Filter</div>
</Button> </Button>
); );
const content = ( const content = (
@ -546,7 +546,7 @@ export function GeneralFilterContent({
<div className="h-auto overflow-y-auto overflow-x-hidden"> <div className="h-auto overflow-y-auto overflow-x-hidden">
<div className="flex justify-between items-center my-2.5"> <div className="flex justify-between items-center my-2.5">
<Label <Label
className="mx-2 text-secondary-foreground cursor-pointer" className="mx-2 text-primary-foreground cursor-pointer"
htmlFor="allLabels" htmlFor="allLabels"
> >
All Labels All Labels
@ -653,7 +653,7 @@ function ShowMotionOnlyButton({
onCheckedChange={setMotionOnlyButton} onCheckedChange={setMotionOnlyButton}
/> />
<Label <Label
className="mx-2 text-secondary-foreground cursor-pointer" className="mx-2 text-primary-foreground cursor-pointer"
htmlFor="collapse-motion" htmlFor="collapse-motion"
> >
Motion only Motion only

View File

@ -187,7 +187,7 @@ export function StorageGraph({ graphId, used, total }: StorageGraphProps) {
}, },
}, },
tooltip: { tooltip: {
theme: systemTheme || theme, show: false,
}, },
xaxis: { xaxis: {
axisBorder: { axisBorder: {
@ -205,7 +205,7 @@ export function StorageGraph({ graphId, used, total }: StorageGraphProps) {
min: 0, min: 0,
max: 100, max: 100,
}, },
}; } as ApexCharts.ApexOptions;
}, [graphId, systemTheme, theme]); }, [graphId, systemTheme, theme]);
useEffect(() => { useEffect(() => {
@ -293,7 +293,6 @@ export function CameraLineGraph({
); );
const options = useMemo(() => { const options = useMemo(() => {
console.log(`new options`);
return { return {
chart: { chart: {
id: graphId, id: graphId,

View File

@ -1,101 +0,0 @@
import { GraphData } from "@/types/graph";
import Chart from "react-apexcharts";
type TimelineGraphProps = {
id: string;
data: GraphData[];
start: number;
end: number;
objects: number[];
};
/**
* A graph meant to be overlaid on top of a timeline
*/
export default function TimelineGraph({
id,
data,
start,
end,
objects,
}: TimelineGraphProps) {
return (
<Chart
type="bar"
options={{
colors: [
({ dataPointIndex }: { dataPointIndex: number }) => {
if (objects.includes(dataPointIndex)) {
return "#06b6d4";
} else {
return "#991b1b";
}
},
],
chart: {
id: id,
selection: {
enabled: false,
},
toolbar: {
show: false,
},
zoom: {
enabled: false,
},
},
dataLabels: { enabled: false },
grid: {
show: false,
padding: {
bottom: 2,
top: -12,
left: -20,
right: 0,
},
},
legend: {
show: false,
position: "top",
},
plotOptions: {
bar: {
columnWidth: "100%",
barHeight: "100%",
hideZeroBarsWhenGrouped: true,
},
},
stroke: {
width: 0,
},
tooltip: {
enabled: false,
},
xaxis: {
type: "datetime",
axisBorder: {
show: false,
},
axisTicks: {
show: false,
},
labels: {
show: false,
},
min: start,
max: end,
},
yaxis: {
axisBorder: {
show: false,
},
labels: {
show: false,
},
},
}}
series={data}
height="100%"
/>
);
}

View File

@ -12,11 +12,11 @@ import { TooltipPortal } from "@radix-ui/react-tooltip";
const variants = { const variants = {
primary: { primary: {
active: "font-bold text-white bg-selected", active: "font-bold text-white bg-selected",
inactive: "text-muted-foreground bg-secondary", inactive: "text-secondary-foreground bg-secondary",
}, },
secondary: { secondary: {
active: "font-bold text-selected", active: "font-bold text-selected",
inactive: "text-muted-foreground", inactive: "text-secondary-foreground",
}, },
}; };

View File

@ -122,8 +122,8 @@ export default function ExportDialog({
setMode("select"); setMode("select");
}} }}
> >
<FaArrowDown className="p-1 fill-secondary bg-muted-foreground rounded-md" /> <FaArrowDown className="p-1 fill-secondary bg-secondary-foreground rounded-md" />
{isDesktop && "Export"} {isDesktop && <div className="text-primary-foreground">Export</div>}
</Button> </Button>
</Trigger> </Trigger>
<Content <Content

View File

@ -237,8 +237,8 @@ function PlusFilterGroup({
> >
<Trigger asChild> <Trigger asChild>
<Button size="sm" className="mx-1 capitalize" variant="secondary"> <Button size="sm" className="mx-1 capitalize" variant="secondary">
<FaVideo className="md:mr-[10px] text-muted-foreground" /> <FaVideo className="md:mr-[10px] text-secondary-foreground" />
<div className="hidden md:block"> <div className="hidden md:block text-primary-foreground">
{selectedCameras == undefined {selectedCameras == undefined
? "All Cameras" ? "All Cameras"
: `${selectedCameras.length} Cameras`} : `${selectedCameras.length} Cameras`}
@ -314,8 +314,8 @@ function PlusFilterGroup({
> >
<Trigger asChild> <Trigger asChild>
<Button size="sm" className="mx-1 capitalize" variant="secondary"> <Button size="sm" className="mx-1 capitalize" variant="secondary">
<FaList className="md:mr-[10px] text-muted-foreground" /> <FaList className="md:mr-[10px] text-secondary-foreground" />
<div className="hidden md:block"> <div className="hidden md:block text-primary-foreground">
{selectedLabels == undefined {selectedLabels == undefined
? "All Labels" ? "All Labels"
: `${selectedLabels.length} Labels`} : `${selectedLabels.length} Labels`}

View File

@ -257,7 +257,7 @@ export function RecordingView({
onClick={() => navigate(-1)} onClick={() => navigate(-1)}
> >
<IoMdArrowRoundBack className="size-5" size="small" /> <IoMdArrowRoundBack className="size-5" size="small" />
{isDesktop && "Back"} {isDesktop && <div className="text-primary-foreground">Back</div>}
</Button> </Button>
<div className="flex items-center justify-end gap-2"> <div className="flex items-center justify-end gap-2">
<MobileCameraDrawer <MobileCameraDrawer

View File

@ -133,7 +133,7 @@ export default function LiveBirdseyeView() {
onClick={() => navigate(-1)} onClick={() => navigate(-1)}
> >
<IoMdArrowBack className="size-5" /> <IoMdArrowBack className="size-5" />
{isDesktop && "Back"} {isDesktop && <div className="text-primary-foreground">Back</div>}
</Button> </Button>
) : ( ) : (
<div /> <div />

View File

@ -228,7 +228,9 @@ export default function LiveCameraView({ camera }: LiveCameraViewProps) {
onClick={() => navigate(-1)} onClick={() => navigate(-1)}
> >
<IoMdArrowRoundBack className="size-5" /> <IoMdArrowRoundBack className="size-5" />
{isDesktop && "Back"} {isDesktop && (
<div className="text-primary-foreground">Back</div>
)}
</Button> </Button>
<Button <Button
className="flex items-center gap-2.5 rounded-lg" className="flex items-center gap-2.5 rounded-lg"
@ -248,7 +250,9 @@ export default function LiveCameraView({ camera }: LiveCameraViewProps) {
}} }}
> >
<LuHistory className="size-5" /> <LuHistory className="size-5" />
{isDesktop && "History"} {isDesktop && (
<div className="text-primary-foreground">History</div>
)}
</Button> </Button>
</div> </div>
) : ( ) : (

View File

@ -159,7 +159,7 @@ export default function CameraMetrics({
</div> </div>
<div key={camera.name} className="grid sm:grid-cols-2 gap-2"> <div key={camera.name} className="grid sm:grid-cols-2 gap-2">
{Object.keys(cameraCpuSeries).includes(camera.name) ? ( {Object.keys(cameraCpuSeries).includes(camera.name) ? (
<div className="p-2.5 bg-primary rounded-2xl flex-col"> <div className="p-2.5 bg-secondary dark:bg-primary rounded-2xl flex-col">
<div className="mb-5">CPU</div> <div className="mb-5">CPU</div>
<CameraLineGraph <CameraLineGraph
graphId={`${camera.name}-cpu`} graphId={`${camera.name}-cpu`}
@ -175,7 +175,7 @@ export default function CameraMetrics({
<Skeleton className="size-full aspect-video" /> <Skeleton className="size-full aspect-video" />
)} )}
{Object.keys(cameraFpsSeries).includes(camera.name) ? ( {Object.keys(cameraFpsSeries).includes(camera.name) ? (
<div className="p-2.5 bg-primary rounded-2xl flex-col"> <div className="p-2.5 bg-secondary dark:bg-primary rounded-2xl flex-col">
<div className="mb-5">DPS</div> <div className="mb-5">DPS</div>
<CameraLineGraph <CameraLineGraph
graphId={`${camera.name}-dps`} graphId={`${camera.name}-dps`}

View File

@ -285,7 +285,7 @@ export default function GeneralMetrics({
</div> </div>
<div className="w-full mt-4 grid grid-cols-1 sm:grid-cols-3 gap-2"> <div className="w-full mt-4 grid grid-cols-1 sm:grid-cols-3 gap-2">
{statsHistory.length != 0 ? ( {statsHistory.length != 0 ? (
<div className="p-2.5 bg-primary rounded-2xl flex-col"> <div className="p-2.5 bg-secondary dark:bg-primary rounded-2xl flex-col">
<div className="mb-5">Detector Inference Speed</div> <div className="mb-5">Detector Inference Speed</div>
{detInferenceTimeSeries.map((series) => ( {detInferenceTimeSeries.map((series) => (
<ThresholdBarGraph <ThresholdBarGraph
@ -303,7 +303,7 @@ export default function GeneralMetrics({
<Skeleton className="w-full aspect-video" /> <Skeleton className="w-full aspect-video" />
)} )}
{statsHistory.length != 0 ? ( {statsHistory.length != 0 ? (
<div className="p-2.5 bg-primary rounded-2xl flex-col"> <div className="p-2.5 bg-secondary dark:bg-primary rounded-2xl flex-col">
<div className="mb-5">Detector CPU Usage</div> <div className="mb-5">Detector CPU Usage</div>
{detCpuSeries.map((series) => ( {detCpuSeries.map((series) => (
<ThresholdBarGraph <ThresholdBarGraph
@ -321,7 +321,7 @@ export default function GeneralMetrics({
<Skeleton className="w-full aspect-video" /> <Skeleton className="w-full aspect-video" />
)} )}
{statsHistory.length != 0 ? ( {statsHistory.length != 0 ? (
<div className="p-2.5 bg-primary rounded-2xl flex-col"> <div className="p-2.5 bg-secondary dark:bg-primary rounded-2xl flex-col">
<div className="mb-5">Detector Memory Usage</div> <div className="mb-5">Detector Memory Usage</div>
{detMemSeries.map((series) => ( {detMemSeries.map((series) => (
<ThresholdBarGraph <ThresholdBarGraph
@ -359,7 +359,7 @@ export default function GeneralMetrics({
</div> </div>
<div className=" mt-4 grid grid-cols-1 sm:grid-cols-2 gap-2"> <div className=" mt-4 grid grid-cols-1 sm:grid-cols-2 gap-2">
{statsHistory.length != 0 ? ( {statsHistory.length != 0 ? (
<div className="p-2.5 bg-primary rounded-2xl flex-col"> <div className="p-2.5 bg-secondary dark:bg-primary rounded-2xl flex-col">
<div className="mb-5">GPU Usage</div> <div className="mb-5">GPU Usage</div>
{gpuSeries.map((series) => ( {gpuSeries.map((series) => (
<ThresholdBarGraph <ThresholdBarGraph
@ -377,7 +377,7 @@ export default function GeneralMetrics({
<Skeleton className="w-full aspect-video" /> <Skeleton className="w-full aspect-video" />
)} )}
{statsHistory.length != 0 ? ( {statsHistory.length != 0 ? (
<div className="p-2.5 bg-primary rounded-2xl flex-col"> <div className="p-2.5 bg-secondary dark:bg-primary rounded-2xl flex-col">
<div className="mb-5">GPU Memory</div> <div className="mb-5">GPU Memory</div>
{gpuMemSeries.map((series) => ( {gpuMemSeries.map((series) => (
<ThresholdBarGraph <ThresholdBarGraph
@ -403,7 +403,7 @@ export default function GeneralMetrics({
</div> </div>
<div className="mt-4 grid grid-cols-1 sm:grid-cols-2 gap-2"> <div className="mt-4 grid grid-cols-1 sm:grid-cols-2 gap-2">
{statsHistory.length != 0 ? ( {statsHistory.length != 0 ? (
<div className="p-2.5 bg-primary rounded-2xl flex-col"> <div className="p-2.5 bg-secondary dark:bg-primary rounded-2xl flex-col">
<div className="mb-5">Process CPU Usage</div> <div className="mb-5">Process CPU Usage</div>
{otherProcessCpuSeries.map((series) => ( {otherProcessCpuSeries.map((series) => (
<ThresholdBarGraph <ThresholdBarGraph
@ -421,7 +421,7 @@ export default function GeneralMetrics({
<Skeleton className="w-full aspect-tall" /> <Skeleton className="w-full aspect-tall" />
)} )}
{statsHistory.length != 0 ? ( {statsHistory.length != 0 ? (
<div className="p-2.5 bg-primary rounded-2xl flex-col"> <div className="p-2.5 bg-secondary dark:bg-primary rounded-2xl flex-col">
<div className="mb-5">Process Memory Usage</div> <div className="mb-5">Process Memory Usage</div>
{otherProcessMemSeries.map((series) => ( {otherProcessMemSeries.map((series) => (
<ThresholdBarGraph <ThresholdBarGraph

View File

@ -47,7 +47,7 @@ export default function StorageMetrics({
General Storage General Storage
</div> </div>
<div className="mt-4 grid grid-cols-1 sm:grid-cols-3 gap-2"> <div className="mt-4 grid grid-cols-1 sm:grid-cols-3 gap-2">
<div className="p-2.5 bg-primary rounded-2xl flex-col"> <div className="p-2.5 bg-secondary dark:bg-primary rounded-2xl flex-col">
<div className="mb-5">Recordings</div> <div className="mb-5">Recordings</div>
<StorageGraph <StorageGraph
graphId="general-recordings" graphId="general-recordings"
@ -55,7 +55,7 @@ export default function StorageMetrics({
total={totalStorage.total} total={totalStorage.total}
/> />
</div> </div>
<div className="p-2.5 bg-primary rounded-2xl flex-col"> <div className="p-2.5 bg-secondary dark:bg-primary rounded-2xl flex-col">
<div className="mb-5">/tmp/cache</div> <div className="mb-5">/tmp/cache</div>
<StorageGraph <StorageGraph
graphId="general-cache" graphId="general-cache"
@ -63,7 +63,7 @@ export default function StorageMetrics({
total={stats.service.storage["/tmp/cache"]["total"]} total={stats.service.storage["/tmp/cache"]["total"]}
/> />
</div> </div>
<div className="p-2.5 bg-primary rounded-2xl flex-col"> <div className="p-2.5 bg-secondary dark:bg-primary rounded-2xl flex-col">
<div className="mb-5">/dev/shm</div> <div className="mb-5">/dev/shm</div>
<StorageGraph <StorageGraph
graphId="general-shared-memory" graphId="general-shared-memory"
@ -77,7 +77,7 @@ export default function StorageMetrics({
</div> </div>
<div className="mt-4 grid grid-cols-1 sm:grid-cols-3 gap-2"> <div className="mt-4 grid grid-cols-1 sm:grid-cols-3 gap-2">
{Object.keys(cameraStorage).map((camera) => ( {Object.keys(cameraStorage).map((camera) => (
<div className="p-2.5 bg-primary rounded-2xl flex-col"> <div className="p-2.5 bg-secondary dark:bg-primary rounded-2xl flex-col">
<div className="mb-5 capitalize">{camera.replaceAll("_", " ")}</div> <div className="mb-5 capitalize">{camera.replaceAll("_", " ")}</div>
<StorageGraph <StorageGraph
graphId={`${camera}-storage`} graphId={`${camera}-storage`}

View File

@ -27,8 +27,8 @@
--secondary: hsl(0, 0%, 96%); --secondary: hsl(0, 0%, 96%);
--secondary: 0 0% 96%; --secondary: 0 0% 96%;
--secondary-foreground: hsl(0, 0%, 32%); --secondary-foreground: hsl(0, 0%, 83%);
--secondary-foreground: 0 0% 32%; --secondary-foreground: 0 0% 83%;
--secondary-highlight: hsl(0, 0%, 94%); --secondary-highlight: hsl(0, 0%, 94%);
--secondary-highlight: 0 0% 94%; --secondary-highlight: 0 0% 94%;
@ -112,8 +112,8 @@
--secondary: hsl(0, 0%, 15%); --secondary: hsl(0, 0%, 15%);
--secondary: 0 0% 15%; --secondary: 0 0% 15%;
--secondary-foreground: hsl(0, 0%, 83%); --secondary-foreground: hsl(0, 0%, 32%);
--secondary-foreground: 0 0% 83%; --secondary-foreground: 0 0% 32%;
--secondary-highlight: hsl(0, 0%, 25%); --secondary-highlight: hsl(0, 0%, 25%);
--secondary-highlight: 0 0% 25%; --secondary-highlight: 0 0% 25%;