diff --git a/UI/components/header/auth.js b/UI/components/header/auth.js index a265421..e141c7c 100644 --- a/UI/components/header/auth.js +++ b/UI/components/header/auth.js @@ -1,10 +1,13 @@ // @flow import * as React from 'react' import HeaderBarCommon from './common' +import { type User } from '../../containers/user' -const HeaderBarAuth: React.StatelessFunctionalComponent<{}> = () => ( +const HeaderBarAuth: React.StatelessFunctionalComponent<{ user: User }> = ({ user }) => ( - hi +
+ Hey there, {user.username}#{user.discriminator} +
) diff --git a/UI/components/header/unauth.js b/UI/components/header/unauth.js index 0155a84..21e4a21 100644 --- a/UI/components/header/unauth.js +++ b/UI/components/header/unauth.js @@ -4,7 +4,9 @@ import HeaderBarCommon from './common' const HeaderBarUnauth: React.StatelessFunctionalComponent<{}> = () => ( - hi +
+ Hey stranger. +
) diff --git a/UI/containers/header-bar.js b/UI/containers/header-bar.js index 8a751f3..db88730 100644 --- a/UI/containers/header-bar.js +++ b/UI/containers/header-bar.js @@ -1,30 +1,21 @@ // @flow import * as React from 'react' import dynamic from 'next/dynamic' -import { withRedux } from '../config/redux' -import { bindActionCreators } from 'redux' -import { connect } from 'react-redux' -import { namespaceConfig } from 'fast-redux' -import * as User from './user' +import { type User } from './user' type Props = { - user: User.User + user: ?User } const HeaderBarAuth = dynamic(() => import('../components/header/auth')) const HeaderBarUnauth = dynamic(() => import('../components/header/unauth')) -const HeaderBar: React.StatelessFunctionalComponent = () => { - // if () - return null +const HeaderBar: React.StatelessFunctionalComponent = (props) => { + if (props.user == null) { + return + } else { + return + } } -const mapStateToProps = (state): Props => { - return {} -} - -function mapDispatchToProps (dispatch) { - return bindActionCreators({ }, dispatch) -} - -export default withRedux(connect(mapStateToProps, mapDispatchToProps)(HeaderBar)) +export default HeaderBar diff --git a/UI/pages/_test/landing-mock.js b/UI/pages/_test/landing-mock.js new file mode 100644 index 0000000..92391bd --- /dev/null +++ b/UI/pages/_test/landing-mock.js @@ -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 { + static async getInitialProps (ctx: PageProps): Promise { + const rpc = withCookies(ctx) + + return { + user: await rpc.getCurrentUser() + } + } + + render () { + return
+ +
+ } +} diff --git a/package.json b/package.json index 61e05f2..e98bf2c 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "chalk": "^2.4.2", "discord.js": "^11.4.2", "dotenv": "^6.2.0", - "erlpack": "github:discordapp/erlpack", + "erlpack": "hammerandchisel/erlpack", "fast-redux": "^0.7.1", "fnv-plus": "^1.2.12", "glob": "^7.1.3", diff --git a/services/discord.js b/services/discord.js index b2bdee6..9d19ef4 100644 --- a/services/discord.js +++ b/services/discord.js @@ -9,7 +9,6 @@ import { type Role, type GuildMember, type Collection, - type User, Client } from 'discord.js' diff --git a/yarn.lock b/yarn.lock index 936ae37..d8f4fc3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3096,9 +3096,9 @@ enhanced-resolve@^4.1.0: memory-fs "^0.4.0" tapable "^1.0.0" -"erlpack@github:discordapp/erlpack": +erlpack@hammerandchisel/erlpack: 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: bindings "^1.2.1" nan "^2.1.0"