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: show consistent initial loading spinner #11054

Merged
merged 1 commit into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Enhancement: Consistent initial loading spinner

We have updated the loading spinner on the initial page load to run continuously during the client bootstrap. Previously, the spinner would appear and disappear multiple times.

Additionally, we have aligned the spinner's design with our other loading spinners and reduced the delay before it appears from 1 second to 0.5 seconds.

https://github.com/owncloud/web/pull/11054
https://github.com/owncloud/web/issues/11041
22 changes: 15 additions & 7 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
}
#loading {
display: inline-block;
width: 50px;
height: 50px;
border: 2px solid #4c5f79;
height: 34px;
width: 34px;
border: 1px solid #4c5f79;
border-radius: 50%;
border-top-color: #fff;
animation: spin 1s ease-in-out infinite;
Expand Down Expand Up @@ -125,7 +125,7 @@ <h2>Your browser is not supported</h2>

var loaderTimer = setTimeout(function () {
loader.classList.remove('splash-hide')
}, 1000);
}, 500);

function displayError() {
loader.classList.remove('splash-hide')
Expand All @@ -134,7 +134,7 @@ <h2>Your browser is not supported</h2>

function displayBrowserError() {
clearTimeout(loaderTimer)
loader.classList.add('splash-hide')
removeLoadingSpinner()
browserError.classList.remove('splash-hide')
}

Expand All @@ -144,14 +144,22 @@ <h2>Your browser is not supported</h2>
init()
}

function removeLoadingSpinner() {
if (!loader.classList.contains('splash-hide')) {
loader.classList.add('splash-hide')
}
}

function init() {
if (typeof requirejs === 'undefined') {
displayError()
} else {
window.runtimeLoaded = function(runtime) {
clearTimeout(loaderTimer)
document.getElementById('splash-loading').classList.add('splash-hide')
runtime.bootstrapApp('config.json').catch(runtime.bootstrapErrorApp)
runtime.bootstrapApp('config.json', removeLoadingSpinner).catch((error) => {
removeLoadingSpinner()
runtime.bootstrapErrorApp(error)
})
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion packages/web-runtime/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ import { ArchiverService } from '@ownclouders/web-pkg'
import { UnifiedRoleDefinition } from '@ownclouders/web-client/graph/generated'
import { extensionPoints } from './extensionPoints'

export const bootstrapApp = async (configurationPath: string): Promise<void> => {
export const bootstrapApp = async (configurationPath: string, appsReadyCallback: () => void) => {
const pinia = createPinia()
const app = createApp(pages.success)
app.use(pinia)
Expand Down Expand Up @@ -168,6 +168,7 @@ export const bootstrapApp = async (configurationPath: string): Promise<void> =>
}
announceVersions({ capabilityStore })
await announceApplicationsReady({ app, appsStore, applications })
appsReadyCallback()
},
{
immediate: true
Expand Down