-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #641 from peanutprotocol/feat/logout
feat: add logout feature + fix layout
- Loading branch information
Showing
15 changed files
with
216 additions
and
55 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { redirect } from 'next/navigation' | ||
|
||
export function GET() { | ||
redirect('/request/create') | ||
} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,16 +1,7 @@ | ||
import { HTMLAttributes } from 'react' | ||
import { twMerge } from 'tailwind-merge' | ||
|
||
const PageContainer = (props: HTMLAttributes<HTMLDivElement>) => { | ||
return ( | ||
<div className="flex min-h-[calc(100dvh-3rem)] w-full items-center justify-center py-6 *:w-full md:*:w-2/5"> | ||
<div | ||
className={twMerge('mx-auto flex h-full w-full items-center justify-evenly *:w-full', props.className)} | ||
> | ||
{props.children} | ||
</div> | ||
</div> | ||
) | ||
return <div className="flex w-full items-center justify-center *:w-full md:*:w-2/5">{props.children}</div> | ||
} | ||
|
||
export default PageContainer |
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,28 @@ | ||
import { LOGOUT_ICON } from '@/assets' | ||
import { Button } from '@/components/0_Bruddle' | ||
import { useAuth } from '@/context/authContext' | ||
import Image from '../Image' | ||
import Loading from '../Loading' | ||
|
||
const LogoutButton = () => { | ||
const { logoutUser, isLoggingOut } = useAuth() | ||
|
||
const logout = async () => { | ||
await logoutUser() | ||
} | ||
|
||
return ( | ||
<Button | ||
disabled={isLoggingOut} | ||
size="medium" | ||
variant="transparent-dark" | ||
onClick={logout} | ||
className="flex w-fit items-center gap-3 hover:text-gray-1" | ||
> | ||
{isLoggingOut ? <Loading /> : <Image src={LOGOUT_ICON} alt="Logout" width={24} height={24} />} | ||
{isLoggingOut ? 'Logging out...' : 'Logout'} | ||
</Button> | ||
) | ||
} | ||
|
||
export default LogoutButton |
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,17 @@ | ||
'use client' | ||
import { getHeaderTitle } from '@/utils' | ||
import { usePathname } from 'next/navigation' | ||
import LogoutButton from '../LogoutButton' | ||
|
||
const TopNavbar = () => { | ||
const pathname = usePathname() | ||
|
||
return ( | ||
<div className="hidden h-[72px] items-center justify-between border-b border-b-black bg-background px-6 md:flex"> | ||
<h1 className="text-2xl font-extrabold md:ml-64">{getHeaderTitle(pathname)}</h1> | ||
<LogoutButton /> | ||
</div> | ||
) | ||
} | ||
|
||
export default TopNavbar |
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
Oops, something went wrong.