Skip to content

Commit

Permalink
Stats: Wire up feedback review button (#94219)
Browse files Browse the repository at this point in the history
  • Loading branch information
a8ck3n authored Sep 6, 2024
1 parent a30fcc6 commit 96c6818
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions client/my-sites/stats/feedback/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ const FEEDBACK_ACTION_LEAVE_REVIEW = 'feedback-action-leave-review';
const FEEDBACK_ACTION_SEND_FEEDBACK = 'feedback-action-send-feedback';
const FEEDBACK_ACTION_DISMISS_FLOATING_PANEL = 'feedback-action-dismiss-floating-panel';

const FEEDBACK_LEAVE_REVIEW_URL = 'https://wordpress.org/support/plugin/jetpack/reviews/';

interface FeedbackProps {
siteId: number;
}
Expand Down Expand Up @@ -95,11 +97,18 @@ function StatsFeedbackController( { siteId }: FeedbackProps ) {
const [ isFloatingPanelOpen, setIsFloatingPanelOpen ] = useState( true );

const handleButtonClick = ( action: string ) => {
if ( action === FEEDBACK_ACTION_SEND_FEEDBACK ) {
setIsOpen( true );
}
if ( action === FEEDBACK_ACTION_DISMISS_FLOATING_PANEL ) {
setIsFloatingPanelOpen( false );
switch ( action ) {
case FEEDBACK_ACTION_SEND_FEEDBACK:
setIsOpen( true );
break;
case FEEDBACK_ACTION_DISMISS_FLOATING_PANEL:
setIsFloatingPanelOpen( false );
break;
case FEEDBACK_ACTION_LEAVE_REVIEW:
setIsFloatingPanelOpen( false );
window.open( FEEDBACK_LEAVE_REVIEW_URL );
break;
// Ignore other cases.
}
};

Expand Down

0 comments on commit 96c6818

Please sign in to comment.