mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-06-30 20:39:46 +02:00
- remove trash
- added help popover
This commit is contained in:
parent
9fbb7d3033
commit
74477c772d
3 changed files with 114 additions and 33 deletions
|
|
@ -9,6 +9,11 @@ import {
|
||||||
PopoverContent,
|
PopoverContent,
|
||||||
PopoverTrigger,
|
PopoverTrigger,
|
||||||
} from "@/components/ui/popover"
|
} from "@/components/ui/popover"
|
||||||
|
import {
|
||||||
|
Tooltip,
|
||||||
|
TooltipContent,
|
||||||
|
TooltipTrigger,
|
||||||
|
} from "@/components/ui/tooltip"
|
||||||
import { Button } from "@/components/ui/button"
|
import { Button } from "@/components/ui/button"
|
||||||
import { Badge } from "@/components/ui/badge"
|
import { Badge } from "@/components/ui/badge"
|
||||||
import { Switch } from "@/components/ui/switch"
|
import { Switch } from "@/components/ui/switch"
|
||||||
|
|
@ -23,9 +28,10 @@ interface ProviderState {
|
||||||
|
|
||||||
interface ConnectorsPopoverProps {
|
interface ConnectorsPopoverProps {
|
||||||
children: React.ReactNode
|
children: React.ReactNode
|
||||||
|
tooltip?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ConnectorsPopover({ children }: ConnectorsPopoverProps) {
|
export function ConnectorsPopover({ children, tooltip }: ConnectorsPopoverProps) {
|
||||||
const [open, setOpen] = useState(false)
|
const [open, setOpen] = useState(false)
|
||||||
const [providers, setProviders] = useState<string[]>([])
|
const [providers, setProviders] = useState<string[]>([])
|
||||||
const [providersLoading, setProvidersLoading] = useState(true)
|
const [providersLoading, setProvidersLoading] = useState(true)
|
||||||
|
|
@ -199,9 +205,22 @@ export function ConnectorsPopover({ children }: ConnectorsPopoverProps) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Popover open={open} onOpenChange={setOpen}>
|
<Popover open={open} onOpenChange={setOpen}>
|
||||||
<PopoverTrigger asChild>
|
{tooltip ? (
|
||||||
{children}
|
<Tooltip open={open ? false : undefined}>
|
||||||
</PopoverTrigger>
|
<TooltipTrigger asChild>
|
||||||
|
<PopoverTrigger asChild>
|
||||||
|
{children}
|
||||||
|
</PopoverTrigger>
|
||||||
|
</TooltipTrigger>
|
||||||
|
<TooltipContent side="right" sideOffset={8}>
|
||||||
|
{tooltip}
|
||||||
|
</TooltipContent>
|
||||||
|
</Tooltip>
|
||||||
|
) : (
|
||||||
|
<PopoverTrigger asChild>
|
||||||
|
{children}
|
||||||
|
</PopoverTrigger>
|
||||||
|
)}
|
||||||
<PopoverContent
|
<PopoverContent
|
||||||
side="right"
|
side="right"
|
||||||
align="end"
|
align="end"
|
||||||
|
|
|
||||||
81
apps/x/apps/renderer/src/components/help-popover.tsx
Normal file
81
apps/x/apps/renderer/src/components/help-popover.tsx
Normal file
|
|
@ -0,0 +1,81 @@
|
||||||
|
"use client"
|
||||||
|
|
||||||
|
import * as React from "react"
|
||||||
|
import { useState } from "react"
|
||||||
|
import { MessageCircle } from "lucide-react"
|
||||||
|
|
||||||
|
import {
|
||||||
|
Popover,
|
||||||
|
PopoverContent,
|
||||||
|
PopoverTrigger,
|
||||||
|
} from "@/components/ui/popover"
|
||||||
|
import {
|
||||||
|
Tooltip,
|
||||||
|
TooltipContent,
|
||||||
|
TooltipTrigger,
|
||||||
|
} from "@/components/ui/tooltip"
|
||||||
|
import { Button } from "@/components/ui/button"
|
||||||
|
|
||||||
|
interface HelpPopoverProps {
|
||||||
|
children: React.ReactNode
|
||||||
|
tooltip?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export function HelpPopover({ children, tooltip }: HelpPopoverProps) {
|
||||||
|
const [open, setOpen] = useState(false)
|
||||||
|
|
||||||
|
const handleDiscordClick = () => {
|
||||||
|
window.open("https://discord.com/invite/rxB8pzHxaS", "_blank")
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Popover open={open} onOpenChange={setOpen}>
|
||||||
|
{tooltip ? (
|
||||||
|
<Tooltip open={open ? false : undefined}>
|
||||||
|
<TooltipTrigger asChild>
|
||||||
|
<PopoverTrigger asChild>
|
||||||
|
{children}
|
||||||
|
</PopoverTrigger>
|
||||||
|
</TooltipTrigger>
|
||||||
|
<TooltipContent side="right" sideOffset={8}>
|
||||||
|
{tooltip}
|
||||||
|
</TooltipContent>
|
||||||
|
</Tooltip>
|
||||||
|
) : (
|
||||||
|
<PopoverTrigger asChild>
|
||||||
|
{children}
|
||||||
|
</PopoverTrigger>
|
||||||
|
)}
|
||||||
|
<PopoverContent
|
||||||
|
side="right"
|
||||||
|
align="end"
|
||||||
|
sideOffset={8}
|
||||||
|
className="w-80 p-0"
|
||||||
|
>
|
||||||
|
<div className="p-4 border-b">
|
||||||
|
<h4 className="font-semibold text-sm">Help & Support</h4>
|
||||||
|
<p className="text-xs text-muted-foreground mt-1">
|
||||||
|
Get help from our community
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div className="p-2">
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
className="w-full justify-start gap-3 h-auto py-3"
|
||||||
|
onClick={handleDiscordClick}
|
||||||
|
>
|
||||||
|
<div className="flex size-8 items-center justify-center rounded-md bg-[#5865F2]">
|
||||||
|
<MessageCircle className="size-4 text-white" />
|
||||||
|
</div>
|
||||||
|
<div className="flex flex-col items-start">
|
||||||
|
<span className="text-sm font-medium">Join our Discord</span>
|
||||||
|
<span className="text-xs text-muted-foreground">
|
||||||
|
Chat with the community
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</PopoverContent>
|
||||||
|
</Popover>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
@ -8,7 +8,6 @@ import {
|
||||||
Plug,
|
Plug,
|
||||||
Settings,
|
Settings,
|
||||||
Ship,
|
Ship,
|
||||||
Trash2,
|
|
||||||
} from "lucide-react"
|
} from "lucide-react"
|
||||||
|
|
||||||
import { cn } from "@/lib/utils"
|
import { cn } from "@/lib/utils"
|
||||||
|
|
@ -19,6 +18,7 @@ import {
|
||||||
} from "@/components/ui/tooltip"
|
} from "@/components/ui/tooltip"
|
||||||
import { type ActiveSection, useSidebarSection } from "@/contexts/sidebar-context"
|
import { type ActiveSection, useSidebarSection } from "@/contexts/sidebar-context"
|
||||||
import { ConnectorsPopover } from "@/components/connectors-popover"
|
import { ConnectorsPopover } from "@/components/connectors-popover"
|
||||||
|
import { HelpPopover } from "@/components/help-popover"
|
||||||
|
|
||||||
type NavItem = {
|
type NavItem = {
|
||||||
id: ActiveSection
|
id: ActiveSection
|
||||||
|
|
@ -26,23 +26,11 @@ type NavItem = {
|
||||||
icon: React.ElementType
|
icon: React.ElementType
|
||||||
}
|
}
|
||||||
|
|
||||||
type SecondaryItem = {
|
|
||||||
id: string
|
|
||||||
title: string
|
|
||||||
icon: React.ElementType
|
|
||||||
action?: () => void
|
|
||||||
}
|
|
||||||
|
|
||||||
const navItems: NavItem[] = [
|
const navItems: NavItem[] = [
|
||||||
{ id: "knowledge", title: "Knowledge", icon: Brain },
|
{ id: "knowledge", title: "Knowledge", icon: Brain },
|
||||||
{ id: "agents", title: "Agents", icon: Bot },
|
{ id: "agents", title: "Agents", icon: Bot },
|
||||||
]
|
]
|
||||||
|
|
||||||
const secondaryItems: SecondaryItem[] = [
|
|
||||||
{ id: "trash", title: "Trash", icon: Trash2 },
|
|
||||||
{ id: "help", title: "Help", icon: HelpCircle },
|
|
||||||
]
|
|
||||||
|
|
||||||
export function SidebarIcon() {
|
export function SidebarIcon() {
|
||||||
const { activeSection, setActiveSection } = useSidebarSection()
|
const { activeSection, setActiveSection } = useSidebarSection()
|
||||||
|
|
||||||
|
|
@ -80,7 +68,7 @@ export function SidebarIcon() {
|
||||||
{/* Secondary navigation (bottom) */}
|
{/* Secondary navigation (bottom) */}
|
||||||
<nav className="flex flex-col items-center gap-1">
|
<nav className="flex flex-col items-center gap-1">
|
||||||
{/* Connectors */}
|
{/* Connectors */}
|
||||||
<ConnectorsPopover>
|
<ConnectorsPopover tooltip="Connectors">
|
||||||
<button
|
<button
|
||||||
className="flex h-10 w-10 items-center justify-center rounded-md text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground transition-colors"
|
className="flex h-10 w-10 items-center justify-center rounded-md text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground transition-colors"
|
||||||
>
|
>
|
||||||
|
|
@ -102,21 +90,14 @@ export function SidebarIcon() {
|
||||||
</TooltipContent>
|
</TooltipContent>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
|
||||||
{secondaryItems.map((item) => (
|
{/* Help */}
|
||||||
<Tooltip key={item.id}>
|
<HelpPopover tooltip="Help">
|
||||||
<TooltipTrigger asChild>
|
<button
|
||||||
<button
|
className="flex h-10 w-10 items-center justify-center rounded-md text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground transition-colors"
|
||||||
onClick={item.action}
|
>
|
||||||
className="flex h-10 w-10 items-center justify-center rounded-md text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground transition-colors"
|
<HelpCircle className="size-5" />
|
||||||
>
|
</button>
|
||||||
<item.icon className="size-5" />
|
</HelpPopover>
|
||||||
</button>
|
|
||||||
</TooltipTrigger>
|
|
||||||
<TooltipContent side="right" sideOffset={8}>
|
|
||||||
{item.title}
|
|
||||||
</TooltipContent>
|
|
||||||
</Tooltip>
|
|
||||||
))}
|
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue