-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added loading skeletons to RSC and expanded profile page with salary …
…and setting sections
- Loading branch information
1 parent
83c10be
commit d34eaa9
Showing
48 changed files
with
679 additions
and
277 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
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,20 @@ | ||
import { TabNavigation } from "@/components/tab-navigation"; | ||
import { Card } from "@/components/ui/card"; | ||
|
||
export default function ProfileLayout({ children }: { children: React.ReactNode }) { | ||
return ( | ||
<div className="space-y-3"> | ||
<TabNavigation | ||
path="/dashboard/profile" | ||
items={[ | ||
{ text: "Profile", slug: "" }, | ||
{ text: "Salary", slug: "salary" }, | ||
{ text: "Settings", slug: "settings" } | ||
]} | ||
/> | ||
<Card> | ||
<Card.Content className="p-4">{children}</Card.Content> | ||
</Card> | ||
</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,24 @@ | ||
import { UserSalaryDetailsFormSkeleton } from "@/components/user/user-salary-details-form"; | ||
import { Suspense } from "react"; | ||
import SalaryForm from "../../_components/salary-form"; | ||
|
||
export const runtime = "edge"; | ||
export const dynamic = "force-dynamic"; | ||
export const dynamicParams = true; | ||
|
||
export const metadata = { | ||
title: "Profile" | ||
}; | ||
|
||
export default async function ProfilePage() { | ||
return ( | ||
<div className="grid grid-cols-1 lg:grid-cols-2"> | ||
<div> | ||
<Suspense fallback={<UserSalaryDetailsFormSkeleton />}> | ||
{/* @ts-expect-error Async Server Component */} | ||
<SalaryForm /> | ||
</Suspense> | ||
</div> | ||
</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,22 @@ | ||
import { UserSettingsFormSkeleton } from "@/components/user/user-settings-form"; | ||
import { Suspense } from "react"; | ||
import SettingsForm from "../../_components/settings-form"; | ||
|
||
export const runtime = "edge"; | ||
export const dynamic = "force-dynamic"; | ||
export const dynamicParams = true; | ||
|
||
export const metadata = { | ||
title: "Settings" | ||
}; | ||
|
||
export default async function SettingsPage() { | ||
return ( | ||
<div className="grid grid-cols-1 lg:grid-cols-2"> | ||
<Suspense fallback={<UserSettingsFormSkeleton />}> | ||
{/* @ts-expect-error Async Server Component */} | ||
<SettingsForm /> | ||
</Suspense> | ||
</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,38 @@ | ||
"use client"; | ||
|
||
import { LoginButton } from "@/components/auth/login-button"; | ||
import { Icons } from "@/components/icons"; | ||
import { Show } from "@/components/ui/show"; | ||
import { useState } from "react"; | ||
|
||
export default function LoginPageContent() { | ||
const [isLoggingIn, setIsLoggingIn] = useState(false); | ||
|
||
return ( | ||
<div className="container flex h-screen w-screen flex-col items-center justify-center"> | ||
<div className="mx-auto flex w-full flex-col justify-center space-y-6 md:max-w-[400px]"> | ||
<div className="flex flex-col space-y-2 text-center"> | ||
<Icons.Logo className="mx-auto" /> | ||
<h1 className="text-2xl font-semibold tracking-tight"> | ||
{isLoggingIn ? "Logging you in" : "Welcome back"} | ||
</h1> | ||
<p className="mb-8 text-sm text-neutral-500 dark:text-neutral-400"> | ||
{isLoggingIn | ||
? "This may take a few seconds, please don't close this page." | ||
: "Click to login with your Knowit AD account."} | ||
</p> | ||
</div> | ||
<LoginButton | ||
className="mx-auto w-full max-w-[300px]" | ||
disabled={isLoggingIn} | ||
onLoginClicked={() => setIsLoggingIn(true)} | ||
> | ||
{isLoggingIn ? "Logging you in..." : "Login with Knowit AD"} | ||
<Show when={isLoggingIn}> | ||
<Icons.Loader className="ml-2 h-4 w-4" /> | ||
</Show> | ||
</LoginButton> | ||
</div> | ||
</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,40 @@ | ||
"use client"; | ||
|
||
export type Item = { | ||
text: string; | ||
slug?: string; | ||
segment?: string; | ||
}; | ||
|
||
import Link from "next/link"; | ||
import { useSelectedLayoutSegment } from "next/navigation"; | ||
import { buttonVariants } from "./ui/button"; | ||
|
||
const TabNavigationItem = ({ path, item }: { path: string; item: Item }) => { | ||
const segment = useSelectedLayoutSegment(); | ||
const href = item.slug ? path + "/" + item.slug : path; | ||
const isActive = | ||
// Example home pages e.g. `/layouts` | ||
(!item.slug && segment === null) || | ||
segment === item.segment || | ||
// Nested pages e.g. `/layouts/electronics` | ||
segment === item.slug; | ||
|
||
return ( | ||
<Link href={href} className={buttonVariants({ variant: isActive ? "default" : "outline" })}> | ||
{item.text} | ||
</Link> | ||
); | ||
}; | ||
|
||
const TabNavigation = ({ path, items }: { path: string; items: Item[] }) => { | ||
return ( | ||
<div className="flex flex-wrap items-center gap-2"> | ||
{items.map(item => ( | ||
<TabNavigationItem key={path + item.slug} item={item} path={path} /> | ||
))} | ||
</div> | ||
); | ||
}; | ||
|
||
export { TabNavigation }; |
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,8 +1,8 @@ | ||
"use client" | ||
"use client"; | ||
|
||
import { ThemeProvider as NextThemesProvider } from "next-themes" | ||
import { ThemeProviderProps } from "next-themes/dist/types" | ||
import { ThemeProvider as NextThemesProvider } from "next-themes"; | ||
import { ThemeProviderProps } from "next-themes/dist/types"; | ||
|
||
export function ThemeProvider({ children, ...props }: ThemeProviderProps) { | ||
return <NextThemesProvider {...props}>{children}</NextThemesProvider> | ||
export function ThemeProvider({ children, ...other }: ThemeProviderProps) { | ||
return <NextThemesProvider {...other}>{children}</NextThemesProvider>; | ||
} |
Oops, something went wrong.