-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'code100x:main' into fix-captions-settings-visibility-issue
- Loading branch information
Showing
12 changed files
with
113 additions
and
42 deletions.
There are no files selected for viewing
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
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
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
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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
'use client'; | ||
import Image from 'next/image'; | ||
import { useState, useEffect } from 'react'; | ||
|
||
const OfflineNotification = () => { | ||
const [isOffline, setIsOffline] = useState(false); | ||
const [mounted, setMounted] = useState(false); | ||
|
||
useEffect(() => { | ||
setMounted(true); | ||
setIsOffline(!window.navigator.onLine); | ||
|
||
const handleOnline = () => setIsOffline(false); | ||
const handleOffline = () => setIsOffline(true); | ||
|
||
window.addEventListener('online', handleOnline); | ||
window.addEventListener('offline', handleOffline); | ||
|
||
return () => { | ||
window.removeEventListener('online', handleOnline); | ||
window.removeEventListener('offline', handleOffline); | ||
}; | ||
}, []); | ||
|
||
if (!mounted) return null; | ||
|
||
if (!isOffline) return null; | ||
|
||
return ( | ||
<div className="fixed inset-0 flex flex-col items-center justify-center space-y-4 bg-white dark:bg-[#020817] z-50"> | ||
<div className="flex flex-col items-center space-y-4 p-6 rounded-lg"> | ||
<Image | ||
src="/harkirat.png" | ||
alt="Offline" | ||
width={48} | ||
height={48} | ||
unoptimized | ||
className="mb-2" | ||
/> | ||
<h2 className="text-xl font-semibold text-black dark:text-white"> | ||
You are offline | ||
</h2> | ||
<p className="text-neutral-500 dark:text-neutral-200 text-center"> | ||
Please check your internet connection | ||
</p> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default OfflineNotification; |
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