-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
fix(dashboard): mobile experience #7652
Merged
Merged
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
0311e4c
fix: wip
scopsy cdc616f
Merge branch 'next' into mobile-fixes-dashboard
scopsy 179d391
fix: copy
scopsy df9c2a4
fix:
scopsy 13964fe
fix: pr notes
scopsy 4e78476
Merge branch 'next' into mobile-fixes-dashboard
scopsy ad65140
fix: validation
scopsy fc23cde
Merge branch 'mobile-fixes-dashboard' of https://github.com/novuhq/no…
scopsy 378c20f
fix:
scopsy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,57 @@ | ||
import { post } from '@/api/api.client'; | ||
import { Smartphone } from 'lucide-react'; | ||
import { useEffect } from 'react'; | ||
import { showErrorToast } from '../primitives/sonner-helpers'; | ||
|
||
const MOBILE_WIDTH_THRESHOLD = 768; | ||
const FIVE_MINUTES_MS = 5 * 60 * 1000; | ||
const MOBILE_SETUP_STORAGE_KEY = 'mobileSetupEmailSentAt'; | ||
|
||
export function MobileMessage() { | ||
scopsy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
useEffect(() => { | ||
const notifyMobileSetup = async () => { | ||
try { | ||
const isMobile = window.innerWidth < MOBILE_WIDTH_THRESHOLD; | ||
const lastSentAt = localStorage.getItem(MOBILE_SETUP_STORAGE_KEY); | ||
|
||
const now = Date.now(); | ||
const shouldSendEmail = !lastSentAt || now - parseInt(lastSentAt) > FIVE_MINUTES_MS; | ||
scopsy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
if (isMobile && shouldSendEmail) { | ||
localStorage.setItem(MOBILE_SETUP_STORAGE_KEY, now.toString()); | ||
|
||
await post('/support/mobile-setup', {}); | ||
} | ||
} catch (e) { | ||
showErrorToast('Failed to send mobile setup email, please visit this page from Desktop.'); | ||
} | ||
}; | ||
|
||
notifyMobileSetup(); | ||
}, []); | ||
|
||
return ( | ||
<div className="flex min-h-[400px] flex-col items-center justify-center space-y-6 px-4 text-center"> | ||
<div className="rounded-full bg-gray-100 p-4 dark:bg-gray-800"> | ||
<Smartphone className="h-8 w-8 text-gray-500" /> | ||
</div> | ||
<div className="space-y-3"> | ||
<h1 className="text-xl font-semibold">Desktop Setup Required</h1> | ||
scopsy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<div className="space-y-2"> | ||
<p className="text-sm font-medium text-gray-950">👋 Hey, You're Almost There!</p> | ||
<p className="text-sm font-medium text-gray-950"> | ||
We see you signed up from your mobile—nice move! But to complete the Novu setup, you'll need to switch over | ||
to your laptop and fire up your favorite IDE. | ||
</p> | ||
<p className="text-sm text-gray-500"> | ||
Integrating Novu into your stack means writing some actual code, setting up workflows, configuring Inbox , | ||
and composing your first email. | ||
</p> | ||
<p className="text-primary text-sm font-medium"> | ||
Check your inbox! We've sent you the setup instructions to get started. | ||
</p> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} |
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 |
---|---|---|
@@ -1,14 +1,20 @@ | ||
import { PageMeta } from '@/components/page-meta'; | ||
import { AuthCard } from '../components/auth/auth-card'; | ||
import { MobileMessage } from '../components/auth/mobile-message'; | ||
import { QuestionnaireForm } from '../components/auth/questionnaire-form'; | ||
|
||
export function QuestionnairePage() { | ||
return ( | ||
<> | ||
<PageMeta title="Setup your workspace" /> | ||
<AuthCard> | ||
<QuestionnaireForm /> | ||
</AuthCard> | ||
<div className="hidden md:block"> | ||
<AuthCard> | ||
<QuestionnaireForm /> | ||
</AuthCard> | ||
</div> | ||
<div className="block md:hidden"> | ||
<MobileMessage /> | ||
</div> | ||
</> | ||
); | ||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add this validation in the apps/api/src/config/env.validators.ts as well.
we should to assume that this env is not undefined on this stage.