|
|
@ -5,6 +5,7 @@ import 'flowbite'
|
|
|
|
import 'react-toastify/dist/ReactToastify.css'
|
|
|
|
import 'react-toastify/dist/ReactToastify.css'
|
|
|
|
|
|
|
|
|
|
|
|
import React from 'react'
|
|
|
|
import React from 'react'
|
|
|
|
|
|
|
|
import NProgress from 'nprogress'
|
|
|
|
import { createRoot } from 'react-dom/client'
|
|
|
|
import { createRoot } from 'react-dom/client'
|
|
|
|
import { createInertiaApp, router } from '@inertiajs/react'
|
|
|
|
import { createInertiaApp, router } from '@inertiajs/react'
|
|
|
|
import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers'
|
|
|
|
import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers'
|
|
|
@ -26,3 +27,34 @@ createInertiaApp({
|
|
|
|
},
|
|
|
|
},
|
|
|
|
progress: { color: '#F1A410', showSpinner: true, includeCSS: true },
|
|
|
|
progress: { color: '#F1A410', showSpinner: true, includeCSS: true },
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let timeout = null
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NProgress.configure({
|
|
|
|
|
|
|
|
template:
|
|
|
|
|
|
|
|
'<div class="bar" role="bar"><div class="peg"></div></div><div class="spinner" role="spinner"><div class="spinner-bg"><div class="spinner-icon"></div><div>Loading</div></div></div>',
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
router.on('start', () => {
|
|
|
|
|
|
|
|
timeout = setTimeout(() => NProgress.start(), 250)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
router.on('progress', (event) => {
|
|
|
|
|
|
|
|
if (NProgress.isStarted() && event.detail.progress.percentage) {
|
|
|
|
|
|
|
|
NProgress.set((event.detail.progress.percentage / 100) * 0.9)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
router.on('finish', (event) => {
|
|
|
|
|
|
|
|
clearTimeout(timeout)
|
|
|
|
|
|
|
|
if (!NProgress.isStarted()) {
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
} else if (event.detail.visit.completed) {
|
|
|
|
|
|
|
|
NProgress.done()
|
|
|
|
|
|
|
|
} else if (event.detail.visit.interrupted) {
|
|
|
|
|
|
|
|
NProgress.set(0)
|
|
|
|
|
|
|
|
} else if (event.detail.visit.cancelled) {
|
|
|
|
|
|
|
|
NProgress.done()
|
|
|
|
|
|
|
|
NProgress.remove()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|