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

feat(dashboard,web): opt-in app switching and redirects #7002

Merged
merged 2 commits into from
Nov 14, 2024

Conversation

ChmaraX
Copy link
Contributor

@ChmaraX ChmaraX commented Nov 14, 2024

What changed? Why was the change needed?

  • added providers to check if user is opted-in/out, in order to redirect:
    • if user is opted-in and visits legacy dashboard path which exists in new dashboard - redirect there
    • if user is opted-out and visits new dashboard - redirect back to old
  • automatically set theme to light when user opts in for new dashboard

Copy link

linear bot commented Nov 14, 2024


useEffect(() => {
if (isLoaded && status !== NewDashboardOptInStatusEnum.OPTED_IN) {
window.location.href = '/legacy/workflows';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

using navigate() here won't work since its external url

segment.track('New dashboard opt-in');
updateUserOptInStatus(NewDashboardOptInStatusEnum.OPTED_IN);
await updateUserOptInStatus(NewDashboardOptInStatusEnum.OPTED_IN);
localStorage.setItem('mantine-theme', 'light');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this needs to be set directly in local storage otherwise when using hook the operation seems to be async and can't be awaited

*
* note: /legacy is part of public URL, so we can't navigate() outside of that
*/
window.location.href = window.location.origin;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

for now we redirect to the default page which is the workflows page - otherwise we would need to parse old env id to new env slugs to redirect to env/<env_slug>/workflows - will do in separate PR if there is a hard requirement to keep env id

Copy link

netlify bot commented Nov 14, 2024

Deploy Preview for novu-stg-vite-dashboard-poc ready!

Name Link
🔨 Latest commit a1b9719
🔍 Latest deploy log https://app.netlify.com/sites/novu-stg-vite-dashboard-poc/deploys/6735f1b7d7d3b70008fc557f
😎 Deploy Preview https://deploy-preview-7002--novu-stg-vite-dashboard-poc.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@ChmaraX ChmaraX merged commit 5c9a609 into next Nov 14, 2024
38 checks passed
@ChmaraX ChmaraX deleted the nv-4748-redirect-logic-old-vs-new-gui branch November 14, 2024 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants