do some changes to prepare for org pages
This commit is contained in:
parent
a9944aa5e0
commit
b72c4bc788
@ -18,7 +18,7 @@ const DashboardLayout = ({
|
|||||||
<OrganizationProvider>
|
<OrganizationProvider>
|
||||||
<div className="min-h-screen flex">
|
<div className="min-h-screen flex">
|
||||||
<Sidebar />
|
<Sidebar />
|
||||||
{children}
|
<div className="w-full mx-7 my-6">{children}</div>
|
||||||
</div>
|
</div>
|
||||||
</OrganizationProvider>
|
</OrganizationProvider>
|
||||||
</UserProvider>
|
</UserProvider>
|
||||||
|
28
src/app/(pages)/dashboard/org/layout.tsx
Normal file
28
src/app/(pages)/dashboard/org/layout.tsx
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { ReactElement, ReactNode } from "react";
|
||||||
|
import { useOrganizationContext } from "@/app/provider/organization-provider";
|
||||||
|
import { Organization } from "@/app/types/org/organization";
|
||||||
|
import { OrganizationState } from "@/app/store/organization-store";
|
||||||
|
import NoOrganizationSelected from "@/components/dashboard/no-organization-selected";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The layout for the organization pages.
|
||||||
|
*
|
||||||
|
* @param children the children to render
|
||||||
|
* @returns the layout jsx
|
||||||
|
*/
|
||||||
|
const OrganizationLayout = ({
|
||||||
|
children,
|
||||||
|
}: Readonly<{
|
||||||
|
children: ReactNode;
|
||||||
|
}>): ReactElement => {
|
||||||
|
const selectedOrganization: Organization | undefined =
|
||||||
|
useOrganizationContext((state: OrganizationState) => state.selected);
|
||||||
|
return (
|
||||||
|
<div className="h-full">
|
||||||
|
{selectedOrganization ? children : <NoOrganizationSelected />}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default OrganizationLayout;
|
4
src/app/(pages)/dashboard/org/status-pages/page.tsx
Normal file
4
src/app/(pages)/dashboard/org/status-pages/page.tsx
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
import { ReactElement } from "react";
|
||||||
|
|
||||||
|
const StatusPagesPage = (): ReactElement => <main>BOB?</main>;
|
||||||
|
export default StatusPagesPage;
|
@ -14,10 +14,6 @@ const DashboardPage = (): ReactElement => {
|
|||||||
const user: User | undefined = useUserContext(
|
const user: User | undefined = useUserContext(
|
||||||
(state: UserState) => state.user
|
(state: UserState) => state.user
|
||||||
);
|
);
|
||||||
return (
|
return <main>Hi there {user?.username}, welcome to Pulse App!</main>;
|
||||||
<main className="p-4">
|
|
||||||
Hi there {user?.username}, welcome to Pulse App!
|
|
||||||
</main>
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
export default DashboardPage;
|
export default DashboardPage;
|
||||||
|
@ -10,7 +10,7 @@ import UserSettingsHeader from "@/components/dashboard/user/user-settings-header
|
|||||||
* @return the page jsx
|
* @return the page jsx
|
||||||
*/
|
*/
|
||||||
const UserBillingPage = (): ReactElement => (
|
const UserBillingPage = (): ReactElement => (
|
||||||
<main className="w-[47rem] px-10 py-7 flex flex-col gap-5">
|
<main className="w-[47rem] flex flex-col gap-5">
|
||||||
<UserSettingsHeader title="Billing" />
|
<UserSettingsHeader title="Billing" />
|
||||||
|
|
||||||
{/* Content */}
|
{/* Content */}
|
||||||
|
@ -14,7 +14,7 @@ import UserSettingsHeader from "@/components/dashboard/user/user-settings-header
|
|||||||
* @return the page jsx
|
* @return the page jsx
|
||||||
*/
|
*/
|
||||||
const UserProfilePage = (): ReactElement => (
|
const UserProfilePage = (): ReactElement => (
|
||||||
<main className="w-[47rem] px-10 py-7 flex flex-col gap-5">
|
<main className="w-[47rem] flex flex-col gap-5">
|
||||||
<UserSettingsHeader title="My Profile" />
|
<UserSettingsHeader title="My Profile" />
|
||||||
|
|
||||||
{/* Content */}
|
{/* Content */}
|
||||||
|
@ -12,7 +12,7 @@ import DevicesSetting from "@/components/dashboard/user/settings/device/devices-
|
|||||||
* @return the page jsx
|
* @return the page jsx
|
||||||
*/
|
*/
|
||||||
const UserSettingsPage = (): ReactElement => (
|
const UserSettingsPage = (): ReactElement => (
|
||||||
<main className="w-[47rem] px-10 py-7 flex flex-col gap-5">
|
<main className="w-[47rem] flex flex-col gap-5">
|
||||||
<UserSettingsHeader title="Settings" />
|
<UserSettingsHeader title="Settings" />
|
||||||
|
|
||||||
{/* Content */}
|
{/* Content */}
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
import { ReactNode, useCallback, useContext, useEffect, useRef } from "react";
|
import { ReactNode, useCallback, useContext, useEffect, useRef } from "react";
|
||||||
import { UserState } from "@/app/store/user-store";
|
import { UserState } from "@/app/store/user-store";
|
||||||
import { User } from "@/app/types/user/user";
|
|
||||||
import { StoreApi, useStore } from "zustand";
|
import { StoreApi, useStore } from "zustand";
|
||||||
import createOrganizationStore, {
|
import createOrganizationStore, {
|
||||||
OrganizationContext,
|
OrganizationContext,
|
||||||
@ -24,9 +23,6 @@ const OrganizationProvider = ({ children }: { children: ReactNode }) => {
|
|||||||
const session: Session | undefined = useUserContext(
|
const session: Session | undefined = useUserContext(
|
||||||
(state: UserState) => state.session
|
(state: UserState) => state.session
|
||||||
);
|
);
|
||||||
const user: User | undefined = useUserContext(
|
|
||||||
(state: UserState) => state.user
|
|
||||||
);
|
|
||||||
|
|
||||||
const storeRef = useRef<OrganizationStore>();
|
const storeRef = useRef<OrganizationStore>();
|
||||||
if (!storeRef.current) {
|
if (!storeRef.current) {
|
||||||
|
67
src/components/dashboard/dashboard-header.tsx
Normal file
67
src/components/dashboard/dashboard-header.tsx
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { ReactElement } from "react";
|
||||||
|
import { User } from "@/app/types/user/user";
|
||||||
|
import { useUserContext } from "@/app/provider/user-provider";
|
||||||
|
import { UserState } from "@/app/store/user-store";
|
||||||
|
import {
|
||||||
|
Breadcrumb,
|
||||||
|
BreadcrumbItem,
|
||||||
|
BreadcrumbLink,
|
||||||
|
BreadcrumbList,
|
||||||
|
BreadcrumbPage,
|
||||||
|
BreadcrumbSeparator,
|
||||||
|
} from "@/components/ui/breadcrumb";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The props for this header.
|
||||||
|
*/
|
||||||
|
type DashboardHeaderProps = {
|
||||||
|
/**
|
||||||
|
* The title of this header.
|
||||||
|
*/
|
||||||
|
title: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The breadcrumb of this header.
|
||||||
|
*/
|
||||||
|
breadcrumb: ReactElement;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The header to display
|
||||||
|
* on dashboard pages.
|
||||||
|
*
|
||||||
|
* @param props the header props
|
||||||
|
* @return the header jsx
|
||||||
|
*/
|
||||||
|
const DashboardHeader = ({
|
||||||
|
title,
|
||||||
|
breadcrumb,
|
||||||
|
}: DashboardHeaderProps): ReactElement => {
|
||||||
|
const user: User | undefined = useUserContext(
|
||||||
|
(state: UserState) => state.user
|
||||||
|
);
|
||||||
|
return (
|
||||||
|
<div className="flex flex-col gap-1.5 select-none">
|
||||||
|
<h1 className="text-2xl font-bold">{title}</h1>
|
||||||
|
|
||||||
|
<Breadcrumb>
|
||||||
|
<BreadcrumbList>
|
||||||
|
<BreadcrumbItem>
|
||||||
|
<BreadcrumbLink href="/dashboard" draggable={false}>
|
||||||
|
Dashboard
|
||||||
|
</BreadcrumbLink>
|
||||||
|
</BreadcrumbItem>
|
||||||
|
<BreadcrumbSeparator />
|
||||||
|
{breadcrumb}
|
||||||
|
<BreadcrumbSeparator />
|
||||||
|
<BreadcrumbItem>
|
||||||
|
<BreadcrumbPage>{title}</BreadcrumbPage>
|
||||||
|
</BreadcrumbItem>
|
||||||
|
</BreadcrumbList>
|
||||||
|
</Breadcrumb>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default DashboardHeader;
|
17
src/components/dashboard/no-organization-selected.tsx
Normal file
17
src/components/dashboard/no-organization-selected.tsx
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import { ReactElement } from "react";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* No organization selected.
|
||||||
|
*
|
||||||
|
* @return the screen jsx
|
||||||
|
*/
|
||||||
|
const NoOrganizationSelected = (): ReactElement => (
|
||||||
|
<div className="h-full flex flex-col gap-2 justify-center text-center items-center">
|
||||||
|
<h1 className="text-2xl font-bold">No Organization ):</h1>
|
||||||
|
<p className="max-w-72 opacity-75">
|
||||||
|
It's a little empty here. Create an organization to get
|
||||||
|
started!
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
export default NoOrganizationSelected;
|
@ -1,7 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { ReactElement, useEffect, useState } from "react";
|
import { ReactElement, useState } from "react";
|
||||||
import { ChevronsUpDownIcon } from "lucide-react";
|
import { ChevronsUpDownIcon } from "lucide-react";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import {
|
import {
|
||||||
|
@ -28,32 +28,32 @@ const links: SidebarLink[] = [
|
|||||||
{
|
{
|
||||||
name: "Status Pages",
|
name: "Status Pages",
|
||||||
icon: <ClipboardIcon />,
|
icon: <ClipboardIcon />,
|
||||||
href: "/dashboard/status-pages",
|
href: "/dashboard/org/status-pages",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Automations",
|
name: "Automations",
|
||||||
icon: <WrenchIcon />,
|
icon: <WrenchIcon />,
|
||||||
href: "/dashboard/automations",
|
href: "/dashboard/org/automations",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Incidents",
|
name: "Incidents",
|
||||||
icon: <FireIcon />,
|
icon: <FireIcon />,
|
||||||
href: "/dashboard/incidents",
|
href: "/dashboard/org/incidents",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Insights",
|
name: "Insights",
|
||||||
icon: <ChartBarSquareIcon />,
|
icon: <ChartBarSquareIcon />,
|
||||||
href: "/dashboard/insights",
|
href: "/dashboard/org/insights",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Audit Logs",
|
name: "Audit Logs",
|
||||||
icon: <PencilSquareIcon />,
|
icon: <PencilSquareIcon />,
|
||||||
href: "/dashboard/audit",
|
href: "/dashboard/org/audit",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Settings",
|
name: "Settings",
|
||||||
icon: <Cog6ToothIcon />,
|
icon: <Cog6ToothIcon />,
|
||||||
href: "/dashboard/settings",
|
href: "/dashboard/org/settings",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
import { userMenuLinks } from "@/components/dashboard/sidebar/user-menu/user-menu";
|
import { userMenuLinks } from "@/components/dashboard/sidebar/user-menu/user-menu";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { DropdownMenuItem } from "@/components/ui/dropdown-menu";
|
import { DropdownMenuItem } from "@/components/ui/dropdown-menu";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user