diff --git a/app/layout.tsx b/app/layout.tsx
index c058c3c..0b1f308 100644
--- a/app/layout.tsx
+++ b/app/layout.tsx
@@ -3,7 +3,7 @@ import { Inter } from 'next/font/google'
import './globals.css'
import { ThemeProvider } from '@/components/theme-provider'
import { Toaster } from '@/components/ui/toaster'
-import Navbar from '@/components/Navbar'
+import { Navbar } from '@/components/Navbar'
const inter = Inter({ subsets: ['latin'] })
diff --git a/app/page.tsx b/app/page.tsx
index dbd2084..37f8cfb 100644
--- a/app/page.tsx
+++ b/app/page.tsx
@@ -4,6 +4,8 @@ import { CardTitle, Card, CardDescription, CardHeader, CardContent, CardFooter }
import RouteCards from '@/components/RouteCards';
import { Button } from '@/components/ui/button';
import { useRoutes } from '@/lib/clientActions';
+import Image from 'next/image';
+import Loading from '@/components/Loading';
export default function Home() {
@@ -12,33 +14,31 @@ export default function Home() {
let routesMap: Route[] = routes as Route[];
if (error) return
Error loading routes
- if (isLoading) return (
-
- Loading...
-
+ if(isLoading) return (
+
)
- return (
-
-
-
-
- Active Routes
- Amount of configured routes
-
-
-
-
-
-
-
-
-
-
-
-
-
- )
+ return (
+
+
+
+
+ Active Routes
+ Amount of configured routes
+
+
+
+
+
+
+
+
+
+
+
+
+
+ )
}
diff --git a/components/Navbar.tsx b/components/Navbar.tsx
index db842d5..e71c2bc 100644
--- a/components/Navbar.tsx
+++ b/components/Navbar.tsx
@@ -1,7 +1,52 @@
-export default function Navbar() {
+"use client"
+
+import * as React from "react"
+import Link from "next/link"
+
+import { cn } from "@/lib/utils"
+import {
+ NavigationMenu,
+ NavigationMenuContent,
+ NavigationMenuItem,
+ NavigationMenuLink,
+ NavigationMenuList,
+ NavigationMenuTrigger,
+ navigationMenuTriggerStyle,
+} from "@/components/ui/navigation-menu"
+import ListItem from "./ListItem"
+import { Avatar, AvatarFallback } from "./ui/avatar"
+
+export function Navbar() {
return (
-
-
Navbar
+
+
+
+
+ Caddy
+
+
+
+ Easy add, edit, and delete routes all from one place.
+
+
+
+
+
+ Panel
+
+
+
+ Easy add, edit, and delete routes all from one place.
+
+
+
+
+
+
)
}
\ No newline at end of file
diff --git a/lib/serverActions.ts b/lib/serverActions.ts
index 0a9b647..bbea70a 100644
--- a/lib/serverActions.ts
+++ b/lib/serverActions.ts
@@ -21,21 +21,15 @@
return server;
}
- export async function deleteRoute(route: Route, index: number = 0) {
- let res = await fetch("http://localhost:3000/api/caddy/routes", {
+ export async function deleteRoute(url: any, { arg }: { arg: Route }) {
+ return fetch(url, {
method: 'DELETE',
headers: {
'Content-Type': 'application/json'
},
cache: 'no-cache',
- body: JSON.stringify(route)
-
- }).catch((e) => {
- console.log(e)
- throw new Error('Failed to remove route. Please check the network and try again.');
- });
-
- return res.json();
+ body: JSON.stringify(arg)
+ }).then((res) => res.json());
}
export async function getUpstreamRequests(route: Route) {
diff --git a/package.json b/package.json
index f6b6d97..45c0175 100644
--- a/package.json
+++ b/package.json
@@ -9,7 +9,9 @@
"lint": "next lint"
},
"dependencies": {
+ "@radix-ui/react-avatar": "^1.0.4",
"@radix-ui/react-icons": "^1.3.0",
+ "@radix-ui/react-navigation-menu": "^1.1.4",
"@radix-ui/react-slot": "^1.0.2",
"@radix-ui/react-toast": "^1.1.5",
"class-variance-authority": "^0.7.0",