import React, { useRef, useState } from "react"; import { Textarea } from "../../tremor/Textarea"; import { ArrowUpCircleIcon } from "@heroicons/react/24/solid"; import { ArrowTrendingUpIcon, ArrowUpRightIcon, Bars3BottomLeftIcon, Bars3BottomRightIcon, Bars3CenterLeftIcon, Bars3Icon, ChartBarIcon, EyeDropperIcon, EyeIcon, EyeSlashIcon, GlobeAltIcon, H1Icon, H2Icon, SparklesIcon, TagIcon } from "@heroicons/react/24/outline"; import { Text } from "../../tremor/Text"; import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuSubMenu, DropdownMenuSubMenuContent, DropdownMenuSubMenuTrigger, } from "../../tremor/DropdownMenu"; import { useBackend } from "../../layouts/Wrapper"; const SuggestionsDropdown: React.FC<{ children: React.ReactNode; url?: string; onSelect: (text: string) => void }> = ({ children, url, onSelect }) => { const { containerRef } = useBackend(); return ( {children}
Prompt suggestions Change chart type onSelect("Change the chart type to be a bar chart")}> Bar chart onSelect("Change the chart type to be a line chart")}> Line chart onSelect("Change the chart type to be a area chart")}> Area chart Change chart color onSelect("Change the chart colors to be shades of red")}>
Shades of red onSelect("Change the chart colors to be shades of green")}>
Shades of green onSelect("Change the chart colors to be shades of blue")}>
Shades of blue onSelect("Change the chart colors to be shades of yellow")}>
Shades of orange onSelect("Change the chart colors to be shades of purple")}>
Shades of purple onSelect("Change the chart colors to be shades of pink")}>
Shades of gray Add a trend line onSelect("Add a linear trend line to the chart")}> Linear trend line onSelect("Add a moving average trend line to the chart")}> Moving average trend line Data labels onSelect("Show data labels on the chart")}> Show data labels onSelect("Hide data labels on the chart")}> Hide data labels Text alignment Title alignment onSelect("Align the title to the left")}> Align title left onSelect("Align the title to the center")}> Align title center onSelect("Align the title to the right")}> Align title right Subtitle alignment onSelect("Align the subtitle to the left")}> Align subtitle left onSelect("Align the subtitle to the center")}> Align subtitle center onSelect("Align the subtitle to the right")}> Align subtitle right onSelect("Add a subtitle to the chart")}> Add a subtitle window.open(url && url.trim() !== "" ? url : "https://www.onvo.ai/blogs/writing-better-ai-prompts-for-dashboard-generation", "_blank")}> Support ); } export const PromptInput: React.FC<{ className?: string; url?: string; onSubmit: (text: string) => void; hideSuggestions?: boolean; }> = ({ className, onSubmit, url, hideSuggestions }) => { const [query, setQuery] = useState(""); const ref = useRef(null); return (
{ ref.current?.focus(); }} className={"onvo-relative onvo-background-color onvo-border onvo-border-black/10 dark:onvo-border-white/10 onvo-shadow-sm onvo-z-10 onvo-p-1 onvo-cursor-text !onvo-rounded-2xl onvo-mx-auto onvo-max-w-screen-md onvo-flex onvo-w-full onvo-flex-col onvo-items-center onvo-justify-center " + (className || "")}>