Elffuss BraidHub

kikocis/continue public

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