-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add success Dialog and UI improvment #465
Changes from 8 commits
c1c4ecd
1cfed03
b0e0d6a
161e4ac
70309cd
7cca963
03e5114
f95dca8
b50bde6
0130c73
e8c6758
b442355
a63d08d
34531fc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -11,6 +11,13 @@ import { | |||||
import { MenuIcon } from "lucide-react" | ||||||
import { useState } from "react" | ||||||
import Link from "next/link" | ||||||
import { useTheme } from 'next-themes'; | ||||||
import {User,LogOut} from 'lucide-react'; | ||||||
import { useRouter } from "next/navigation"; | ||||||
import Cookies from 'js-cookie'; | ||||||
import useProjectStore from "@/state/projectStore"; | ||||||
import { useQueryClient } from '@tanstack/react-query'; | ||||||
import useProfileStore from "@/state/profileStore"; | ||||||
|
||||||
|
||||||
export function SmallNav({ | ||||||
|
@@ -19,7 +26,12 @@ export function SmallNav({ | |||||
onLinkClick: (name: string) => void | ||||||
}) { | ||||||
const [selectedItem, setSelectedItem] = useState<string>("dashboard"); | ||||||
const router = useRouter(); | ||||||
const { profile, setProfile } = useProfileStore(); | ||||||
const { setIdProject } = useProjectStore(); | ||||||
const queryClient = useQueryClient(); | ||||||
const [open, setOpen] = useState(false); | ||||||
const { theme } = useTheme() | ||||||
const navItemClassName = (itemName: string) => | ||||||
`text-sm border-b font-medium w-full text-left mx-0 py-2 dark:hover:bg-zinc-900 hover:bg-zinc-200 cursor-pointer ${ | ||||||
selectedItem === itemName ? "dark:bg-zinc-800 bg-zinc-200" : "text-muted-foreground" | ||||||
|
@@ -30,6 +42,15 @@ export function SmallNav({ | |||||
onLinkClick(name); | ||||||
setOpen(false); | ||||||
} | ||||||
|
||||||
const onLogout = () => { | ||||||
router.push('/b2c/login') | ||||||
Cookies.remove("access_token") | ||||||
setProfile(null) | ||||||
setIdProject("") | ||||||
queryClient.clear() | ||||||
} | ||||||
|
||||||
return ( | ||||||
<div className="flex flex-row mx-0 px-0"> | ||||||
<Sheet key={"left"} open={open} onOpenChange={setOpen}> | ||||||
|
@@ -39,8 +60,10 @@ export function SmallNav({ | |||||
<SheetContent side={"left"} className="p-0 w-[200px]"> | ||||||
<SheetHeader className="flex items-center"> | ||||||
<SheetTitle className="mx-4 my-4"> | ||||||
<Link href="/" className="flex flex-row items-center" onClick={() => setOpen(false)}> | ||||||
<img src="./../../../../public/logo.png" className="w-10 mr-1"/><span className="font-bold">Panora.</span> | ||||||
<Link href="/" className="flex flex-row" onClick={() => setOpen(false)}> | ||||||
{/* <img src="./../../../../public/logo.png" className="w-10 mr-1"/><span className="font-bold">Panora.</span> */} | ||||||
{theme == "light" ? <img src="/logo-panora-black.png" className='w-12' /> : <img src="/logo-panora-white-hq.png" className='w-12' />} | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Provide alt text for images and use strict equality. - {theme == "light" ? <img src="/logo-panora-black.png" className='w-12' /> : <img src="/logo-panora-white-hq.png" className='w-12' />}
+ {theme === "light" ? <img src="/logo-panora-black.png" alt="Panora Logo Black" className='w-12' /> : <img src="/logo-panora-white-hq.png" alt="Panora Logo White" className='w-12' />} Committable suggestion
Suggested change
|
||||||
|
||||||
</Link> | ||||||
</SheetTitle> | ||||||
</SheetHeader> | ||||||
|
@@ -93,6 +116,20 @@ export function SmallNav({ | |||||
<p className="mx-4">Docs</p> | ||||||
<svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M3 2C2.44772 2 2 2.44772 2 3V12C2 12.5523 2.44772 13 3 13H12C12.5523 13 13 12.5523 13 12V8.5C13 8.22386 12.7761 8 12.5 8C12.2239 8 12 8.22386 12 8.5V12H3V3L6.5 3C6.77614 3 7 2.77614 7 2.5C7 2.22386 6.77614 2 6.5 2H3ZM12.8536 2.14645C12.9015 2.19439 12.9377 2.24964 12.9621 2.30861C12.9861 2.36669 12.9996 2.4303 13 2.497L13 2.5V2.50049V5.5C13 5.77614 12.7761 6 12.5 6C12.2239 6 12 5.77614 12 5.5V3.70711L6.85355 8.85355C6.65829 9.04882 6.34171 9.04882 6.14645 8.85355C5.95118 8.65829 5.95118 8.34171 6.14645 8.14645L11.2929 3H9.5C9.22386 3 9 2.77614 9 2.5C9 2.22386 9.22386 2 9.5 2H12.4999H12.5C12.5678 2 12.6324 2.01349 12.6914 2.03794C12.7504 2.06234 12.8056 2.09851 12.8536 2.14645Z" fill="currentColor" fillRule="evenodd" clipRule="evenodd"></path></svg> | ||||||
</a> | ||||||
<a | ||||||
className={`${navItemClassName('b2c/profile')} flex gap-2 px-4`} | ||||||
onClick={() => click('b2c/profile')} | ||||||
> | ||||||
<User className="h-4 w-4" /> | ||||||
<p className="">Profile</p> | ||||||
</a> | ||||||
<a | ||||||
className={`${navItemClassName('log-out')} px-4 flex gap-2`} | ||||||
onClick={() => onLogout()} | ||||||
> | ||||||
<LogOut className="h-4 w-4" /> | ||||||
<p className="">Log Out</p> | ||||||
</a> | ||||||
</nav> | ||||||
</SheetContent> | ||||||
</Sheet> | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -13,10 +13,15 @@ import { ThemeToggle } from '@/components/Nav/theme-toggle'; | |||||
import useProjects from '@/hooks/get/useProjects'; | ||||||
import useRefreshAccessTokenMutation from '@/hooks/create/useRefreshAccessToken'; | ||||||
import { useTheme } from 'next-themes'; | ||||||
import { useState } from "react"; | ||||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"; | ||||||
import { Button } from "@/components/ui/button"; | ||||||
import { toast } from "sonner"; | ||||||
|
||||||
export const RootLayout = ({children}:{children:React.ReactNode}) => { | ||||||
const router = useRouter() | ||||||
const base = process.env.NEXT_PUBLIC_WEBAPP_DOMAIN; | ||||||
const [copiesProjectID, SetCopiesProjectID] = useState<boolean>(false); | ||||||
const {data : projectsData} = useProjects(); | ||||||
const { idProject, setIdProject } = useProjectStore(); | ||||||
const {mutate : refreshAccessToken} = useRefreshAccessTokenMutation() | ||||||
|
@@ -42,9 +47,23 @@ export const RootLayout = ({children}:{children:React.ReactNode}) => { | |||||
} | ||||||
}; | ||||||
|
||||||
const handleCopyRight = () => { | ||||||
navigator.clipboard.writeText(idProject); | ||||||
toast.success("Project ID copied!", { | ||||||
action: { | ||||||
label: "Close", | ||||||
onClick: () => console.log("Close"), | ||||||
}, | ||||||
}) | ||||||
SetCopiesProjectID(true); | ||||||
setTimeout(() => { | ||||||
SetCopiesProjectID(false); | ||||||
}, 2000); | ||||||
}; | ||||||
|
||||||
return ( | ||||||
<> | ||||||
<div className="fixed top-0 left-0 right-0 supports-backdrop-blur:bg-background/60 border-b bg-background/95 backdrop-blur z-20"> | ||||||
{/* <div className="fixed top-0 left-0 right-0 supports-backdrop-blur:bg-background/60 border-b bg-background/95 backdrop-blur z-20"> | ||||||
<nav className="h-14 flex items-center justify-between px-4"> | ||||||
<div className="hidden lg:block"> | ||||||
<Link href='/'> | ||||||
|
@@ -60,21 +79,68 @@ export const RootLayout = ({children}:{children:React.ReactNode}) => { | |||||
<ThemeToggle /> | ||||||
</div> | ||||||
</nav> | ||||||
</div> | ||||||
</div> */} | ||||||
<div className="flex h-screen overflow-hidden"> | ||||||
|
||||||
<nav | ||||||
className={cn(`relative hidden h-screen border-r pt-16 lg:block w-72`)} | ||||||
className={cn(`relative hidden h-screen border-r lg:block w-72`)} | ||||||
> | ||||||
<div className="space-y-4 py-4"> | ||||||
<div className='flex items-center justify-center min-w-full'> | ||||||
<div className="hidden lg:block pt-5"> | ||||||
<Link href='/'> | ||||||
{theme == "light" ? <img src="/logo-panora-black.png" className='w-14' /> : <img src="/logo-panora-white-hq.png" className='w-14' />} | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Provide alt text for images and use strict equality. - {theme == "light" ? <img src="/logo-panora-black.png" className='w-14' /> : <img src="/logo-panora-white-hq.png" className='w-14' />}
+ {theme === "light" ? <img src="/logo-panora-black.png" alt="Panora Logo Black" className='w-14' /> : <img src="/logo-panora-white-hq.png" alt="Panora Logo White" className='w-14' />} Committable suggestion
Suggested change
|
||||||
</Link> | ||||||
</div> | ||||||
|
||||||
</div> | ||||||
|
||||||
<div className="space-y-4 py-4 pt-10"> | ||||||
<div className="px-3 py-2"> | ||||||
<div className="space-y-3"> | ||||||
<TeamSwitcher className='w-40 ml-3' projects={projectsData? projectsData : []}/> | ||||||
<p className='text-xs dark:text-gray-400 cursor-default text-gray-950 font-semibold'>Project</p> | ||||||
<div className='flex gap-2 items-center'> | ||||||
<TeamSwitcher className='w-40 ml-3' projects={projectsData? projectsData : []}/> | ||||||
<div | ||||||
className="cursor-pointer" | ||||||
onClick={handleCopyRight} | ||||||
> | ||||||
<TooltipProvider delayDuration={0}> | ||||||
<Tooltip> | ||||||
<TooltipTrigger asChild> | ||||||
<Button size="sm" variant="outline">{copiesProjectID ? ( | ||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" width="15" height="15" fill="#ffffff"> | ||||||
<path d="M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"/> | ||||||
</svg> | ||||||
) : ( | ||||||
<> | ||||||
<svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||||||
<path d="M5 2V1H10V2H5ZM4.75 0C4.33579 0 4 0.335786 4 0.75V1H3.5C2.67157 1 2 1.67157 2 2.5V12.5C2 13.3284 2.67157 14 3.5 14H11.5C12.3284 14 13 13.3284 13 12.5V2.5C13 1.67157 12.3284 1 11.5 1H11V0.75C11 0.335786 10.6642 0 10.25 0H4.75ZM11 2V2.25C11 2.66421 10.6642 3 10.25 3H4.75C4.33579 3 4 2.66421 4 2.25V2H3.5C3.22386 2 3 2.22386 3 2.5V12.5C3 12.7761 3.22386 13 3.5 13H11.5C11.7761 13 12 12.7761 12 12.5V2.5C12 2.22386 11.7761 2 11.5 2H11Z" fill="currentColor" fillRule="evenodd" clipRule="evenodd"></path> | ||||||
</svg> | ||||||
</> | ||||||
)} | ||||||
</Button> | ||||||
</TooltipTrigger> | ||||||
<TooltipContent> | ||||||
<p className="text-sm">Copy Project ID</p> | ||||||
</TooltipContent> | ||||||
</Tooltip> | ||||||
</TooltipProvider> | ||||||
</div> | ||||||
</div> | ||||||
<p className='text-xs cursor-default dark:text-gray-400 text-gray-950 font-semibold pt-5'>General</p> | ||||||
<MainNav onLinkClick={handlePageChange} className=''/> | ||||||
</div> | ||||||
</div> | ||||||
</div> | ||||||
|
||||||
<div className='absolute bottom-0 left-0 w-full cursor-pointer'> | ||||||
<UserNav/> | ||||||
</div> | ||||||
</nav> | ||||||
<main className="w-full pt-16 overflow-y-scroll">{children}</main> | ||||||
<div className={cn("block lg:!hidden")}> | ||||||
<SmallNav onLinkClick={handlePageChange} /> | ||||||
</div> | ||||||
<main className="w-full overflow-y-scroll">{children}</main> | ||||||
|
||||||
</div> | ||||||
</> | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add alt text to the logo image for accessibility.
Committable suggestion