-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sites Dashboard: Implement survey (#98218)
- Loading branch information
1 parent
2713cc1
commit f2878c5
Showing
7 changed files
with
97 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
...ites/components/sites-dashboard-survey/assets/images/survey-sites-dashboard.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { isEnabled } from '@automattic/calypso-config'; | ||
import { useIsEnglishLocale } from '@automattic/i18n-utils'; | ||
import ReactDOM from 'react-dom'; | ||
import SurveyModal from 'calypso/components/survey-modal'; | ||
import { useSelector } from 'calypso/state'; | ||
import { getCurrentUserId } from 'calypso/state/current-user/selectors'; | ||
import { isEligibleForProductSampling } from 'calypso/utils'; | ||
import surveySitesDashboardImage from './assets/images/survey-sites-dashboard.svg'; | ||
|
||
const SitesDashboardSurvey = () => { | ||
const isEnglishLocale = useIsEnglishLocale(); | ||
const userId = useSelector( getCurrentUserId ); | ||
|
||
const urlParams = new URLSearchParams( window.location.search ); | ||
const isEligibleSurvey = | ||
isEnabled( 'sites/dashboard-survey' ) && | ||
isEnglishLocale && | ||
userId && | ||
( isEligibleForProductSampling( userId, 15 ) || urlParams.has( 'show_survey' ) ); | ||
|
||
if ( ! isEligibleSurvey ) { | ||
return null; | ||
} | ||
|
||
return ReactDOM.createPortal( | ||
<SurveyModal | ||
name="survey-sites-dashboard" | ||
eventName="calypso_survey_sites_dashboard" | ||
title="Shape the Future of WordPress.com" | ||
description="Got a minute? We’d love to get your feedback on some upcoming changes to the WordPress.com dashboard." | ||
surveyImage={ surveySitesDashboardImage } | ||
surveyImageAlt="WordPress.com dashboard" | ||
url="https://wordpressdotcom.crowdsignal.net/wordpress-com-dashboard-feedback" | ||
dismissText="No thanks" | ||
confirmText="Take survey" | ||
showOverlay={ false } | ||
/>, | ||
document.body | ||
); | ||
}; | ||
|
||
export default SitesDashboardSurvey; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters