From 3d07efb5fa7a265150d3a34c7b7c867eb9cbcb73 Mon Sep 17 00:00:00 2001 From: Katalina / stardust Date: Sun, 31 Dec 2017 13:01:21 -0600 Subject: [PATCH] add why no roles and landing pages --- Server/.env.example | 2 + UI/package.json | 4 +- UI/src/actions/index.js | 2 +- UI/src/components/role-editor/RoleEditor.sass | 16 ++++ UI/src/components/role-editor/actions.js | 5 +- UI/src/components/role-editor/index.js | 11 ++- UI/src/components/role-picker/actions.js | 5 +- UI/src/components/role-picker/index.js | 2 + UI/src/components/role/Role.sass | 1 + UI/src/components/role/demo.js | 19 +++++ UI/src/components/wrapper/index.js | 4 +- UI/src/generic.sass | 9 ++- UI/src/index.css | 2 + UI/src/pages/Landing.js | 61 +++++++++++++++ UI/src/pages/WhyNoRoles.js | 19 +++++ UI/src/pages/images/discord-logo.svg | 21 +++++ UI/src/pages/images/whynoroles-bad.png | Bin 0 -> 78143 bytes UI/src/pages/images/whynoroles-good.png | Bin 0 -> 78185 bytes UI/src/pages/index.js | 25 ++++++ UI/src/pages/landing.sass | 72 ++++++++++++++++++ UI/src/pages/pages.sass | 16 ++++ UI/src/reducers/role-editor.js | 5 +- UI/src/router/index.js | 21 +++-- UI/yarn.lock | 22 ++++++ 24 files changed, 329 insertions(+), 15 deletions(-) create mode 100644 UI/src/components/role/demo.js create mode 100644 UI/src/pages/Landing.js create mode 100644 UI/src/pages/WhyNoRoles.js create mode 100644 UI/src/pages/images/discord-logo.svg create mode 100644 UI/src/pages/images/whynoroles-bad.png create mode 100644 UI/src/pages/images/whynoroles-good.png create mode 100644 UI/src/pages/index.js create mode 100644 UI/src/pages/landing.sass create mode 100644 UI/src/pages/pages.sass diff --git a/Server/.env.example b/Server/.env.example index 3764d20..b93a1c9 100644 --- a/Server/.env.example +++ b/Server/.env.example @@ -6,3 +6,5 @@ DISCORD_CLIENT_SECRET=PZd3u4RkokhnB8MVdALPz5 DISCORD_BOT_TOKEN=qgTk4wm9Q7ECmMCovpmJVNCBltzJhL APP_URL=http://localhost:6769 APP_KEY=PJoayPGqi8vfYVFYBDgSeJSDYUpzBX +IS_BOT=true +ROOT_USERS=62601275618889721 \ No newline at end of file diff --git a/UI/package.json b/UI/package.json index 116675b..d81b4ac 100644 --- a/UI/package.json +++ b/UI/package.json @@ -7,6 +7,7 @@ "custom-react-scripts": "0.2.1", "history": "^4.7.2", "immutable": "^3.8.2", + "moment": "^2.20.1", "prop-types": "^15.6.0", "react": "^16.2.0", "react-custom-scrollbars": "^4.2.1", @@ -18,6 +19,8 @@ "react-router": "^4.2.0", "react-router-dom": "^4.2.2", "react-router-redux": "^5.0.0-alpha.8", + "react-typist": "^2.0.4", + "react-typist-cycle": "^0.1.2", "redux": "^3.7.2", "redux-logger": "^3.0.6", "redux-thunk": "^2.2.0", @@ -33,7 +36,6 @@ "proxy": "http://localhost:6769", "devDependencies": { "eslint": "^4.14.0", - "eslint-config-standard": "^11.0.0-beta.0", "eslint-plugin-import": "^2.8.0", "eslint-plugin-node": "^5.2.1", diff --git a/UI/src/actions/index.js b/UI/src/actions/index.js index 234c383..ef7d88e 100644 --- a/UI/src/actions/index.js +++ b/UI/src/actions/index.js @@ -25,7 +25,7 @@ export const userInit = async dispatch => { dispatch(fetchServers) } catch (e) { - window.location.href = '/oauth/flow' + // window.location.href = '/oauth/flow' } } else { dispatch({ diff --git a/UI/src/components/role-editor/RoleEditor.sass b/UI/src/components/role-editor/RoleEditor.sass index 74a5b85..e3face1 100644 --- a/UI/src/components/role-editor/RoleEditor.sass +++ b/UI/src/components/role-editor/RoleEditor.sass @@ -22,6 +22,22 @@ &__uncat-zone padding: 10px + &__alert + background-color: var(--c-5) + padding: 15px + + a + color: var(--c-9) + text-decoration: none + font-style: italic + transition: color 0.15s ease-in-out + + &:hover + color: var(--c-white) + + + + .role-editor__category box-sizing: border-box background-color: var(--c-1) diff --git a/UI/src/components/role-editor/actions.js b/UI/src/components/role-editor/actions.js index c697ad5..6bdab36 100644 --- a/UI/src/components/role-editor/actions.js +++ b/UI/src/components/role-editor/actions.js @@ -7,13 +7,14 @@ import superagent from 'superagent' export const constructView = id => (dispatch, getState) => { const server = getState().servers.get(id) - let { viewMap } = getViewMap(server) + let { viewMap, hasSafeRoles } = getViewMap(server) viewMap = viewMap.map(c => c.set('mode', Symbol.for('drop'))) dispatch({ type: Symbol.for('re: setup'), data: { - viewMap: viewMap, + hasSafeRoles, + viewMap, originalSnapshot: viewMap } }) diff --git a/UI/src/components/role-editor/index.js b/UI/src/components/role-editor/index.js index 9ad6133..8e43b14 100644 --- a/UI/src/components/role-editor/index.js +++ b/UI/src/components/role-editor/index.js @@ -2,6 +2,8 @@ import React, { Component } from 'react' import { Set } from 'immutable' import { connect } from 'react-redux' import { DropTarget } from 'react-dnd' +import { Link, Prompt } from 'react-router-dom' +import { Scrollbars } from 'react-custom-scrollbars' import * as Actions from './actions' import * as PickerActions from '../role-picker/actions' import * as UIActions from '../../actions/ui' @@ -10,7 +12,6 @@ import './RoleEditor.sass' import Category from './Category' import CategoryEditor from './CategoryEditor' import Role from '../role/draggable' -import { Scrollbars } from 'react-custom-scrollbars'; const mapState = ({ rolePicker, roleEditor, servers }, ownProps) => ({ rp: rolePicker, @@ -113,6 +114,7 @@ class RoleEditor extends Component { render () { const vm = this.props.editor.get('viewMap') return
+

