diff --git a/src/components/core/card/RawCard.tsx b/src/components/core/card/RawCard.tsx index f9c10c4..32225ca 100644 --- a/src/components/core/card/RawCard.tsx +++ b/src/components/core/card/RawCard.tsx @@ -95,7 +95,7 @@ export function RawCard({ color="gray" aria-label="Edit Field" component={Link} - href={`/t/edit?fld=${props.id}`} + href={`/team/edit?fld=${props.id}`} > ( - - - {item.label} - - )); - - return ( - -
- - - BuildTheEarth Logo - - Admin - - - - -
{links}
-
-
- ); -} diff --git a/src/components/layout/buildTeam/navbar.tsx b/src/components/layout/buildTeam/navbar.tsx deleted file mode 100644 index 7424e9b..0000000 --- a/src/components/layout/buildTeam/navbar.tsx +++ /dev/null @@ -1,62 +0,0 @@ -"use client"; - -import { ActionIcon, AppShellNavbar, Group, Image, Text } from "@mantine/core"; - -import ThemeIcon from "@/components/core/ThemeIcon"; -import { UserButton } from "@/components/core/UserButton"; -import useAvailableBuildTeam from "@/hooks/useAvailableBuildTeam"; -import classes from "@/styles/BuildTeamNavbar.module.css"; -import { buildTeamNavLinks } from "@/util/links"; -import { IconLock } from "@tabler/icons-react"; -import { useSession } from "next-auth/react"; -import { useRouter } from "next/router"; - -export interface BuildTeamNavbar { - currentLink: string; -} - -/** - * Navbar of BuildTeam Pages - */ -export default function BuildTeamNavbar(props: BuildTeamNavbar) { - const { activeBuildTeam } = useAvailableBuildTeam(); - const router = useRouter(); - const { data: session } = useSession(); - - const links = buildTeamNavLinks.map((item) => ( - - - {item.label} - - )); - - return ( - -
- - - BTE Logo - - BuildTheEarth - - - - -
{links}
-
- -
- -
-
- ); -} diff --git a/src/components/layout/index.tsx b/src/components/layout/index.tsx index c8c24f0..1af9824 100644 --- a/src/components/layout/index.tsx +++ b/src/components/layout/index.tsx @@ -1,15 +1,11 @@ import { AppShell, Box, ScrollArea } from "@mantine/core"; -import AdminNavbar from "./admin/navbar"; -import BuildTeamNavbar from "./buildTeam/navbar"; -import ToolsNavbar from "./tools/navbar"; +import { default as Navbar } from "./navbar"; export interface LayoutProps { children: React.ReactNode; currentLink: string; - tools?: boolean; - admin?: boolean; - team?: boolean; + currentSpace: "me" | "team"; isLoading?: boolean; loader?: React.ReactNode; } @@ -18,16 +14,6 @@ export interface LayoutProps { * Root layout of BuildTeam Pages */ export default function Layout(props: LayoutProps) { - const Navbar = props.team - ? BuildTeamNavbar - : props.tools - ? ToolsNavbar - : props.admin - ? AdminNavbar - : () => { - return <>; - }; - return ( - + diff --git a/src/components/layout/navbar.tsx b/src/components/layout/navbar.tsx new file mode 100644 index 0000000..7a01eb0 --- /dev/null +++ b/src/components/layout/navbar.tsx @@ -0,0 +1,72 @@ +"use client"; + +import { AppShellNavbar, Group, Image, Text } from "@mantine/core"; +import { IconLogout, IconSwitchHorizontal } from "@tabler/icons-react"; + +import classes from "@/styles/Navbar.module.css"; +import { navLinks } from "@/util/links"; +import { signOut } from "next-auth/react"; +import Anchor from "../core/Anchor"; + +export interface ToolsNavbar { + currentLink: string; + currentSpace: "me" | "team"; +} + +/** + * Main Navbar + */ +export default function ToolsNavbar(props: ToolsNavbar) { + const links = navLinks[props.currentSpace].map((item) => ( + + + {item.label} + + )); + + return ( + +
+ + + BuildTheEarth Logo + + MyBuildTheEarth + + + + +
{links}
+
+
+ {props.currentSpace == "team" ? ( + + + My Dashboard + + ) : ( + + + Team Dashboard + + )} + + signOut()}> + + Logout + +
+
+ ); +} diff --git a/src/components/layout/tools/navbar.tsx b/src/components/layout/tools/navbar.tsx deleted file mode 100644 index 9b36cfd..0000000 --- a/src/components/layout/tools/navbar.tsx +++ /dev/null @@ -1,46 +0,0 @@ -"use client"; - -import { ActionIcon, AppShellNavbar, Group, Image, Text } from "@mantine/core"; - -import ThemeIcon from "@/components/core/ThemeIcon"; -import classes from "@/styles/BuildTeamNavbar.module.css"; -import { toolsNavLiks } from "@/util/links"; -import { IconLock } from "@tabler/icons-react"; - -export interface ToolsNavbar { - currentLink: string; -} - -/** - * Navbar of Tools Pages - */ -export default function ToolsNavbar(props: ToolsNavbar) { - const links = toolsNavLiks.map((item) => ( - - - {item.label} - - )); - - return ( - -
- - - BuildTheEarth Logo - - Tools - - - - -
{links}
-
-
- ); -} diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 8f5a51a..e7cb59b 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -61,7 +61,10 @@ export default function Debug() { fz="sm" c="dimmed" onClick={() => - signIn("keycloak", { callbackUrl: "/t/select", redirect: true }) + signIn("keycloak", { + callbackUrl: "/team/select", + redirect: true, + }) } style={{ cursor: "pointer" }} > diff --git a/src/pages/t/index.tsx b/src/pages/team/index.tsx similarity index 97% rename from src/pages/t/index.tsx rename to src/pages/team/index.tsx index 7d56899..92725a2 100644 --- a/src/pages/t/index.tsx +++ b/src/pages/team/index.tsx @@ -24,7 +24,12 @@ export default function Home() { const { data, isLoading } = useBuildTeamData("/"); return ( - }> + } + > - ), + ) )} @@ -244,7 +249,7 @@ export default function Home() { fw="bold" className="xl2" lineClamp={1} - href={`/t/members/${data?.creatorId}`} + href={`/team/members/${data?.creatorId}`} target="_blank" > {isLoading diff --git a/src/pages/t/members/[id].tsx b/src/pages/team/members/[id].tsx similarity index 99% rename from src/pages/t/members/[id].tsx rename to src/pages/team/members/[id].tsx index e9c5e74..f3e4d65 100644 --- a/src/pages/t/members/[id].tsx +++ b/src/pages/team/members/[id].tsx @@ -59,7 +59,7 @@ export default function Home() { ); return ( - + @@ -292,7 +292,7 @@ export default function Home() { disabled={ application.buildteam.id != activeBuildTeam?.id } - href={`/t/applications/${application.id}`} + href={`/team/applications/${application.id}`} > diff --git a/src/pages/t/members/index.tsx b/src/pages/team/members/index.tsx similarity index 96% rename from src/pages/t/members/index.tsx rename to src/pages/team/members/index.tsx index 40eb8fa..9bbe2e7 100644 --- a/src/pages/t/members/index.tsx +++ b/src/pages/team/members/index.tsx @@ -27,7 +27,7 @@ export default function Home() { const { data, isLoading } = useBuildTeamData(`/members?page=${page}`); return ( - + diff --git a/src/pages/t/select.tsx b/src/pages/team/select.tsx similarity index 100% rename from src/pages/t/select.tsx rename to src/pages/team/select.tsx diff --git a/src/pages/t/tools.tsx b/src/pages/team/tools.tsx similarity index 94% rename from src/pages/t/tools.tsx rename to src/pages/team/tools.tsx index 8b664d3..e42b843 100644 --- a/src/pages/t/tools.tsx +++ b/src/pages/team/tools.tsx @@ -20,20 +20,20 @@ export default function Home() { "/teams/[team]/manage/settings", ].map( (route) => - "/" + lang + route.replaceAll("[team]", activeBuildTeam?.slug || ""), - ), + "/" + lang + route.replaceAll("[team]", activeBuildTeam?.slug || "") + ) ); const [loading, setLoading] = useState(false); const handleRerender = async () => { setLoading(true); await fetch(`/api/rerender?routes=${JSON.stringify(routes)}`).then((res) => - setLoading(false), + setLoading(false) ); }; return ( - + - + + {categoriesResult.map((category) => { diff --git a/src/pages/tools/coordinates.tsx b/src/pages/tools/coordinates.tsx index e7f8f7b..fc63837 100644 --- a/src/pages/tools/coordinates.tsx +++ b/src/pages/tools/coordinates.tsx @@ -33,7 +33,7 @@ export default function Coordinates() { }; return ( - + diff --git a/src/pages/tools/report.tsx b/src/pages/tools/report.tsx index efefbe3..48c843c 100644 --- a/src/pages/tools/report.tsx +++ b/src/pages/tools/report.tsx @@ -201,7 +201,7 @@ export default function Report() { }; return ( - + BuildTheEarth Report Form To submit a report to us, you need to fill in all the data below. diff --git a/src/pages/tools/timezone.tsx b/src/pages/tools/timezone.tsx index 7a8d915..79c5b90 100644 --- a/src/pages/tools/timezone.tsx +++ b/src/pages/tools/timezone.tsx @@ -11,11 +11,11 @@ import { } from "@mantine/core"; import { useEffect, useState } from "react"; -import { DateTimePicker } from "@mantine/dates"; -import { IconSearch } from "@tabler/icons-react"; -import Layout from "@/components/layout"; import { RawCard } from "@/components/core/card/RawCard"; import TextCard from "@/components/core/card/TextCard"; +import Layout from "@/components/layout"; +import { DateTimePicker } from "@mantine/dates"; +import { IconSearch } from "@tabler/icons-react"; import moment from "moment-timezone"; import { useRouter } from "next/router"; @@ -23,7 +23,7 @@ export default function Timezones() { const router = useRouter(); const [search, setSearch] = useState(""); const [date, setDate] = useState( - router.query?.date ? new Date(router.query.date as string) : new Date(), + router.query?.date ? new Date(router.query.date as string) : new Date() ); let loadedDate = moment(date); @@ -37,7 +37,7 @@ export default function Timezones() { }, [date, router]); return ( - +