mirror of
https://github.com/roleypoly/roleypoly-v1.git
synced 2025-06-17 02:29:10 +00:00
force rename all UI folders to it's alway lowercase
This commit is contained in:
parent
df2a27663b
commit
dc3a65cfc4
26 changed files with 0 additions and 0 deletions
76
ui/pages/_app.js
Normal file
76
ui/pages/_app.js
Normal file
|
@ -0,0 +1,76 @@
|
|||
import * as React from 'react'
|
||||
import App, { Container } from 'next/app'
|
||||
import Head from 'next/head'
|
||||
import Layout from '../components/layout'
|
||||
import { withCookies } from '../config/rpc'
|
||||
|
||||
class RoleypolyApp extends App {
|
||||
static async getInitialProps ({ Component, ctx }) {
|
||||
let pageProps = {}
|
||||
const rpc = withCookies(ctx)
|
||||
|
||||
if (Component.getInitialProps) {
|
||||
pageProps = await Component.getInitialProps(ctx)
|
||||
}
|
||||
|
||||
return { pageProps, user: await rpc.getCurrentUser() }
|
||||
}
|
||||
|
||||
componentDidMount () {
|
||||
this.loadTypekit(document)
|
||||
this.waitForFOUC()
|
||||
}
|
||||
|
||||
loadTypekit (d) {
|
||||
var config = {
|
||||
kitId: 'bck0pci',
|
||||
scriptTimeout: 1500,
|
||||
async: true
|
||||
}
|
||||
const h = d.documentElement
|
||||
const t = setTimeout(function () { h.className = h.className.replace(/\bwf-loading\b/g, '') + ' wf-inactive' }, config.scriptTimeout)
|
||||
const tk = d.createElement('script')
|
||||
const s = d.getElementsByTagName('script')[0]
|
||||
let f = false
|
||||
let a
|
||||
h.className += ' wf-loading'
|
||||
tk.src = 'https://use.typekit.net/' + config.kitId + '.js'
|
||||
tk.async = true
|
||||
tk.onload = tk.onreadystatechange = function () {
|
||||
a = this.readyState
|
||||
if (f || (a && a !== 'complete' && a !== 'loaded')) return
|
||||
f = true
|
||||
clearTimeout(t)
|
||||
try { window.Typekit.load(config) } catch (e) {}
|
||||
}
|
||||
s.parentNode.insertBefore(tk, s)
|
||||
}
|
||||
|
||||
// wait one second, add FOUC de-protection.
|
||||
waitForFOUC () {
|
||||
setTimeout(() => {
|
||||
document.documentElement.className += ' force-active'//
|
||||
}, 1500)
|
||||
}
|
||||
|
||||
render () {
|
||||
const { Component, pageProps, router, user } = this.props
|
||||
|
||||
return (
|
||||
<Container>
|
||||
<noscript>Hey there. Unfortunately, we require JS for this app to work. Please take this rose as retribution. 🌹</noscript>
|
||||
<Head>
|
||||
<meta charSet='utf-8' />
|
||||
<title key='title'>Roleypoly</title>
|
||||
<meta name='viewport' content='width=device-width, initial-scale=1' />
|
||||
</Head>
|
||||
|
||||
<Layout user={user}>
|
||||
<Component {...pageProps} router={router} />
|
||||
</Layout>
|
||||
</Container>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default RoleypolyApp
|
Loading…
Add table
Add a link
Reference in a new issue