| 1 | import { ChevronRightIcon } from "@heroicons/react/24/outline"; |
| 2 | import { useContext } from "react"; |
| 3 | import { Button, ButtonSubtext } from ".."; |
| 4 | import { IdeMessengerContext } from "../../context/IdeMessenger"; |
| 5 | import { useAppDispatch, useAppSelector } from "../../redux/hooks"; |
| 6 | import { setIsExploreDialogOpen } from "../../redux/slices/uiSlice"; |
| 7 | import { LocalStorageKey, setLocalStorage } from "../../util/localStorage"; |
| 8 | import { ReusableCard } from "../ReusableCard"; |
| 9 | |
| 10 | export function ExploreHubCard() { |
| 11 | const dispatch = useAppDispatch(); |
| 12 | const isOpen = useAppSelector((state) => state.ui.isExploreDialogOpen); |
| 13 | const ideMessenger = useContext(IdeMessengerContext); |
| 14 | |
| 15 | if (!isOpen) return null; |
| 16 | |
| 17 | return ( |
| 18 | <ReusableCard |
| 19 | showCloseButton={true} |
| 20 | onClose={() => { |
| 21 | setLocalStorage(LocalStorageKey.IsExploreDialogOpen, false); |
| 22 | setLocalStorage(LocalStorageKey.HasDismissedExploreDialog, true); |
| 23 | return dispatch(setIsExploreDialogOpen(false)); |
| 24 | }} |
| 25 | > |
| 26 | <div className="flex flex-col items-center gap-1 px-4 text-center"> |
| 27 | <div className="mb-4"> |
| 28 | <h2 className="mb-1 text-xl font-semibold">Create Your Own Agent</h2> |
| 29 | |
| 30 | <p className="text-lightgray my-0 max-w-lg text-sm font-light leading-relaxed"> |
| 31 | Discover and remix popular agents, or create your own from scratch |
| 32 | </p> |
| 33 | </div> |
| 34 | |
| 35 | <Button |
| 36 | className="w-full" |
| 37 | onClick={() => { |
| 38 | ideMessenger.request("controlPlane/openUrl", { |
| 39 | path: "/?type=assistants", |
| 40 | orgSlug: undefined, |
| 41 | }); |
| 42 | }} |
| 43 | > |
| 44 | Explore Agents |
| 45 | </Button> |
| 46 | |
| 47 | <ButtonSubtext |
| 48 | onClick={() => { |
| 49 | ideMessenger.request("controlPlane/openUrl", { |
| 50 | path: "/new?type=assistant", |
| 51 | orgSlug: undefined, |
| 52 | }); |
| 53 | }} |
| 54 | > |
| 55 | <div className="flex cursor-pointer items-center justify-center gap-1"> |
| 56 | <span>Or, create your own agent from scratch</span> |
| 57 | <ChevronRightIcon className="h-3 w-3" /> |
| 58 | </div> |
| 59 | </ButtonSubtext> |
| 60 | </div> |
| 61 | </ReusableCard> |
| 62 | ); |
| 63 | } |