mirror of
https://github.com/roleypoly/roleypoly-v1.git
synced 2025-04-26 04:29:11 +00:00
landing-mock start
This commit is contained in:
parent
5a87a497bb
commit
7e0379ec3c
7 changed files with 46 additions and 25 deletions
|
@ -1,10 +1,13 @@
|
||||||
// @flow
|
// @flow
|
||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import HeaderBarCommon from './common'
|
import HeaderBarCommon from './common'
|
||||||
|
import { type User } from '../../containers/user'
|
||||||
|
|
||||||
const HeaderBarAuth: React.StatelessFunctionalComponent<{}> = () => (
|
const HeaderBarAuth: React.StatelessFunctionalComponent<{ user: User }> = ({ user }) => (
|
||||||
<HeaderBarCommon>
|
<HeaderBarCommon>
|
||||||
hi
|
<div>
|
||||||
|
Hey there, {user.username}#{user.discriminator}
|
||||||
|
</div>
|
||||||
</HeaderBarCommon>
|
</HeaderBarCommon>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,9 @@ import HeaderBarCommon from './common'
|
||||||
|
|
||||||
const HeaderBarUnauth: React.StatelessFunctionalComponent<{}> = () => (
|
const HeaderBarUnauth: React.StatelessFunctionalComponent<{}> = () => (
|
||||||
<HeaderBarCommon>
|
<HeaderBarCommon>
|
||||||
hi
|
<div>
|
||||||
|
Hey stranger.
|
||||||
|
</div>
|
||||||
</HeaderBarCommon>
|
</HeaderBarCommon>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,30 +1,21 @@
|
||||||
// @flow
|
// @flow
|
||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import dynamic from 'next/dynamic'
|
import dynamic from 'next/dynamic'
|
||||||
import { withRedux } from '../config/redux'
|
import { type User } from './user'
|
||||||
import { bindActionCreators } from 'redux'
|
|
||||||
import { connect } from 'react-redux'
|
|
||||||
import { namespaceConfig } from 'fast-redux'
|
|
||||||
import * as User from './user'
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
user: User.User
|
user: ?User
|
||||||
}
|
}
|
||||||
|
|
||||||
const HeaderBarAuth = dynamic(() => import('../components/header/auth'))
|
const HeaderBarAuth = dynamic(() => import('../components/header/auth'))
|
||||||
const HeaderBarUnauth = dynamic(() => import('../components/header/unauth'))
|
const HeaderBarUnauth = dynamic(() => import('../components/header/unauth'))
|
||||||
|
|
||||||
const HeaderBar: React.StatelessFunctionalComponent<Props> = () => {
|
const HeaderBar: React.StatelessFunctionalComponent<Props> = (props) => {
|
||||||
// if ()
|
if (props.user == null) {
|
||||||
return null
|
return <HeaderBarUnauth {...props} />
|
||||||
|
} else {
|
||||||
|
return <HeaderBarAuth {...props} />
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapStateToProps = (state): Props => {
|
export default HeaderBar
|
||||||
return {}
|
|
||||||
}
|
|
||||||
|
|
||||||
function mapDispatchToProps (dispatch) {
|
|
||||||
return bindActionCreators({ }, dispatch)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default withRedux(connect(mapStateToProps, mapDispatchToProps)(HeaderBar))
|
|
||||||
|
|
26
UI/pages/_test/landing-mock.js
Normal file
26
UI/pages/_test/landing-mock.js
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
// @flow
|
||||||
|
import * as React from 'react'
|
||||||
|
import type { PageProps } from '../../types'
|
||||||
|
import HeaderBar from '../../containers/header-bar'
|
||||||
|
import { withCookies } from '../../config/rpc'
|
||||||
|
import { type UserPartial } from '../../../services/discord'
|
||||||
|
|
||||||
|
type InitialProps = {
|
||||||
|
user: ?UserPartial
|
||||||
|
}
|
||||||
|
|
||||||
|
export default class LandingTest extends React.Component<PageProps & InitialProps> {
|
||||||
|
static async getInitialProps (ctx: PageProps): Promise<InitialProps> {
|
||||||
|
const rpc = withCookies(ctx)
|
||||||
|
|
||||||
|
return {
|
||||||
|
user: await rpc.getCurrentUser()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
render () {
|
||||||
|
return <div>
|
||||||
|
<HeaderBar user={this.props.user} />
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,7 +16,7 @@
|
||||||
"chalk": "^2.4.2",
|
"chalk": "^2.4.2",
|
||||||
"discord.js": "^11.4.2",
|
"discord.js": "^11.4.2",
|
||||||
"dotenv": "^6.2.0",
|
"dotenv": "^6.2.0",
|
||||||
"erlpack": "github:discordapp/erlpack",
|
"erlpack": "hammerandchisel/erlpack",
|
||||||
"fast-redux": "^0.7.1",
|
"fast-redux": "^0.7.1",
|
||||||
"fnv-plus": "^1.2.12",
|
"fnv-plus": "^1.2.12",
|
||||||
"glob": "^7.1.3",
|
"glob": "^7.1.3",
|
||||||
|
|
|
@ -9,7 +9,6 @@ import {
|
||||||
type Role,
|
type Role,
|
||||||
type GuildMember,
|
type GuildMember,
|
||||||
type Collection,
|
type Collection,
|
||||||
type User,
|
|
||||||
Client
|
Client
|
||||||
} from 'discord.js'
|
} from 'discord.js'
|
||||||
|
|
||||||
|
|
|
@ -3096,9 +3096,9 @@ enhanced-resolve@^4.1.0:
|
||||||
memory-fs "^0.4.0"
|
memory-fs "^0.4.0"
|
||||||
tapable "^1.0.0"
|
tapable "^1.0.0"
|
||||||
|
|
||||||
"erlpack@github:discordapp/erlpack":
|
erlpack@hammerandchisel/erlpack:
|
||||||
version "0.1.0"
|
version "0.1.0"
|
||||||
resolved "https://codeload.github.com/discordapp/erlpack/tar.gz/674ebfd3439ba4b7ce616709821d27630f7cdc61"
|
resolved "https://codeload.github.com/hammerandchisel/erlpack/tar.gz/674ebfd3439ba4b7ce616709821d27630f7cdc61"
|
||||||
dependencies:
|
dependencies:
|
||||||
bindings "^1.2.1"
|
bindings "^1.2.1"
|
||||||
nan "^2.1.0"
|
nan "^2.1.0"
|
||||||
|
|
Loading…
Add table
Reference in a new issue