| 1 | import { |
| 2 | ArrowTopRightOnSquareIcon, |
| 3 | DocumentArrowUpIcon, |
| 4 | NumberedListIcon, |
| 5 | PaintBrushIcon, |
| 6 | TableCellsIcon, |
| 7 | } from "@heroicons/react/24/outline"; |
| 8 | import { useContext } from "react"; |
| 9 | import { useNavigate } from "react-router-dom"; |
| 10 | import { IdeMessengerContext } from "../../context/IdeMessenger"; |
| 11 | import { useAppDispatch, useAppSelector } from "../../redux/hooks"; |
| 12 | import { setOnboardingCard } from "../../redux/slices/uiSlice"; |
| 13 | import { saveCurrentSession } from "../../redux/thunks/session"; |
| 14 | import { ROUTES } from "../../util/navigation"; |
| 15 | import MoreHelpRow from "./MoreHelpRow"; |
| 16 | |
| 17 | export function HelpCenterSection() { |
| 18 | const ideMessenger = useContext(IdeMessengerContext); |
| 19 | const navigate = useNavigate(); |
| 20 | const dispatch = useAppDispatch(); |
| 21 | |
| 22 | const currentSession = useAppSelector((state) => state.session); |
| 23 | |
| 24 | const handleViewSessionData = async () => { |
| 25 | const sessionData = await ideMessenger.request("history/load", { |
| 26 | id: currentSession.id, |
| 27 | }); |
| 28 | |
| 29 | if (sessionData.status === "success") { |
| 30 | await ideMessenger.request("showVirtualFile", { |
| 31 | name: `${sessionData.content.title}.json`, |
| 32 | content: JSON.stringify(sessionData.content, null, 2), |
| 33 | }); |
| 34 | } |
| 35 | }; |
| 36 | |
| 37 | return ( |
| 38 | <div className="py-5"> |
| 39 | <h3 className="mb-4 mt-0 text-xl">Help center</h3> |
| 40 | <div className="-mx-4 flex flex-col"> |
| 41 | <MoreHelpRow |
| 42 | title="Continue Hub" |
| 43 | description="Visit hub.continue.dev to explore custom assistants and blocks" |
| 44 | Icon={ArrowTopRightOnSquareIcon} |
| 45 | onClick={() => |
| 46 | ideMessenger.post("openUrl", "https://hub.continue.dev/") |
| 47 | } |
| 48 | /> |
| 49 | |
| 50 | <MoreHelpRow |
| 51 | title="Documentation" |
| 52 | description="Learn how to configure and use Continue" |
| 53 | Icon={ArrowTopRightOnSquareIcon} |
| 54 | onClick={() => |
| 55 | ideMessenger.post("openUrl", "https://docs.continue.dev/") |
| 56 | } |
| 57 | /> |
| 58 | |
| 59 | <MoreHelpRow |
| 60 | title="Have an issue?" |
| 61 | description="Let us know on GitHub and we'll do our best to resolve it" |
| 62 | Icon={ArrowTopRightOnSquareIcon} |
| 63 | onClick={() => |
| 64 | ideMessenger.post( |
| 65 | "openUrl", |
| 66 | "https://github.com/continuedev/continue/issues/new/choose", |
| 67 | ) |
| 68 | } |
| 69 | /> |
| 70 | |
| 71 | <MoreHelpRow |
| 72 | title="Join the community!" |
| 73 | description="Join us on Discord to stay up-to-date on the latest developments" |
| 74 | Icon={ArrowTopRightOnSquareIcon} |
| 75 | onClick={() => |
| 76 | ideMessenger.post("openUrl", "https://discord.gg/vapESyrFmJ") |
| 77 | } |
| 78 | /> |
| 79 | |
| 80 | <MoreHelpRow |
| 81 | title="Token usage" |
| 82 | description="Daily token usage across models" |
| 83 | Icon={TableCellsIcon} |
| 84 | onClick={() => navigate("/stats")} |
| 85 | /> |
| 86 | |
| 87 | {currentSession.history.length > 0 && !currentSession.isStreaming && ( |
| 88 | <MoreHelpRow |
| 89 | title="View current session history" |
| 90 | description="Open the current chat session file for troubleshooting" |
| 91 | Icon={NumberedListIcon} |
| 92 | onClick={handleViewSessionData} |
| 93 | /> |
| 94 | )} |
| 95 | |
| 96 | <MoreHelpRow |
| 97 | title="Quickstart" |
| 98 | description="Reopen the quickstart and tutorial file" |
| 99 | Icon={DocumentArrowUpIcon} |
| 100 | onClick={async () => { |
| 101 | navigate("/"); |
| 102 | // Used to clear the chat panel before showing onboarding card |
| 103 | await dispatch( |
| 104 | saveCurrentSession({ |
| 105 | openNewSession: true, |
| 106 | generateTitle: true, |
| 107 | }), |
| 108 | ); |
| 109 | dispatch( |
| 110 | setOnboardingCard({ |
| 111 | show: true, |
| 112 | activeTab: undefined, |
| 113 | }), |
| 114 | ); |
| 115 | ideMessenger.post("showTutorial", undefined); |
| 116 | }} |
| 117 | /> |
| 118 | {process.env.NODE_ENV === "development" && ( |
| 119 | <MoreHelpRow |
| 120 | title="Theme Test Page" |
| 121 | description="Development page for testing themes" |
| 122 | Icon={PaintBrushIcon} |
| 123 | onClick={async () => { |
| 124 | navigate(ROUTES.THEME); |
| 125 | }} |
| 126 | /> |
| 127 | )} |
| 128 | </div> |
| 129 | </div> |
| 130 | ); |
| 131 | } |