flowtyped everything, some functional, safety, and structural changes

This commit is contained in:
41666 2019-03-10 03:18:11 -05:00
parent 6f3eca7a64
commit d2aecb38ca
92 changed files with 17554 additions and 1440 deletions

View file

@ -1,6 +1,9 @@
import * as React from 'react'
import App, { Container } from 'next/app'
import Head from 'next/head'
import GlobalColors from '../components/global-colors'
import SocialCards from '../components/social-cards'
// import RPCClient from '../rpc'
class RoleypolyApp extends App {
static async getInitialProps ({ Component, ctx }) {
@ -15,6 +18,7 @@ class RoleypolyApp extends App {
componentDidMount () {
this.loadTypekit(document)
this.waitForFOUC()
}
loadTypekit (d) {
@ -42,14 +46,26 @@ class RoleypolyApp extends App {
s.parentNode.insertBefore(tk, s)
}
// wait one second, add FOUC de-protection.
waitForFOUC () {
setTimeout(() => {
document.documentElement.className += ' force-active'//
}, 2000)
}
render () {
const { Component, pageProps, router } = this.props
const { Component, pageProps, router, rpc } = this.props
return (
<Container>
<Head />
<Head>
<meta charSet='utf-8' />
<title key='title'>Roleypoly</title>
<meta name='viewport' content='width=device-width, initial-scale=1' />
</Head>
<GlobalColors />
<Component {...pageProps} router={router} />
<SocialCards />
<Component {...pageProps} router={router} rpc={rpc} />
</Container>
)
}

View file

@ -1,7 +1,19 @@
const Server = ({ router: { query: { id } } }) => (
<div>
{id}
</div>
)
// @flow
import * as React from 'react'
import Head from 'next/head'
import type { PageProps } from '../../types'
import SocialCards from '../../components/social-cards'
export default Server
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

@ -5,24 +5,24 @@ import Nav from '../components/nav'
const Home = () => (
<div>
<Head title="Home" />
<Head title='Home' />
<Nav />
<div className="hero">
<h1 className="title">Welcome to Next!</h1>
<p className="description">
<div className='hero'>
<h1 className='title'>Welcome to Next!</h1>
<p className='description'>
To get started, edit <code>pages/index.js</code> and save to reload.
</p>
<div className="row">
<Link href="https://github.com/zeit/next.js#getting-started">
<a className="card">
<div className='row'>
<Link href='https://github.com/zeit/next.js#getting-started'>
<a className='card'>
<h3>Getting Started &rarr;</h3>
<p>Learn more about Next on Github and in their examples</p>
</a>
</Link>
<Link href="https://open.segment.com/create-next-app">
<a className="card">
<Link href='https://open.segment.com/create-next-app'>
<a className='card'>
<h3>Examples &rarr;</h3>
<p>
Find other example boilerplates on the{' '}
@ -30,8 +30,8 @@ const Home = () => (
</p>
</a>
</Link>
<Link href="https://github.com/segmentio/create-next-app">
<a className="card">
<Link href='https://github.com/segmentio/create-next-app'>
<a className='card'>
<h3>Create Next App &rarr;</h3>
<p>Was this tool helpful? Let us know how we can improve it</p>
</a>

24
UI/pages/testrpc.js Normal file
View file

@ -0,0 +1,24 @@
import * as React from 'react'
import RPC from '../config/rpc'
export default class TestRPC extends React.Component {
static async getInitialProps (ctx) {
return {
// hello: await RPC.hello('world')
}
}
componentDidMount () {
window.$RPC = RPC
}
componentDidCatch (error, errorInfo) {
if (error) {
console.log(error, errorInfo)
}
}
render () {
return <div>hello, { this.props.hello }</div>
}
}