{this.props.server.getIn(['server','name'])}

@@ -161,6 +163,13 @@ class RoleEditor extends Component { .map((r, k) => ) .toArray() } + { + (!this.props.editor.hasSafeRoles) + ?
+ Why are there no roles here? +
+ : null + }
) diff --git a/UI/src/components/role-picker/actions.js b/UI/src/components/role-picker/actions.js index 9bfd25e..f39ede1 100644 --- a/UI/src/components/role-picker/actions.js +++ b/UI/src/components/role-picker/actions.js @@ -48,9 +48,12 @@ export const getViewMap = server => { const selected = roles.reduce((acc, r) => acc.set(r.get('id'), r.get('selected')), Map()) + const hasSafeRoles = allRoles.size > 0 + return { viewMap, - selected + selected, + hasSafeRoles } } diff --git a/UI/src/components/role-picker/index.js b/UI/src/components/role-picker/index.js index 049d059..dce058d 100644 --- a/UI/src/components/role-picker/index.js +++ b/UI/src/components/role-picker/index.js @@ -1,5 +1,6 @@ import React, { Component, Fragment } from 'react' import { connect } from 'react-redux' +import { Prompt } from 'react-router-dom' import superagent from 'superagent' import * as Actions from './actions' import * as UIActions from '../../actions/ui' @@ -100,6 +101,7 @@ class RolePicker extends Component { } return
+ { this.renderServerMessage(server) }
diff --git a/UI/src/components/role/Role.sass b/UI/src/components/role/Role.sass index 46db09d..2efb12e 100644 --- a/UI/src/components/role/Role.sass +++ b/UI/src/components/role/Role.sass @@ -22,6 +22,7 @@ cursor: inherit &:hover:not(.disabled) + cursor: pointer .role__option transform: translateY(-1px) translateZ(0px) box-shadow: 0 1px 1px var(--c-dark) diff --git a/UI/src/components/role/demo.js b/UI/src/components/role/demo.js new file mode 100644 index 0000000..35543ff --- /dev/null +++ b/UI/src/components/role/demo.js @@ -0,0 +1,19 @@ +import React, { Component } from 'react' +import { Map } from 'immutable' + +import Role from './index' + +export default class DemoRole extends Component { + state = { + isSelected: false + } + + handleToggle = () => { + this.setState({ isSelected: !this.state.isSelected }) + } + + + render () { + return + } +} diff --git a/UI/src/components/wrapper/index.js b/UI/src/components/wrapper/index.js index a275ef4..20a8df2 100644 --- a/UI/src/components/wrapper/index.js +++ b/UI/src/components/wrapper/index.js @@ -11,7 +11,9 @@ class Wrapper extends Component {