Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions gui/src/components/dialogs/FeedbackDialog.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<div className="mx-auto flex max-w-md flex-col p-6 pt-8">
<div className="flex items-center gap-2 text-lg font-medium">
<span>👋</span>
<span>Help us improve Continue</span>
</div>

<p className="text-foreground text-sm leading-relaxed">
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-foreground text-sm">
We'll be in touch soon.
</p>
</div>,
),
);

// Auto-close after 2 seconds
setTimeout(() => {
dispatch(setShowDialog(false));
dispatch(setDialogMessage(undefined));
}, 2000);
}}
className="flex flex-col gap-3"
>
<Input type="text" name="name" placeholder="Name" required />
<Input type="email" name="email" placeholder="Email" required />
<div className="mt-2 flex justify-between gap-2">
<SecondaryButton
className="flex-1"
type="button"
onClick={() => {
dispatch(setShowDialog(false));
dispatch(setDialogMessage(undefined));
}}
>
Not now
</SecondaryButton>
<Button className="flex-1" type="submit">
Submit
</Button>
</div>
</form>

<p className="text-description-muted text-xs">
We'll only use this information to reach out for feedback.
</p>
</div>
);
}
15 changes: 15 additions & 0 deletions gui/src/pages/gui/Chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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(<FeedbackDialog />));
dispatch(setShowDialog(true));
}
} else {
setLocalStorage("mainTextEntryCounter", 1);
}
},
[dispatch, ideMessenger, reduxStore, setIsCreatingAgent],
);
Expand Down
2 changes: 0 additions & 2 deletions gui/src/redux/slices/uiSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
Expand Down
1 change: 1 addition & 0 deletions gui/src/util/localStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ type LocalStorageTypes = {
hasDismissedExploreDialog: boolean;
onboardingStatus?: OnboardingStatus;
hasDismissedOnboardingCard: boolean;
mainTextEntryCounter: number;
ide: "vscode" | "jetbrains";
vsCodeUriScheme: string;
fontSize: number;
Expand Down
Loading