Browse Source
Instead of doing manual layout switching use the Nextjs nested layout support. Also add some additional lazy loading of components. This is to work on performance score re: #2167.pull/2562/head
8 changed files with 107 additions and 82 deletions
@ -1,37 +0,0 @@
@@ -1,37 +0,0 @@
|
||||
/* eslint-disable @next/next/no-css-tags */ |
||||
import { AppProps } from 'next/app'; |
||||
import { FC } from 'react'; |
||||
import ServerStatusProvider from '../../utils/server-status-context'; |
||||
import AlertMessageProvider from '../../utils/alert-message-context'; |
||||
import { MainLayout } from '../MainLayout'; |
||||
|
||||
/* |
||||
NOTE: A bunch of compiled css is loaded here for the Admin UI. |
||||
These are old stylesheets that were converted from sass and should not be |
||||
edited or maintained. Instead we are using css modules everywhere. So if you |
||||
need to change a style rewrite the css file as a css module and import it |
||||
into the component that needs it, removing it from this global list. |
||||
*/ |
||||
export const AdminLayout: FC<AppProps> = ({ Component, pageProps }) => ( |
||||
<> |
||||
<link rel="stylesheet" href="/styles/admin/main-layout.css" /> |
||||
<link rel="stylesheet" href="/styles/admin/form-textfields.css" /> |
||||
<link rel="stylesheet" href="/styles/admin/config-socialhandles.css" /> |
||||
<link rel="stylesheet" href="/styles/admin/config-storage.css" /> |
||||
<link rel="stylesheet" href="/styles/admin/config-edit-string-tags.css" /> |
||||
<link rel="stylesheet" href="/styles/admin/config-video-variants.css" /> |
||||
<link rel="stylesheet" href="/styles/admin/config-public-details.css" /> |
||||
<link rel="stylesheet" href="/styles/admin/home.css" /> |
||||
<link rel="stylesheet" href="/styles/admin/chat.css" /> |
||||
<link rel="stylesheet" href="/styles/admin/pages.css" /> |
||||
<link rel="stylesheet" href="/styles/admin/offline-notice.css" /> |
||||
|
||||
<ServerStatusProvider> |
||||
<AlertMessageProvider> |
||||
<MainLayout> |
||||
<Component {...pageProps} /> |
||||
</MainLayout> |
||||
</AlertMessageProvider> |
||||
</ServerStatusProvider> |
||||
</> |
||||
); |
@ -1,8 +0,0 @@
@@ -1,8 +0,0 @@
|
||||
import { AppProps } from 'next/app'; |
||||
import { FC } from 'react'; |
||||
|
||||
export const SimpleLayout: FC<AppProps> = ({ Component, pageProps }) => ( |
||||
<div> |
||||
<Component {...pageProps} /> |
||||
</div> |
||||
); |
@ -0,0 +1,12 @@
@@ -0,0 +1,12 @@
|
||||
# EditorConfig is awesome: https://EditorConfig.org |
||||
|
||||
# top-most EditorConfig file |
||||
root = true |
||||
|
||||
[*] |
||||
indent_style = space |
||||
indent_size = 4 |
||||
end_of_line = lf |
||||
charset = utf-8 |
||||
trim_trailing_whitespace = false |
||||
insert_final_newline = false |
@ -0,0 +1,27 @@
@@ -0,0 +1,27 @@
|
||||
/* eslint-disable react/no-danger */ |
||||
import { FC, useEffect } from 'react'; |
||||
|
||||
export const PushNotificationServiceWorker: FC = () => { |
||||
const add = () => { |
||||
navigator.serviceWorker.register('/serviceWorker.js').then( |
||||
registration => { |
||||
console.debug('Service Worker registration successful with scope: ', registration.scope); |
||||
}, |
||||
err => { |
||||
console.error('Service Worker registration failed: ', err); |
||||
}, |
||||
); |
||||
}; |
||||
|
||||
useEffect(() => { |
||||
if ('serviceWorker' in navigator) { |
||||
window.addEventListener('load', add); |
||||
} |
||||
|
||||
return () => { |
||||
window.removeEventListener('load', add); |
||||
}; |
||||
}, []); |
||||
|
||||
return null; |
||||
}; |
Loading…
Reference in new issue