feat: restore feedback modal for user interest collection
- Restore FeedbackDialog component with improved modern styling - Add Tailwind CSS classes for better UI/UX - Include 'Not now' button for less intrusive experience - Auto-close modal after submission - Restore localStorage counter tracking in Chat.tsx - Restore UI state management in uiSlice.ts - Track user interest via PostHog 'user_interest_form' event Closes CON-4856 Generated with [Continue](https://continue.dev) Co-Authored-By: Continue <noreply@continue.dev> Co-authored-by: dallin <dallin@continue.dev>
This commit is contained in:
parent
9aa7fc53b8
commit
a258974bf5
4 changed files with 109 additions and 0 deletions
81
gui/src/components/dialogs/FeedbackDialog.tsx
Normal file
81
gui/src/components/dialogs/FeedbackDialog.tsx
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
import { usePostHog } from "posthog-js/react";
|
||||
import { setDialogMessage, setShowDialog } from "../../redux/slices/uiSlice";
|
||||
import { useAppDispatch } from "../../redux/hooks";
|
||||
|
||||
export default function FeedbackDialog() {
|
||||
const posthog = usePostHog();
|
||||
const dispatch = useAppDispatch();
|
||||
|
||||
return (
|
||||
<div className="mx-auto flex max-w-md flex-col gap-4 p-6">
|
||||
<div className="flex items-center gap-2 text-lg font-medium">
|
||||
<span>👋</span>
|
||||
<span>Help us improve Continue</span>
|
||||
</div>
|
||||
|
||||
<p className="text-sm leading-relaxed text-gray-300">
|
||||
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.
|
||||
</p>
|
||||
|
||||
<form
|
||||
onSubmit={(e: any) => {
|
||||
e.preventDefault();
|
||||
posthog?.capture("user_interest_form", {
|
||||
name: e.target.elements[0].value,
|
||||
email: e.target.elements[1].value,
|
||||
});
|
||||
dispatch(
|
||||
setDialogMessage(
|
||||
<div className="p-6 text-center">
|
||||
<div className="mb-2 text-lg">✓ Thank you!</div>
|
||||
<p className="text-sm text-gray-300">We'll be in touch soon.</p>
|
||||
</div>,
|
||||
),
|
||||
);
|
||||
|
||||
// Auto-close after 2 seconds
|
||||
setTimeout(() => {
|
||||
dispatch(setShowDialog(false));
|
||||
}, 2000);
|
||||
}}
|
||||
className="flex flex-col gap-3"
|
||||
>
|
||||
<input
|
||||
className="rounded-md border border-gray-600 bg-gray-800 px-3 py-2 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
type="text"
|
||||
name="name"
|
||||
placeholder="Name"
|
||||
required
|
||||
/>
|
||||
<input
|
||||
className="rounded-md border border-gray-600 bg-gray-800 px-3 py-2 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
type="email"
|
||||
name="email"
|
||||
placeholder="Email"
|
||||
required
|
||||
/>
|
||||
<div className="mt-2 flex gap-2">
|
||||
<button
|
||||
type="submit"
|
||||
className="flex-1 rounded-md bg-blue-600 px-4 py-2 font-medium transition-colors hover:bg-blue-700"
|
||||
>
|
||||
Submit
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => dispatch(setShowDialog(false))}
|
||||
className="rounded-md bg-gray-700 px-4 py-2 font-medium transition-colors hover:bg-gray-600"
|
||||
>
|
||||
Not now
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<p className="text-center text-xs text-gray-400">
|
||||
We won't use this information for anything other than reaching out.
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -47,12 +47,19 @@ 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 {
|
||||
setDialogEntryOn,
|
||||
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 +276,19 @@ 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(<FeedbackDialog />));
|
||||
dispatch(setDialogEntryOn(false));
|
||||
dispatch(setShowDialog(true));
|
||||
}
|
||||
} else {
|
||||
setLocalStorage("mainTextEntryCounter", 1);
|
||||
}
|
||||
},
|
||||
[dispatch, ideMessenger, reduxStore, setIsCreatingAgent],
|
||||
);
|
||||
|
|
|
|||
|
|
@ -66,6 +66,12 @@ export const uiSlice = createSlice({
|
|||
) => {
|
||||
state.dialogMessage = action.payload;
|
||||
},
|
||||
setDialogEntryOn: (
|
||||
state,
|
||||
action: PayloadAction<UIState["dialogEntryOn"]>,
|
||||
) => {
|
||||
state.dialogEntryOn = action.payload;
|
||||
},
|
||||
setShowDialog: (state, action: PayloadAction<UIState["showDialog"]>) => {
|
||||
state.showDialog = action.payload;
|
||||
},
|
||||
|
|
@ -147,6 +153,7 @@ export const uiSlice = createSlice({
|
|||
export const {
|
||||
setOnboardingCard,
|
||||
setDialogMessage,
|
||||
setDialogEntryOn,
|
||||
setShowDialog,
|
||||
setIsExploreDialogOpen,
|
||||
toggleToolSetting,
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ type LocalStorageTypes = {
|
|||
hasDismissedExploreDialog: boolean;
|
||||
onboardingStatus?: OnboardingStatus;
|
||||
hasDismissedOnboardingCard: boolean;
|
||||
mainTextEntryCounter: number;
|
||||
ide: "vscode" | "jetbrains";
|
||||
vsCodeUriScheme: string;
|
||||
fontSize: number;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue