mirror of
https://github.com/eliasstepanik/core.git
synced 2026-01-11 23:58:26 +00:00
Add skip button to onboarding modal with persistence
Add skip functionality to the Welcome to Core onboarding modal that prevents it from showing again after the user clicks skip. Changes: - Add skip button in modal header with ghost styling - Persist onboarding completion state to localStorage - Check localStorage before showing modal on future visits - Apply persistence to both skip and complete flows The modal will no longer appear after being skipped or completed, improving user experience for returning users.
This commit is contained in:
parent
f038ad5c61
commit
da30ec8a6b
@ -6,6 +6,7 @@ import { IngestionStep } from "./ingestion-step";
|
|||||||
import { VerificationStep } from "./verification-step";
|
import { VerificationStep } from "./verification-step";
|
||||||
import { PROVIDER_CONFIGS } from "./provider-config";
|
import { PROVIDER_CONFIGS } from "./provider-config";
|
||||||
import { Progress } from "../ui/progress";
|
import { Progress } from "../ui/progress";
|
||||||
|
import { Button } from "../ui/button";
|
||||||
|
|
||||||
interface OnboardingModalProps {
|
interface OnboardingModalProps {
|
||||||
isOpen: boolean;
|
isOpen: boolean;
|
||||||
@ -108,11 +109,24 @@ export function OnboardingModal({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleComplete = () => {
|
const handleComplete = () => {
|
||||||
|
// Mark onboarding as completed in localStorage
|
||||||
|
if (typeof window !== "undefined") {
|
||||||
|
localStorage.setItem("onboarding_completed", "true");
|
||||||
|
}
|
||||||
setCurrentStep(OnboardingStep.COMPLETE);
|
setCurrentStep(OnboardingStep.COMPLETE);
|
||||||
onComplete();
|
onComplete();
|
||||||
onClose();
|
onClose();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleSkip = () => {
|
||||||
|
// Mark onboarding as completed in localStorage
|
||||||
|
if (typeof window !== "undefined") {
|
||||||
|
localStorage.setItem("onboarding_completed", "true");
|
||||||
|
}
|
||||||
|
onComplete();
|
||||||
|
onClose();
|
||||||
|
};
|
||||||
|
|
||||||
// Poll for recall logs to detect verification
|
// Poll for recall logs to detect verification
|
||||||
const pollRecallLogs = async () => {
|
const pollRecallLogs = async () => {
|
||||||
setIsCheckingRecall(true);
|
setIsCheckingRecall(true);
|
||||||
@ -179,7 +193,17 @@ export function OnboardingModal({
|
|||||||
<DialogContent className="max-h-[90vh] max-w-3xl overflow-y-auto p-4">
|
<DialogContent className="max-h-[90vh] max-w-3xl overflow-y-auto p-4">
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<div className="space-y-3">
|
<div className="space-y-3">
|
||||||
<DialogTitle className="text-2xl">Welcome to Core</DialogTitle>
|
<div className="flex items-center justify-between">
|
||||||
|
<DialogTitle className="text-2xl">Welcome to Core</DialogTitle>
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
size="sm"
|
||||||
|
onClick={handleSkip}
|
||||||
|
className="text-muted-foreground hover:text-foreground"
|
||||||
|
>
|
||||||
|
Skip
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<p className="text-muted-foreground text-sm">
|
<p className="text-muted-foreground text-sm">
|
||||||
|
|||||||
@ -38,7 +38,14 @@ export default function LogsAll() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!isLoading && logs && logs.length === 1) {
|
if (!isLoading && logs && logs.length === 1) {
|
||||||
setOnboarding(true);
|
// Check if onboarding has been completed before
|
||||||
|
const hasCompletedOnboarding =
|
||||||
|
typeof window !== "undefined" &&
|
||||||
|
localStorage.getItem("onboarding_completed") === "true";
|
||||||
|
|
||||||
|
if (!hasCompletedOnboarding) {
|
||||||
|
setOnboarding(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, [logs.length, isLoading]);
|
}, [logs.length, isLoading]);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user