| 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"> |
| 29 | Create Your Own Assistant |
| 30 | </h2> |
| 31 | |
| 32 | <p className="text-lightgray my-0 max-w-lg text-sm font-light leading-relaxed"> |
| 33 | Discover and remix popular assistants, or create your own from |
| 34 | scratch |
| 35 | </p> |
| 36 | </div> |
| 37 | |
| 38 | <Button |
| 39 | className="w-full" |
| 40 | onClick={() => { |
| 41 | ideMessenger.request("controlPlane/openUrl", { |
| 42 | path: "/explore/assistants", |
| 43 | orgSlug: undefined, |
| 44 | }); |
| 45 | }} |
| 46 | > |
| 47 | Explore Assistants |
| 48 | </Button> |
| 49 | |
| 50 | <ButtonSubtext |
| 51 | onClick={() => { |
| 52 | ideMessenger.request("controlPlane/openUrl", { |
| 53 | path: "/new?type=assistant", |
| 54 | orgSlug: undefined, |
| 55 | }); |
| 56 | }} |
| 57 | > |
| 58 | <div className="flex cursor-pointer items-center justify-center gap-1"> |
| 59 | <span>Or, create your own assistant from scratch</span> |
| 60 | <ChevronRightIcon className="h-3 w-3" /> |
| 61 | </div> |
| 62 | </ButtonSubtext> |
| 63 | </div> |
| 64 | </ReusableCard> |
| 65 | ); |
| 66 | } |