mirror of
https://github.com/supabase/supabase.git
synced 2026-10-13 13:19:09 +03:00
* sidebar-manager * storage keys * tests * more ai spots * test fix * revert to default * remove ref * Update apps/studio/state/sidebar-manager-state.tsx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update apps/studio/components/ui/AIAssistantPanel/AIAssistant.tsx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix ts * fix * fux * fux query param * clean * fix * more * mock local storage * simplify * remove provider test * remve useopensidebar * fix(new homepage): open ai assistant on advisor card button clicks * Update apps/studio/components/layouts/ProjectLayout/LayoutSidebar/index.tsx Co-authored-by: Charis <26616127+charislam@users.noreply.github.com> * Update apps/studio/state/sidebar-manager-state.tsx Co-authored-by: Charis <26616127+charislam@users.noreply.github.com> * refine * editor sidebar manager * reset results * advisor sidebar manager * empty state and notice * event tracking * remove variable * remove use effect * open in sidebar * use sidebar old home * Update apps/studio/components/ui/EditorPanel/EditorPanel.tsx Co-authored-by: Charis <26616127+charislam@users.noreply.github.com> * connect hotkey * Update apps/studio/components/layouts/AppLayout/AssistantButton.tsx Co-authored-by: Charis <26616127+charislam@users.noreply.github.com> * Update apps/studio/state/advisor-state.ts Co-authored-by: Charis <26616127+charislam@users.noreply.github.com> * Update apps/studio/state/advisor-state.ts Co-authored-by: Charis <26616127+charislam@users.noreply.github.com> * fix * initial prompt * fix(inline editor button): only show keyboard shortcut if hotkey active * cleanup(advisor panel): minor code cleanup * fix(advisor panel): misplaced key on list * fix(advisor panel): add error state * fix(advisor panel): improve a11y * fix(advisor panel): cannot find selected item * fix * fix * tooltip * link * sidebar move up * LayoutSidebarProvider to only sendEvent if in a project --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Charis Lam <26616127+charislam@users.noreply.github.com> Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
70 lines
2.6 KiB
TypeScript
70 lines
2.6 KiB
TypeScript
import { Lightbulb, TriangleAlert } from 'lucide-react'
|
|
import { useState } from 'react'
|
|
|
|
import { SupportLink } from 'components/interfaces/Support/SupportLink'
|
|
import { Button, PopoverContent_Shadcn_, PopoverTrigger_Shadcn_, Popover_Shadcn_ } from 'ui'
|
|
import { FeedbackWidget } from './FeedbackWidget'
|
|
|
|
export const FeedbackDropdown = ({ className }: { className?: string }) => {
|
|
const [isOpen, setIsOpen] = useState(false)
|
|
const [stage, setStage] = useState<'select' | 'widget'>('select')
|
|
|
|
return (
|
|
<Popover_Shadcn_
|
|
modal={false}
|
|
open={isOpen}
|
|
onOpenChange={(e) => {
|
|
setIsOpen(e)
|
|
if (!e) setStage('select')
|
|
}}
|
|
>
|
|
<PopoverTrigger_Shadcn_ asChild>
|
|
<Button
|
|
asChild
|
|
onClick={() => {
|
|
setIsOpen((isOpen) => !isOpen)
|
|
setStage('select')
|
|
}}
|
|
type="text"
|
|
className="rounded-full h-[32px] text-foreground-light hover:text-foreground"
|
|
>
|
|
<span className={className}>Feedback</span>
|
|
</Button>
|
|
</PopoverTrigger_Shadcn_>
|
|
<PopoverContent_Shadcn_
|
|
side="bottom"
|
|
align="end"
|
|
className="px-0 flex flex-col pt-1 pb-3 w-96"
|
|
id="feedback-widget"
|
|
>
|
|
{stage === 'select' && (
|
|
<div className="flex flex-col gap-4 p-4">
|
|
<div className="font-medium text-sm">What would you like to share?</div>
|
|
<div className="grid grid-cols-2 gap-3">
|
|
<Button type="default" className="h-32" onClick={() => setIsOpen(false)} asChild>
|
|
<SupportLink>
|
|
<span className="grid gap-1 text-center">
|
|
<TriangleAlert size="28" className="mx-auto text-destructive-600" />
|
|
<span className="text-base">Issue</span>
|
|
<span className="text-xm text-foreground-lighter">with my project</span>
|
|
</span>
|
|
</SupportLink>
|
|
</Button>
|
|
<Button type="default" className="h-32" onClick={() => setStage('widget')}>
|
|
<span className="grid gap-1 text-center">
|
|
<Lightbulb size="28" className="mx-auto text-warning" />
|
|
<span className="text-base">Idea</span>
|
|
<span className="text-xm text-foreground-lighter">to improve Supabase</span>
|
|
</span>
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
)}
|
|
{stage === 'widget' && <FeedbackWidget onClose={() => setIsOpen(false)} />}
|
|
</PopoverContent_Shadcn_>
|
|
</Popover_Shadcn_>
|
|
)
|
|
}
|
|
|
|
export default FeedbackDropdown
|