aboutsummaryrefslogtreecommitdiffstats
path: root/apps/web/components/dashboard/admin/AdminNotices.tsx
diff options
context:
space:
mode:
authorMohamed Bassem <me@mbassem.com>2024-12-30 11:27:32 +0000
committerMohamed Bassem <me@mbassem.com>2024-12-30 11:31:35 +0000
commit179f00b15525b024b6823088ef8fb94b7106b4f0 (patch)
treed64257778930965ed076ff9a081411470343fb3c /apps/web/components/dashboard/admin/AdminNotices.tsx
parentaff4e60952321d06dc4cf517ff3b15206aaaebba (diff)
downloadkarakeep-179f00b15525b024b6823088ef8fb94b7106b4f0.tar.zst
feat: Change the admin page to be tabbed similar to that of the settings page
Diffstat (limited to 'apps/web/components/dashboard/admin/AdminNotices.tsx')
-rw-r--r--apps/web/components/dashboard/admin/AdminNotices.tsx71
1 files changed, 0 insertions, 71 deletions
diff --git a/apps/web/components/dashboard/admin/AdminNotices.tsx b/apps/web/components/dashboard/admin/AdminNotices.tsx
deleted file mode 100644
index 4977736f..00000000
--- a/apps/web/components/dashboard/admin/AdminNotices.tsx
+++ /dev/null
@@ -1,71 +0,0 @@
-"use client";
-
-import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
-import { Badge } from "@/components/ui/badge";
-import { api } from "@/lib/trpc";
-import { AlertCircle } from "lucide-react";
-
-import { AdminCard } from "./AdminCard";
-
-interface AdminNotice {
- level: "info" | "warning" | "error";
- message: React.ReactNode;
- title: string;
-}
-
-function useAdminNotices() {
- const { data } = api.admin.getAdminNoticies.useQuery();
- if (!data) {
- return [];
- }
- const ret: AdminNotice[] = [];
- if (data.legacyContainersNotice) {
- ret.push({
- level: "warning",
- message: (
- <p>
- You&apos;re using the legacy docker container images. Those will stop
- getting supported soon. Please follow{" "}
- <a
- href="https://docs.hoarder.app/next/Guides/legacy-container-upgrade"
- className="underline"
- >
- this guide
- </a>{" "}
- to upgrade.
- </p>
- ),
- title: "Legacy Container Images",
- });
- }
- return ret;
-}
-
-export function AdminNotices() {
- const notices = useAdminNotices();
-
- if (notices.length === 0) {
- return null;
- }
- return (
- <AdminCard>
- <div className="flex flex-col gap-2">
- {notices.map((n, i) => (
- <Alert key={i} variant="destructive">
- <AlertCircle className="h-4 w-4" />
- <AlertTitle>{n.title}</AlertTitle>
- <AlertDescription>{n.message}</AlertDescription>
- </Alert>
- ))}
- </div>
- </AdminCard>
- );
-}
-
-export function AdminNoticeBadge() {
- const notices = useAdminNotices();
- if (notices.length === 0) {
- return null;
- }
- return <Badge variant="destructive">{notices.length}</Badge>;
-}