-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #136 from weaponsforge/dev
v2.0.3
- Loading branch information
Showing
11 changed files
with
104 additions
and
130 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -29,6 +29,6 @@ | |
"next": "13.2.1", | ||
"react": "18.2.0", | ||
"react-dom": "18.2.0", | ||
"use-sync-v": "^2.0.19" | ||
"use-sync-v": "^2.2.0" | ||
} | ||
} |
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 |
---|---|---|
@@ -1,12 +1,39 @@ | ||
import { LinearProgress } from '@mui/material' | ||
import { Box, LinearProgress } from '@mui/material' | ||
import { useRouter } from 'next/router' | ||
import { useEffect } from 'react' | ||
import { updateSyncV, useSyncV } from 'use-sync-v' | ||
|
||
export const LoadingLinear = () => { | ||
const authLoading = useSyncV('auth.authLoading') | ||
const loadingContacts = useSyncV('contacts.loading') | ||
const loading = useSyncV('show.loading') | ||
|
||
const router = useRouter() | ||
useEffect(() => { | ||
const changeStartHandler = () => { | ||
updateSyncV('show.loading', true) | ||
} | ||
const changeCompleteHandler = () => { | ||
updateSyncV('show.loading', false) | ||
} | ||
router.events.on('routeChangeStart', changeStartHandler) | ||
router.events.on('routeChangeComplete', changeCompleteHandler) | ||
// If the component is unmounted, unsubscribe | ||
// from the event with the `off` method: | ||
return () => { | ||
router.events.off('routeChangeStart', changeStartHandler) | ||
router.events.off('routeChangeComplete', changeCompleteHandler) | ||
} | ||
}, [router]) | ||
return ( | ||
<LinearProgress | ||
sx={{ | ||
position: 'fixed', | ||
width: '100%', | ||
}} | ||
/> | ||
<Box sx={{ zIndex: 100 }}> | ||
{(loadingContacts || authLoading || loading) && <LinearProgress | ||
sx={{ | ||
position: 'fixed', | ||
width: '100%', | ||
}} | ||
/>} | ||
</Box> | ||
|
||
) | ||
} |
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
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
Oops, something went wrong.