Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/development'
Browse files Browse the repository at this point in the history
# Conflicts:
#	README.md
  • Loading branch information
Hartorn committed Nov 26, 2017
2 parents f6b2608 + 1604ded commit 1aa6592
Show file tree
Hide file tree
Showing 52 changed files with 1,543 additions and 1,196 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@
[![Dependencies Status](https://david-dm.org/Hartorn/ffs-zera.svg)](https://david-dm.org/Hartorn/ffs-zera)
[![Dev Dependencies Status](https://david-dm.org/Hartorn/ffs-zera/dev-status.svg)](https://david-dm.org/Hartorn/ffs-zera?type=dev)
[![Peer Dependencies Status](https://david-dm.org/Hartorn/ffs-zera/peer-status.svg)](https://david-dm.org/Hartorn/ffs-zera?type=peer)
[![Slack Status](https://slack.fightforsub.com/badge.svg)](https://slack.fightforsub.com)

These are the FFS front sources.

The FFS Project is accessible from [this address](https://ffs-events.zerator.com).

Theses sources will allow you to build the front binaries.

By contributing or using this project, you agree to abide by the [Code of Conduct](/CODE_OF_CONDUCT.md) when interracting with a community member.

## Build and run
Expand Down Expand Up @@ -48,8 +52,7 @@ If you find any bugs, please report it on the [Issues](https://gitlab.com/Hartor

## Join us on Slack

Discuss with us about this project on Slack:
https://join.slack.com/t/ffs-events-zerator/shared_invite/enQtMjczMTM0NzE5MzE3LWJhZTk1ZjAyZTAyN2Y5ZDQ5MzJjMDUxODZjNjIzNzgzYTAzMWUwM2MzMzJhODQwMTM5MTAxNDgxNzA1MDYwNTM
Discuss with us about this project on [Slack](https://slack.fightforsub.com).

## License

Expand Down
21 changes: 19 additions & 2 deletions app/action/event.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import eventServices from '../services/event';
import eventServices from '@/services/event';
import actionBuilder from 'focus-core/application/action-builder';


export default {
load: actionBuilder({
node: 'eventDetail',
Expand Down Expand Up @@ -39,6 +38,12 @@ export default {
shouldDumpStoreOnActionCall: true,
status: 'loaded'
}),
loadMyEvents: actionBuilder({
node: 'eventList',
service: eventServices.loadMyEvents,
shouldDumpStoreOnActionCall: true,
status: 'loaded'
}),
listUsers: actionBuilder({
node: 'eventUserList',
service: eventServices.listUsers,
Expand Down Expand Up @@ -98,5 +103,17 @@ export default {
service: eventServices.updateUserScore,
shouldDumpStoreOnActionCall: true,
status: 'saved'
}),
registerToEvent: actionBuilder({
node: 'eventUserRegistration',
service: eventServices.registerToEvent,
shouldDumpStoreOnActionCall: true,
status: 'saved'
}),
unregisterFromEvent: actionBuilder({
node: 'eventUserRegistration',
service: eventServices.unregisterFromEvent,
shouldDumpStoreOnActionCall: true,
status: 'saved'
})
}
2 changes: 2 additions & 0 deletions app/components/app-layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import AppContent from '@/components/app-content';
import DevTools from '@/components/dev-tools';
import LoadingBar from 'focus-components/components/layout/header-loading-bar';
import ConfirmWrapper from 'focus-components/components/confirm';
import MessageCenter from 'focus-components/components/message-center';

const CustomLayout = (props) => (
<div className='app-layout'>
Expand All @@ -15,6 +16,7 @@ const CustomLayout = (props) => (
</AppContent>
{__DEV__ && <DevTools />}
<ConfirmWrapper />
<MessageCenter />
</div >
);
CustomLayout.displayName = 'CustomAppLayout';
Expand Down
26 changes: 24 additions & 2 deletions app/components/app-side-menu/side-menu-links.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
import React from 'react';
import { Link } from '@/components/router';
import { translate } from 'focus-core/translation';
import UserStore from 'focus-core/user/built-in-store';
import connectToStore from 'focus-components/behaviours/store/connect';
import { isAuthenticated } from '@/utilities/check-rights';

@connectToStore([{
store: UserStore,
properties: ['profile']
}], () => {
return {}
})
class SideMenuLinks extends React.Component {
state = {
}

_getMenuItems() {
return [
const items = [
{
icon: 'live_tv',
route: 'live',
Expand All @@ -18,8 +27,21 @@ class SideMenuLinks extends React.Component {
route: 'events',
name: translate('label.eventListPage')
}
// { icon: 'add_circle', route: 'inscription', name: translate('label.inscriptionPage') }
];

if (isAuthenticated()) {
items.push({
icon: 'dashboard',
route: 'myevents',
name: translate('label.myEventsPage')
},
{
icon: 'add_circle',
route: 'inscription',
name: translate('label.inscriptionPage')
});
}
return items;
}

render() {
Expand Down
16 changes: 16 additions & 0 deletions app/components/icon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React, { PropTypes } from 'react';


const Icon = ({ children, iconLib }) => (
<i className={iconLib}>{children}</i>
);

Icon.defaultProps = {
iconLib: 'material-icons'
};

Icon.propTypes = {
iconLib: PropTypes.string,
children: PropTypes.any.isRequired
}
export default Icon;
32 changes: 0 additions & 32 deletions app/components/layout/index.js

This file was deleted.

26 changes: 0 additions & 26 deletions app/components/layout/side-menu/index.js

This file was deleted.

4 changes: 2 additions & 2 deletions app/components/list/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ const List = (props) => {
props.dataList.map(({ avatar, logoUrl, name, LineContent, actions, onClick, selected }, index) => {
return (
<li key={index} className='mdl-list__item'>
<span className='mdl-list__item-primary-content mdl-button--raised' data-dd={`list-grey-elt ${selected ? 'selected' : ''}`} onClick={() => onClick()}>
<span className='mdl-list__item-primary-content mdl-button--raised' data-dd={`list-grey-elt ${selected ? 'selected' : ''}`} onClick={(evt) => onClick(evt)}>
{avatar &&
<i className={`${avatar.className || 'material-icons'} mdl-list__item-avatar`}>{avatar.iconText}</i>
}
{
<i className={'mdl-list__item-avatar'} style={{ backgroundImage: `url(${logoUrl}`, backgroundSize: 'contain' }} />
<i className={'mdl-list__item-avatar'} style={{ backgroundImage: logoUrl ? `url(${logoUrl}` : null, backgroundSize: 'contain' }} />
}
<span>
{LineContent}
Expand Down
11 changes: 6 additions & 5 deletions app/components/login/twitch-button.jsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import React from 'react';
import FontAwesome from 'react-fontawesome';
import { translate } from 'focus-core/translation';

import localforage from 'localforage';
import { v4 as uuid } from 'uuid';
class TwitchButton extends React.Component {
constructor(props) {
super(props);
this.doLogin = this.doLogin.bind(this);
}

doLogin() {
Twitch.login({
scope: ['user_read'],
redirect_uri: __ROOT_URL__
});
const state = uuid();
localforage.setItem('nonce', state).then(elt => {
location.href = `https://api.twitch.tv/kraken/oauth2/authorize?client_id=${__CLIENT_ID__}&redirect_uri=${__ROOT_URL__}&response_type=token&scope=user_read&state=${state}`;
})
}

render() {
Expand Down
7 changes: 6 additions & 1 deletion app/components/login/user-infos.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@ import UserStore from 'focus-core/user/built-in-store';
import { dispatchData } from 'focus-core/dispatcher';
import localForage from 'localforage';
import { translate } from 'focus-core/translation';
import fetch from 'focus-core/network/fetch';

@connectToStore([{
store: UserStore,
properties: ['profile', 'login', 'roles']
}], () => UserStore.getValue())
class UserInfos extends React.Component {
doLogout() {
Twitch.logout(error => console.warn(error));
const token = this.props.profile && this.props.profile.token;
if (token) {
fetch({ url: `https://api.twitch.tv/kraken/oauth2/revoke?client_id=${__CLIENT_ID__}&token=${token}`, method: 'POST' })
.catch(error => { });
}
localForage.clear();
dispatchData('profile', null);
}
Expand Down
58 changes: 58 additions & 0 deletions app/components/rich-text-editor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import React, { Component } from 'react';
import { EditorState, convertToRaw, ContentState } from 'draft-js';
import { Editor } from 'react-draft-wysiwyg';
import draftToHtml from 'draftjs-to-html';
import htmlToDraft from 'html-to-draftjs';

class EditorConvertToHTML extends Component {
constructor(props) {
super(props);
this.state = {
editorState: this.buildEditorState(this.props.value)
}
this.customOnChange = this.customOnChange.bind(this);
this.catchEvent = this.catchEvent.bind(this);
}

buildEditorState(value) {
const contentBlock = htmlToDraft(value || '');
const contentState = contentBlock ? ContentState.createFromBlockArray(contentBlock.contentBlocks) : ContentState.createFromText('');
const editorState = EditorState.createWithContent(contentState);
return editorState;
}

componentWillReceiveProps({ value }) {
if ((value && !this.props.value) || (!this.props.isEdit && value !== !this.props.value)) {
this.setState({ editorState: this.buildEditorState(value) });
}
}

customOnChange(editorState) {
this.setState({
editorState: editorState
});
this.props.onChange(draftToHtml(convertToRaw(editorState.getCurrentContent())));
}

catchEvent(evt) {
evt.preventDefault();
evt.stopPropagation();
}

render() {
return (
<div onKeyUp={this.catchEvent} >
<Editor
toolbarHidden={!this.props.isEdit}
editorState={this.state.editorState}
wrapperClassName='rich-text-wrapper'
editorClassName='rich-text-editor'
onEditorStateChange={this.customOnChange}
readOnly={!this.props.isEdit}
/>
</div>
);
}
}

export default EditorConvertToHTML;
36 changes: 36 additions & 0 deletions app/components/tab.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import React, { PropTypes } from 'react';

const onClickTab = (onClick) => (evt) => {
evt.preventDefault();
evt.stopPropagation();
onClick();
};

const TabComponent = ({ tabs, children }) => (
<div className='mdl-tabs mdl-js-tabs mdl-js-ripple-effect is-upgraded'>
<div className='mdl-tabs__tab-bar'>
{tabs.map(({ label, isActive, onClick }, idx) => (
<a
key={idx}
href='#'
onClick={onClickTab(onClick)}
className={`mdl-tabs__tab ${isActive ? 'is-active' : ''}`}
>
{label}
</a>)
)}
</div>
<div className='mdl-tabs__panel is-active'>{children}</div>
</div>
);

TabComponent.propTypes = {
children: PropTypes.any.isRequired,
tabs: PropTypes.arrayOf({
label: PropTypes.string.isRequired,
isActive: PropTypes.bool.isRequired,
onClick: PropTypes.func.isRequired
}).isRequired
}

export default TabComponent;
Loading

0 comments on commit 1aa6592

Please sign in to comment.