diff --git a/gui/src/components/dialogs/FeedbackDialog.tsx b/gui/src/components/dialogs/FeedbackDialog.tsx new file mode 100644 index 00000000000..4ece0387116 --- /dev/null +++ b/gui/src/components/dialogs/FeedbackDialog.tsx @@ -0,0 +1,73 @@ +import { usePostHog } from "posthog-js/react"; +import { Button, Input, SecondaryButton } from ".."; +import { useAppDispatch } from "../../redux/hooks"; +import { setDialogMessage, setShowDialog } from "../../redux/slices/uiSlice"; + +export default function FeedbackDialog() { + const posthog = usePostHog(); + const dispatch = useAppDispatch(); + + return ( +
+
+ 👋 + Help us improve Continue +
+ +

+ We're always working to make Continue better and would love to hear from + you. If you're interested in sharing your experience, please enter your + details below. +

+ +
{ + e.preventDefault(); + posthog?.capture("user_interest_form", { + name: e.target.elements[0].value, + email: e.target.elements[1].value, + }); + dispatch( + setDialogMessage( +
+
✓ Thank you!
+

+ We'll be in touch soon. +

+
, + ), + ); + + // Auto-close after 2 seconds + setTimeout(() => { + dispatch(setShowDialog(false)); + dispatch(setDialogMessage(undefined)); + }, 2000); + }} + className="flex flex-col gap-3" + > + + +
+ { + dispatch(setShowDialog(false)); + dispatch(setDialogMessage(undefined)); + }} + > + Not now + + +
+
+ +

+ We'll only use this information to reach out for feedback. +

+
+ ); +} diff --git a/gui/src/pages/gui/Chat.tsx b/gui/src/pages/gui/Chat.tsx index f0ddad002f1..45929ec12e2 100644 --- a/gui/src/pages/gui/Chat.tsx +++ b/gui/src/pages/gui/Chat.tsx @@ -47,12 +47,15 @@ import { ToolCallDiv } from "./ToolCallDiv"; import { useStore } from "react-redux"; import { BackgroundModeView } from "../../components/BackgroundMode/BackgroundModeView"; import { CliInstallBanner } from "../../components/CliInstallBanner"; +import FeedbackDialog from "../../components/dialogs/FeedbackDialog"; import { FatalErrorIndicator } from "../../components/config/FatalErrorNotice"; import InlineErrorMessage from "../../components/mainInput/InlineErrorMessage"; import { resolveEditorContent } from "../../components/mainInput/TipTapEditor/utils/resolveEditorContent"; +import { setDialogMessage, setShowDialog } from "../../redux/slices/uiSlice"; import { RootState } from "../../redux/store"; import { cancelStream } from "../../redux/thunks/cancelStream"; +import { getLocalStorage, setLocalStorage } from "../../util/localStorage"; import { EmptyChatBody } from "./EmptyChatBody"; import { ExploreDialogWatcher } from "./ExploreDialogWatcher"; import { useAutoScroll } from "./useAutoScroll"; @@ -269,6 +272,18 @@ export function Chat() { editorToClearOnSend.commands.clearContent(); } } + + // Increment localstorage counter for popup + const currentCount = getLocalStorage("mainTextEntryCounter"); + if (currentCount) { + setLocalStorage("mainTextEntryCounter", currentCount + 1); + if (currentCount === 300) { + dispatch(setDialogMessage()); + dispatch(setShowDialog(true)); + } + } else { + setLocalStorage("mainTextEntryCounter", 1); + } }, [dispatch, ideMessenger, reduxStore, setIsCreatingAgent], ); diff --git a/gui/src/redux/slices/uiSlice.ts b/gui/src/redux/slices/uiSlice.ts index e261af346d1..c020cadd02b 100644 --- a/gui/src/redux/slices/uiSlice.ts +++ b/gui/src/redux/slices/uiSlice.ts @@ -19,7 +19,6 @@ export type ToolGroupPolicies = { [toolGroupName: string]: ToolGroupPolicy }; type UIState = { showDialog: boolean; dialogMessage: JSX.Element | undefined; - dialogEntryOn: boolean; onboardingCard: OnboardingCardState; isExploreDialogOpen: boolean; hasDismissedExploreDialog: boolean; @@ -35,7 +34,6 @@ export const DEFAULT_RULE_SETTING: RulePolicy = "on"; export const DEFAULT_UI_SLICE: UIState = { showDialog: false, dialogMessage: undefined, - dialogEntryOn: false, onboardingCard: defaultOnboardingCardState, isExploreDialogOpen: getLocalStorage(LocalStorageKey.IsExploreDialogOpen) ?? false, diff --git a/gui/src/util/localStorage.ts b/gui/src/util/localStorage.ts index cab68d7b6b8..15221159f74 100644 --- a/gui/src/util/localStorage.ts +++ b/gui/src/util/localStorage.ts @@ -6,6 +6,7 @@ type LocalStorageTypes = { hasDismissedExploreDialog: boolean; onboardingStatus?: OnboardingStatus; hasDismissedOnboardingCard: boolean; + mainTextEntryCounter: number; ide: "vscode" | "jetbrains"; vsCodeUriScheme: string; fontSize: number;