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

💄 Add splash animation within web index file #503

Merged
merged 3 commits into from
Nov 9, 2024

Conversation

xendke
Copy link
Contributor

@xendke xendke commented Nov 8, 2024

Is this something we're interested in? Any concerns or improvements? we could support more themes if needed!

splash.mp4

@JMicheli
Copy link
Collaborator

JMicheli commented Nov 8, 2024

I actually think that rocks!

Copy link
Collaborator

@aaronleopold aaronleopold left a comment

Choose a reason for hiding this comment

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

I think I can dig it! I left a few comments I'd like to resolve before giving my ✅, but otherwise I think we can give this UI a try

apps/web/src/index.html Outdated Show resolved Hide resolved
Comment on lines 7 to 14
try {
const zustandState = JSON.parse(
localStorage.getItem('stump-user-store') || '{"state": {}}',
).state
if (zustandState.userPreferences && zustandState.userPreferences.app_theme === 'dark') {
document.querySelector('html').classList.add('dark')
}
} catch {}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think I originally wrote something like this for the desktop app back when there were only two themes. To make this work with the current system, it should be something like:

Suggested change
try {
const zustandState = JSON.parse(
localStorage.getItem('stump-user-store') || '{"state": {}}',
).state
if (zustandState.userPreferences && zustandState.userPreferences.app_theme === 'dark') {
document.querySelector('html').classList.add('dark')
}
} catch {}
try {
const zustandState = JSON.parse(
localStorage.getItem('stump-user-store') || '{"state": {}}',
).state
const appTheme = zustandState.userPreferences?.app_theme || ''
const alreadyHasTheme =
!appTheme || document.querySelector('html').classList.contains(appTheme)
if (!alreadyHasTheme) {
document.querySelector('html').classList.add(appTheme)
}
} catch {}

Comment on lines +22 to +24
html.dark {
background-color: #161719;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm sure you already know where to find them since you pulled this value, but I'd want to make sure we cover each supported theme before merging this in.

A note for the future is that custom themes won't quite work using this method, since the CSS isn't loaded until the app mounts and this splash is present before that point

xendke and others added 2 commits November 8, 2024 21:32
Co-authored-by: Aaron Leopold <36278431+aaronleopold@users.noreply.github.com>
@xendke xendke requested a review from aaronleopold November 9, 2024 03:14
@aaronleopold aaronleopold merged commit 5935ed4 into stumpapp:experimental Nov 9, 2024
@aaronleopold aaronleopold mentioned this pull request Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants