force rename all UI folders to it's alway lowercase

This commit is contained in:
41666 2019-03-11 02:56:26 -05:00
parent df2a27663b
commit dc3a65cfc4
26 changed files with 0 additions and 0 deletions

76
ui/pages/_app.js Normal file
View 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

24
ui/pages/_document.js Normal file
View file

@ -0,0 +1,24 @@
import Document from 'next/document'
import { ServerStyleSheet } from 'styled-components'
export default class MyDocument extends Document {
static async getInitialProps (ctx) {
const sheet = new ServerStyleSheet()
const originalRenderPage = ctx.renderPage
try {
ctx.renderPage = () =>
originalRenderPage({
enhanceApp: App => props => sheet.collectStyles(<App {...props} />)
})
const initialProps = await Document.getInitialProps(ctx)
return {
...initialProps,
styles: <>{initialProps.styles}{sheet.getStyleElement()}</>
}
} finally {
sheet.seal()
}
}
}

View file

@ -0,0 +1,19 @@
// @flow
import * as React from 'react'
import Head from 'next/head'
import type { PageProps } from '../../types'
import SocialCards from '../../components/social-cards'
export default class Server extends React.Component<PageProps> {
render () {
return (
<div>
<Head>
<title key='title'>server name!</title>
</Head>
<SocialCards title={'server test'} />
hello {this.props.router.query.id}
</div>
)
}
}

View file

@ -0,0 +1,9 @@
// @flow
import * as React from 'react'
import type { PageProps } from '../../types'
export default class LandingTest extends React.Component<PageProps> {
render () {
return <div />
}
}

10
ui/pages/index.js Normal file
View file

@ -0,0 +1,10 @@
import React from 'react'
// import Link from 'next/link'
// import Head from '../components/head'
// import Nav from '../components/nav'
const Home = () => (
<h1>Hi there.</h1>
)
export default Home

31
ui/pages/testrpc.js Normal file
View file

@ -0,0 +1,31 @@
import * as React from 'react'
import RPC, { withCookies } from '../config/rpc'
export default class TestRPC extends React.Component {
static async getInitialProps (ctx) {
const user = await withCookies(ctx).getCurrentUser()
console.log(user)
return {
user
}
}
async componentDidMount () {
window.$RPC = RPC
}
componentDidCatch (error, errorInfo) {
if (error) {
console.log(error, errorInfo)
}
}
render () {
if (this.props.user == null) {
return <div>hello stranger OwO</div>
}
const { username, avatar, discriminator } = this.props.user
return <div>hello, {username}#{discriminator} <img src={avatar} width={50} height={50} /></div>
}
}