From c2b231d5ccca7d9d9b970c7bc9e735a974635360 Mon Sep 17 00:00:00 2001 From: chamikaJ Date: Tue, 29 Jul 2025 11:13:08 +0530 Subject: [PATCH] feat(survey-modal): add survey modal configuration to environment files - Introduced a new environment variable VITE_ENABLE_SURVEY_MODAL to control the visibility of the survey modal. - Updated .env.example to include the new variable with a default value of true. - Modified SurveyPromptModal component to check the environment variable before displaying the modal, enhancing user experience by allowing toggling of the feature. --- worklenz-frontend/.env.development | 6 ++++- worklenz-frontend/.env.example | 22 +++++++++++++++++++ .../components/survey/SurveyPromptModal.tsx | 5 +++++ 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 worklenz-frontend/.env.example diff --git a/worklenz-frontend/.env.development b/worklenz-frontend/.env.development index 21605cdf..fce70952 100644 --- a/worklenz-frontend/.env.development +++ b/worklenz-frontend/.env.development @@ -15,4 +15,8 @@ VITE_RECAPTCHA_SITE_KEY=recaptcha-site-key VITE_WORKLENZ_SESSION_ID=worklenz-session-id # Google Login -VITE_ENABLE_GOOGLE_LOGIN=false \ No newline at end of file +VITE_ENABLE_GOOGLE_LOGIN=false + +# Survey Modal Configuration +# Set to true to enable the survey modal, false to disable it +VITE_ENABLE_SURVEY_MODAL=false \ No newline at end of file diff --git a/worklenz-frontend/.env.example b/worklenz-frontend/.env.example new file mode 100644 index 00000000..fce70952 --- /dev/null +++ b/worklenz-frontend/.env.example @@ -0,0 +1,22 @@ +VITE_API_URL=http://localhost:3000 +VITE_SOCKET_URL=ws://localhost:3000 + +VITE_APP_TITLE=Worklenz +VITE_APP_ENV=development + +# Mixpanel +VITE_MIXPANEL_TOKEN=mixpanel-token + +# Recaptcha +VITE_ENABLE_RECAPTCHA=false +VITE_RECAPTCHA_SITE_KEY=recaptcha-site-key + +# Session ID +VITE_WORKLENZ_SESSION_ID=worklenz-session-id + +# Google Login +VITE_ENABLE_GOOGLE_LOGIN=false + +# Survey Modal Configuration +# Set to true to enable the survey modal, false to disable it +VITE_ENABLE_SURVEY_MODAL=false \ No newline at end of file diff --git a/worklenz-frontend/src/components/survey/SurveyPromptModal.tsx b/worklenz-frontend/src/components/survey/SurveyPromptModal.tsx index 334d08b2..b09a57a9 100644 --- a/worklenz-frontend/src/components/survey/SurveyPromptModal.tsx +++ b/worklenz-frontend/src/components/survey/SurveyPromptModal.tsx @@ -30,6 +30,11 @@ export const SurveyPromptModal: React.FC = ({ forceShow const isDarkMode = themeMode === 'dark'; useEffect(() => { + // Check if survey modal is disabled via environment variable + if (import.meta.env.VITE_ENABLE_SURVEY_MODAL !== 'true' && !forceShow) { + return; // Don't show modal if disabled in environment + } + // Check if survey was skipped recently (within 7 days) const skippedAt = localStorage.getItem('survey_skipped_at'); if (!forceShow && skippedAt) {