From b3807e72c32b53ae9eb0c101b4a81c20170dba61 Mon Sep 17 00:00:00 2001 From: "Laurie T. Malau" Date: Wed, 11 May 2022 10:32:19 +0000 Subject: [PATCH] Feedback modal --- components/dashboard/src/Analytics.tsx | 10 +- components/dashboard/src/App.tsx | 2 + components/dashboard/src/Menu.tsx | 21 ++- .../dashboard/src/components/PillMenuItem.tsx | 2 +- .../src/feedback-form/FeedbackComponent.tsx | 166 ++++++++++++++++++ .../src/feedback-form/FeedbackModal.tsx | 26 +++ .../src/images/feedback/crying-emoji.svg | 10 ++ .../src/images/feedback/happy-emoji.svg | 7 + .../src/images/feedback/meh-emoji.svg | 6 + .../src/images/feedback/starry-eyed-emoji.svg | 6 + components/dashboard/src/index.css | 6 + 11 files changed, 255 insertions(+), 7 deletions(-) create mode 100644 components/dashboard/src/feedback-form/FeedbackComponent.tsx create mode 100644 components/dashboard/src/feedback-form/FeedbackModal.tsx create mode 100644 components/dashboard/src/images/feedback/crying-emoji.svg create mode 100644 components/dashboard/src/images/feedback/happy-emoji.svg create mode 100644 components/dashboard/src/images/feedback/meh-emoji.svg create mode 100644 components/dashboard/src/images/feedback/starry-eyed-emoji.svg diff --git a/components/dashboard/src/Analytics.tsx b/components/dashboard/src/Analytics.tsx index b6f127850942b1..9099f07d5b0076 100644 --- a/components/dashboard/src/Analytics.tsx +++ b/components/dashboard/src/Analytics.tsx @@ -10,10 +10,10 @@ import Cookies from "js-cookie"; import { v4 } from "uuid"; import { Experiment } from "./experiments"; -export type Event = "invite_url_requested" | "organisation_authorised" | "dotfile_repo_changed"; +export type Event = "invite_url_requested" | "organisation_authorised" | "dotfile_repo_changed" | "feedback_submitted"; type InternalEvent = Event | "path_changed" | "dashboard_clicked"; -export type EventProperties = TrackOrgAuthorised | TrackInviteUrlRequested | TrackDotfileRepo; +export type EventProperties = TrackOrgAuthorised | TrackInviteUrlRequested | TrackDotfileRepo | TrackFeedback; type InternalEventProperties = TrackUIExperiments & (EventProperties | TrackDashboardClick | TrackPathChanged); export interface TrackOrgAuthorised { @@ -30,6 +30,12 @@ export interface TrackDotfileRepo { current: string; } +export interface TrackFeedback { + selectedEmoji: number; + text: string; + href: string; + path: string; +} interface TrackDashboardClick { dnt?: boolean; path: string; diff --git a/components/dashboard/src/App.tsx b/components/dashboard/src/App.tsx index 1db31a3a659df5..49821b7930661c 100644 --- a/components/dashboard/src/App.tsx +++ b/components/dashboard/src/App.tsx @@ -48,6 +48,7 @@ import { parseProps } from "./start/StartWorkspace"; import SelectIDEModal from "./settings/SelectIDEModal"; import { StartPage, StartPhase } from "./start/StartPage"; import { isGitpodIo } from "./utils"; +import FeedbackFormModal from "./feedback-form/FeedbackModal"; const Setup = React.lazy(() => import(/* webpackPrefetch: true */ "./Setup")); const Workspaces = React.lazy(() => import(/* webpackPrefetch: true */ "./workspaces/Workspaces")); @@ -372,6 +373,7 @@ function App() { + diff --git a/components/dashboard/src/Menu.tsx b/components/dashboard/src/Menu.tsx index 225c1b5f6d3414..5c330b0b4f9928 100644 --- a/components/dashboard/src/Menu.tsx +++ b/components/dashboard/src/Menu.tsx @@ -26,6 +26,7 @@ import { getTeamSettingsMenu } from "./teams/TeamSettings"; import { getProjectSettingsMenu } from "./projects/ProjectSettings"; import { ProjectContext } from "./projects/project-context"; import { PaymentContext } from "./payment-context"; +import FeedbackFormModal from "./feedback-form/FeedbackModal"; interface Entry { title: string; @@ -41,6 +42,7 @@ export default function Menu() { const { showPaymentUI, setShowPaymentUI, setCurrency, setIsStudent, setIsChargebeeCustomer } = useContext(PaymentContext); const { project, setProject } = useContext(ProjectContext); + const [isFeedbackFormVisible, setFeedbackFormVisible] = useState(false); const match = useRouteMatch<{ segment1?: string; segment2?: string; segment3?: string }>( "/(t/)?:segment1/:segment2?/:segment3?", @@ -227,12 +229,15 @@ export default function Menu() { title: "Docs", link: "https://www.gitpod.io/docs/", }, - { - title: "Help", - link: "https://www.gitpod.io/support", - }, ]; + const handleFeedbackFormClick = () => { + setFeedbackFormVisible(true); + }; + + const onFeedbackFormClose = () => { + setFeedbackFormVisible(false); + }; const renderTeamMenu = () => { return (
@@ -371,6 +376,9 @@ export default function Menu() { /> ))} +
  • + +
  • + {isFeedbackFormVisible && } {!isMinimalUI && !prebuildId && (