From ccc9f42003dd20fc70323ed631e2008065bd4478 Mon Sep 17 00:00:00 2001 From: VarunShukla07 Date: Sat, 19 Jul 2025 16:05:00 +0530 Subject: [PATCH] fix(ui): add back button to API Key page --- .../app/dashboard/api-key/api-key-client.tsx | 112 +++++++++++------- 1 file changed, 70 insertions(+), 42 deletions(-) diff --git a/surfsense_web/app/dashboard/api-key/api-key-client.tsx b/surfsense_web/app/dashboard/api-key/api-key-client.tsx index 4b33fff..cf1b509 100644 --- a/surfsense_web/app/dashboard/api-key/api-key-client.tsx +++ b/surfsense_web/app/dashboard/api-key/api-key-client.tsx @@ -1,40 +1,48 @@ -'use client' +"use client"; -import React from 'react' -import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card" -import { Button } from "@/components/ui/button" -import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert" -import { motion, AnimatePresence } from "framer-motion" -import { IconCheck, IconCopy, IconKey } from "@tabler/icons-react" -import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip" -import { useApiKey } from "@/hooks/use-api-key" +import React from "react"; +import { useRouter } from "next/navigation"; +import { ArrowLeft } from "lucide-react"; +import { + Card, + CardContent, + CardDescription, + CardHeader, + CardTitle, +} from "@/components/ui/card"; +import { Button } from "@/components/ui/button"; +import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"; +import { motion, AnimatePresence } from "framer-motion"; +import { IconCheck, IconCopy, IconKey } from "@tabler/icons-react"; +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from "@/components/ui/tooltip"; +import { useApiKey } from "@/hooks/use-api-key"; const fadeIn = { hidden: { opacity: 0 }, - visible: { opacity: 1, transition: { duration: 0.4 } } -} + visible: { opacity: 1, transition: { duration: 0.4 } }, +}; const staggerContainer = { hidden: { opacity: 0 }, visible: { opacity: 1, transition: { - staggerChildren: 0.1 - } - } -} + staggerChildren: 0.1, + }, + }, +}; const ApiKeyClient = () => { - const { - apiKey, - isLoading, - copied, - copyToClipboard - } = useApiKey() - + const { apiKey, isLoading, copied, copyToClipboard } = useApiKey(); + const router = useRouter(); return (
- { Important - Your API key grants full access to your account. Never share it publicly or with unauthorized users. + Your API key grants full access to your account. Never share it + publicly or with unauthorized users. @@ -68,15 +77,15 @@ const ApiKeyClient = () => { {isLoading ? ( - ) : apiKey ? ( - { - @@ -118,7 +131,7 @@ const ApiKeyClient = () => { ) : ( - { - -

How to use your API key

+

+ How to use your API key +

- -

Authentication

+

+ Authentication +

- Include your API key in the Authorization header of your requests: + Include your API key in the Authorization header of your + requests:

- - Authorization: Bearer {apiKey || 'YOUR_API_KEY'} + Authorization: Bearer {apiKey || "YOUR_API_KEY"}
@@ -168,9 +186,19 @@ const ApiKeyClient = () => {
+
+ +
- ) -} + ); +}; -export default ApiKeyClient \ No newline at end of file +export default ApiKeyClient;