diff --git a/src/common/pages/App/index.js b/src/common/pages/App/index.js index 7faa8da..0de5898 100644 --- a/src/common/pages/App/index.js +++ b/src/common/pages/App/index.js @@ -1,15 +1,15 @@ import React from "react"; -import {inject, observer} from "mobx-react"; -import {Link} from "react-router-dom"; -import {Helmet} from "react-helmet"; +import { inject, observer } from "mobx-react"; +import { Link } from "react-router-dom"; +import { Helmet } from "react-helmet"; import "../../styles/constants.scss"; import "../../styles/style.scss"; import "./style.scss"; -import {LINKS} from "../../routes"; +import { LINKS } from "../../routes"; import startcase from "lodash.startcase"; import Route from "./routes"; import moment from 'moment'; -import {Icon, Button, Modal, notification} from 'antd'; +import { Icon, Button, Modal, notification } from 'antd'; import { Divider, Drawer, @@ -32,20 +32,19 @@ import WithdrawDialog from './../WithdrawDialog'; import IconMenus from 'material-ui/svg-icons/navigation/menu'; import LoadingDialog from '../LoadingDialog/index'; import * as _ from 'lodash'; // TODO: remove this, import only needed module from lodash -import PrintProvider, {Print, NoPrint} from 'react-easy-print'; -import {black} from "material-ui/styles/colors"; +import { black } from "material-ui/styles/colors"; import cinnamonSugar from 'cinnamon-sugar'; import ButterToast from 'butter-toast'; import 'material-design-icons/iconfont/material-icons.css'; -import {grey400, darkBlack, lightBlack} from 'material-ui/styles/colors'; -import {getMobileOperatingSystem} from '../../stores/firebase'; +import { grey400, darkBlack, lightBlack } from 'material-ui/styles/colors'; +import { getMobileOperatingSystem } from '../../stores/firebase'; import Alert from "../../components/Alert"; import EmptyComponent from '../EmptyComponent'; import NumberFormat from 'react-number-format'; import faker from 'faker'; import { Route as RouteDOM } from 'react-router-dom' import WalletComponent from "./WalletComponent"; -import {APP_TYPE} from "../../config/app"; +import { APP_TYPE } from "../../config/app"; faker.locale = 'id_ID'; @@ -99,19 +98,19 @@ export default class App extends React.Component { notification[type]({ message: (title) ? title : 'Title', description: (content) ? content : -

This is the content of the notification. This is the content of the notification. +

This is the content of the notification. This is the content of the notification. This is the content of the notification.

, - icon: + icon: }); notification.open(); } else { notification.open({ message: (title) ? title : 'Title', - description: (content) ?

{content}

: -

This is the content of the notification. This is the content of the notification. + description: (content) ?

{content}

: +

This is the content of the notification. This is the content of the notification. This is the content of the notification.

, - icon: + icon: }); } }; @@ -222,9 +221,9 @@ export default class App extends React.Component { } - handleToggleIcon = () => this.setState({open: !this.state.open}); - handleToggleIconSecondary = () => this.setState({openSecondary: !this.state.openSecondary}); - handleClose = () => this.setState({open: false}); + handleToggleIcon = () => this.setState({ open: !this.state.open }); + handleToggleIconSecondary = () => this.setState({ openSecondary: !this.state.openSecondary }); + handleClose = () => this.setState({ open: false }); handleChangeSingle = (event, value) => { @@ -251,10 +250,10 @@ export default class App extends React.Component { }); } - handleChange = (event, index, value) => this.setState({value}); + handleChange = (event, index, value) => this.setState({ value }); changeRoute = (path) => { - this.setState({selectedMenu: path}); + this.setState({ selectedMenu: path }); if (window.innerWidth < 600) { this.handleClose() } @@ -274,7 +273,7 @@ export default class App extends React.Component { render() { - const {redirect} = this.state; + const { redirect } = this.state; if (redirect) { this.props.history.replace(LINKS.LOGIN); // return - -
- - - {applicationName} - - - +
+ + + {applicationName} + + + - - + + - -
- -
-
- - - + +
+ +
+
+ + - - - this.toggleDrawer()}> - {/* + + this.toggleDrawer()}> + + {/* */} - - - + + + - {/**/} - {/* this.toggleDrawer()}>*/} - {/**/} - {/**/} - {/* */} - {/*Home*/} + {/*Home*/} - {/* Shop */} - {/* Vouchers */} - {/* */} - - - - - {window.location.pathname.split("/")[2] == "shop" ? ( - this.notificationStore.readAll()} - iconButtonElement={ -
- - - -
- } - > - - { - (this.notificationStore.list.length) ? - this.notificationStore.list.slice(0, 5).map((item, index) => { - return ( - - } - primaryText={item.notification.title} - secondaryText={ -
-

- {item.notification.description.substr(0, 40)}{(item.notification.description.length > 40) ? '...' : ""} -

-

{moment(item.created_at).fromNow()}

-
- } - secondaryTextLines={2} - /> - - ); - }) : - } - - -

View All

-
- } - /> - - - - ) : (
)} - - - this.notificationStore.readAll()} - iconButtonElement={ -
- {userData.role === 'admin' ? ( -
- {this.notificationStore.unread_notif === 0 ? - - - : - - - - - - } -
- ) : ( -
- {this.notificationStore.unread_notif === 0 ? - - - : - - - - - - } -
- )} - -
- } - > - - { - (this.notificationStore.list.length) ? - this.notificationStore.list.slice(0, 5).map((item, index) => { - return ( - - } - primaryText={item.notification.title} - secondaryText={ -
-

- {item.notification.description.substr(0, 40)}{(item.notification.description.length > 40) ? '...' : ""} -

-

{moment(item.created_at).fromNow()}

-
- } - secondaryTextLines={2} - /> - - ); - }) : - } - - -

