generated from amosproj/amos202Xss0Y-projname
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/#60 create sidebar navigation #141
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
b4a19c8
feat(Explorer): added sidebar navigation
njochens fc79ef1
feat(Explorer): further work on sidebar
njochens 3df156f
fix(Explorer): fixed some minor bugs
njochens f1cde16
feat(Explorer): work on side bar
njochens c55b6bf
feat(Explorer): work on sidebar
njochens 55468b0
feat(Explorer): performed further changes to sidebar
njochens dcaf2f7
fix(): repaired containers page
njochens 27046f0
fix(): fixed folder id name
njochens 3a8cb77
Merge branch 'develop' into feat/#60-create-sidebar-navigation
njochens a969d6f
feat(Explorer): added changes recommended by stefan. current location…
njochens 281139a
Update page.tsx
njochens 134a2ef
fix(): reversed remove of use client
njochens a3394be
Merge branch 'develop' into feat/#60-create-sidebar-navigation
njochens 434b982
fix(): reversed remove of use client 2
njochens f09d718
Merge branch 'develop' into feat/#60-create-sidebar-navigation
njochens a978705
fix(explorer): align explorer with DB schema
vringar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Empty file.
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,10 @@ | ||
import { H1 } from "@/components/style_elements"; | ||
|
||
/* @ts-expect-error Async Server Component */ | ||
export default async function Index(): JSX.Element { | ||
return ( | ||
<div className="p-6"> | ||
<H1 content={"Cluster"} /> | ||
</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
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,15 @@ | ||
import ContainerTable from "@/components/containerTable"; | ||
import { getContainerList } from "@/lib/db"; | ||
import { H1 } from "@/components/style_elements"; | ||
|
||
export const dynamic = "force-dynamic"; | ||
/* @ts-expect-error Async Server Component */ | ||
export default async function Index(): JSX.Element { | ||
const data = await getContainerList(); | ||
return ( | ||
<div className="container mx-auto px-4"> | ||
<H1 content={"Containers"} /> | ||
<ContainerTable list={data} /> | ||
</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,10 @@ | ||
import { H1 } from "@/components/style_elements"; | ||
|
||
/* @ts-expect-error Async Server Component */ | ||
export default async function Index(): JSX.Element { | ||
return ( | ||
<div className="p-6"> | ||
<H1 content={"Dashboard"} /> | ||
</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,10 @@ | ||
import { H1 } from "@/components/style_elements"; | ||
|
||
/* @ts-expect-error Async Server Component */ | ||
export default async function Index(): JSX.Element { | ||
return ( | ||
<div className="p-6"> | ||
<H1 content={"Deployments"} /> | ||
</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
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,10 @@ | ||
import { H1 } from "@/components/style_elements"; | ||
|
||
/* @ts-expect-error Async Server Component */ | ||
export default async function Index(): JSX.Element { | ||
return ( | ||
<div className="p-6"> | ||
<H1 content={"Nodes"} /> | ||
</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,10 @@ | ||
import { H1 } from "@/components/style_elements"; | ||
|
||
/* @ts-expect-error Async Server Component */ | ||
export default async function Index(): JSX.Element { | ||
return ( | ||
<div className="p-6"> | ||
<H1 content={"Pods"} /> | ||
</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,10 @@ | ||
import { H1 } from "@/components/style_elements"; | ||
|
||
/* @ts-expect-error Async Server Component */ | ||
export default async function Index(): JSX.Element { | ||
return ( | ||
<div className="p-6"> | ||
<H1 content={"Services"} /> | ||
</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,10 @@ | ||
import { H1 } from "@/components/style_elements"; | ||
|
||
/* @ts-expect-error Async Server Component */ | ||
export default async function Index(): JSX.Element { | ||
return ( | ||
<div className="p-6"> | ||
<H1 content={"Settings"} /> | ||
</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,10 @@ | ||
import { H1 } from "@/components/style_elements"; | ||
|
||
/* @ts-expect-error Async Server Component */ | ||
export default async function Index(): JSX.Element { | ||
return ( | ||
<div className="p-6"> | ||
<H1 content={"Volumes"} /> | ||
</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
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,62 @@ | ||
"use client"; | ||
|
||
import { DarkThemeToggle, Navbar } from "flowbite-react"; | ||
import { FC } from "react"; | ||
import { useSidebarContext } from "@/context/sidebar_context"; | ||
|
||
export const Header: FC<Record<string, never>> = function () { | ||
const { isOpenOnSmallScreens, isPageWithSidebar, setOpenOnSmallScreens } = | ||
useSidebarContext(); | ||
|
||
return ( | ||
<header className="sticky top-0 z-20"> | ||
<Navbar fluid className="bg-slate-200"> | ||
{isPageWithSidebar && ( | ||
<button | ||
aria-controls="sidebar" | ||
aria-expanded="true" | ||
className="mr-2 cursor-pointer p-2 text-gray-600 hover:bg-gray-100 hover:text-gray-900 focus:bg-gray-100 focus:ring-2 focus:ring-gray-100 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white dark:focus:bg-gray-700 dark:focus:ring-gray-700 lg:hidden" | ||
onClick={() => setOpenOnSmallScreens(!isOpenOnSmallScreens)} | ||
> | ||
{isOpenOnSmallScreens ? ( | ||
<svg | ||
className="h-6 w-6" | ||
fill="currentColor" | ||
viewBox="0 0 20 20" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<path | ||
fillRule="evenodd" | ||
d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" | ||
clipRule="evenodd" | ||
></path> | ||
</svg> | ||
) : ( | ||
<svg | ||
className="h-6 w-6" | ||
fill="currentColor" | ||
viewBox="0 0 20 20" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<path | ||
fillRule="evenodd" | ||
d="M3 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 10a1 1 0 011-1h6a1 1 0 110 2H4a1 1 0 01-1-1zM3 15a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z" | ||
clipRule="evenodd" | ||
></path> | ||
</svg> | ||
)} | ||
</button> | ||
)} | ||
<Navbar.Brand> | ||
<span className="self-center whitespace-nowrap px-3 text-xl font-semibold dark:text-white"> | ||
Todo/Implement/Current/Path | ||
</span> | ||
</Navbar.Brand> | ||
<div className="flex md:order-2"> | ||
<Navbar.Toggle /> | ||
<DarkThemeToggle /> | ||
</div> | ||
</Navbar> | ||
</header> | ||
); | ||
}; |
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,120 @@ | ||||||
"use client"; | ||||||
|
||||||
import classNames from "classnames"; | ||||||
import { Sidebar as FlowbiteSidebar } from "flowbite-react"; | ||||||
import type { FC, PropsWithChildren } from "react"; | ||||||
import { useSidebarContext } from "@/context/sidebar_context"; | ||||||
import { | ||||||
HiPresentationChartLine, | ||||||
HiCog, | ||||||
HiFolder, | ||||||
HiServer, | ||||||
HiTemplate, | ||||||
HiChip, | ||||||
HiTable, | ||||||
HiHome, | ||||||
} from "react-icons/hi"; | ||||||
|
||||||
const Sidebar: FC<PropsWithChildren<Record<string, unknown>>> = function ({ | ||||||
children, | ||||||
}) { | ||||||
const { isOpenOnSmallScreens: isSidebarOpenOnSmallScreens } = | ||||||
useSidebarContext(); | ||||||
|
||||||
return ( | ||||||
<div | ||||||
className={classNames( | ||||||
"fixed overflow-auto top-0 h-screen z-10 lg:sticky lg:!block", | ||||||
{ | ||||||
hidden: !isSidebarOpenOnSmallScreens, | ||||||
} | ||||||
)} | ||||||
> | ||||||
<FlowbiteSidebar>{children}</FlowbiteSidebar> | ||||||
</div> | ||||||
); | ||||||
}; | ||||||
|
||||||
export default Object.assign(Sidebar, { ...FlowbiteSidebar }); | ||||||
|
||||||
import { usePathname } from "next/navigation"; | ||||||
|
||||||
export function ActualSidebar(): JSX.Element { | ||||||
const pathname = usePathname(); | ||||||
const splitPathname = pathname.split("/"); | ||||||
const current_page = splitPathname[1]; | ||||||
|
||||||
return ( | ||||||
<FlowbiteSidebar> | ||||||
<FlowbiteSidebar.Items> | ||||||
<FlowbiteSidebar.ItemGroup> | ||||||
<FlowbiteSidebar.Item | ||||||
href="dashboard" | ||||||
icon={HiPresentationChartLine} | ||||||
active={current_page.localeCompare("dashboard") ? false : true} | ||||||
njochens marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: I don't like this use of the ternary.
Suggested change
|
||||||
> | ||||||
Dashboard | ||||||
</FlowbiteSidebar.Item> | ||||||
<FlowbiteSidebar.Item | ||||||
href="cluster" | ||||||
icon={HiHome} | ||||||
active={current_page.localeCompare("cluster") ? false : true} | ||||||
> | ||||||
Cluster | ||||||
</FlowbiteSidebar.Item> | ||||||
<FlowbiteSidebar.Item | ||||||
href="deployments" | ||||||
icon={HiTemplate} | ||||||
active={current_page.localeCompare("deployments") ? false : true} | ||||||
> | ||||||
Deployments | ||||||
</FlowbiteSidebar.Item> | ||||||
<FlowbiteSidebar.Item | ||||||
href="nodes" | ||||||
icon={HiTemplate} | ||||||
active={current_page.localeCompare("nodes") ? false : true} | ||||||
> | ||||||
Nodes | ||||||
</FlowbiteSidebar.Item> | ||||||
<FlowbiteSidebar.Item | ||||||
href="pods" | ||||||
icon={HiTable} | ||||||
active={current_page.localeCompare("pods") ? false : true} | ||||||
> | ||||||
Pods | ||||||
</FlowbiteSidebar.Item> | ||||||
<FlowbiteSidebar.Item | ||||||
href="containers" | ||||||
icon={HiFolder} | ||||||
active={current_page.localeCompare("containers") ? false : true} | ||||||
> | ||||||
Containers | ||||||
</FlowbiteSidebar.Item> | ||||||
<FlowbiteSidebar.Item | ||||||
href="volumes" | ||||||
icon={HiServer} | ||||||
active={current_page.localeCompare("volumes") ? false : true} | ||||||
> | ||||||
Volumes | ||||||
</FlowbiteSidebar.Item> | ||||||
<FlowbiteSidebar.Item | ||||||
href="services" | ||||||
icon={HiChip} | ||||||
active={current_page.localeCompare("services") ? false : true} | ||||||
> | ||||||
Services | ||||||
</FlowbiteSidebar.Item> | ||||||
</FlowbiteSidebar.ItemGroup> | ||||||
<FlowbiteSidebar.ItemGroup> | ||||||
<FlowbiteSidebar.Item | ||||||
href="settings" | ||||||
icon={HiCog} | ||||||
active={current_page.localeCompare("settings") ? false : true} | ||||||
> | ||||||
Settings | ||||||
</FlowbiteSidebar.Item> | ||||||
</FlowbiteSidebar.ItemGroup> | ||||||
</FlowbiteSidebar.Items> | ||||||
</FlowbiteSidebar> | ||||||
); | ||||||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I wish we had a comment on this line