Skip to content

Commit

Permalink
add dashboard layout
Browse files Browse the repository at this point in the history
  • Loading branch information
iceship committed Oct 3, 2024
1 parent fdfe0a7 commit 3024443
Show file tree
Hide file tree
Showing 73 changed files with 2,024 additions and 238 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@
"editor.defaultFormatter": "Prisma.prisma"
},
"cSpell.words": [
"burguer",
"Burguer",
"formik",
"Formik",
"jiti",
"nextui",
"searchicon",
"signin",
"signout",
"superjson",
Expand Down
26 changes: 0 additions & 26 deletions middleware.ts

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"framer-motion": "^11.7.0",
"geist": "^1.3.1",
"jiti": "^2.0.0",
"next": "14.2.13",
"next": "14.2.14",
"next-auth": "^4.24.8",
"next-themes": "^0.3.0",
"postgres": "^3.4.4",
Expand Down
120 changes: 60 additions & 60 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions src/actions/auth.action.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"use server";

import { cookies } from "next/headers";

export const createAuthCookie = async () => {
cookies().set("userAuth", "myToken", { secure: true });
};

export const deleteAuthCookie = async () => {
cookies().delete("userAuth");
};
10 changes: 10 additions & 0 deletions src/app/(app)/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Layout } from "@/components/layout/layout";
import "@/styles/globals.css";

export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return <Layout>{children}</Layout>;
}
9 changes: 9 additions & 0 deletions src/app/(app)/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import type { NextPage } from "next";

import { Content } from "@/components/home/content";

const Home: NextPage = () => {
return <Content />;
};

export default Home;
10 changes: 10 additions & 0 deletions src/app/(auth)/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { AuthLayoutWrapper } from "@/components/auth/auth-layout";
import "@/styles/globals.css";

export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return <AuthLayoutWrapper>{children}</AuthLayoutWrapper>;
}
7 changes: 7 additions & 0 deletions src/app/(auth)/login/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Login from "@/components/auth/login";

const login = () => {
return <Login />;
};

export default login;
10 changes: 10 additions & 0 deletions src/app/(dashboard)/admin/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Layout } from "@/components/layout/layout";
import "@/styles/globals.css";

export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return <Layout>{children}</Layout>;
}
16 changes: 9 additions & 7 deletions src/app/(dashboard)/admin/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
export default function AdminPage() {
return (
<div>
<h1>Admin Dashboard</h1>
</div>
);
}
import type { NextPage } from "next";

import { Content } from "@/components/home/content";

const Home: NextPage = () => {
return <Content />;
};

export default Home;
74 changes: 0 additions & 74 deletions src/app/_components/auth-button.tsx

This file was deleted.

3 changes: 0 additions & 3 deletions src/app/globals.css

This file was deleted.

21 changes: 9 additions & 12 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ import { Suspense } from "react";

import { GeistSans } from "geist/font/sans";

import Providers from "@/components/providers";
import { TRPCReactProvider } from "@/trpc/react";
import "@/styles/globals.css";

import "./globals.css";
import Providers from "./providers";

export const metadata: Metadata = {
title: "Next.js Starter App",
Expand All @@ -15,9 +14,9 @@ export const metadata: Metadata = {

export default function RootLayout({
children,
}: Readonly<{
}: {
children: React.ReactNode;
}>) {
}) {
return (
<html
lang="en"
Expand All @@ -31,13 +30,11 @@ export default function RootLayout({
/>
</head>
<body className="h-screen w-screen">
<TRPCReactProvider>
<Providers>
<main className="flex-grow overflow-auto bg-[url(/light-bg.svg)] bg-cover dark:bg-[url(/dark-bg.svg)]">
<Suspense>{children}</Suspense>
</main>
</Providers>
</TRPCReactProvider>
<Providers>
<main className="flex-grow overflow-auto bg-[url(/light-bg.svg)] bg-cover dark:bg-[url(/dark-bg.svg)]">
<Suspense>{children}</Suspense>
</main>
</Providers>
</body>
</html>
);
Expand Down
42 changes: 0 additions & 42 deletions src/app/page.tsx

This file was deleted.

26 changes: 15 additions & 11 deletions src/components/providers.tsx → src/app/providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,27 @@ import { SessionProvider } from "next-auth/react";
import { ThemeProvider as NextThemesProvider } from "next-themes";
import { ThemeProviderProps } from "next-themes/dist/types";

import { TRPCReactProvider } from "@/trpc/react";

export interface ProvidersProps {
children: React.ReactNode;
themeProps?: ThemeProviderProps;
}

export default function Providers({ children, themeProps }: ProvidersProps) {
return (
<SessionProvider>
<NextUIProvider className="flex h-full w-full flex-col">
<NextThemesProvider
defaultTheme="system"
attribute="class"
{...themeProps}
>
{children}
</NextThemesProvider>
</NextUIProvider>
</SessionProvider>
<TRPCReactProvider>
<SessionProvider>
<NextUIProvider className="flex h-full w-full flex-col">
<NextThemesProvider
defaultTheme="system"
attribute="class"
{...themeProps}
>
{children}
</NextThemesProvider>
</NextUIProvider>
</SessionProvider>
</TRPCReactProvider>
);
}
4 changes: 2 additions & 2 deletions src/components/app-navbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
import { IconPackage } from "@tabler/icons-react";
import { useSession } from "next-auth/react";

import AuthButton from "../../app/_components/auth-button";
import AuthButton from "../auth/auth-button";
import SearchBox from "./search-box";
import { ThemeSwitcher } from "./theme-switcher";

Expand Down Expand Up @@ -78,7 +78,7 @@ export default function AppNavbar() {
<ThemeSwitcher />
</NavbarItem>
<NavbarItem>
<AuthButton minimal={false} />
<AuthButton />
</NavbarItem>
</NavbarContent>
<NavbarMenu>
Expand Down
Loading

0 comments on commit 3024443

Please sign in to comment.