-
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 team route and project route, refactored dashboard, and setting…
…s page routes
- Loading branch information
1 parent
c790d8f
commit 72d7722
Showing
20 changed files
with
99 additions
and
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function ProjectHomePage() { | ||
return <div>ProjectHomePage</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,3 @@ | ||
export default function ProjectSettingsPage() { | ||
return <div>ProjectSettingsPage</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,7 @@ | ||
export default function TeamRootLayout({ | ||
children, | ||
}: { | ||
children: React.ReactNode; | ||
}) { | ||
return <div>{children}</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 Dashboard from "@/components/dashboard"; | ||
|
||
export default function TeamHomePage() { | ||
return ( | ||
<div> | ||
{" "} | ||
<Dashboard /> | ||
</div> | ||
); | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,3 @@ | ||
export default function ProductsDetailsPage() { | ||
return <div>page</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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
"use client"; | ||
import useCurrentUser from "@/lib/hooks/use-current-user"; | ||
import { Avatar, AvatarFallback, AvatarImage } from "@saroh/ui/avatar"; | ||
import { Button } from "@saroh/ui/button"; | ||
import { | ||
|
@@ -10,8 +12,20 @@ import { | |
DropdownMenuShortcut, | ||
DropdownMenuTrigger, | ||
} from "@saroh/ui/dropdown-menu"; | ||
import { Skeleton } from "@saroh/ui/skeleton"; | ||
import { signOut } from "next-auth/react"; | ||
|
||
export function UserNav() { | ||
const { user, isLoading } = useCurrentUser(); | ||
|
||
if (isLoading) | ||
return ( | ||
<div> | ||
<Skeleton className="h-10 w-10 rounded-full" /> | ||
</div> | ||
); | ||
if (!user) return null; | ||
|
||
return ( | ||
<DropdownMenu> | ||
<DropdownMenuTrigger asChild> | ||
|
@@ -20,19 +34,22 @@ export function UserNav() { | |
className="relative h-8 w-8 rounded-full" | ||
> | ||
<Avatar className="h-8 w-8"> | ||
<AvatarImage src="/avatars/01.png" alt="@shadcn" /> | ||
<AvatarFallback>SC</AvatarFallback> | ||
<AvatarImage | ||
src="/avatars/01.png" | ||
alt={user.name ?? "user profile pic"} | ||
/> | ||
<AvatarFallback>{user?.name[0] ?? "U"}</AvatarFallback> | ||
</Avatar> | ||
</Button> | ||
</DropdownMenuTrigger> | ||
<DropdownMenuContent className="w-56" align="end" forceMount> | ||
<DropdownMenuLabel className="font-normal"> | ||
<div className="flex flex-col space-y-1"> | ||
<p className="text-sm font-medium leading-none"> | ||
shadcn | ||
{user.name} | ||
</p> | ||
<p className="text-muted-foreground text-xs leading-none"> | ||
[email protected] | ||
{user.email} | ||
</p> | ||
</div> | ||
</DropdownMenuLabel> | ||
|
@@ -53,7 +70,11 @@ export function UserNav() { | |
<DropdownMenuItem>New Team</DropdownMenuItem> | ||
</DropdownMenuGroup> | ||
<DropdownMenuSeparator /> | ||
<DropdownMenuItem> | ||
<DropdownMenuItem | ||
onClick={async () => { | ||
await signOut(); | ||
}} | ||
> | ||
Log out | ||
<DropdownMenuShortcut>⇧⌘Q</DropdownMenuShortcut> | ||
</DropdownMenuItem> | ||
|
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,16 @@ | ||
import { useSession } from "next-auth/react"; | ||
|
||
export default function useCurrentUser() { | ||
const { data, status } = useSession(); | ||
const user = data?.user; | ||
if (status === "loading") return { isLoading: true }; | ||
if (status === "authenticated") | ||
return { | ||
user, | ||
isLoading: false, | ||
}; | ||
if (status === "unauthenticated" || status === "error") | ||
return { isLoading: true, user: null }; | ||
|
||
return { isLoading: true, user: null }; | ||
} |
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,8 @@ | ||
import { auth } from "../auth"; | ||
|
||
export async function getCurrentUser() { | ||
const session = await auth(); | ||
const user = session?.user; | ||
if (user) return user; | ||
return null; | ||
} |
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