This commit is contained in:
Dallin Romney 2025-01-21 12:00:03 -08:00
parent e971c393b6
commit efced3206c
2 changed files with 54 additions and 18 deletions

View file

@ -3,12 +3,16 @@ import { Button, ButtonSubtext } from "../../..";
import { useAuth } from "../../../../context/Auth";
import ContinueLogo from "../../../gui/ContinueLogo";
import { useOnboardingCard } from "../../hooks";
import { hasPassedFTL } from "../../../../util/freeTrial";
import { useContext } from "react";
import { IdeMessengerContext } from "../../../../context/IdeMessenger";
export default function MainTab({
onRemainLocal,
}: {
onRemainLocal: () => void;
}) {
const ideMessenger = useContext(IdeMessengerContext);
const onboardingCard = useOnboardingCard();
const auth = useAuth();
@ -20,30 +24,53 @@ export default function MainTab({
});
}
function openPastFreeTrialOnboarding() {
// NATE TODO - add custom onboarding process handling here
ideMessenger.post("openUrl", "app.continue.dev/onboard?freeTrialStatus=1");
}
const pastFreeTrialLimit = hasPassedFTL();
return (
<div className="xs:px-0 flex w-full max-w-full flex-col items-center justify-center px-4 text-center">
<div className="xs:flex hidden">
<ContinueLogo height={75} />
</div>
<p className="xs:w-3/4 w-full text-sm">
Log in to quickly build your first custom AI code assistant
</p>
{pastFreeTrialLimit ? (
<>
<p className="xs:w-3/4 w-full text-sm">
You've reached the free trial limit. Visit the Continue Platform to
select a Coding Assistant.
</p>
<Button
onClick={openPastFreeTrialOnboarding}
className="mt-4 grid w-full grid-flow-col items-center gap-2"
>
Go to Continue Platform
</Button>
</>
) : (
<>
<p className="xs:w-3/4 w-full text-sm">
Log in to quickly build your first custom AI code assistant
</p>
<div className="mt-4 w-full">
<Button
onClick={onGetStarted}
className="grid w-full grid-flow-col items-center gap-2"
>
Get started
</Button>
<ButtonSubtext onClick={onRemainLocal}>
<div className="mt-4 flex cursor-pointer items-center justify-center gap-1">
<span>Or, remain local</span>
<ChevronRightIcon className="h-3 w-3" />
</div>
</ButtonSubtext>
</div>
<Button
onClick={onGetStarted}
className="mt-4 grid w-full grid-flow-col items-center gap-2"
>
Get started
</Button>
</>
)}
<ButtonSubtext onClick={onRemainLocal}>
<div className="mt-4 flex cursor-pointer items-center justify-center gap-1">
<span>Or, remain local</span>
<ChevronRightIcon className="h-3 w-3" />
</div>
</ButtonSubtext>
</div>
);
}

View file

@ -257,14 +257,23 @@ export function Chat() {
posthog?.capture("ftc_reached");
}
if (newCount >= FREE_TRIAL_LIMIT_REQUESTS) {
// Show this message whether using platform or not
// So that something happens if in new chat
ideMessenger.ide.showToast(
"error",
"You've reached the free trial limit. Please configure a model to continue.",
);
// Card in chat will only show if no history
onboardingCard.open("Quickstart");
// Also, note that platform card ignore the "Best", always opens to main tab
onboardingCard.open("Best");
// If history, show the dialog, which will automatically close if there is not history
if (history.length) {
dispatch(setDialogMessage(<FreeTrialOverDialog />));
dispatch(setShowDialog(true));
}
return;
}
}