-
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 10 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 | ||||
---|---|---|---|---|---|---|
|
@@ -2,20 +2,48 @@ import { ColumnDef } from "@tanstack/react-table"; | |||||
import { ColumnLU } from "./schema"; | ||||||
import { DataTableColumnHeader } from "@/components/shared/data-table-column-header"; | ||||||
import { Badge } from "@/components/ui/badge"; | ||||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"; | ||||||
import { toast } from "sonner"; | ||||||
|
||||||
|
||||||
const LinkedUserIdComponent = ({ row } : {row:any}) => { | ||||||
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. Specify a more precise type instead of - const LinkedUserIdComponent = ({ row } : {row:any}) => {
+ const LinkedUserIdComponent = ({ row } : {row: { getValue: (key: string) => string }}) => { Committable suggestion
Suggested change
|
||||||
|
||||||
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. Remove the console.log statement or replace it with a more appropriate logging mechanism. |
||||||
const handleCopyLinkedUserId = () => { | ||||||
navigator.clipboard.writeText(row.getValue("linked_user_id")); | ||||||
toast.success("LinkedUser ID copied!", { | ||||||
action: { | ||||||
label: "Close", | ||||||
onClick: () => console.log("Close"), | ||||||
}, | ||||||
}) | ||||||
}; | ||||||
|
||||||
return ( | ||||||
<div className="cursor-pointer" onClick={handleCopyLinkedUserId}> | ||||||
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. Ensure keyboard accessibility by adding keyboard event handlers. + onKeyUp={(e) => { if (e.key === 'Enter') handleCopyLinkedUserId(); }} Committable suggestion
Suggested change
|
||||||
<TooltipProvider delayDuration={0}> | ||||||
<Tooltip> | ||||||
<TooltipTrigger> | ||||||
<Badge variant="outline" > | ||||||
{row.getValue("linked_user_id")} | ||||||
</Badge> | ||||||
</TooltipTrigger> | ||||||
<TooltipContent> | ||||||
<p className="text-sm">Copy</p> | ||||||
</TooltipContent> | ||||||
</Tooltip> | ||||||
</TooltipProvider> | ||||||
</div> | ||||||
) | ||||||
} | ||||||
|
||||||
|
||||||
export const columns: ColumnDef<ColumnLU>[] = [ | ||||||
{ | ||||||
accessorKey: "linked_user_id", | ||||||
header: ({ column }) => ( | ||||||
<DataTableColumnHeader column={column} title="Linked User Id" /> | ||||||
), | ||||||
cell: ({ row }) =>{ | ||||||
return ( | ||||||
<div className=""> | ||||||
<Badge variant="outline">{row.getValue("linked_user_id")}</Badge> | ||||||
</div> | ||||||
) | ||||||
}, | ||||||
cell: LinkedUserIdComponent, | ||||||
enableSorting: false, | ||||||
enableHiding: false, | ||||||
}, | ||||||
|
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,26 +60,15 @@ 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)}> | ||||||
{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> | ||||||
<nav | ||||||
className={`flex flex-col items-start mt-6`} | ||||||
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. Use button elements instead of anchor tags for actions that don't navigate to a URL. - <a onClick={...}>
+ <button onClick={...}> Also applies to: 74-74, 80-80, 87-87, 93-93, 104-104, 108-108, 115-115
|
||||||
> | ||||||
{/*<a | ||||||
className={navItemClassName('quickstart')} | ||||||
onClick={() => click('quickstart')} | ||||||
> | ||||||
<p className="mx-4">Quick Start</p> | ||||||
</a> | ||||||
<a | ||||||
className={navItemClassName('dashboard')} | ||||||
onClick={() => click('dashboard')} | ||||||
> | ||||||
<p className="mx-4">Dashboard</p> | ||||||
</a>*/} | ||||||
<a | ||||||
className={navItemClassName('connections')} | ||||||
onClick={() => click('connections')} | ||||||
|
@@ -93,6 +103,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> | ||||||
|
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