From 021c0adff6b42653aa15131fcc8de16b502fa4ab Mon Sep 17 00:00:00 2001 From: Nick Mowen Date: Mon, 11 Dec 2023 18:28:51 -0700 Subject: [PATCH] Add toooltips for cards --- web-new/package-lock.json | 35 +++++++++++++++++++++++ web-new/package.json | 1 + web-new/src/components/ui/tooltip.tsx | 28 +++++++++++++++++++ web-new/src/pages/Storage.tsx | 40 +++++++++++++++++++++++++-- 4 files changed, 102 insertions(+), 2 deletions(-) create mode 100644 web-new/src/components/ui/tooltip.tsx diff --git a/web-new/package-lock.json b/web-new/package-lock.json index 9e594ef17..52127da3e 100644 --- a/web-new/package-lock.json +++ b/web-new/package-lock.json @@ -23,6 +23,7 @@ "@radix-ui/react-slot": "^1.0.2", "@radix-ui/react-switch": "^1.0.3", "@radix-ui/react-tabs": "^1.0.4", + "@radix-ui/react-tooltip": "^1.0.7", "axios": "^1.6.2", "class-variance-authority": "^0.7.0", "clsx": "^2.0.0", @@ -1628,6 +1629,40 @@ } } }, + "node_modules/@radix-ui/react-tooltip": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/@radix-ui/react-tooltip/-/react-tooltip-1.0.7.tgz", + "integrity": "sha512-lPh5iKNFVQ/jav/j6ZrWq3blfDJ0OH9R6FlNUHPMqdLuQ9vwDgFsRxvl8b7Asuy5c8xmoojHUxKHQSOAvMHxyw==", + "dependencies": { + "@babel/runtime": "^7.13.10", + "@radix-ui/primitive": "1.0.1", + "@radix-ui/react-compose-refs": "1.0.1", + "@radix-ui/react-context": "1.0.1", + "@radix-ui/react-dismissable-layer": "1.0.5", + "@radix-ui/react-id": "1.0.1", + "@radix-ui/react-popper": "1.1.3", + "@radix-ui/react-portal": "1.0.4", + "@radix-ui/react-presence": "1.0.1", + "@radix-ui/react-primitive": "1.0.3", + "@radix-ui/react-slot": "1.0.2", + "@radix-ui/react-use-controllable-state": "1.0.1", + "@radix-ui/react-visually-hidden": "1.0.3" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0", + "react-dom": "^16.8 || ^17.0 || ^18.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, "node_modules/@radix-ui/react-use-callback-ref": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@radix-ui/react-use-callback-ref/-/react-use-callback-ref-1.0.1.tgz", diff --git a/web-new/package.json b/web-new/package.json index 794fcc863..c085ad431 100644 --- a/web-new/package.json +++ b/web-new/package.json @@ -28,6 +28,7 @@ "@radix-ui/react-slot": "^1.0.2", "@radix-ui/react-switch": "^1.0.3", "@radix-ui/react-tabs": "^1.0.4", + "@radix-ui/react-tooltip": "^1.0.7", "axios": "^1.6.2", "class-variance-authority": "^0.7.0", "clsx": "^2.0.0", diff --git a/web-new/src/components/ui/tooltip.tsx b/web-new/src/components/ui/tooltip.tsx new file mode 100644 index 000000000..e121f0aea --- /dev/null +++ b/web-new/src/components/ui/tooltip.tsx @@ -0,0 +1,28 @@ +import * as React from "react" +import * as TooltipPrimitive from "@radix-ui/react-tooltip" + +import { cn } from "@/lib/utils" + +const TooltipProvider = TooltipPrimitive.Provider + +const Tooltip = TooltipPrimitive.Root + +const TooltipTrigger = TooltipPrimitive.Trigger + +const TooltipContent = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, sideOffset = 4, ...props }, ref) => ( + +)) +TooltipContent.displayName = TooltipPrimitive.Content.displayName + +export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } diff --git a/web-new/src/pages/Storage.tsx b/web-new/src/pages/Storage.tsx index 96a86369c..dc5c216e6 100644 --- a/web-new/src/pages/Storage.tsx +++ b/web-new/src/pages/Storage.tsx @@ -1,5 +1,6 @@ import { useWs } from "@/api/ws"; import ActivityIndicator from "@/components/ui/activity-indicator"; +import { Button } from "@/components/ui/button"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import Heading from "@/components/ui/heading"; import { @@ -10,7 +11,14 @@ import { TableHeader, TableRow, } from "@/components/ui/table"; +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from "@/components/ui/tooltip"; import { useMemo } from "react"; +import { LuAlertCircle } from "react-icons/lu"; import useSWR from "swr"; type CameraStorage = { @@ -61,7 +69,21 @@ function Storage() {
- Data +
+ Data + + + + + + +

Overview of total used storage and total capacity of the drives that hold the recordings and snapshots directories.

+
+
+
+
@@ -110,7 +132,21 @@ function Storage() { - Memory +
+ Memory + + + + + + +

Overview of used and total memory in frigate process.

+
+
+
+