Skip to content

Commit 448a7a0

Browse files
committed
feat: tool tip over disabled deploy/live share buttons
1 parent 1a727bf commit 448a7a0

File tree

1 file changed

+50
-36
lines changed

1 file changed

+50
-36
lines changed

apps/postgres-new/components/sidebar/database-menu-item.tsx

Lines changed: 50 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -336,26 +336,33 @@ export function DatabaseMenuItem({ database, isActive, onClick }: DatabaseMenuIt
336336
<span>Download</span>
337337
</DropdownMenuItem>
338338
<DropdownMenuSub>
339-
<DropdownMenuSubTrigger
340-
disabled={!user}
341-
className="bg-inherit justify-start hover:bg-neutral-200 flex gap-3 cursor-pointer"
342-
chevronRightClassName="text-muted-foreground"
343-
>
344-
{isDeploying ? (
345-
<Loader2
346-
className="animate-spin flex-shrink-0 text-muted-foreground"
347-
size={16}
348-
strokeWidth={2}
349-
/>
350-
) : (
351-
<Upload
352-
size={16}
353-
strokeWidth={2}
354-
className="flex-shrink-0 text-muted-foreground"
355-
/>
356-
)}
357-
<span>Deploy</span>
358-
</DropdownMenuSubTrigger>
339+
<Tooltip>
340+
<TooltipTrigger className="cursor-default">
341+
<DropdownMenuSubTrigger
342+
disabled={!user}
343+
className="bg-inherit justify-start hover:bg-neutral-200 flex gap-3 cursor-pointer"
344+
chevronRightClassName="text-muted-foreground"
345+
>
346+
{isDeploying ? (
347+
<Loader2
348+
className="animate-spin flex-shrink-0 text-muted-foreground"
349+
size={16}
350+
strokeWidth={2}
351+
/>
352+
) : (
353+
<Upload
354+
size={16}
355+
strokeWidth={2}
356+
className="flex-shrink-0 text-muted-foreground"
357+
/>
358+
)}
359+
<span>Deploy</span>
360+
</DropdownMenuSubTrigger>
361+
</TooltipTrigger>
362+
<TooltipPortal>
363+
{!user && <TooltipContent side="right">Sign in to deploy</TooltipContent>}
364+
</TooltipPortal>
365+
</Tooltip>
359366
<DropdownMenuPortal>
360367
<DropdownMenuSubContent>
361368
<DropdownMenuItem
@@ -443,21 +450,28 @@ function LiveShareMenuItem(props: ConnectMenuItemProps) {
443450
}
444451

445452
return (
446-
<DropdownMenuItem
447-
disabled={props.disabled}
448-
className="bg-inherit justify-start hover:bg-neutral-200 flex gap-3"
449-
onClick={async (e) => {
450-
e.preventDefault()
451-
if (liveShare.isLiveSharing) {
452-
liveShare.stop()
453-
}
454-
liveShare.start(props.databaseId)
455-
router.push(`/db/${props.databaseId}`)
456-
props.onStart?.()
457-
}}
458-
>
459-
<LiveShareIcon size={16} className="flex-shrink-0 text-muted-foreground" />
460-
<span>Live Share</span>
461-
</DropdownMenuItem>
453+
<Tooltip>
454+
<TooltipTrigger className="cursor-default">
455+
<DropdownMenuItem
456+
disabled={props.disabled}
457+
className="bg-inherit justify-start hover:bg-neutral-200 flex gap-3"
458+
onClick={async (e) => {
459+
e.preventDefault()
460+
if (liveShare.isLiveSharing) {
461+
liveShare.stop()
462+
}
463+
liveShare.start(props.databaseId)
464+
router.push(`/db/${props.databaseId}`)
465+
props.onStart?.()
466+
}}
467+
>
468+
<LiveShareIcon size={16} className="flex-shrink-0 text-muted-foreground" />
469+
<span>Live Share</span>
470+
</DropdownMenuItem>
471+
</TooltipTrigger>
472+
<TooltipPortal>
473+
{!user && <TooltipContent side="right">Sign in to live share</TooltipContent>}
474+
</TooltipPortal>
475+
</Tooltip>
462476
)
463477
}

0 commit comments

Comments
 (0)