View All

-
- } - /> - - - - - - {!!this.profileStore.userProfile.photo ? - : - } + + + + {window.location.pathname.split("/")[2] == "shop" ? ( + this.notificationStore.readAll()} + iconButtonElement={ +
+ + +
+ } + > + + { + (this.notificationStore.list.length) ? + this.notificationStore.list.slice(0, 5).map((item, index) => { + return ( + + } + primaryText={item.notification.title} + secondaryText={ +
+

+ {item.notification.description.substr(0, 40)}{(item.notification.description.length > 40) ? '...' : ""} +

+

{moment(item.created_at).fromNow()}

+
+ } + secondaryTextLines={2} + /> + + ); + }) : } - > - {this.authStore.userProfile.username || 'Username'}} - secondaryText={

{_.capitalize(this.authStore.userProfile.role) || 'role'}

} - /> -
- - - - - {}} style={{fontSize: 14}} primaryText="Sign out"/> + + +

View All

+
+ } + /> - - - + + + ) : (
)} -
-
- -
-
- - + this.notificationStore.readAll()} + iconButtonElement={ +
+ {userData.role === 'admin' ? ( +
+ {this.notificationStore.unread_notif === 0 ? + + + : + + + + + + } +
+ ) : ( +
+ {this.notificationStore.unread_notif === 0 ? + + + : + + + + + + } +
+ )} + +
+ } + > + + { + (this.notificationStore.list.length) ? + this.notificationStore.list.slice(0, 5).map((item, index) => { + return ( + + } + primaryText={item.notification.title} + secondaryText={ +
+

+ {item.notification.description.substr(0, 40)}{(item.notification.description.length > 40) ? '...' : ""} +

+

{moment(item.created_at).fromNow()}

+
+ } + secondaryTextLines={2} + /> + + ); + }) : + } + + +

View All

+
+ } + /> + + + + + + {!!this.profileStore.userProfile.photo ? + : + } + + + } + > + {this.authStore.userProfile.username || 'Username'}} + secondaryText={

{_.capitalize(this.authStore.userProfile.role) || 'role'}

} + /> +
+ + + + + { }} style={{ fontSize: 14 }} primaryText="Sign out" /> + +
+ + + +
+
+ +
+ +
); } }