diff --git a/app/dashboard/sites/SitesPage.tsx b/app/dashboard/sites/SitesPage.tsx new file mode 100644 index 0000000..c199c33 --- /dev/null +++ b/app/dashboard/sites/SitesPage.tsx @@ -0,0 +1,35 @@ +"use client"; +import Sidebar from "@/components/Sidebar"; +import { Plus } from "lucide-react"; +import AddSite from "@/components/dialogues/AddSite"; + +interface SitesPageProps { + username: string; + name: string; +} + + +export default function SitesPage({ username, name }: SitesPageProps) { + return ( + + + + + Sites + Manage your sites. Sites are real-world locations where you can monitor your assets & add networks. + + document.getElementById('add_site')?.showModal()}> + + Add Site + + + + + + + ) +} \ No newline at end of file diff --git a/app/dashboard/sites/page.tsx b/app/dashboard/sites/page.tsx new file mode 100644 index 0000000..b43cd8b --- /dev/null +++ b/app/dashboard/sites/page.tsx @@ -0,0 +1,41 @@ +"use client"; + +import SitesPage from "./SitesPage"; +import Loading from "@/components/Loading"; + +import { useState, useEffect } from "react"; +import { useRouter } from "next/navigation"; +import axios from "axios"; +import Cookies from "js-cookie"; + +export default function Dashboard() { + const router = useRouter(); + const [loading, setLoading] = useState(true); + const [username, setUsername] = useState(""); + const [name, setName] = useState(""); + + useEffect(() => { + const init = async () => { + const token = Cookies.get("token"); + if (!token) { + router.push("/"); + } + const response = await axios.post("/api/user/validate", { token }); + if (response.data.message !== "Valid") { + Cookies.remove("token"); + router.push("/"); + } else { + setUsername(response.data.username); + setName(response.data.name); + setLoading(false); + } + }; + init(); + }, []); + + if (loading) { + return ; + } else { + return ; + } +} \ No newline at end of file diff --git a/components/dialogues/AddSite.tsx b/components/dialogues/AddSite.tsx new file mode 100644 index 0000000..9aa4eaa --- /dev/null +++ b/components/dialogues/AddSite.tsx @@ -0,0 +1,48 @@ +export default function AddSite() { + return ( + + + + + Add New Site + Provide details for the new site location + + + + + + Site Name + + + + + + + + Description + (optional) + + + + + + + + + Cancel + Add Site + + + + + + ) +} \ No newline at end of file
Manage your sites. Sites are real-world locations where you can monitor your assets & add networks.
Provide details for the new site location