-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
141 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
"use client"; | ||
|
||
import Link, { LinkProps } from "next/link"; | ||
import { usePathname } from "next/navigation"; | ||
import { PropsWithChildren } from "react"; | ||
|
||
/** | ||
* A navigation link that has a different style when the user is on the page it links to, or on a sub-page | ||
* @param href The URL to navigate to | ||
* @param className CSS classes for the enclosing div | ||
* @param activeClassName Additional CSS classes for the enclosing div, when active | ||
* @param linkClassName The CSS classes for the anchor tag | ||
* @param children The contents in the anchor tag | ||
* @param props Other options applicable to <Link> | ||
* @constructor | ||
*/ | ||
export default function SmartNavigation({ | ||
href, | ||
className = "px-2 border-2 border-transparent", | ||
linkClassName, | ||
children, | ||
...props | ||
}: PropsWithChildren<LinkProps & { href: string; className?: string; linkClassName?: string }>) { | ||
// get the path of the currently open page | ||
const currentPath = usePathname(); | ||
|
||
// and determine if we are currently on that path | ||
const active = (currentPath === href || currentPath?.startsWith(href + "/")) ?? false; | ||
|
||
const activeClassName = "bg-neutral-500/20 !border-gray-500 rounded"; | ||
|
||
return ( | ||
<div className={className + (active ? " " + activeClassName : "")}> | ||
<Link href={href} className={linkClassName} {...props}> | ||
{children} | ||
</Link> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import Link from "next/link"; | ||
|
||
/** | ||
* A link that somewhat resembles a button to select a different track. | ||
*/ | ||
export function SelectTrackButton() { | ||
return ( | ||
<Link | ||
href={"/select_track"} | ||
className={"bg-gray-200 dark:bg-slate-600 border-2 border-gray-500 rounded px-2 py-1 no-a-style"}> | ||
Andere Strecke wählen | ||
</Link> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,29 @@ | ||
import { FormWrapper } from "@/app/components/form"; | ||
import React from "react"; | ||
import SmartNavigation from "@/app/components/layout/smart_navigation"; | ||
|
||
/** | ||
* The | ||
* @param children | ||
* @constructor | ||
*/ | ||
export default function Layout({ children }: { children: React.ReactNode }) { | ||
return <FormWrapper>{children}</FormWrapper>; | ||
return ( | ||
<> | ||
<header | ||
className={ | ||
"flex flex-row w-full justify-items-center justify-around p-2 flex-wrap bg-gray-100 dark:bg-slate-800 gap-2" | ||
}> | ||
<SmartNavigation href={"/management/add_track"}>Strecke hinzufügen</SmartNavigation> | ||
<SmartNavigation href={"/management/vehicles"}>Fahrzeuge</SmartNavigation> | ||
<SmartNavigation href={"/management/trackers"}>Tracker</SmartNavigation> | ||
<SmartNavigation href={"/management/poi"}>Interessenspunkte</SmartNavigation> | ||
<SmartNavigation href={"/management/vehicleTypes"}>Fahrzeugarten</SmartNavigation> | ||
<SmartNavigation href={"/management/poiTypes"}>Interessenspunktarten</SmartNavigation> | ||
<SmartNavigation href={"/management/users"}>andere Nutzer</SmartNavigation> | ||
<SmartNavigation href={"/management/myself"}>eigener Nutzer</SmartNavigation> | ||
</header> | ||
<FormWrapper>{children}</FormWrapper> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters