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: splashscreen #175

Merged
merged 9 commits into from
Sep 25, 2024
Merged

feat: splashscreen #175

merged 9 commits into from
Sep 25, 2024

Conversation

Llandy3d
Copy link
Member

Adds a splashscreen to show while the app is loading.

A new event splashscreen:close is created that can be sent from the frontend via window.studio.app.closeSplashscreen().

To complete this we need the splashscreen and a way to detect from the frontend that the app is loaded so that we can close it and show the main window.

src/App.tsx Outdated
Comment on lines 16 to 19
setTimeout(() => {
console.log('REPLACE ME')
window.studio.app.closeSplashscreen()
}, 1000)
Copy link
Member Author

Choose a reason for hiding this comment

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

to be replaced: example of how to close the splashscreen and show the app

src/main.ts Outdated
splashscreenWindow = new BrowserWindow({
width: 500,
height: 300,
// transparent: true,
Copy link
Member Author

Choose a reason for hiding this comment

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

if we want the window transparent , will depend on the splashscreen we use

@@ -138,13 +138,20 @@ const generator = {
},
} as const

const app = {
Copy link
Member Author

Choose a reason for hiding this comment

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

I've added it as app as I think it made more sense, feel free to let me know if you think otherwise 🤔

@@ -17,6 +17,7 @@ const config: ForgeConfig = {
'./resources/json_output.py',
'./resources/group_snippet.js',
'./resources/checks_snippet.js',
'./resources/splashscreen.html',
Copy link
Member Author

Choose a reason for hiding this comment

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

the splashscreen is a simple html file so that we don't need to wait any kind of react loading to show it. It has to be quick and visible and simple~

@CLAassistant
Copy link

CLAassistant commented Sep 23, 2024

CLA assistant check
All committers have signed the CLA.

@cristianoventura
Copy link
Collaborator

The splash screen handles light and dark mode. However, it shows up pretty quickly since it's only waiting for the main window and the project structure to be configured. We can add an extra time out if we want it to show for a longer period.

You can uncomment L158 of main.ts to see how it looks like.

Screen.Recording.2024-09-23.at.1.43.18.PM.mov

src/main.ts Outdated
Comment on lines 162 to 165

splashscreenWindow.close()
mainWindow.show()
mainWindow.focus()
Copy link
Member Author

Choose a reason for hiding this comment

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

This won't work, we will need to use the splashscreen:close event to make sure we show a ready page.
So we will need to detect that the react page is loaded and then we can send the event from there to trigger the hiding of the splashscreen and the showing of the main window

@cristianoventura cristianoventura requested a review from a team as a code owner September 24, 2024 15:06
Copy link
Collaborator

@e-fisher e-fisher left a comment

Choose a reason for hiding this comment

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

LGTM! 🚀

@Llandy3d Llandy3d merged commit 23cd496 into main Sep 25, 2024
2 checks passed
@Llandy3d Llandy3d deleted the splashscreen branch September 25, 2024 09:16
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.

4 participants