|
|
|
@ -1,3 +1,4 @@
|
|
|
|
|
import { useEffect, } from 'react'
|
|
|
|
|
import '@/assets/App.css'
|
|
|
|
|
import AppLogo from '@/assets/logo-gh.png'
|
|
|
|
|
import { useThemeContext } from '@/stores/ThemeContext'
|
|
|
|
@ -17,6 +18,31 @@ function MobileApp() {
|
|
|
|
|
token: { colorBgContainer },
|
|
|
|
|
} = theme.useToken()
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
const handleLoad = () => {
|
|
|
|
|
const isPWAInstalled = window.matchMedia('(display-mode: window-controls-overlay)').matches || window.matchMedia('(display-mode: standalone)').matches;
|
|
|
|
|
const isStandalone = navigator.standalone || window.navigator.standalone;
|
|
|
|
|
|
|
|
|
|
if (isPWAInstalled || isStandalone) {
|
|
|
|
|
document.getElementById('install-button').disabled = true;
|
|
|
|
|
} else {
|
|
|
|
|
document.getElementById('about-dialog').showModal();
|
|
|
|
|
window.addEventListener('beforeinstallprompt', (e) => {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
|
|
document.getElementById('about-dialog').addEventListener('close', () => {
|
|
|
|
|
if (document.getElementById('about-dialog').returnValue === 'install') {
|
|
|
|
|
e.prompt();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
window.addEventListener('load', handleLoad);
|
|
|
|
|
return () => window.removeEventListener('load', handleLoad);
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Layout>
|
|
|
|
|
<Header className='header' style={{ position: 'sticky', top: 0, zIndex: 1, width: '100%', background: 'white' }}>
|
|
|
|
|