close dialog on submit onboarding
This commit is contained in:
parent
89df3f6e0e
commit
f67eae4c9d
10 changed files with 57 additions and 20 deletions
4
extensions/vscode/package-lock.json
generated
4
extensions/vscode/package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "continue",
|
||||
"version": "0.9.252",
|
||||
"version": "0.9.253",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "continue",
|
||||
"version": "0.9.252",
|
||||
"version": "0.9.253",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@continuedev/fetch": "^1.0.3",
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ export function OnboardingCard({ isDialog }: OnboardingCardProps) {
|
|||
onTabClick={onboardingCard.setActiveTab}
|
||||
/>
|
||||
{!isDialog && (
|
||||
<CloseButton onClick={onboardingCard.close}>
|
||||
<CloseButton onClick={() => onboardingCard.close()}>
|
||||
<XMarkIcon className="mt-1.5 hidden h-5 w-5 hover:brightness-125 sm:flex" />
|
||||
</CloseButton>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -9,11 +9,15 @@ import { useSubmitOnboarding } from "../hooks";
|
|||
import JetBrainsFetchGitHubTokenDialog from "./JetBrainsFetchGitHubTokenDialog";
|
||||
import { setDefaultModel } from "../../../redux/slices/configSlice";
|
||||
|
||||
function QuickstartSubmitButton() {
|
||||
interface QuickstartSubmitButtonProps {
|
||||
isDialog?: boolean;
|
||||
}
|
||||
|
||||
function QuickstartSubmitButton({ isDialog }: QuickstartSubmitButtonProps) {
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const { submitOnboarding } = useSubmitOnboarding("Quickstart");
|
||||
const { submitOnboarding } = useSubmitOnboarding("Quickstart", isDialog);
|
||||
|
||||
function onComplete() {
|
||||
submitOnboarding();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,11 @@
|
|||
import { useDispatch } from "react-redux";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { TabTitle } from "../components/OnboardingCardTabs";
|
||||
import { setOnboardingCard } from "../../../redux/slices/uiSlice";
|
||||
import {
|
||||
setDialogMessage,
|
||||
setOnboardingCard,
|
||||
setShowDialog,
|
||||
} from "../../../redux/slices/uiSlice";
|
||||
import { OnboardingCardState } from "..";
|
||||
import { getLocalStorage, setLocalStorage } from "../../../util/localStorage";
|
||||
import { useAppDispatch, useAppSelector } from "../../../redux/hooks";
|
||||
|
|
@ -12,7 +16,7 @@ export interface UseOnboardingCard {
|
|||
activeTab: OnboardingCardState["activeTab"];
|
||||
setActiveTab: (tab: TabTitle) => void;
|
||||
open: (tab: TabTitle) => void;
|
||||
close: () => void;
|
||||
close: (isDialog?: boolean) => void;
|
||||
}
|
||||
|
||||
export function useOnboardingCard(): UseOnboardingCard {
|
||||
|
|
@ -41,9 +45,13 @@ export function useOnboardingCard(): UseOnboardingCard {
|
|||
dispatch(setOnboardingCard({ show: true, activeTab: tab }));
|
||||
}
|
||||
|
||||
function close() {
|
||||
function close(isDialog = false) {
|
||||
setLocalStorage("hasDismissedOnboardingCard", true);
|
||||
dispatch(setOnboardingCard({ show: false }));
|
||||
if (isDialog) {
|
||||
dispatch(setDialogMessage(undefined));
|
||||
dispatch(setShowDialog(false));
|
||||
}
|
||||
}
|
||||
|
||||
function setActiveTab(tab: TabTitle) {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import { OnboardingModes } from "core/protocol/core";
|
|||
import { useTutorialCard } from "../../../hooks/useTutorialCard";
|
||||
import { useOnboardingCard } from "./useOnboardingCard";
|
||||
|
||||
export function useSubmitOnboarding(mode: OnboardingModes) {
|
||||
export function useSubmitOnboarding(mode: OnboardingModes, isDialog = false) {
|
||||
const posthog = usePostHog();
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
const { openTutorialCard } = useTutorialCard();
|
||||
|
|
@ -16,7 +16,7 @@ export function useSubmitOnboarding(mode: OnboardingModes) {
|
|||
const onboardingStatus = getLocalStorage("onboardingStatus");
|
||||
|
||||
// Always close the onboarding card and update config.json
|
||||
closeOnboardingCard();
|
||||
closeOnboardingCard(isDialog);
|
||||
ideMessenger.post("completeOnboarding", {
|
||||
mode,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ export interface OnboardingCardState {
|
|||
}
|
||||
|
||||
interface OnboardingCardProps {
|
||||
isDialog?: boolean;
|
||||
isDialog: boolean;
|
||||
}
|
||||
|
||||
export function PlatformOnboardingCard({ isDialog }: OnboardingCardProps) {
|
||||
|
|
@ -39,14 +39,17 @@ export function PlatformOnboardingCard({ isDialog }: OnboardingCardProps) {
|
|||
return (
|
||||
<StyledCard className="xs:py-4 xs:px-4 relative px-2 py-3">
|
||||
{!isDialog && (
|
||||
<CloseButton onClick={onboardingCard.close}>
|
||||
<CloseButton onClick={() => onboardingCard.close()}>
|
||||
<XMarkIcon className="mt-1.5 hidden h-5 w-5 hover:brightness-125 sm:flex" />
|
||||
</CloseButton>
|
||||
)}
|
||||
<div className="content py-4">
|
||||
<div className="flex h-full w-full items-center justify-center">
|
||||
{currentTab === "main" ? (
|
||||
<MainTab onRemainLocal={() => setCurrentTab("local")} />
|
||||
<MainTab
|
||||
onRemainLocal={() => setCurrentTab("local")}
|
||||
isDialog={isDialog}
|
||||
/>
|
||||
) : (
|
||||
<div className="mt-4">
|
||||
<Alert type="info">
|
||||
|
|
@ -59,7 +62,7 @@ export function PlatformOnboardingCard({ isDialog }: OnboardingCardProps) {
|
|||
</a>
|
||||
</Alert>
|
||||
|
||||
<OnboardingLocalTab />
|
||||
<OnboardingLocalTab isDialog={isDialog} />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -9,8 +9,10 @@ import { IdeMessengerContext } from "../../../../context/IdeMessenger";
|
|||
|
||||
export default function MainTab({
|
||||
onRemainLocal,
|
||||
isDialog,
|
||||
}: {
|
||||
onRemainLocal: () => void;
|
||||
isDialog: boolean;
|
||||
}) {
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
const onboardingCard = useOnboardingCard();
|
||||
|
|
@ -19,7 +21,7 @@ export default function MainTab({
|
|||
function onGetStarted() {
|
||||
auth.login(true).then((success) => {
|
||||
if (success) {
|
||||
onboardingCard.close();
|
||||
onboardingCard.close(isDialog);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -27,6 +29,7 @@ export default function MainTab({
|
|||
function openPastFreeTrialOnboarding() {
|
||||
// NATE TODO - add custom onboarding process handling here
|
||||
ideMessenger.post("openUrl", "app.continue.dev/onboard?freeTrialStatus=1");
|
||||
onboardingCard.close(isDialog);
|
||||
}
|
||||
|
||||
const pastFreeTrialLimit = hasPassedFTL();
|
||||
|
|
|
|||
|
|
@ -2,8 +2,12 @@ import BestExperienceConfigForm from "../components/BestExperienceConfigForm";
|
|||
import ProviderAlert from "../components/ProviderAlert";
|
||||
import { useSubmitOnboarding } from "../hooks";
|
||||
|
||||
function OnboardingBestTab() {
|
||||
const { submitOnboarding } = useSubmitOnboarding("Best");
|
||||
interface OnboardingBestTabProps {
|
||||
isDialog?: boolean;
|
||||
}
|
||||
|
||||
function OnboardingBestTab({ isDialog }: OnboardingBestTabProps) {
|
||||
const { submitOnboarding } = useSubmitOnboarding("Best", isDialog);
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-8">
|
||||
|
|
|
|||
|
|
@ -14,14 +14,20 @@ import OllamaModelDownload from "../components/OllamaModelDownload";
|
|||
import { OllamaStatus } from "../components/OllamaStatus";
|
||||
import { useSubmitOnboarding } from "../hooks";
|
||||
import { setDefaultModel } from "../../../redux/slices/configSlice";
|
||||
import { setDialogMessage, setShowDialog } from "../../../redux/slices/uiSlice";
|
||||
|
||||
const OLLAMA_CHECK_INTERVAL_MS = 3000;
|
||||
|
||||
function OnboardingLocalTab() {
|
||||
interface OnboardingLocalTabProps {
|
||||
isDialog?: boolean;
|
||||
}
|
||||
|
||||
function OnboardingLocalTab({ isDialog }: OnboardingLocalTabProps) {
|
||||
const dispatch = useDispatch();
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
const { submitOnboarding } = useSubmitOnboarding(
|
||||
hasPassedFTL() ? "LocalAfterFreeTrial" : "Local",
|
||||
isDialog,
|
||||
);
|
||||
const [hasLoadedChatModel, setHasLoadedChatModel] = useState(false);
|
||||
const [downloadedOllamaModels, setDownloadedOllamaModels] = useState<
|
||||
|
|
@ -117,6 +123,11 @@ function OnboardingLocalTab() {
|
|||
onClick={() => {
|
||||
submitOnboarding();
|
||||
|
||||
if (isDialog) {
|
||||
dispatch(setDialogMessage(undefined));
|
||||
dispatch(setShowDialog(false));
|
||||
}
|
||||
|
||||
// Set the selected model to the local chat model
|
||||
dispatch(
|
||||
setDefaultModel({
|
||||
|
|
|
|||
|
|
@ -1,7 +1,11 @@
|
|||
import ContinueLogo from "../../gui/ContinueLogo";
|
||||
import QuickStartSubmitButton from "../components/QuickStartSubmitButton";
|
||||
|
||||
function OnboardingQuickstartTab() {
|
||||
interface OnboardingQuickstartTabProps {
|
||||
isDialog?: boolean;
|
||||
}
|
||||
|
||||
function OnboardingQuickstartTab({ isDialog }: OnboardingQuickstartTabProps) {
|
||||
return (
|
||||
<div className="flex h-full w-full items-center justify-center">
|
||||
<div className="xs:px-0 flex w-full max-w-full flex-col items-center justify-center px-4 text-center">
|
||||
|
|
@ -18,7 +22,7 @@ function OnboardingQuickstartTab() {
|
|||
To prevent abuse, we'll ask you to sign in to GitHub.
|
||||
</p>
|
||||
|
||||
<QuickStartSubmitButton />
|
||||
<QuickStartSubmitButton isDialog={isDialog} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue