diff --git a/gui/package-lock.json b/gui/package-lock.json index e8471ee68..4b5330ad2 100644 --- a/gui/package-lock.json +++ b/gui/package-lock.json @@ -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" } diff --git a/gui/src/components/mainInput/TutorialCard.tsx b/gui/src/components/mainInput/TutorialCard.tsx new file mode 100644 index 000000000..d26c2502b --- /dev/null +++ b/gui/src/components/mainInput/TutorialCard.tsx @@ -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 ( + +
+ +
+ + +
+ ); +} diff --git a/gui/src/pages/gui.tsx b/gui/src/pages/gui.tsx index c1f07e72c..8837e001e 100644 --- a/gui/src/pages/gui.tsx +++ b/gui/src/pages/gui.tsx @@ -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( + 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"}) - ) : getLastSessionId() ? ( - { - loadLastSession(); - }} - className="mr-auto flex items-center gap-1" - > - - Last Session - - ) : null} + ) : ( + <> + {getLastSessionId() ? ( + { + loadLastSession(); + }} + className="mr-auto flex items-center gap-1" + > + + Last Session + + ) : null} + + {!!showTutorialCard && ( +
+ +
+ )} + + )} (