Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MPDX-8393] Make the Helpjuice beacon dismissable #1150

Merged
merged 6 commits into from
Oct 24, 2024
Merged

Conversation

canac
Copy link
Contributor

@canac canac commented Oct 23, 2024

Description

Make the Helpjuice beacon dismissable. There is a new Hide Beacon link in the beacon widget that dismisses the beacon. Once dismissed, the beacon peeks just barely out from the right side of the screen. Hovering over it causes it to slide out, and clicking on it makes it no longer dismissed.

On most pages, the dismissed preference is saved to a persistent user preference. On login and error pages, we don't have an Apollo client, so the preference can't be persisted, but the beacon can still be temporarily dismissed until the next page load.

I had to jump through some hoops to get this to work, but the complexity is abstracted away into the Helpjuice component, and the comments for ApolloBeacon and NoApolloBeacon should describe what is going on. I chose not to do something like this because although it might technically work, it violates React's rules of hooks that hooks must not be conditionally called.

const hasApolloClient = !useContext(getApolloContext());
const [dismissed, setDismissed] = hasApolloClient
  ? useUserPreference({
      key: 'beacon_dismissed',
      defaultValue: false,
    })
  : useState(false);
  return <DismissableBeacon dismissed={dismissed} setDismissed={setDismissed} />;

MPDX-8393

Checklist:

  • I have given my PR a title with the format "MPDX-(JIRA#) (summary sentence max 80 chars)"
  • I have applied the appropriate labels. (Add the label "On Staging" to get the branch automatically merged into staging.)
  • I have requested a review from another person on the project

@canac canac added the Preview Environment Add this label to create an Amplify Preview label Oct 23, 2024
@canac canac requested a review from dr-bizz October 23, 2024 15:54
@canac canac self-assigned this Oct 23, 2024
Copy link
Contributor

Preview branch generated at https://8393-dismiss-beacon.d3dytjb8adxkk5.amplifyapp.com

Copy link
Contributor

github-actions bot commented Oct 23, 2024

Bundle sizes [mpdx-react]

Compared against 559211c

Route Size (gzipped) Diff
/_app 375.28 KB +1.25 KB
/accountLists/[accountListId]/setup/finish 86.42 KB -1.1 KB

Copy link
Contributor

@dr-bizz dr-bizz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks great, but when I test it on the preview link, the beacon is visible after a refresh

@canac canac requested a review from dr-bizz October 23, 2024 19:20
@canac
Copy link
Contributor Author

canac commented Oct 23, 2024

@dr-bizz Good catch! I messed up the hasApolloCheck.

Copy link
Contributor

@dr-bizz dr-bizz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thought I had to improve the Help Jiuce beacon is when it is clicked, the icon changes to a close button, as it isn't obvious you have to click it again to close it, and some users might click on hide beacon thinking it will just close the beacon.

Screenshot 2024-10-23 at 3 35 40 PM

@canac canac requested a review from dr-bizz October 23, 2024 20:52
Copy link
Contributor

@dr-bizz dr-bizz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome! Thank you for adding on the x icon when it's open! it adds a lot to the user experience.

@canac canac force-pushed the 8393-dismiss-beacon branch from 84040f0 to 62ca893 Compare October 24, 2024 17:33
@canac canac enabled auto-merge October 24, 2024 17:33
@canac canac force-pushed the 8393-dismiss-beacon branch from 62ca893 to ba7f9d9 Compare October 24, 2024 17:35
@canac canac merged commit 4f9c22b into main Oct 24, 2024
18 checks passed
@canac canac deleted the 8393-dismiss-beacon branch October 24, 2024 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Preview Environment Add this label to create an Amplify Preview
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants