feat: add tutorial card (#1716)
* feat: create tutorial card * Update TutorialCard.tsx
This commit is contained in:
parent
7f0cf7df7a
commit
cb8b207582
5 changed files with 124 additions and 20 deletions
6
gui/package-lock.json
generated
6
gui/package-lock.json
generated
|
|
@ -920,9 +920,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@heroicons/react": {
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@heroicons/react/-/react-2.1.3.tgz",
|
||||
"integrity": "sha512-fEcPfo4oN345SoqdlCDdSa4ivjaKbk0jTd+oubcgNxnNgAfzysfwWfQUr+51wigiWHQQRiZNd1Ao0M5Y3M2EGg==",
|
||||
"version": "2.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@heroicons/react/-/react-2.1.5.tgz",
|
||||
"integrity": "sha512-FuzFN+BsHa+7OxbvAERtgBTNeZpUjgM/MIizfVkSCL2/edriN0Hx/DWRCR//aPYwO5QX/YlgLGXk+E3PcfZwjA==",
|
||||
"peerDependencies": {
|
||||
"react": ">= 16"
|
||||
}
|
||||
|
|
|
|||
86
gui/src/components/mainInput/TutorialCard.tsx
Normal file
86
gui/src/components/mainInput/TutorialCard.tsx
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
import {
|
||||
PencilSquareIcon,
|
||||
Cog6ToothIcon,
|
||||
BookOpenIcon,
|
||||
ClipboardDocumentIcon,
|
||||
XMarkIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
import { getMetaKeyLabel } from "../../util";
|
||||
import styled from "styled-components";
|
||||
import { lightGray } from "..";
|
||||
|
||||
interface TutorialCardProps {
|
||||
onClose: () => void;
|
||||
}
|
||||
|
||||
const TutorialCardDiv = styled.div`
|
||||
border: 1px solid ${lightGray};
|
||||
border-radius: 0.125rem;
|
||||
padding: 0.5rem;
|
||||
margin: 1.5rem;
|
||||
max-width: 28rem;
|
||||
position: relative;
|
||||
`;
|
||||
|
||||
export function TutorialCard({ onClose }: TutorialCardProps) {
|
||||
return (
|
||||
<TutorialCardDiv>
|
||||
<div
|
||||
onClick={onClose}
|
||||
className="absolute top-2 right-2 p-1 text-gray-400 hover:text-gray-600 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 bg-white rounded-full cursor-pointer shadow-sm"
|
||||
role="button"
|
||||
aria-label="Close"
|
||||
>
|
||||
<XMarkIcon width="1.4em" height="1.4em" />
|
||||
</div>
|
||||
|
||||
<ul className="text-gray-300 space-y-4">
|
||||
<li className="flex items-start">
|
||||
<PencilSquareIcon
|
||||
width="1.4em"
|
||||
height="1.4em"
|
||||
className="align-middle pr-3"
|
||||
/>
|
||||
<span>
|
||||
Highlight code and press <code>{getMetaKeyLabel() + "I"}</code> to
|
||||
quickly make natural language edits
|
||||
</span>
|
||||
</li>
|
||||
<li className="flex items-start">
|
||||
<ClipboardDocumentIcon
|
||||
width="1.4em"
|
||||
height="1.4em"
|
||||
className="align-middle pr-3"
|
||||
/>
|
||||
<span>
|
||||
Highlight code and press <code>{getMetaKeyLabel() + "L"}</code> o
|
||||
add it to the chat window
|
||||
</span>
|
||||
</li>
|
||||
<li className="flex items-start">
|
||||
<Cog6ToothIcon
|
||||
width="1.4em"
|
||||
height="1.4em"
|
||||
className="align-middle pr-3"
|
||||
/>
|
||||
<span>
|
||||
Click the gear icon in the bottom right to configure Continue
|
||||
</span>
|
||||
</li>
|
||||
<li className="flex items-start">
|
||||
<BookOpenIcon
|
||||
width="1.4em"
|
||||
height="1.4em"
|
||||
className="align-middle pr-3"
|
||||
/>
|
||||
<span>
|
||||
<a href="https://docs.continue.dev" target="_blank">
|
||||
Read our documentation
|
||||
</a>{" "}
|
||||
to learn more
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</TutorialCardDiv>
|
||||
);
|
||||
}
|
||||
|
|
@ -12,7 +12,6 @@ import {
|
|||
useCallback,
|
||||
useContext,
|
||||
useEffect,
|
||||
useLayoutEffect,
|
||||
useRef,
|
||||
useState,
|
||||
} from "react";
|
||||
|
|
@ -56,6 +55,7 @@ import {
|
|||
import { getLocalStorage, setLocalStorage } from "../util/localStorage";
|
||||
import { FREE_TRIAL_LIMIT_REQUESTS } from "../util/freeTrial";
|
||||
import { ChatScrollAnchor } from "../components/ChatScrollAnchor";
|
||||
import { TutorialCard } from "../components/mainInput/TutorialCard";
|
||||
|
||||
const TopGuiDiv = styled.div`
|
||||
overflow-y: scroll;
|
||||
|
|
@ -144,11 +144,7 @@ function fallbackRender({ error, resetErrorBoundary }) {
|
|||
);
|
||||
}
|
||||
|
||||
interface GUIProps {
|
||||
firstObservation?: any;
|
||||
}
|
||||
|
||||
function GUI(props: GUIProps) {
|
||||
function GUI() {
|
||||
const posthog = usePostHog();
|
||||
const dispatch = useDispatch();
|
||||
const navigate = useNavigate();
|
||||
|
|
@ -169,6 +165,16 @@ function GUI(props: GUIProps) {
|
|||
|
||||
const state = useSelector((state: RootState) => state.state);
|
||||
|
||||
const [showTutorialCard, setShowTutorialCard] = useState<boolean>(
|
||||
getLocalStorage("showTutorialCard"),
|
||||
);
|
||||
|
||||
const onCloseTutorialCard = () => {
|
||||
posthog.capture("closedTutorialCard");
|
||||
setLocalStorage("showTutorialCard", false);
|
||||
setShowTutorialCard(false);
|
||||
};
|
||||
|
||||
const handleScroll = () => {
|
||||
// Temporary fix to account for additional height when code blocks are added
|
||||
const OFFSET_HERUISTIC = 300;
|
||||
|
|
@ -461,17 +467,27 @@ function GUI(props: GUIProps) {
|
|||
>
|
||||
New Session ({getMetaKeyLabel()} {isJetBrains() ? "J" : "L"})
|
||||
</NewSessionButton>
|
||||
) : getLastSessionId() ? (
|
||||
<NewSessionButton
|
||||
onClick={async () => {
|
||||
loadLastSession();
|
||||
}}
|
||||
className="mr-auto flex items-center gap-1"
|
||||
>
|
||||
<ArrowLeftIcon width="11px" height="11px" />
|
||||
Last Session
|
||||
</NewSessionButton>
|
||||
) : null}
|
||||
) : (
|
||||
<>
|
||||
{getLastSessionId() ? (
|
||||
<NewSessionButton
|
||||
onClick={async () => {
|
||||
loadLastSession();
|
||||
}}
|
||||
className="mr-auto flex items-center gap-1"
|
||||
>
|
||||
<ArrowLeftIcon width="11px" height="11px" />
|
||||
Last Session
|
||||
</NewSessionButton>
|
||||
) : null}
|
||||
|
||||
{!!showTutorialCard && (
|
||||
<div className="flex justify-center w-full">
|
||||
<TutorialCard onClose={onCloseTutorialCard} />
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<ChatScrollAnchor
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ export function useOnboarding() {
|
|||
|
||||
if (onboardingStatus === "Started") {
|
||||
setLocalStorage("onboardingStatus", "Completed");
|
||||
setLocalStorage("showTutorialCard", true);
|
||||
posthog.capture("Onboarding Step", { status: "Completed" });
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ type LocalStorageTypes = {
|
|||
indexingState: IndexingProgressUpdate;
|
||||
signedInToGh: boolean;
|
||||
isOnboardingInProgress: boolean;
|
||||
showTutorialCard: boolean;
|
||||
};
|
||||
|
||||
export function getLocalStorage<T extends keyof LocalStorageTypes>(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue