[Update Package] whole packages updated.
This commit is contained in:
146
package.json
146
package.json
@@ -20,90 +20,92 @@
|
|||||||
"author": "Amir Movahedi",
|
"author": "Amir Movahedi",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@material-ui/core": "^1.0.0-rc.1",
|
"@material-ui/core": "^3.6.1",
|
||||||
"@material-ui/icons": "^1.0.0-rc.0",
|
"@material-ui/icons": "^3.0.1",
|
||||||
"@types/react-helmet": "^5.0.5",
|
"@types/ramda": "^0.25.42",
|
||||||
"@types/redux-devtools": "^3.0.43",
|
"@types/react-helmet": "^5.0.7",
|
||||||
"@types/redux-devtools-dock-monitor": "^1.1.32",
|
"@types/redux-devtools": "^3.0.44",
|
||||||
"@types/redux-devtools-log-monitor": "^1.0.33",
|
"@types/redux-devtools-dock-monitor": "^1.1.33",
|
||||||
"@types/redux-immutable": "^3.0.38",
|
"@types/redux-devtools-log-monitor": "^1.0.34",
|
||||||
"amazon-cognito-identity-js": "^2.0.0",
|
"@types/redux-immutable": "^4.0.0",
|
||||||
"aws-sdk": "^2.132.0",
|
"amazon-cognito-identity-js": "^3.0.4",
|
||||||
"axios": "^0.16.2",
|
"aws-sdk": "^2.370.0",
|
||||||
"classnames": "^2.2.5",
|
"axios": "^0.18.0",
|
||||||
|
"classnames": "^2.2.6",
|
||||||
|
"connected-react-router": "^6.0.0-beta.1",
|
||||||
"copy-to-clipboard": "^3.0.8",
|
"copy-to-clipboard": "^3.0.8",
|
||||||
"crypto-js": "^3.1.9-1",
|
"crypto-js": "^3.1.9-1",
|
||||||
"faker": "^4.1.0",
|
"faker": "^4.1.0",
|
||||||
"firebase": "^5.0.4",
|
"firebase": "^5.6.0",
|
||||||
"immutable": "^3.8.2",
|
"immutable": "^4.0.0-rc.12",
|
||||||
"install": "^0.10.2",
|
"install": "^0.12.2",
|
||||||
"inversify": "^4.6.0",
|
"inversify": "^5.0.1",
|
||||||
"jss-rtl": "^0.2.1",
|
"jss-rtl": "^0.2.3",
|
||||||
"keycode": "^2.1.9",
|
"keycode": "^2.2.0",
|
||||||
"lodash": "^4.17.4",
|
"lodash": "^4.17.11",
|
||||||
"moment": "^2.18.1",
|
"moment": "^2.22.2",
|
||||||
"morgan": "^1.8.1",
|
"morgan": "^1.9.1",
|
||||||
"node-sass-chokidar": "1.3.1",
|
"node-sass-chokidar": "1.3.4",
|
||||||
"npm": "^5.6.0",
|
"npm": "^6.4.1",
|
||||||
"npm-run-all": "^4.1.2",
|
"npm-run-all": "^4.1.5",
|
||||||
"prop-types": "^15.6.0",
|
"prop-types": "^15.6.2",
|
||||||
"react": "^16.2.0",
|
"ramda": "^0.26.1",
|
||||||
|
"react": "^16.6.3",
|
||||||
"react-addons-test-utils": "^15.6.2",
|
"react-addons-test-utils": "^15.6.2",
|
||||||
"react-avatar-editor": "^10.3.0",
|
"react-avatar-editor": "^11.0.4",
|
||||||
"react-day-picker": "^7.0.7",
|
"react-day-picker": "^7.2.4",
|
||||||
"react-dom": "^16.2.0",
|
"react-dom": "^16.6.3",
|
||||||
"react-event-listener": "^0.5.1",
|
"react-event-listener": "^0.6.4",
|
||||||
"react-helmet": "^5.2.0",
|
"react-helmet": "^5.2.0",
|
||||||
"react-infinite-scroller": "^1.1.2",
|
"react-infinite-scroller": "^1.2.2",
|
||||||
"react-linkify": "^0.2.1",
|
"react-linkify": "^0.2.2",
|
||||||
"react-loadable": "^5.3.1",
|
"react-loadable": "^5.5.0",
|
||||||
"react-localize-redux": "^2.17.2",
|
"react-localize-redux": "git+https://git@github.com/Qolzam/react-localize-redux.git",
|
||||||
"react-parallax": "^1.6.1",
|
"react-parallax": "^2.0.1",
|
||||||
"react-redux": "^5.0.6",
|
"react-redux": "6.0.0",
|
||||||
"react-router": "^4.1.1 ",
|
"react-router": "^4.3.1",
|
||||||
"react-router-dom": "^4.1.1",
|
"react-router-dom": "^4.3.1",
|
||||||
"react-router-redux": "^5.0.0-alpha.6",
|
"react-share": "2.4.0",
|
||||||
"react-share": "2.2.0",
|
"react-string-replace": "^0.4.1",
|
||||||
"react-string-replace": "^0.4.0",
|
"react-tap-event-plugin": "^3.0.3",
|
||||||
"react-tap-event-plugin": "^3.0.2",
|
"redux": "^4.0.1",
|
||||||
"redux": "^3.7.2",
|
"redux-actions": "^2.6.4",
|
||||||
"redux-actions": "^2.0.3",
|
|
||||||
"redux-immutable": "^4.0.0",
|
"redux-immutable": "^4.0.0",
|
||||||
"redux-saga": "^0.16.0",
|
"redux-saga": "^0.16.2",
|
||||||
"redux-thunk": "^2.2.0",
|
"redux-thunk": "^2.3.0",
|
||||||
"reflect-metadata": "^0.1.10",
|
"reflect-metadata": "^0.1.12",
|
||||||
"save": "^2.3.0",
|
"save": "^2.3.3",
|
||||||
"snyk": "^1.89.0",
|
"snyk": "^1.114.0",
|
||||||
"typeface-roboto": "0.0.50",
|
"typeface-roboto": "0.0.54",
|
||||||
"uuid": "^3.0.1"
|
"uuid": "^3.3.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/classnames": "^2.2.3",
|
"@types/classnames": "^2.2.6",
|
||||||
"@types/jest": "^22.1.1",
|
"@types/jest": "^23.3.10",
|
||||||
"@types/lodash": "^4.14.77",
|
"@types/lodash": "^4.14.119",
|
||||||
"@types/node": "^9.6.2",
|
"@types/node": "^10.12.12",
|
||||||
"@types/prop-types": "^15.5.2",
|
"@types/prop-types": "^15.5.6",
|
||||||
"@types/react": "^16.0.36",
|
"@types/react": "^16.7.13",
|
||||||
"@types/react-dom": "^16.0.3",
|
"@types/react-dom": "^16.0.11",
|
||||||
"@types/react-event-listener": "^0.4.4",
|
"@types/react-event-listener": "^0.4.7",
|
||||||
"@types/react-infinite-scroller": "^1.0.4",
|
"@types/react-infinite-scroller": "^1.2.0",
|
||||||
"@types/react-redux": "^5.0.10",
|
"@types/react-redux": "^6.0.10",
|
||||||
"@types/react-router-dom": "^4.0.8",
|
"@types/react-router-dom": "^4.3.1",
|
||||||
"@types/react-router-redux": "^5.0.8",
|
"@types/react-router-redux": "^5.0.16",
|
||||||
"@types/react-tap-event-plugin": "0.0.30",
|
"@types/react-tap-event-plugin": "0.0.30",
|
||||||
"@types/redux-logger": "^3.0.4",
|
"@types/redux-logger": "^3.0.6",
|
||||||
"@types/uuid": "^3.4.3",
|
"@types/uuid": "^3.4.4",
|
||||||
"react-scripts-ts": "^2.14.0",
|
"react-scripts-ts": "^3.1.0",
|
||||||
"redux-devtools": "^3.4.1",
|
"redux-devtools": "^3.4.2",
|
||||||
"redux-devtools-dock-monitor": "^1.1.3",
|
"redux-devtools-dock-monitor": "^1.1.3",
|
||||||
"redux-devtools-extension": "^2.13.2",
|
"redux-devtools-extension": "^2.13.7",
|
||||||
"redux-devtools-log-monitor": "^1.4.0",
|
"redux-devtools-log-monitor": "^1.4.0",
|
||||||
"redux-logger": "^3.0.6",
|
"redux-logger": "^3.0.6",
|
||||||
"redux-mock-store": "^1.2.3",
|
"redux-mock-store": "^1.5.3",
|
||||||
"ts-node": "^5.0.1",
|
"ts-node": "^7.0.1",
|
||||||
"tslint": "^5.9.1",
|
"tslint": "^5.11.0",
|
||||||
"tslint-config-standard": "^6.0.1",
|
"tslint-config-standard": "^8.0.1",
|
||||||
"typescript": "^2.8.1"
|
"typescript": "^3.2.1"
|
||||||
},
|
},
|
||||||
"directories": {
|
"directories": {
|
||||||
"doc": "docs"
|
"doc": "docs"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// - Import react components
|
// - Import react components
|
||||||
import React, { Component } from 'react'
|
import React, { Component } from 'react'
|
||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import { push } from 'react-router-redux'
|
import { push } from 'connected-react-router'
|
||||||
import { Map, List as ImuList } from 'immutable'
|
import { Map, List as ImuList } from 'immutable'
|
||||||
|
|
||||||
// - Material UI
|
// - Material UI
|
||||||
@@ -17,7 +17,6 @@ import TextField from '@material-ui/core/TextField'
|
|||||||
import MenuList from '@material-ui/core/MenuList'
|
import MenuList from '@material-ui/core/MenuList'
|
||||||
import MenuItem from '@material-ui/core/MenuItem'
|
import MenuItem from '@material-ui/core/MenuItem'
|
||||||
import { withStyles } from '@material-ui/core/styles'
|
import { withStyles } from '@material-ui/core/styles'
|
||||||
import { Manager, Target, Popper } from 'react-popper'
|
|
||||||
import Grow from '@material-ui/core/Grow'
|
import Grow from '@material-ui/core/Grow'
|
||||||
import ClickAwayListener from '@material-ui/core/ClickAwayListener'
|
import ClickAwayListener from '@material-ui/core/ClickAwayListener'
|
||||||
import classNames from 'classnames'
|
import classNames from 'classnames'
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ import MenuList from '@material-ui/core/MenuList'
|
|||||||
import MenuItem from '@material-ui/core/MenuItem'
|
import MenuItem from '@material-ui/core/MenuItem'
|
||||||
import TextField from '@material-ui/core/TextField'
|
import TextField from '@material-ui/core/TextField'
|
||||||
import { withStyles } from '@material-ui/core/styles'
|
import { withStyles } from '@material-ui/core/styles'
|
||||||
import { Manager, Target, Popper } from 'react-popper'
|
|
||||||
import { Card, CardActions, CardHeader, CardMedia, CardContent } from '@material-ui/core'
|
import { Card, CardActions, CardHeader, CardMedia, CardContent } from '@material-ui/core'
|
||||||
import Grow from '@material-ui/core/Grow'
|
import Grow from '@material-ui/core/Grow'
|
||||||
import ClickAwayListener from '@material-ui/core/ClickAwayListener'
|
import ClickAwayListener from '@material-ui/core/ClickAwayListener'
|
||||||
@@ -311,7 +310,7 @@ export class CommentComponent extends Component<ICommentComponentProps, IComment
|
|||||||
const { openMenu, anchorEl } = this.state
|
const { openMenu, anchorEl } = this.state
|
||||||
|
|
||||||
const rightIconMenu = (
|
const rightIconMenu = (
|
||||||
<>
|
<div>
|
||||||
<IconButton
|
<IconButton
|
||||||
buttonRef={(node: any) => {
|
buttonRef={(node: any) => {
|
||||||
this.buttonMenu = node
|
this.buttonMenu = node
|
||||||
@@ -322,13 +321,6 @@ export class CommentComponent extends Component<ICommentComponentProps, IComment
|
|||||||
>
|
>
|
||||||
<MoreVertIcon className={classes.moreIcon} />
|
<MoreVertIcon className={classes.moreIcon} />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
{/* <Popper
|
|
||||||
placement='bottom-start'
|
|
||||||
eventsEnabled={openMenu!}
|
|
||||||
className={classNames({ [classes.popperClose]: !openMenu! }, { [classes.popperOpen]: openMenu! })}
|
|
||||||
>
|
|
||||||
<ClickAwayListener onClickAway={this.handleCloseCommentMenu}>
|
|
||||||
<Grow in={openMenu!} > */}
|
|
||||||
<Popover
|
<Popover
|
||||||
open={openMenu!}
|
open={openMenu!}
|
||||||
anchorEl={anchorEl}
|
anchorEl={anchorEl}
|
||||||
@@ -353,7 +345,7 @@ export class CommentComponent extends Component<ICommentComponentProps, IComment
|
|||||||
</Paper>
|
</Paper>
|
||||||
</Popover>
|
</Popover>
|
||||||
|
|
||||||
</>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
||||||
const Author = () => (
|
const Author = () => (
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import ListItemIcon from '@material-ui/core/ListItemIcon'
|
|||||||
import { grey, teal } from '@material-ui/core/colors'
|
import { grey, teal } from '@material-ui/core/colors'
|
||||||
import LinearProgress from '@material-ui/core/LinearProgress'
|
import LinearProgress from '@material-ui/core/LinearProgress'
|
||||||
import { withStyles } from '@material-ui/core/styles'
|
import { withStyles } from '@material-ui/core/styles'
|
||||||
import { Manager, Target, Popper } from 'react-popper'
|
|
||||||
import { Card, CardActions, CardHeader, CardMedia, CardContent } from '@material-ui/core'
|
import { Card, CardActions, CardHeader, CardMedia, CardContent } from '@material-ui/core'
|
||||||
import Grow from '@material-ui/core/Grow'
|
import Grow from '@material-ui/core/Grow'
|
||||||
import ClickAwayListener from '@material-ui/core/ClickAwayListener'
|
import ClickAwayListener from '@material-ui/core/ClickAwayListener'
|
||||||
|
|||||||
@@ -72,15 +72,15 @@ export class CommentListComponent extends Component<ICommentListComponentProps,
|
|||||||
* @return {DOM} list of comments' DOM
|
* @return {DOM} list of comments' DOM
|
||||||
*/
|
*/
|
||||||
commentList = () => {
|
commentList = () => {
|
||||||
let comments = Map<string, Comment>(this.props.comments)
|
let comments = Map<string, any>(this.props.comments)
|
||||||
let commentsEditorStatus = Map<string, boolean>(this.props.commentsEditorStatus!)
|
let commentsEditorStatus = Map(this.props.commentsEditorStatus! )
|
||||||
if (!comments.isEmpty()) {
|
if (!comments.isEmpty()) {
|
||||||
|
|
||||||
let parsedComments: Comment[] = []
|
let parsedComments: Comment[] = []
|
||||||
comments.forEach((comment, commentId) => {
|
comments.forEach((comment, commentId) => {
|
||||||
parsedComments.push({
|
parsedComments.push({
|
||||||
id: commentId,
|
id: commentId,
|
||||||
...Map(comment!).toJS()
|
...comment.toJS()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
let sortedComments = PostAPI.sortObjectsDate(parsedComments)
|
let sortedComments = PostAPI.sortObjectsDate(parsedComments)
|
||||||
|
|||||||
@@ -514,7 +514,7 @@ export class EditProfileComponent extends Component<IEditProfileComponentProps,
|
|||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions className={classes.fixedDownStickyXS}>
|
<DialogActions className={classes.fixedDownStickyXS}>
|
||||||
<Button onClick={this.props.onRequestClose} > {translate!('profile.cancelButton')} </Button>
|
<Button onClick={this.props.onRequestClose} > {translate!('profile.cancelButton')} </Button>
|
||||||
<Button variant='raised' color='primary' onClick={this.handleUpdate} style={this.styles.updateButton}> {translate!('profile.updateButton')} </Button>
|
<Button variant='contained' color='primary' onClick={this.handleUpdate} style={this.styles.updateButton}> {translate!('profile.updateButton')} </Button>
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
|
||||||
|
|||||||
@@ -1,27 +1,20 @@
|
|||||||
|
|
||||||
export interface IEditProfileComponentState {
|
export interface IEditProfileComponentState {
|
||||||
|
|
||||||
|
[key: string]: any
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Full name input value
|
* Full name input value
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof IEditProfileComponentState
|
|
||||||
*/
|
*/
|
||||||
fullNameInput: string
|
fullNameInput: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Full name input error message
|
* Full name input error message
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof IEditProfileComponentState
|
|
||||||
*/
|
*/
|
||||||
fullNameInputError: string
|
fullNameInputError: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tag line input value
|
* Tag line input value
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof IEditProfileComponentState
|
|
||||||
*/
|
*/
|
||||||
tagLineInput: string
|
tagLineInput: string
|
||||||
|
|
||||||
@@ -35,17 +28,11 @@ export interface IEditProfileComponentState {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* User's banner URL
|
* User's banner URL
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof IEditProfileComponentState
|
|
||||||
*/
|
*/
|
||||||
banner: string
|
banner: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User's avatar URL address
|
* User's avatar URL address
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof IEditProfileComponentState
|
|
||||||
*/
|
*/
|
||||||
avatar: string
|
avatar: string
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import Hidden from '@material-ui/core/Hidden'
|
|||||||
import NotificationsIcon from '@material-ui/icons/Notifications'
|
import NotificationsIcon from '@material-ui/icons/Notifications'
|
||||||
import Tooltip from '@material-ui/core/Tooltip'
|
import Tooltip from '@material-ui/core/Tooltip'
|
||||||
import Typography from '@material-ui/core/Typography'
|
import Typography from '@material-ui/core/Typography'
|
||||||
import { Manager, Target, Popper } from 'react-popper'
|
|
||||||
import { withStyles } from '@material-ui/core/styles'
|
import { withStyles } from '@material-ui/core/styles'
|
||||||
import { getTranslate, getActiveLanguage } from 'react-localize-redux'
|
import { getTranslate, getActiveLanguage } from 'react-localize-redux'
|
||||||
import config from 'src/config'
|
import config from 'src/config'
|
||||||
@@ -87,8 +86,6 @@ export class HomeHeaderComponent extends Component<IHomeHeaderComponentProps, IH
|
|||||||
/**
|
/**
|
||||||
* Handle close notification menu
|
* Handle close notification menu
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @memberof HomeHeader
|
|
||||||
*/
|
*/
|
||||||
handleCloseNotify = () => {
|
handleCloseNotify = () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
@@ -105,8 +102,6 @@ export class HomeHeaderComponent extends Component<IHomeHeaderComponentProps, IH
|
|||||||
/**
|
/**
|
||||||
* Handle notification touch
|
* Handle notification touch
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @memberof HomeHeader
|
|
||||||
*/
|
*/
|
||||||
handleNotifyTouchTap = (event: any) => {
|
handleNotifyTouchTap = (event: any) => {
|
||||||
// This prevents ghost click.
|
// This prevents ghost click.
|
||||||
@@ -121,8 +116,6 @@ export class HomeHeaderComponent extends Component<IHomeHeaderComponentProps, IH
|
|||||||
/**
|
/**
|
||||||
* Handle touch on user avatar for popover
|
* Handle touch on user avatar for popover
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @memberof HomeHeader
|
|
||||||
*/
|
*/
|
||||||
handleAvatarTouchTap = (event: any) => {
|
handleAvatarTouchTap = (event: any) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
@@ -134,8 +127,6 @@ export class HomeHeaderComponent extends Component<IHomeHeaderComponentProps, IH
|
|||||||
/**
|
/**
|
||||||
* Handle logout user
|
* Handle logout user
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @memberof HomeHeader
|
|
||||||
*/
|
*/
|
||||||
handleLogout = () => {
|
handleLogout = () => {
|
||||||
this.props.logout!()
|
this.props.logout!()
|
||||||
@@ -144,8 +135,6 @@ export class HomeHeaderComponent extends Component<IHomeHeaderComponentProps, IH
|
|||||||
/**
|
/**
|
||||||
* Handle close popover
|
* Handle close popover
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @memberof HomeHeader
|
|
||||||
*/
|
*/
|
||||||
handleRequestClose = () => {
|
handleRequestClose = () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
@@ -188,7 +177,7 @@ export class HomeHeaderComponent extends Component<IHomeHeaderComponentProps, IH
|
|||||||
<SvgDehaze color='primary' style={{ cursor: 'pointer' }} />
|
<SvgDehaze color='primary' style={{ cursor: 'pointer' }} />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
{/* Header title */}
|
{/* Header title */}
|
||||||
<Typography variant='title' color='primary' style={{ marginLeft: '15px' }} >
|
<Typography variant='h6' color='primary' style={{ marginLeft: '15px' }} >
|
||||||
{config.settings.appName}
|
{config.settings.appName}
|
||||||
</Typography>
|
</Typography>
|
||||||
<div className='homeHeader__title-root'>
|
<div className='homeHeader__title-root'>
|
||||||
@@ -199,7 +188,7 @@ export class HomeHeaderComponent extends Component<IHomeHeaderComponentProps, IH
|
|||||||
|
|
||||||
{/* Notification */}
|
{/* Notification */}
|
||||||
<div className='homeHeader__right'>
|
<div className='homeHeader__right'>
|
||||||
<Manager>
|
{/* <Manager>
|
||||||
<Target>
|
<Target>
|
||||||
{this.props.notifyCount! > 0 ? (
|
{this.props.notifyCount! > 0 ? (
|
||||||
<Tooltip title={translate!('header.notificationTooltip')}>
|
<Tooltip title={translate!('header.notificationTooltip')}>
|
||||||
@@ -215,8 +204,22 @@ export class HomeHeaderComponent extends Component<IHomeHeaderComponentProps, IH
|
|||||||
</IconButton>
|
</IconButton>
|
||||||
</Tooltip>)}
|
</Tooltip>)}
|
||||||
</Target>
|
</Target>
|
||||||
<Notify open={this.state.openNotifyMenu} anchorEl={this.state.anchorEl} onRequestClose={this.handleCloseNotify} />
|
</Manager> */}
|
||||||
</Manager>
|
|
||||||
|
{this.props.notifyCount! > 0 ? (
|
||||||
|
<Tooltip title={translate!('header.notificationTooltip')}>
|
||||||
|
<IconButton onClick={this.handleNotifyTouchTap}>
|
||||||
|
<div className='homeHeader__notify'>
|
||||||
|
<div className='title'>{this.props.notifyCount}</div>
|
||||||
|
</div>
|
||||||
|
</IconButton>
|
||||||
|
</Tooltip>)
|
||||||
|
: (<Tooltip title={translate!('header.notificationTooltip')}>
|
||||||
|
<IconButton onClick={this.handleNotifyTouchTap}>
|
||||||
|
<NotificationsIcon style={{color: theme.palette.common.white}} />
|
||||||
|
</IconButton>
|
||||||
|
</Tooltip>)}
|
||||||
|
<Notify open={this.state.openNotifyMenu} anchorEl={this.state.anchorEl} onRequestClose={this.handleCloseNotify} />
|
||||||
|
|
||||||
{/* User avatar*/}
|
{/* User avatar*/}
|
||||||
<UserAvatarComponent
|
<UserAvatarComponent
|
||||||
|
|||||||
@@ -222,7 +222,7 @@ export class ImageGalleryComponent extends Component<IImageGalleryComponentProps
|
|||||||
type='file'
|
type='file'
|
||||||
/>
|
/>
|
||||||
<label htmlFor='raised-button-file'>
|
<label htmlFor='raised-button-file'>
|
||||||
<Button variant='raised' component='span' style={this.styles.uploadButton as any}>
|
<Button variant='contained' component='span' style={this.styles.uploadButton as any}>
|
||||||
{translate!('imageGallery.uploadButton')}
|
{translate!('imageGallery.uploadButton')}
|
||||||
</Button>
|
</Button>
|
||||||
</label>
|
</label>
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ export default class MasterLoadingComponent extends Component<IMasterLoadingComp
|
|||||||
<CircularProgress style={{ color: red[500] }} size={50} />
|
<CircularProgress style={{ color: red[500] }} size={50} />
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item style={{ zIndex: 1 }}>
|
<Grid item style={{ zIndex: 1 }}>
|
||||||
<Typography variant='title' color='primary' style={{ marginLeft: '15px' }} >
|
<Typography variant='h6' color='primary' style={{ marginLeft: '15px' }} >
|
||||||
Unexpected Error Happened ...
|
Unexpected Error Happened ...
|
||||||
</Typography>
|
</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
@@ -42,7 +42,7 @@ export default class MasterLoadingComponent extends Component<IMasterLoadingComp
|
|||||||
<CircularProgress style={{ color: red[500] }} size={50} />
|
<CircularProgress style={{ color: red[500] }} size={50} />
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item style={{ zIndex: 1 }}>
|
<Grid item style={{ zIndex: 1 }}>
|
||||||
<Typography variant='title' color='primary' style={{ marginLeft: '15px' }} >
|
<Typography variant='h6' color='primary' style={{ marginLeft: '15px' }} >
|
||||||
It takes long time ...
|
It takes long time ...
|
||||||
</Typography>
|
</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
@@ -55,7 +55,7 @@ export default class MasterLoadingComponent extends Component<IMasterLoadingComp
|
|||||||
<CircularProgress size={50} />
|
<CircularProgress size={50} />
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item style={{ zIndex: 1 }}>
|
<Grid item style={{ zIndex: 1 }}>
|
||||||
<Typography variant='title' color='primary' style={{ marginLeft: '15px' }} >
|
<Typography variant='h6' color='primary' style={{ marginLeft: '15px' }} >
|
||||||
Loading...
|
Loading...
|
||||||
</Typography>
|
</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
@@ -68,7 +68,7 @@ export default class MasterLoadingComponent extends Component<IMasterLoadingComp
|
|||||||
<CircularProgress size={50} />
|
<CircularProgress size={50} />
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item style={{ zIndex: 1 }}>
|
<Grid item style={{ zIndex: 1 }}>
|
||||||
<Typography variant='title' color='primary' style={{ marginLeft: '15px' }} >
|
<Typography variant='h6' color='primary' style={{ marginLeft: '15px' }} >
|
||||||
Loading...
|
Loading...
|
||||||
</Typography>
|
</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import React, { Component } from 'react'
|
|||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import classNames from 'classnames'
|
import classNames from 'classnames'
|
||||||
import { Manager, Target, Popper } from 'react-popper'
|
import Popover from '@material-ui/core/Popover'
|
||||||
import ClickAwayListener from '@material-ui/core/ClickAwayListener'
|
import ClickAwayListener from '@material-ui/core/ClickAwayListener'
|
||||||
import Grow from '@material-ui/core/Grow'
|
import Grow from '@material-ui/core/Grow'
|
||||||
import { withStyles } from '@material-ui/core/styles'
|
import { withStyles } from '@material-ui/core/styles'
|
||||||
@@ -150,31 +150,32 @@ export class NotifyComponent extends Component<INotifyComponentProps, INotifyCom
|
|||||||
)
|
)
|
||||||
const items = this.notifyItemList()
|
const items = this.notifyItemList()
|
||||||
return (
|
return (
|
||||||
<Popper
|
<Popover
|
||||||
placement='bottom-start'
|
open={open}
|
||||||
eventsEnabled={open}
|
anchorEl={anchorEl}
|
||||||
className={classNames({ [classes.popperClose]: !open }, { [classes.popperOpen]: open })}
|
onClose={onRequestClose}
|
||||||
>
|
PaperProps={{ className: classNames(classes.paper) }}
|
||||||
|
anchorOrigin={{
|
||||||
|
vertical: 'bottom',
|
||||||
|
horizontal: 'center',
|
||||||
|
}}
|
||||||
|
transformOrigin={{
|
||||||
|
vertical: 'top',
|
||||||
|
horizontal: 'center',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Paper className={classNames(classes.root, { [classes.overflowHidden]: !open })} elevation={4} >
|
||||||
|
|
||||||
<ClickAwayListener onClickAway={onRequestClose}>
|
{items.length > 0 ? <List className={classes.list} >{items}</List> : noNotify}
|
||||||
<Grow in={open} >
|
|
||||||
<Paper className={classNames(classes.root, { [classes.overflowHidden]: !open })} elevation={4} >
|
|
||||||
|
|
||||||
{items.length > 0 ? <List className={classes.list} >{items}</List> : noNotify}
|
</Paper>
|
||||||
|
</Popover>
|
||||||
</Paper>
|
|
||||||
</Grow>
|
|
||||||
</ClickAwayListener>
|
|
||||||
</Popper>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map dispatch to props
|
* Map dispatch to props
|
||||||
* @param {func} dispatch is the function to dispatch action to reducers
|
|
||||||
* @param {object} ownProps is the props belong to component
|
|
||||||
* @return {object} props of component
|
|
||||||
*/
|
*/
|
||||||
const mapDispatchToProps = (dispatch: any, ownProps: INotifyComponentProps) => {
|
const mapDispatchToProps = (dispatch: any, ownProps: INotifyComponentProps) => {
|
||||||
return {
|
return {
|
||||||
@@ -184,9 +185,6 @@ const mapDispatchToProps = (dispatch: any, ownProps: INotifyComponentProps) => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Map state to props
|
* Map state to props
|
||||||
* @param {object} state is the obeject from redux store
|
|
||||||
* @param {object} ownProps is the props belong to component
|
|
||||||
* @return {object} props of component
|
|
||||||
*/
|
*/
|
||||||
const mapStateToProps = (state: Map<string, any>, ownProps: INotifyComponentProps) => {
|
const mapStateToProps = (state: Map<string, any>, ownProps: INotifyComponentProps) => {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import React, { Component } from 'react'
|
|||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import { NavLink } from 'react-router-dom'
|
import { NavLink } from 'react-router-dom'
|
||||||
import { push } from 'react-router-redux'
|
import { push } from 'connected-react-router'
|
||||||
import SvgClose from '@material-ui/icons/Close'
|
import SvgClose from '@material-ui/icons/Close'
|
||||||
import { grey } from '@material-ui/core/colors'
|
import { grey } from '@material-ui/core/colors'
|
||||||
import { withStyles } from '@material-ui/core/styles'
|
import { withStyles } from '@material-ui/core/styles'
|
||||||
|
|||||||
@@ -2,13 +2,14 @@
|
|||||||
import React, { Component } from 'react'
|
import React, { Component } from 'react'
|
||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import { NavLink } from 'react-router-dom'
|
import { NavLink } from 'react-router-dom'
|
||||||
import { push } from 'react-router-redux'
|
import { push } from 'connected-react-router'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import moment from 'moment/moment'
|
import moment from 'moment/moment'
|
||||||
import Linkify from 'react-linkify'
|
import Linkify from 'react-linkify'
|
||||||
import copy from 'copy-to-clipboard'
|
import copy from 'copy-to-clipboard'
|
||||||
import { getTranslate, getActiveLanguage } from 'react-localize-redux'
|
import { getTranslate, getActiveLanguage } from 'react-localize-redux'
|
||||||
import { Map } from 'immutable'
|
import { Map } from 'immutable'
|
||||||
|
import * as R from 'ramda'
|
||||||
|
|
||||||
// - Material UI
|
// - Material UI
|
||||||
import Card from '@material-ui/core/Card'
|
import Card from '@material-ui/core/Card'
|
||||||
@@ -37,7 +38,6 @@ import MoreVertIcon from '@material-ui/icons/MoreVert'
|
|||||||
import ListItemIcon from '@material-ui/core/ListItemIcon'
|
import ListItemIcon from '@material-ui/core/ListItemIcon'
|
||||||
import ListItemText from '@material-ui/core/ListItemText'
|
import ListItemText from '@material-ui/core/ListItemText'
|
||||||
import { withStyles } from '@material-ui/core/styles'
|
import { withStyles } from '@material-ui/core/styles'
|
||||||
import { Manager, Target, Popper } from 'react-popper'
|
|
||||||
import Grow from '@material-ui/core/Grow'
|
import Grow from '@material-ui/core/Grow'
|
||||||
import ClickAwayListener from '@material-ui/core/ClickAwayListener'
|
import ClickAwayListener from '@material-ui/core/ClickAwayListener'
|
||||||
import classNames from 'classnames'
|
import classNames from 'classnames'
|
||||||
@@ -191,7 +191,6 @@ export class PostComponent extends Component<IPostComponentProps, IPostComponent
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Toggle on show/hide comment
|
* Toggle on show/hide comment
|
||||||
* @param {event} evt passed by clicking on comment slide show
|
|
||||||
*/
|
*/
|
||||||
handleOpenComments = () => {
|
handleOpenComments = () => {
|
||||||
const { getPostComments, commentList, post } = this.props
|
const { getPostComments, commentList, post } = this.props
|
||||||
@@ -208,8 +207,6 @@ export class PostComponent extends Component<IPostComponentProps, IPostComponent
|
|||||||
/**
|
/**
|
||||||
* Open post write
|
* Open post write
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @memberof StreamComponent
|
|
||||||
*/
|
*/
|
||||||
handleOpenPostWrite = () => {
|
handleOpenPostWrite = () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
@@ -220,8 +217,6 @@ export class PostComponent extends Component<IPostComponentProps, IPostComponent
|
|||||||
/**
|
/**
|
||||||
* Close post write
|
* Close post write
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @memberof StreamComponent
|
|
||||||
*/
|
*/
|
||||||
handleClosePostWrite = () => {
|
handleClosePostWrite = () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
@@ -232,8 +227,6 @@ export class PostComponent extends Component<IPostComponentProps, IPostComponent
|
|||||||
/**
|
/**
|
||||||
* Delete a post
|
* Delete a post
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @memberof Post
|
|
||||||
*/
|
*/
|
||||||
handleDelete = () => {
|
handleDelete = () => {
|
||||||
const { post } = this.props
|
const { post } = this.props
|
||||||
@@ -263,8 +256,6 @@ export class PostComponent extends Component<IPostComponentProps, IPostComponent
|
|||||||
/**
|
/**
|
||||||
* Show copy link
|
* Show copy link
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @memberof Post
|
|
||||||
*/
|
*/
|
||||||
handleCopyLink = () => {
|
handleCopyLink = () => {
|
||||||
const {translate} = this.props
|
const {translate} = this.props
|
||||||
@@ -277,8 +268,6 @@ export class PostComponent extends Component<IPostComponentProps, IPostComponent
|
|||||||
/**
|
/**
|
||||||
* Open share post
|
* Open share post
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @memberof Post
|
|
||||||
*/
|
*/
|
||||||
handleOpenShare = () => {
|
handleOpenShare = () => {
|
||||||
const {post} = this.props
|
const {post} = this.props
|
||||||
@@ -291,8 +280,6 @@ export class PostComponent extends Component<IPostComponentProps, IPostComponent
|
|||||||
/**
|
/**
|
||||||
* Close share post
|
* Close share post
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @memberof Post
|
|
||||||
*/
|
*/
|
||||||
handleCloseShare = () => {
|
handleCloseShare = () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
@@ -305,8 +292,6 @@ export class PostComponent extends Component<IPostComponentProps, IPostComponent
|
|||||||
/**
|
/**
|
||||||
* Handle vote on a post
|
* Handle vote on a post
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @memberof Post
|
|
||||||
*/
|
*/
|
||||||
handleVote = () => {
|
handleVote = () => {
|
||||||
if (this.props.currentUserVote) {
|
if (this.props.currentUserVote) {
|
||||||
@@ -337,50 +322,66 @@ export class PostComponent extends Component<IPostComponentProps, IPostComponent
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
shouldComponentUpdate(nextProps: IPostComponentProps ,nextState: IPostComponentState) {
|
||||||
|
let shouldUpdate = false
|
||||||
|
|
||||||
|
if (!nextProps.post.equals(this.props.post)) {
|
||||||
|
shouldUpdate = true
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nextProps.commentList && !nextProps.commentList!.equals(this.props.commentList!)) {
|
||||||
|
shouldUpdate = true
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.props.getPostComments !== nextProps.getPostComments) {
|
||||||
|
shouldUpdate = true
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!R.equals(this.state, nextState)) {
|
||||||
|
shouldUpdate = true
|
||||||
|
}
|
||||||
|
|
||||||
|
return shouldUpdate
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reneder component DOM
|
* Reneder component DOM
|
||||||
* @return {react element} return the DOM which rendered by component
|
|
||||||
*/
|
*/
|
||||||
render () {
|
render () {
|
||||||
const { post, setHomeTitle, goTo, fullName, isPostOwner, commentList, classes , translate} = this.props
|
const { post, setHomeTitle, goTo, fullName, isPostOwner, commentList, classes , translate} = this.props
|
||||||
const { postMenuAnchorEl, isPostMenuOpen } = this.state
|
const { postMenuAnchorEl, isPostMenuOpen } = this.state
|
||||||
const rightIconMenu = (
|
const rightIconMenu = (
|
||||||
<Manager>
|
<div>
|
||||||
<Target>
|
<IconButton
|
||||||
<IconButton
|
onClick={this.openPostMenu.bind(this)}
|
||||||
aria-owns={isPostMenuOpen! ? 'post-menu' : ''}
|
|
||||||
aria-haspopup='true'
|
|
||||||
onClick={this.openPostMenu.bind(this)}
|
|
||||||
>
|
|
||||||
<MoreVertIcon />
|
|
||||||
</IconButton>
|
|
||||||
|
|
||||||
</Target>
|
|
||||||
<Popper
|
|
||||||
placement='bottom-start'
|
|
||||||
eventsEnabled={isPostMenuOpen!}
|
|
||||||
className={classNames({ [classes.popperClose]: !isPostMenuOpen }, { [classes.popperOpen]: isPostMenuOpen })}
|
|
||||||
>
|
>
|
||||||
<ClickAwayListener onClickAway={this.closePostMenu}>
|
<MoreVertIcon />
|
||||||
<Grow in={isPostMenuOpen} >
|
</IconButton>
|
||||||
<Paper>
|
|
||||||
<MenuList role='menu'>
|
<Menu
|
||||||
<MenuItem onClick={this.handleOpenPostWrite} > {translate!('post.edit')} </MenuItem>
|
open={isPostMenuOpen!}
|
||||||
<MenuItem onClick={this.handleDelete} > {translate!('post.delete')} </MenuItem>
|
anchorEl={postMenuAnchorEl}
|
||||||
<MenuItem
|
anchorOrigin={{
|
||||||
onClick={() => this.props.toggleDisableComments!(!post.get('disableComments'))} >
|
vertical: 'top',
|
||||||
{post.get('disableComments') ? translate!('post.enableComments') : translate!('post.disableComments')}
|
horizontal: 'right'
|
||||||
</MenuItem>
|
}}
|
||||||
<MenuItem
|
transformOrigin={{
|
||||||
onClick={() => this.props.toggleSharingComments!(!post.get('disableSharing'))} >
|
vertical: 'top',
|
||||||
{post.get('disableSharing') ? translate!('post.enableSharing') : translate!('post.disableSharing')}
|
horizontal: 'right'
|
||||||
</MenuItem>
|
}}
|
||||||
</MenuList>
|
onClose={this.closePostMenu}>
|
||||||
</Paper>
|
<MenuItem onClick={this.handleOpenPostWrite} > {translate!('post.edit')} </MenuItem>
|
||||||
</Grow>
|
<MenuItem onClick={this.handleDelete} > {translate!('post.delete')} </MenuItem>
|
||||||
</ClickAwayListener>
|
<MenuItem
|
||||||
</Popper>
|
onClick={() => this.props.toggleDisableComments!(!post.get('disableComments'))} >
|
||||||
</Manager>
|
{post.get('disableComments') ? translate!('post.enableComments') : translate!('post.disableComments')}
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem
|
||||||
|
onClick={() => this.props.toggleSharingComments!(!post.get('disableSharing'))} >
|
||||||
|
{post.get('disableSharing') ? translate!('post.enableSharing') : translate!('post.disableSharing')}
|
||||||
|
</MenuItem>
|
||||||
|
</Menu>
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@@ -393,7 +394,7 @@ export class PostComponent extends Component<IPostComponentProps, IPostComponent
|
|||||||
disableComments,
|
disableComments,
|
||||||
commentCounter,
|
commentCounter,
|
||||||
disableSharing ,
|
disableSharing ,
|
||||||
} = post.toJS()
|
} = post.toJS() as any
|
||||||
// Define variables
|
// Define variables
|
||||||
return (
|
return (
|
||||||
<Card key={`post-component-${id}`}>
|
<Card key={`post-component-${id}`}>
|
||||||
@@ -488,9 +489,6 @@ export class PostComponent extends Component<IPostComponentProps, IPostComponent
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Map dispatch to props
|
* Map dispatch to props
|
||||||
* @param {func} dispatch is the function to dispatch action to reducers
|
|
||||||
* @param {object} ownProps is the props belong to component
|
|
||||||
* @return {object} props of component
|
|
||||||
*/
|
*/
|
||||||
const mapDispatchToProps = (dispatch: any, ownProps: IPostComponentProps) => {
|
const mapDispatchToProps = (dispatch: any, ownProps: IPostComponentProps) => {
|
||||||
const { post } = ownProps
|
const { post } = ownProps
|
||||||
@@ -513,9 +511,6 @@ const mapDispatchToProps = (dispatch: any, ownProps: IPostComponentProps) => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Map state to props
|
* Map state to props
|
||||||
* @param {object} state is the obeject from redux store
|
|
||||||
* @param {object} ownProps is the props belong to component
|
|
||||||
* @return {object} props of component
|
|
||||||
*/
|
*/
|
||||||
const mapStateToProps = (state: Map<string, any>, ownProps: IPostComponentProps) => {
|
const mapStateToProps = (state: Map<string, any>, ownProps: IPostComponentProps) => {
|
||||||
|
|
||||||
|
|||||||
@@ -35,4 +35,9 @@ export interface IPostWriteComponentState {
|
|||||||
*/
|
*/
|
||||||
menuOpen: boolean
|
menuOpen: boolean
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Menu anchor element
|
||||||
|
*/
|
||||||
|
menuAnchorEl: any
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import SvgRemoveImage from '@material-ui/icons/RemoveCircle'
|
|||||||
import SvgCamera from '@material-ui/icons/PhotoCamera'
|
import SvgCamera from '@material-ui/icons/PhotoCamera'
|
||||||
import MoreVertIcon from '@material-ui/icons/MoreVert'
|
import MoreVertIcon from '@material-ui/icons/MoreVert'
|
||||||
import { withStyles } from '@material-ui/core/styles'
|
import { withStyles } from '@material-ui/core/styles'
|
||||||
import { Manager, Target, Popper } from 'react-popper'
|
import Menu from '@material-ui/core/Menu'
|
||||||
import Grow from '@material-ui/core/Grow'
|
import Grow from '@material-ui/core/Grow'
|
||||||
import ClickAwayListener from '@material-ui/core/ClickAwayListener'
|
import ClickAwayListener from '@material-ui/core/ClickAwayListener'
|
||||||
import classNames from 'classnames'
|
import classNames from 'classnames'
|
||||||
@@ -125,6 +125,10 @@ export class PostWriteComponent extends Component<IPostWriteComponentProps, IPos
|
|||||||
* Whether menu is open
|
* Whether menu is open
|
||||||
*/
|
*/
|
||||||
menuOpen: false,
|
menuOpen: false,
|
||||||
|
/**
|
||||||
|
* Menu anchor element
|
||||||
|
*/
|
||||||
|
menuAnchorEl: null,
|
||||||
/**
|
/**
|
||||||
* If it's true post button will be disabled
|
* If it's true post button will be disabled
|
||||||
*/
|
*/
|
||||||
@@ -264,6 +268,26 @@ export class PostWriteComponent extends Component<IPostWriteComponentProps, IPos
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle open more menu
|
||||||
|
*/
|
||||||
|
handleOpenMenu = (event: any) => {
|
||||||
|
this.setState({
|
||||||
|
menuOpen: true,
|
||||||
|
menuAnchorEl: event.currentTarget
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle close more menu
|
||||||
|
*/
|
||||||
|
handleCloseMenu = () => {
|
||||||
|
this.setState({
|
||||||
|
menuOpen: false,
|
||||||
|
menuAnchorEl: null
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set post image url
|
* Set post image url
|
||||||
*/
|
*/
|
||||||
@@ -315,24 +339,6 @@ export class PostWriteComponent extends Component<IPostWriteComponentProps, IPos
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle open more menu
|
|
||||||
*/
|
|
||||||
handleOpenMenu = () => {
|
|
||||||
this.setState({
|
|
||||||
menuOpen: true
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle close more menu
|
|
||||||
*/
|
|
||||||
handleCloseMenu = () => {
|
|
||||||
this.setState({
|
|
||||||
menuOpen: false
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps: IPostWriteComponentProps) {
|
componentWillReceiveProps(nextProps: IPostWriteComponentProps) {
|
||||||
if (!nextProps.open) {
|
if (!nextProps.open) {
|
||||||
const { postModel } = this.props
|
const { postModel } = this.props
|
||||||
@@ -381,36 +387,34 @@ export class PostWriteComponent extends Component<IPostWriteComponentProps, IPos
|
|||||||
render() {
|
render() {
|
||||||
|
|
||||||
const { classes, translate } = this.props
|
const { classes, translate } = this.props
|
||||||
const { menuOpen } = this.state
|
const { menuOpen, menuAnchorEl } = this.state
|
||||||
|
|
||||||
const rightIconMenu = (
|
const rightIconMenu = (
|
||||||
<Manager>
|
<div>
|
||||||
<Target>
|
<Tooltip id='tooltip-icon' title={translate!('post.moreTooltip')} placement='bottom-start'>
|
||||||
<Tooltip id='tooltip-icon' title={translate!('post.moreTooltip')} placement='bottom-start'>
|
<IconButton
|
||||||
<IconButton
|
onClick={this.handleOpenMenu}
|
||||||
onClick={this.handleOpenMenu}
|
>
|
||||||
>
|
<MoreVertIcon />
|
||||||
<MoreVertIcon />
|
</IconButton>
|
||||||
</IconButton>
|
</Tooltip>
|
||||||
</Tooltip>
|
<Menu
|
||||||
</Target>
|
open={menuOpen}
|
||||||
<Popper
|
anchorEl={menuAnchorEl}
|
||||||
placement='bottom-start'
|
anchorOrigin={{
|
||||||
eventsEnabled={menuOpen}
|
vertical: 'top',
|
||||||
className={classNames({ [classes.popperClose]: !menuOpen }, { [classes.popperOpen]: menuOpen })}
|
horizontal: 'right'
|
||||||
>
|
}}
|
||||||
<ClickAwayListener onClickAway={this.handleCloseMenu}>
|
transformOrigin={{
|
||||||
<Grow in={menuOpen} >
|
vertical: 'top',
|
||||||
<Paper>
|
horizontal: 'right'
|
||||||
<MenuList role='menu'>
|
}}
|
||||||
<MenuItem onClick={this.handleToggleComments} style={{ fontSize: '14px' }}>{!this.state.disableComments ? 'Disable comments' : 'Enable comments'} </MenuItem>
|
onClose={this.handleCloseMenu}>
|
||||||
<MenuItem onClick={this.handleToggleSharing} style={{ fontSize: '14px' }}>{!this.state.disableSharing ? 'Disable sharing' : 'Enable sharing'}</MenuItem>
|
<MenuItem onClick={this.handleToggleComments} style={{ fontSize: '14px' }}>{!this.state.disableComments ? translate!('post.disableComments') : translate!('post.enableComments')} </MenuItem>
|
||||||
</MenuList>
|
<MenuItem onClick={this.handleToggleSharing} style={{ fontSize: '14px' }}>{!this.state.disableSharing ? translate!('post.disableSharing') : translate!('post.disableSharing')}</MenuItem>
|
||||||
</Paper>
|
|
||||||
</Grow>
|
</Menu>
|
||||||
</ClickAwayListener>
|
</div>
|
||||||
</Popper>
|
|
||||||
</Manager>
|
|
||||||
)
|
)
|
||||||
let postAvatar = <UserAvatarComponent fullName={this.props.ownerDisplayName!} fileName={this.props.ownerAvatar!} size={36} />
|
let postAvatar = <UserAvatarComponent fullName={this.props.ownerDisplayName!} fileName={this.props.ownerAvatar!} size={36} />
|
||||||
|
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ export class ProfileHeaderComponent extends Component<IProfileHeaderComponentPro
|
|||||||
</div>
|
</div>
|
||||||
<div className='right'>
|
<div className='right'>
|
||||||
{isAuthedUser ? (<div style={this.state.isSmall ? styles.editButtonSmall : styles.editButton}>
|
{isAuthedUser ? (<div style={this.state.isSmall ? styles.editButtonSmall : styles.editButton}>
|
||||||
<Button variant='raised' onClick={this.props.openEditor}>
|
<Button variant='contained' onClick={this.props.openEditor}>
|
||||||
{translate!('profile.editProfileButton')}
|
{translate!('profile.editProfileButton')}
|
||||||
</Button>
|
</Button>
|
||||||
</div>) : ''}
|
</div>) : ''}
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ export class ShareDialogComponent extends Component<IShareDialogComponentProps,
|
|||||||
</MenuList>)
|
</MenuList>)
|
||||||
: <div>
|
: <div>
|
||||||
<TextField autoFocus fullWidth={true} id='text-field-default' defaultValue={`${location.origin}/${post.get('ownerUserId')}/posts/${post.get('id')}`} />
|
<TextField autoFocus fullWidth={true} id='text-field-default' defaultValue={`${location.origin}/${post.get('ownerUserId')}/posts/${post.get('id')}`} />
|
||||||
<Typography className={classNames('animate-top', classes.clipboard)} variant='headline' component='h2'>
|
<Typography className={classNames('animate-top', classes.clipboard)} variant='h5' component='h2'>
|
||||||
Link has been copied to clipboard ...
|
Link has been copied to clipboard ...
|
||||||
</Typography>
|
</Typography>
|
||||||
</div>}
|
</div>}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import React, { Component } from 'react'
|
|||||||
import moment from 'moment/moment'
|
import moment from 'moment/moment'
|
||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import { push } from 'react-router-redux'
|
import { push } from 'connected-react-router'
|
||||||
import { getTranslate, getActiveLanguage } from 'react-localize-redux'
|
import { getTranslate, getActiveLanguage } from 'react-localize-redux'
|
||||||
import classNames from 'classnames'
|
import classNames from 'classnames'
|
||||||
import {Map, List as ImuList} from 'immutable'
|
import {Map, List as ImuList} from 'immutable'
|
||||||
@@ -178,7 +178,8 @@ export class UserBoxComponent extends Component<IUserBoxComponentProps, IUserBox
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!isFollowed) {
|
if (!isFollowed) {
|
||||||
followUser!(followingCircle!.get('id'), { avatar, userId, fullName })
|
debugger
|
||||||
|
followUser!(followingCircle![0], { avatar, userId, fullName })
|
||||||
} else {
|
} else {
|
||||||
this.onRequestOpenAddCircle()
|
this.onRequestOpenAddCircle()
|
||||||
}
|
}
|
||||||
@@ -286,8 +287,8 @@ export class UserBoxComponent extends Component<IUserBoxComponentProps, IUserBox
|
|||||||
|
|
||||||
if (selectedCircles.count() === userBelongCircles!.count()) {
|
if (selectedCircles.count() === userBelongCircles!.count()) {
|
||||||
for (let circleIndex: number = 0; circleIndex < selectedCircles.count(); circleIndex++) {
|
for (let circleIndex: number = 0; circleIndex < selectedCircles.count(); circleIndex++) {
|
||||||
const selectedCircleId = selectedCircles.get(circleIndex)
|
const selectedCircleId = selectedCircles.get(circleIndex, '')
|
||||||
if (!(userBelongCircles!.indexOf(selectedCircleId) > -1)) {
|
if (!(userBelongCircles!.indexOf(selectedCircleId!) > -1)) {
|
||||||
isChanged = true
|
isChanged = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import React, { Component } from 'react'
|
import React, { Component } from 'react'
|
||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import { NavLink, withRouter } from 'react-router-dom'
|
import { NavLink, withRouter } from 'react-router-dom'
|
||||||
import { push } from 'react-router-redux'
|
import { push } from 'connected-react-router'
|
||||||
import Paper from '@material-ui/core/Paper'
|
import Paper from '@material-ui/core/Paper'
|
||||||
import TextField from '@material-ui/core/TextField'
|
import TextField from '@material-ui/core/TextField'
|
||||||
import RaisedButton from '@material-ui/core/Button'
|
import RaisedButton from '@material-ui/core/Button'
|
||||||
@@ -106,8 +106,8 @@ export class EmailVerificationComponent extends Component<IEmailVerificationComp
|
|||||||
{translate!('emailVerification.description')}
|
{translate!('emailVerification.description')}
|
||||||
</p>
|
</p>
|
||||||
<div style={this.styles.buttons}>
|
<div style={this.styles.buttons}>
|
||||||
<Button variant='raised' style={this.styles.homeButton} color='primary' onClick={() => this.props.homePage()}> {translate!('emailVerification.homeButton')} </Button>
|
<Button variant='contained' style={this.styles.homeButton} color='primary' onClick={() => this.props.homePage()}> {translate!('emailVerification.homeButton')} </Button>
|
||||||
<Button variant='raised' color='primary' onClick={() => this.props.sendEmailVerification()}> {translate!('emailVerification.sendButton')} </Button>
|
<Button variant='contained' color='primary' onClick={() => this.props.sendEmailVerification()}> {translate!('emailVerification.sendButton')} </Button>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import React, { Component } from 'react'
|
|||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
import { Route, Switch, withRouter, Redirect, NavLink } from 'react-router-dom'
|
import { Route, Switch, withRouter, Redirect, NavLink } from 'react-router-dom'
|
||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import { push } from 'react-router-redux'
|
import { push } from 'connected-react-router'
|
||||||
import { getTranslate, getActiveLanguage } from 'react-localize-redux'
|
import { getTranslate, getActiveLanguage } from 'react-localize-redux'
|
||||||
import config from 'src/config'
|
import config from 'src/config'
|
||||||
import classNames from 'classnames'
|
import classNames from 'classnames'
|
||||||
@@ -197,7 +197,7 @@ export class HomeComponent extends Component<IHomeComponentProps, IHomeComponent
|
|||||||
const { loaded, authed, loadDataStream, mergedPosts, hasMorePosts, showSendFeedback, translate, classes, theme } = this.props
|
const { loaded, authed, loadDataStream, mergedPosts, hasMorePosts, showSendFeedback, translate, classes, theme } = this.props
|
||||||
const { drawerOpen } = this.state
|
const { drawerOpen } = this.state
|
||||||
const drawer = (
|
const drawer = (
|
||||||
<>
|
<div>
|
||||||
|
|
||||||
<NavLink to='/'>
|
<NavLink to='/'>
|
||||||
<MenuItem style={{ color: 'rgb(117, 117, 117)' }}>
|
<MenuItem style={{ color: 'rgb(117, 117, 117)' }}>
|
||||||
@@ -238,7 +238,7 @@ export class HomeComponent extends Component<IHomeComponentProps, IHomeComponent
|
|||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
<ListItemText inset primary={translate!('sidebar.sendFeedback')} />
|
<ListItemText inset primary={translate!('sidebar.sendFeedback')} />
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
</>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
||||||
const anchor = theme.direction === 'rtl' ? 'right' : 'left'
|
const anchor = theme.direction === 'rtl' ? 'right' : 'left'
|
||||||
|
|||||||
@@ -1,43 +1,30 @@
|
|||||||
|
|
||||||
export interface ILoginComponentState {
|
export interface ILoginComponentState {
|
||||||
|
|
||||||
|
[key: string]: any
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Email input value
|
* Email input value
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof ILoginComponentState
|
|
||||||
*/
|
*/
|
||||||
emailInput: string
|
emailInput: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Email input error text
|
* Email input error text
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof ILoginComponentState
|
|
||||||
*/
|
*/
|
||||||
emailInputError: string
|
emailInputError: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Password input value
|
* Password input value
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof ILoginComponentState
|
|
||||||
*/
|
*/
|
||||||
passwordInput: string
|
passwordInput: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Password input error text
|
* Password input error text
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof ILoginComponentState
|
|
||||||
*/
|
*/
|
||||||
passwordInputError: string
|
passwordInputError: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Confirm input error text
|
* Confirm input error text
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof ILoginComponentState
|
|
||||||
*/
|
*/
|
||||||
confirmInputError: string
|
confirmInputError: string
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import React, { Component } from 'react'
|
import React, { Component } from 'react'
|
||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import { NavLink, withRouter } from 'react-router-dom'
|
import { NavLink, withRouter } from 'react-router-dom'
|
||||||
import { push } from 'react-router-redux'
|
import { push } from 'connected-react-router'
|
||||||
import Paper from '@material-ui/core/Paper'
|
import Paper from '@material-ui/core/Paper'
|
||||||
import TextField from '@material-ui/core/TextField'
|
import TextField from '@material-ui/core/TextField'
|
||||||
import RaisedButton from '@material-ui/core/Button'
|
import RaisedButton from '@material-ui/core/Button'
|
||||||
@@ -214,7 +214,7 @@ export class LoginComponent extends Component<ILoginComponentProps, ILoginCompon
|
|||||||
<Button onClick={this.props.signupPage} tabIndex={4}>{translate!('login.createAccountButton')}</Button>
|
<Button onClick={this.props.signupPage} tabIndex={4}>{translate!('login.createAccountButton')}</Button>
|
||||||
</div>
|
</div>
|
||||||
<div >
|
<div >
|
||||||
<Button variant='raised' color='primary' onClick={this.handleForm} tabIndex={3} >{translate!('login.loginButton')}</Button>
|
<Button variant='contained' color='primary' onClick={this.handleForm} tabIndex={3} >{translate!('login.loginButton')}</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<span className={classes.bottomPaper}>{translate!('login.forgetPasswordMessage')} <NavLink to='/resetPassword' className={classes.link}>{translate!('login.resetPasswordLabel')}</NavLink></span>
|
<span className={classes.bottomPaper}>{translate!('login.forgetPasswordMessage')} <NavLink to='/resetPassword' className={classes.link}>{translate!('login.resetPasswordLabel')}</NavLink></span>
|
||||||
@@ -255,4 +255,4 @@ const mapStateToProps = (state: any, ownProps: ILoginComponentProps) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// - Connect component to redux store
|
// - Connect component to redux store
|
||||||
export default withRouter<any>(connect(mapStateToProps, mapDispatchToProps)(withStyles(styles as any)(localize(LoginComponent, 'locale', CommonAPI.getStateSlice) as any) as any)) as typeof LoginComponent
|
export default withRouter<any>(connect(mapStateToProps, mapDispatchToProps)(withStyles(styles as any)(localize(LoginComponent as any, 'locale', CommonAPI.getStateSlice) as any) as any)) as typeof LoginComponent
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import React, { Component } from 'react'
|
import React, { Component } from 'react'
|
||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import { Route, Switch, NavLink, withRouter, Redirect } from 'react-router-dom'
|
import { Route, Switch, NavLink, withRouter, Redirect } from 'react-router-dom'
|
||||||
import { push } from 'react-router-redux'
|
import { push } from 'connected-react-router'
|
||||||
import Snackbar from '@material-ui/core/Snackbar'
|
import Snackbar from '@material-ui/core/Snackbar'
|
||||||
import LinearProgress from '@material-ui/core/LinearProgress'
|
import LinearProgress from '@material-ui/core/LinearProgress'
|
||||||
import {Helmet} from 'react-helmet'
|
import {Helmet} from 'react-helmet'
|
||||||
@@ -195,8 +195,9 @@ const mapDispatchToProps = (dispatch: any, ownProps: IMasterComponentProps) => {
|
|||||||
* @param {object} state
|
* @param {object} state
|
||||||
*/
|
*/
|
||||||
const mapStateToProps = (state: Map<string, any>) => {
|
const mapStateToProps = (state: Map<string, any>) => {
|
||||||
const authorize = Map(state.get('authorize', {})).toJS()
|
// FIXME: Never use toJS() in mapStateToProps https://redux.js.org/recipes/usingimmutablejs
|
||||||
const global = Map(state.get('global', {})).toJS()
|
const authorize = Map(state.get('authorize', {})).toJS() as any
|
||||||
|
const global = Map(state.get('global', {})).toJS() as any
|
||||||
const { sendFeedbackStatus, progress } = global
|
const { sendFeedbackStatus, progress } = global
|
||||||
return {
|
return {
|
||||||
sendFeedbackStatus,
|
sendFeedbackStatus,
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import PropTypes from 'prop-types'
|
|||||||
import Tabs from '@material-ui/core/Tabs'
|
import Tabs from '@material-ui/core/Tabs'
|
||||||
import Tab from '@material-ui/core/Tab'
|
import Tab from '@material-ui/core/Tab'
|
||||||
import { grey, cyan } from '@material-ui/core/colors'
|
import { grey, cyan } from '@material-ui/core/colors'
|
||||||
import { push } from 'react-router-redux'
|
import { push } from 'connected-react-router'
|
||||||
import AppBar from '@material-ui/core/AppBar'
|
import AppBar from '@material-ui/core/AppBar'
|
||||||
import Typography from '@material-ui/core/Typography'
|
import Typography from '@material-ui/core/Typography'
|
||||||
import { getTranslate, getActiveLanguage } from 'react-localize-redux'
|
import { getTranslate, getActiveLanguage } from 'react-localize-redux'
|
||||||
@@ -132,7 +132,7 @@ export class PeopleComponent extends Component<IPeopleComponentProps,IPeopleComp
|
|||||||
return (
|
return (
|
||||||
<div style={styles.people}>
|
<div style={styles.people}>
|
||||||
<AppBar position='static' color='default'>
|
<AppBar position='static' color='default'>
|
||||||
<Tabs indicatorColor={grey[50]}
|
<Tabs
|
||||||
onChange={this.handleChangeTab}
|
onChange={this.handleChangeTab}
|
||||||
value={tabIndex} centered
|
value={tabIndex} centered
|
||||||
textColor='primary'
|
textColor='primary'
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ export class ProfileComponent extends Component<IProfileComponentProps,IProfileC
|
|||||||
}
|
}
|
||||||
const {loadPosts, hasMorePosts, translate} = this.props
|
const {loadPosts, hasMorePosts, translate} = this.props
|
||||||
const St = StreamComponent as any
|
const St = StreamComponent as any
|
||||||
const posts = Map(this.props.posts)
|
const posts = this.props.posts
|
||||||
return (
|
return (
|
||||||
<div style={styles.profile}>
|
<div style={styles.profile}>
|
||||||
<div style={styles.header}>
|
<div style={styles.header}>
|
||||||
|
|||||||
@@ -1,19 +1,15 @@
|
|||||||
|
|
||||||
export interface IResetPasswordComponentState {
|
export interface IResetPasswordComponentState {
|
||||||
|
|
||||||
|
[key: string]: any
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Email input value
|
* Email input value
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof IResetPasswordComponentState
|
|
||||||
*/
|
*/
|
||||||
emailInput: string
|
emailInput: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Email input error text
|
* Email input error text
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof IResetPasswordComponentState
|
|
||||||
*/
|
*/
|
||||||
emailInputError: string
|
emailInputError: string
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import React, { Component } from 'react'
|
import React, { Component } from 'react'
|
||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import { NavLink, withRouter } from 'react-router-dom'
|
import { NavLink, withRouter } from 'react-router-dom'
|
||||||
import { push } from 'react-router-redux'
|
import { push } from 'connected-react-router'
|
||||||
import config from 'src/config'
|
import config from 'src/config'
|
||||||
import { getTranslate, getActiveLanguage } from 'react-localize-redux'
|
import { getTranslate, getActiveLanguage } from 'react-localize-redux'
|
||||||
|
|
||||||
@@ -141,7 +141,7 @@ export class ResetPasswordComponent extends Component<IResetPasswordComponentPro
|
|||||||
<Button onClick={this.props.loginPage}>{translate!('resetPassword.backButton')}</Button>
|
<Button onClick={this.props.loginPage}>{translate!('resetPassword.backButton')}</Button>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<Button variant='raised' color='primary' onClick={this.handleForm}>{translate!('resetPassword.resetPasswordButton')} </Button>
|
<Button variant='contained' color='primary' onClick={this.handleForm}>{translate!('resetPassword.resetPasswordButton')} </Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Typography className={classes.caption} variant='caption' component='p'>
|
<Typography className={classes.caption} variant='caption' component='p'>
|
||||||
|
|||||||
@@ -1,35 +1,25 @@
|
|||||||
|
|
||||||
export interface ISettingComponentState {
|
export interface ISettingComponentState {
|
||||||
|
|
||||||
|
[key: string]: any
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Password input value
|
* Password input value
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof ISettingComponentState
|
|
||||||
*/
|
*/
|
||||||
passwordInput: string
|
passwordInput: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Password input error text
|
* Password input error text
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof ISettingComponentState
|
|
||||||
*/
|
*/
|
||||||
passwordInputError: string
|
passwordInputError: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Confirm input value
|
* Confirm input value
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof ISettingComponentState
|
|
||||||
*/
|
*/
|
||||||
confirmInput: string
|
confirmInput: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Confirm input error
|
* Confirm input error
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof ISettingComponentState
|
|
||||||
*/
|
*/
|
||||||
confirmInputError: string
|
confirmInputError: string
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import React, { Component } from 'react'
|
import React, { Component } from 'react'
|
||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import { NavLink, withRouter } from 'react-router-dom'
|
import { NavLink, withRouter } from 'react-router-dom'
|
||||||
import { push } from 'react-router-redux'
|
import { push } from 'connected-react-router'
|
||||||
import Paper from '@material-ui/core/Paper'
|
import Paper from '@material-ui/core/Paper'
|
||||||
import TextField from '@material-ui/core/TextField'
|
import TextField from '@material-ui/core/TextField'
|
||||||
import RaisedButton from '@material-ui/core/Button'
|
import RaisedButton from '@material-ui/core/Button'
|
||||||
@@ -186,7 +186,7 @@ export class SettingComponent extends Component<ISettingComponentProps,ISettingC
|
|||||||
<Button onClick={this.props.homePage} > {translate!('changePassword.homeButton')} </Button>
|
<Button onClick={this.props.homePage} > {translate!('changePassword.homeButton')} </Button>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<Button variant='raised' color='primary' onClick={this.handleForm}> {translate!('changePassword.changePasswordButton')} </Button>
|
<Button variant='contained' color='primary' onClick={this.handleForm}> {translate!('changePassword.changePasswordButton')} </Button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,75 +1,50 @@
|
|||||||
|
|
||||||
export interface ISignupComponentState {
|
export interface ISignupComponentState {
|
||||||
|
|
||||||
|
[key: string]: any
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Full name input value
|
* Full name input value
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof ISignupComponentState
|
|
||||||
*/
|
*/
|
||||||
fullNameInput: string
|
fullNameInput: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Full name input error text
|
* Full name input error text
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof ISignupComponentState
|
|
||||||
*/
|
*/
|
||||||
fullNameInputError: string
|
fullNameInputError: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Email input value
|
* Email input value
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof ISignupComponentState
|
|
||||||
*/
|
*/
|
||||||
emailInput: string
|
emailInput: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Email input error text
|
* Email input error text
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof ISignupComponentState
|
|
||||||
*/
|
*/
|
||||||
emailInputError: string
|
emailInputError: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Password input value
|
* Password input value
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof ISignupComponentState
|
|
||||||
*/
|
*/
|
||||||
passwordInput: string
|
passwordInput: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Passwor input error text
|
* Passwor input error text
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof ISignupComponentState
|
|
||||||
*/
|
*/
|
||||||
passwordInputError: string
|
passwordInputError: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Confirm input value
|
* Confirm input value
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof ISignupComponentState
|
|
||||||
*/
|
*/
|
||||||
confirmInput: string
|
confirmInput: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Confirm input error text
|
* Confirm input error text
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof ISignupComponentState
|
|
||||||
*/
|
*/
|
||||||
confirmInputError: string
|
confirmInputError: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checkbox input error text
|
* Checkbox input error text
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof ISignupComponentState
|
|
||||||
*/
|
*/
|
||||||
checkInputError?: string
|
checkInputError?: string
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// - Import react components
|
// - Import react components
|
||||||
import React, { Component } from 'react'
|
import React, { Component } from 'react'
|
||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import { push } from 'react-router-redux'
|
import { push } from 'connected-react-router'
|
||||||
import { NavLink, withRouter } from 'react-router-dom'
|
import { NavLink, withRouter } from 'react-router-dom'
|
||||||
import Paper from '@material-ui/core/Paper'
|
import Paper from '@material-ui/core/Paper'
|
||||||
import TextField from '@material-ui/core/TextField'
|
import TextField from '@material-ui/core/TextField'
|
||||||
@@ -244,7 +244,7 @@ export class SignupComponent extends Component<ISignupComponentProps, ISignupCom
|
|||||||
<Button onClick={this.props.loginPage}>{translate!('signup.loginButton')}</Button>
|
<Button onClick={this.props.loginPage}>{translate!('signup.loginButton')}</Button>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<Button variant='raised' color='primary' onClick={this.handleForm}>{translate!('signup.createButton')}</Button>
|
<Button variant='contained' color='primary' onClick={this.handleForm}>{translate!('signup.createButton')}</Button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -138,24 +138,24 @@ export class StreamComponent extends Component<IStreamComponentProps, IStreamCom
|
|||||||
let posts: Map<string, Map<string, any>> = this.props.posts
|
let posts: Map<string, Map<string, any>> = this.props.posts
|
||||||
let { tag } = match.params
|
let { tag } = match.params
|
||||||
if (posts === undefined || !(posts.keySeq().count() > 0)) {
|
if (posts === undefined || !(posts.keySeq().count() > 0)) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
||||||
<h1>
|
<h1>
|
||||||
'Nothing has shared.'
|
'Nothing has shared.'
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
let postBack = { divided: false, oddPostList: [], evenPostList: [] }
|
let postBack = { divided: false, oddPostList: [], evenPostList: [] }
|
||||||
let parsedPosts: ImuList<any> = ImuList()
|
let parsedPosts: ImuList<any> = ImuList()
|
||||||
posts.forEach((post: Map<string, any>) => {
|
posts.forEach((post: Map<string, any>) => {
|
||||||
if (tag) {
|
if (tag) {
|
||||||
let regex = new RegExp('#' + tag, 'g')
|
let regex = new RegExp('#' + tag, 'g')
|
||||||
let postMatch = String(post.get('body', '')).match(regex)
|
let postMatch = String(post.get('body', '')).match(regex)
|
||||||
if (postMatch !== null) {
|
if (postMatch !== null) {
|
||||||
parsedPosts = parsedPosts.push(post)
|
parsedPosts = parsedPosts.push(post)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
parsedPosts = parsedPosts.push(post)
|
parsedPosts = parsedPosts.push(post)
|
||||||
@@ -164,22 +164,22 @@ export class StreamComponent extends Component<IStreamComponentProps, IStreamCom
|
|||||||
const sortedPosts = PostAPI.sortImuObjectsDate(parsedPosts)
|
const sortedPosts = PostAPI.sortImuObjectsDate(parsedPosts)
|
||||||
if (sortedPosts.count() > 6) {
|
if (sortedPosts.count() > 6) {
|
||||||
postBack.divided = true
|
postBack.divided = true
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
postBack.divided = false
|
postBack.divided = false
|
||||||
}
|
}
|
||||||
let index = 0
|
let index = 0
|
||||||
sortedPosts.forEach((post) => {
|
sortedPosts.forEach((post) => {
|
||||||
|
|
||||||
let newPost: any = (
|
let newPost: any = (
|
||||||
<div key={`${post!.get('id')!}-stream-div`}>
|
<div key={`${post!.get('id')!}-stream-div`}>
|
||||||
|
|
||||||
{index > 1 || (!postBack.divided && index > 0) ? <div style={{ height: '16px' }}></div> : ''}
|
{index > 1 || (!postBack.divided && index > 0) ? <div style={{ height: '16px' }}></div> : ''}
|
||||||
<PostComponent key={`${post!.get('id')}-stream-div-post`} post={post! as any} />
|
<PostComponent key={`${post!.get('id')}-stream-div-post`} post={post! as any} />
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
||||||
if ((index % 2) === 1 && postBack.divided) {
|
if ((index % 2) === 1 && postBack.divided) {
|
||||||
postBack.oddPostList.push(newPost as never)
|
postBack.oddPostList.push(newPost as never)
|
||||||
} else {
|
} else {
|
||||||
@@ -285,8 +285,8 @@ const mapDispatchToProps = (dispatch: any, ownProps: IStreamComponentProps) => {
|
|||||||
* @return {object} props of component
|
* @return {object} props of component
|
||||||
*/
|
*/
|
||||||
const mapStateToProps = (state: Map<string, any>, ownProps: IStreamComponentProps) => {
|
const mapStateToProps = (state: Map<string, any>, ownProps: IStreamComponentProps) => {
|
||||||
const uid = state.getIn(['authorize', 'uid'])
|
const uid = state.getIn(['authorize', 'uid'])
|
||||||
const user = state.getIn(['user', 'info', uid])
|
const user = state.getIn(['user', 'info', uid])
|
||||||
return {
|
return {
|
||||||
translate: getTranslate(state.get('locale')),
|
translate: getTranslate(state.get('locale')),
|
||||||
avatar: user ? user.avatar : '',
|
avatar: user ? user.avatar : '',
|
||||||
|
|||||||
@@ -4,65 +4,41 @@ export class Comment extends BaseDomain {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Comment identifier
|
* Comment identifier
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof Comment
|
|
||||||
*/
|
*/
|
||||||
public id?: string | null
|
public id?: string | null
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Post identifier that comment belong to
|
* Post identifier that comment belong to
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof Comment
|
|
||||||
*/
|
*/
|
||||||
public postId: string
|
public postId: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Comment text
|
* Comment text
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof Comment
|
|
||||||
*/
|
*/
|
||||||
public text?: string | null
|
public text?: string | null
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Comment score
|
* Comment score
|
||||||
*
|
|
||||||
* @type {number}
|
|
||||||
* @memberof Comment
|
|
||||||
*/
|
*/
|
||||||
public score?: number | null
|
public score?: number | null
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Comment creation date
|
* Comment creation date
|
||||||
*
|
|
||||||
* @type {number}
|
|
||||||
* @memberof Comment
|
|
||||||
*/
|
*/
|
||||||
public creationDate?: number
|
public creationDate?: number
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Comment owner full name
|
* Comment owner full name
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof Comment
|
|
||||||
*/
|
*/
|
||||||
public userDisplayName?: string
|
public userDisplayName?: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Comment owner avater address
|
* Comment owner avater address
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof Comment
|
|
||||||
*/
|
*/
|
||||||
public userAvatar?: string
|
public userAvatar?: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Comment owner identifier
|
* Comment owner identifier
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof Comment
|
|
||||||
*/
|
*/
|
||||||
public userId?: string
|
public userId?: string
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { User } from 'core/domain/users'
|
import { User } from 'core/domain/users'
|
||||||
|
import {Map} from 'immutable'
|
||||||
import { Comment } from 'core/domain/comments'
|
import { Comment } from 'core/domain/comments'
|
||||||
import { postComments } from 'models/comments/commentTypes'
|
import { postComments } from 'models/comments/commentTypes'
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@ import { postComments } from 'models/comments/commentTypes'
|
|||||||
export interface ICommentService {
|
export interface ICommentService {
|
||||||
|
|
||||||
addComment: (comment: Comment) => Promise<string>
|
addComment: (comment: Comment) => Promise<string>
|
||||||
getComments: (postId: string, next: (resultComments: postComments) => void) => () => void
|
getComments: (postId: string, next: (resultComments: Map<string, Map<string, any>>) => void) => () => void
|
||||||
updateComment: (comment: Comment) => Promise<void>
|
updateComment: (comment: Comment) => Promise<void>
|
||||||
deleteComment: (commentId: string) => Promise<void>
|
deleteComment: (commentId: string) => Promise<void>
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
// - Import react components
|
// - Import react components
|
||||||
import { firebaseAuth, db } from 'data/firestoreClient'
|
import { firebaseAuth, db } from 'data/firestoreClient'
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
|
import {Map, fromJS} from 'immutable'
|
||||||
|
|
||||||
import { SocialError } from 'core/domain/common'
|
import { SocialError } from 'core/domain/common'
|
||||||
import { ICommentService } from 'core/services/comments'
|
import { ICommentService } from 'core/services/comments'
|
||||||
@@ -41,16 +42,13 @@ export class CommentService implements ICommentService {
|
|||||||
*
|
*
|
||||||
* @memberof CommentService
|
* @memberof CommentService
|
||||||
*/
|
*/
|
||||||
public getComments: (postId: string, next: (resultComments: postComments) => void)
|
public getComments = (postId: string, next: (resultComments: Map<string, Map<string, any>>) => void) => {
|
||||||
=> () => void = (postId, next) => {
|
|
||||||
let commentsRef = db.collection(`comments`).where('postId', '==', postId)
|
let commentsRef = db.collection(`comments`).where('postId', '==', postId)
|
||||||
const unsubscribe = commentsRef.onSnapshot((snapshot) => {
|
const unsubscribe = commentsRef.onSnapshot((snapshot) => {
|
||||||
let parsedData: {[postId: string]: {[commentId: string]: Comment}} = {[postId]: {}}
|
let parsedData: Map<string, Map<string, any>> = Map({})
|
||||||
snapshot.forEach((result) => {
|
snapshot.forEach((result) => {
|
||||||
parsedData[postId][result.id] = {
|
parsedData = parsedData.setIn([postId, result.id], fromJS({id: result.id,
|
||||||
id: result.id,
|
...result.data()}))
|
||||||
...result.data() as Comment
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
if (next) {
|
if (next) {
|
||||||
next(parsedData)
|
next(parsedData)
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import config from 'src/config'
|
|||||||
|
|
||||||
import { Provider } from 'react-redux'
|
import { Provider } from 'react-redux'
|
||||||
import configureStore from 'store/configureStore'
|
import configureStore from 'store/configureStore'
|
||||||
import { ConnectedRouter } from 'react-router-redux'
|
import { ConnectedRouter } from 'connected-react-router/immutable'
|
||||||
|
|
||||||
// - Actions
|
// - Actions
|
||||||
import * as localeActions from 'store/actions/localeActions'
|
import * as localeActions from 'store/actions/localeActions'
|
||||||
@@ -39,24 +39,27 @@ configureStore.store.dispatch(globalActions.initLocale())
|
|||||||
|
|
||||||
// Needed for onClick
|
// Needed for onClick
|
||||||
// http://stackoverflow.com/a/34015469/988941
|
// http://stackoverflow.com/a/34015469/988941
|
||||||
try { injectTapEventPlugin() } catch (e) {}
|
try { injectTapEventPlugin() } catch (e) { }
|
||||||
|
|
||||||
const theme = createMuiTheme({
|
const theme = createMuiTheme({
|
||||||
palette: {
|
palette: {
|
||||||
primary: { main: config.theme.primaryColor },
|
primary: { main: config.theme.primaryColor },
|
||||||
secondary: { main: config.theme.secondaryColor }
|
secondary: { main: config.theme.secondaryColor },
|
||||||
}
|
},
|
||||||
|
typography: {
|
||||||
|
useNextVariants: true,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const supportsHistory = 'pushState' in window.history
|
const supportsHistory = 'pushState' in window.history
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<Provider store={configureStore.store}>
|
<Provider store={configureStore.store}>
|
||||||
<ConnectedRouter history={configureStore.history}>
|
<ConnectedRouter history={configureStore.history}>
|
||||||
<MuiThemeProvider theme={theme}>
|
<MuiThemeProvider theme={theme}>
|
||||||
<Master />
|
<Master />
|
||||||
</MuiThemeProvider>
|
</MuiThemeProvider>
|
||||||
</ConnectedRouter>
|
</ConnectedRouter>
|
||||||
</Provider>,
|
</Provider>,
|
||||||
document.getElementById('app') as HTMLElement
|
document.getElementById('app') as HTMLElement
|
||||||
)
|
)
|
||||||
registerServiceWorker()
|
registerServiceWorker()
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
// - Import react components
|
// - Import react components
|
||||||
import { push } from 'react-router-redux'
|
import { push } from 'connected-react-router'
|
||||||
|
|
||||||
// -Import domain
|
// -Import domain
|
||||||
import { User } from 'src/core/domain/users'
|
import { User } from 'src/core/domain/users'
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { User } from 'src/core/domain/users'
|
|||||||
import { Circle, UserTie } from 'src/core/domain/circles'
|
import { Circle, UserTie } from 'src/core/domain/circles'
|
||||||
import { SocialError } from 'src/core/domain/common'
|
import { SocialError } from 'src/core/domain/common'
|
||||||
import * as moment from 'moment/moment'
|
import * as moment from 'moment/moment'
|
||||||
import { Map, List } from 'immutable'
|
import { Map, List, fromJS } from 'immutable'
|
||||||
|
|
||||||
// - Import action types
|
// - Import action types
|
||||||
import { CircleActionType } from 'constants/circleActionType'
|
import { CircleActionType } from 'constants/circleActionType'
|
||||||
@@ -219,7 +219,7 @@ export const dbUpdateCircle = (newCircle: Circle) => {
|
|||||||
// Write the new data simultaneously in the list
|
// Write the new data simultaneously in the list
|
||||||
let circle: Map<string, any> = state.getIn(['circle', 'circleList', newCircle.id!])
|
let circle: Map<string, any> = state.getIn(['circle', 'circleList', newCircle.id!])
|
||||||
circle = circle.set('name', newCircle.name)
|
circle = circle.set('name', newCircle.name)
|
||||||
return circleService.updateCircle(uid, newCircle.id!, circle.toJS())
|
return circleService.updateCircle(uid, newCircle.id!, circle.toJS() as any)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
circle = circle.set('id', newCircle.id)
|
circle = circle.set('id', newCircle.id)
|
||||||
dispatch(updateCircle(circle))
|
dispatch(updateCircle(circle))
|
||||||
@@ -261,7 +261,7 @@ export const dbGetCircles = () => {
|
|||||||
|
|
||||||
return circleService.getCircles(uid)
|
return circleService.getCircles(uid)
|
||||||
.then((circles: { [circleId: string]: Circle }) => {
|
.then((circles: { [circleId: string]: Circle }) => {
|
||||||
dispatch(addCircles(circles))
|
dispatch(addCircles(fromJS(circles)))
|
||||||
})
|
})
|
||||||
.catch((error: SocialError) => {
|
.catch((error: SocialError) => {
|
||||||
dispatch(globalActions.showMessage(error.message))
|
dispatch(globalActions.showMessage(error.message))
|
||||||
@@ -282,7 +282,7 @@ export const dbGetUserTies = () => {
|
|||||||
userTieService.getUserTies(uid).then((result) => {
|
userTieService.getUserTies(uid).then((result) => {
|
||||||
|
|
||||||
dispatch(userActions.addPeopleInfo(result as any))
|
dispatch(userActions.addPeopleInfo(result as any))
|
||||||
dispatch(addUserTies(result))
|
dispatch(addUserTies(fromJS(result)))
|
||||||
|
|
||||||
})
|
})
|
||||||
.catch((error: SocialError) => {
|
.catch((error: SocialError) => {
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ export const dbAddComment = (ownerPostUserId: string, newComment: Comment, callB
|
|||||||
|
|
||||||
return commentService.addComment(comment)
|
return commentService.addComment(comment)
|
||||||
.then((commentKey: string) => {
|
.then((commentKey: string) => {
|
||||||
dispatch(addComment({ id: commentKey!, ...comment }))
|
dispatch(addComment(Map({ id: commentKey!, ...comment })))
|
||||||
callBack()
|
callBack()
|
||||||
dispatch(globalActions.hideTopLoading())
|
dispatch(globalActions.hideTopLoading())
|
||||||
|
|
||||||
@@ -140,7 +140,7 @@ export const dbDeleteComment = (id?: string | null, postId?: string) => {
|
|||||||
* Add comment
|
* Add comment
|
||||||
* @param {Comment} data
|
* @param {Comment} data
|
||||||
*/
|
*/
|
||||||
export const addComment = (comment: Comment) => {
|
export const addComment = (comment: Map<string, any>) => {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
type: CommentActionType.ADD_COMMENT,
|
type: CommentActionType.ADD_COMMENT,
|
||||||
@@ -163,7 +163,7 @@ export const updateComment = (comment: Comment) => {
|
|||||||
* Add comment list
|
* Add comment list
|
||||||
* @param {[postId: string]: {[commentId: string] : Comment}} postComments an array of comments
|
* @param {[postId: string]: {[commentId: string] : Comment}} postComments an array of comments
|
||||||
*/
|
*/
|
||||||
export const addCommentList = (postComments: { [postId: string]: { [commentId: string]: Comment } }) => {
|
export const addCommentList = (postComments: Map<string, Map<string, any>>) => {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
type: CommentActionType.ADD_COMMENT_LIST,
|
type: CommentActionType.ADD_COMMENT_LIST,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// - Import domain
|
// - Import domain
|
||||||
import { Post } from 'src/core/domain/posts'
|
import { Post } from 'src/core/domain/posts'
|
||||||
import { SocialError } from 'src/core/domain/common'
|
import { SocialError } from 'src/core/domain/common'
|
||||||
import { Map } from 'immutable'
|
import { Map, fromJS } from 'immutable'
|
||||||
|
|
||||||
// - Import utility components
|
// - Import utility components
|
||||||
import moment from 'moment/moment'
|
import moment from 'moment/moment'
|
||||||
@@ -28,7 +28,7 @@ const postService: IPostService = provider.get<IPostService>(SocialProviderTypes
|
|||||||
*/
|
*/
|
||||||
export let dbAddPost = (newPost: Post, callBack: Function) => {
|
export let dbAddPost = (newPost: Post, callBack: Function) => {
|
||||||
return (dispatch: any, getState: Function) => {
|
return (dispatch: any, getState: Function) => {
|
||||||
const state: Map<string, any> = getState()
|
const state: Map<string, any> = getState()
|
||||||
let uid: string = state.getIn(['authorize', 'uid'])
|
let uid: string = state.getIn(['authorize', 'uid'])
|
||||||
let post: Post = {
|
let post: Post = {
|
||||||
postTypeId: 0,
|
postTypeId: 0,
|
||||||
@@ -71,7 +71,7 @@ export const dbAddImagePost = (newPost: Post, callBack: Function) => {
|
|||||||
return (dispatch: any, getState: Function) => {
|
return (dispatch: any, getState: Function) => {
|
||||||
|
|
||||||
dispatch(globalActions.showTopLoading())
|
dispatch(globalActions.showTopLoading())
|
||||||
const state: Map<string, any> = getState()
|
const state: Map<string, any> = getState()
|
||||||
let uid: string = state.getIn(['authorize', 'uid'])
|
let uid: string = state.getIn(['authorize', 'uid'])
|
||||||
let post: Post = {
|
let post: Post = {
|
||||||
postTypeId: 1,
|
postTypeId: 1,
|
||||||
@@ -142,7 +142,7 @@ export const dbDeletePost = (id: string) => {
|
|||||||
|
|
||||||
dispatch(globalActions.showTopLoading())
|
dispatch(globalActions.showTopLoading())
|
||||||
|
|
||||||
const state: Map<string, any> = getState()
|
const state: Map<string, any> = getState()
|
||||||
// Get current user id
|
// Get current user id
|
||||||
let uid: string = state.getIn(['authorize', 'uid'])
|
let uid: string = state.getIn(['authorize', 'uid'])
|
||||||
|
|
||||||
@@ -164,7 +164,7 @@ export const dbDeletePost = (id: string) => {
|
|||||||
*/
|
*/
|
||||||
export const dbGetPosts = (page: number = 0, limit: number = 10) => {
|
export const dbGetPosts = (page: number = 0, limit: number = 10) => {
|
||||||
return (dispatch: any, getState: Function) => {
|
return (dispatch: any, getState: Function) => {
|
||||||
const state: Map<string, any> = getState()
|
const state: Map<string, any> = getState()
|
||||||
const stream: Map<string, any> = state.getIn(['post', 'stream'])
|
const stream: Map<string, any> = state.getIn(['post', 'stream'])
|
||||||
const lastPageRequest = stream.get('lastPageRequest')
|
const lastPageRequest = stream.get('lastPageRequest')
|
||||||
const lastPostId = stream.get('lastPostId')
|
const lastPostId = stream.get('lastPostId')
|
||||||
@@ -178,22 +178,14 @@ export const dbGetPosts = (page: number = 0, limit: number = 10) => {
|
|||||||
|
|
||||||
// Store last post Id
|
// Store last post Id
|
||||||
dispatch(lastPostStream(result.newLastPostId))
|
dispatch(lastPostStream(result.newLastPostId))
|
||||||
|
let parsedData: Map<string, Map<string, any>> = Map({})
|
||||||
let parsedData: { [userId: string]: {[postId: string]: Post} } = {}
|
|
||||||
result.posts.forEach((post) => {
|
result.posts.forEach((post) => {
|
||||||
const postId = Object.keys(post)[0]
|
const postId = Object.keys(post)[0]
|
||||||
const postData = post[postId]
|
const postData = post[postId]
|
||||||
const ownerId = postData.ownerUserId!
|
const ownerId = postData.ownerUserId!
|
||||||
parsedData = {
|
parsedData = parsedData.setIn([ownerId, postId], fromJS(postData))
|
||||||
...parsedData,
|
|
||||||
[ownerId]: {
|
|
||||||
...parsedData[ownerId],
|
|
||||||
[postId]: {
|
|
||||||
...postData
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
dispatch(addPosts(parsedData))
|
dispatch(addPosts(parsedData))
|
||||||
})
|
})
|
||||||
.catch((error: SocialError) => {
|
.catch((error: SocialError) => {
|
||||||
@@ -209,10 +201,10 @@ export const dbGetPosts = (page: number = 0, limit: number = 10) => {
|
|||||||
*/
|
*/
|
||||||
export const dbGetPostsByUserId = (userId: string, page: number = 0, limit: number = 10) => {
|
export const dbGetPostsByUserId = (userId: string, page: number = 0, limit: number = 10) => {
|
||||||
return (dispatch: any, getState: Function) => {
|
return (dispatch: any, getState: Function) => {
|
||||||
const state: Map<string, any> = getState()
|
const state: Map<string, any> = getState()
|
||||||
const {profile} = state.get('post')
|
const { profile } = state.get('post')
|
||||||
const lastPageRequest = state.getIn(['post','profile', userId, 'lastPageRequest'], -1 )
|
const lastPageRequest = state.getIn(['post', 'profile', userId, 'lastPageRequest'], -1)
|
||||||
const lastPostId = state.getIn(['post','profile', userId, 'lastPostId'], '' )
|
const lastPostId = state.getIn(['post', 'profile', userId, 'lastPostId'], '')
|
||||||
|
|
||||||
let uid: string = state.getIn(['authorize', 'uid'])
|
let uid: string = state.getIn(['authorize', 'uid'])
|
||||||
|
|
||||||
@@ -226,20 +218,12 @@ export const dbGetPostsByUserId = (userId: string, page: number = 0, limit: numb
|
|||||||
// Store last post Id
|
// Store last post Id
|
||||||
dispatch(lastPostProfile(userId, result.newLastPostId))
|
dispatch(lastPostProfile(userId, result.newLastPostId))
|
||||||
|
|
||||||
let parsedData: { [userId: string]: {[postId: string]: Post} } = {}
|
let parsedData: Map<string, Map<string, any>> = Map({})
|
||||||
result.posts.forEach((post) => {
|
result.posts.forEach((post) => {
|
||||||
const postId = Object.keys(post)[0]
|
const postId = Object.keys(post)[0]
|
||||||
const postData = post[postId]
|
const postData = post[postId]
|
||||||
const ownerId = postData.ownerUserId!
|
const ownerId = postData.ownerUserId!
|
||||||
parsedData = {
|
parsedData = parsedData.setIn([ownerId, postId], fromJS(postData))
|
||||||
...parsedData,
|
|
||||||
[ownerId]: {
|
|
||||||
...parsedData[ownerId],
|
|
||||||
[postId]: {
|
|
||||||
...postData
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
dispatch(addPosts(parsedData))
|
dispatch(addPosts(parsedData))
|
||||||
})
|
})
|
||||||
@@ -324,7 +308,7 @@ export const deletePost = (uid: string, id: string) => {
|
|||||||
/**
|
/**
|
||||||
* Add a list of post
|
* Add a list of post
|
||||||
*/
|
*/
|
||||||
export const addPosts = (userPosts: { [userId: string]: {[postId: string]: Post} }) => {
|
export const addPosts = (userPosts: Map<string, Map<string, any>>) => {
|
||||||
return {
|
return {
|
||||||
type: PostActionType.ADD_LIST_POST,
|
type: PostActionType.ADD_LIST_POST,
|
||||||
payload: { userPosts }
|
payload: { userPosts }
|
||||||
@@ -377,7 +361,7 @@ export const notMoreDataStream = () => {
|
|||||||
export const requestPageStream = (page: number) => {
|
export const requestPageStream = (page: number) => {
|
||||||
return {
|
return {
|
||||||
type: PostActionType.REQUEST_PAGE_STREAM,
|
type: PostActionType.REQUEST_PAGE_STREAM,
|
||||||
payload: { page}
|
payload: { page }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -388,7 +372,7 @@ export const requestPageStream = (page: number) => {
|
|||||||
export const lastPostStream = (lastPostId: string) => {
|
export const lastPostStream = (lastPostId: string) => {
|
||||||
return {
|
return {
|
||||||
type: PostActionType.LAST_POST_STREAM,
|
type: PostActionType.LAST_POST_STREAM,
|
||||||
payload: { lastPostId}
|
payload: { lastPostId }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -409,7 +393,7 @@ export const hasMoreDataProfile = () => {
|
|||||||
export const notMoreDataProfile = (userId: string) => {
|
export const notMoreDataProfile = (userId: string) => {
|
||||||
return {
|
return {
|
||||||
type: PostActionType.NOT_MORE_DATA_PROFILE,
|
type: PostActionType.NOT_MORE_DATA_PROFILE,
|
||||||
payload: {userId}
|
payload: { userId }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -420,7 +404,7 @@ export const notMoreDataProfile = (userId: string) => {
|
|||||||
export const requestPageProfile = (userId: string, page: number) => {
|
export const requestPageProfile = (userId: string, page: number) => {
|
||||||
return {
|
return {
|
||||||
type: PostActionType.REQUEST_PAGE_PROFILE,
|
type: PostActionType.REQUEST_PAGE_PROFILE,
|
||||||
payload: {userId, page}
|
payload: { userId, page }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -431,7 +415,7 @@ export const requestPageProfile = (userId: string, page: number) => {
|
|||||||
export const lastPostProfile = (userId: string, lastPostId: string) => {
|
export const lastPostProfile = (userId: string, lastPostId: string) => {
|
||||||
return {
|
return {
|
||||||
type: PostActionType.LAST_POST_PROFILE,
|
type: PostActionType.LAST_POST_PROFILE,
|
||||||
payload: { userId, lastPostId}
|
payload: { userId, lastPostId }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,13 +2,14 @@
|
|||||||
import { createStore, applyMiddleware, compose, Store } from 'redux'
|
import { createStore, applyMiddleware, compose, Store } from 'redux'
|
||||||
import { composeWithDevTools } from 'redux-devtools-extension'
|
import { composeWithDevTools } from 'redux-devtools-extension'
|
||||||
import thunk from 'redux-thunk'
|
import thunk from 'redux-thunk'
|
||||||
import { routerMiddleware } from 'react-router-redux'
|
|
||||||
import createHistory from 'history/createBrowserHistory'
|
import createHistory from 'history/createBrowserHistory'
|
||||||
import createSagaMiddleware, { END } from 'redux-saga'
|
import createSagaMiddleware, { END } from 'redux-saga'
|
||||||
import { createLogger } from 'redux-logger'
|
import { createLogger } from 'redux-logger'
|
||||||
import { rootReducer } from 'store/reducers'
|
import { rootReducer } from 'store/reducers'
|
||||||
import { fromJS, Iterable, Map } from 'immutable'
|
import { fromJS, Map } from 'immutable'
|
||||||
import DevTools from './devTools'
|
import DevTools from './devTools'
|
||||||
|
import { routerMiddleware, connectRouter } from 'connected-react-router/immutable'
|
||||||
|
|
||||||
// Create a history of your choosing (we're using a browser history in this case)
|
// Create a history of your choosing (we're using a browser history in this case)
|
||||||
export const history = createHistory()
|
export const history = createHistory()
|
||||||
|
|
||||||
@@ -30,7 +31,7 @@ let initialState = {
|
|||||||
const composeEnhancers = composeWithDevTools({
|
const composeEnhancers = composeWithDevTools({
|
||||||
// Specify extension’s options like name, actionsBlacklist, actionsCreators, serialize...
|
// Specify extension’s options like name, actionsBlacklist, actionsCreators, serialize...
|
||||||
})
|
})
|
||||||
let store: Store<any> = createStore(rootReducer, fromJS(initialState), composeEnhancers(
|
let store: Store<any> = createStore(rootReducer(history), fromJS(initialState), composeEnhancers(
|
||||||
applyMiddleware(logger,thunk, routerMiddleware(history), sagaMiddleware)
|
applyMiddleware(logger,thunk, routerMiddleware(history), sagaMiddleware)
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
// - Import external components
|
// - Import external components
|
||||||
import * as redux from 'redux'
|
import * as redux from 'redux'
|
||||||
import thunk from 'redux-thunk'
|
import thunk from 'redux-thunk'
|
||||||
import { routerMiddleware } from 'react-router-redux'
|
import DevTools from './devTools'
|
||||||
import createHistory from 'history/createBrowserHistory'
|
import createHistory from 'history/createBrowserHistory'
|
||||||
import createSagaMiddleware, { END } from 'redux-saga'
|
import createSagaMiddleware, { END } from 'redux-saga'
|
||||||
import { rootReducer } from 'store/reducers'
|
import { rootReducer } from 'store/reducers'
|
||||||
import { fromJS } from 'immutable'
|
import { fromJS } from 'immutable'
|
||||||
|
import { routerMiddleware, connectRouter } from 'connected-react-router/immutable'
|
||||||
// Create a history of your choosing (we're using a browser history in this case)
|
// Create a history of your choosing (we're using a browser history in this case)
|
||||||
export const history = createHistory()
|
export const history = createHistory()
|
||||||
|
|
||||||
@@ -17,7 +18,7 @@ let initialState = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// - Config and create store of redux
|
// - Config and create store of redux
|
||||||
let store: redux.Store<any> = redux.createStore(rootReducer, fromJS(initialState), redux.compose(
|
let store: redux.Store<any> = redux.createStore(rootReducer(history), fromJS(initialState), redux.compose(
|
||||||
redux.applyMiddleware(thunk, routerMiddleware(history), sagaMiddleware)
|
redux.applyMiddleware(thunk, routerMiddleware(history), sagaMiddleware)
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import { Map } from 'immutable'
|
|||||||
* @param {object} state
|
* @param {object} state
|
||||||
* @param {object} action
|
* @param {object} action
|
||||||
*/
|
*/
|
||||||
export let authorizeReducer = (state = Map(new AuthorizeState()), action: IAuthorizeAction) => {
|
export let authorizeReducer = (state = Map(new AuthorizeState() as any), action: IAuthorizeAction) => {
|
||||||
const { payload } = action
|
const { payload } = action
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case AuthorizeActionType.LOGIN:
|
case AuthorizeActionType.LOGIN:
|
||||||
|
|||||||
@@ -3,22 +3,16 @@ import {Map} from 'immutable'
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Circle state
|
* Circle state
|
||||||
*
|
|
||||||
* @export
|
|
||||||
* @class CircleState
|
|
||||||
*/
|
*/
|
||||||
export class CircleState {
|
export class CircleState {
|
||||||
|
[key: string]: any
|
||||||
/**
|
/**
|
||||||
* The list of users belong to users circle
|
* The list of users belong to users circle
|
||||||
*
|
|
||||||
* @memberof CircleState
|
|
||||||
*/
|
*/
|
||||||
userTies: Map<string, UserTie> = Map({})
|
userTies: Map<string, UserTie> = Map({})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The list of users belong to users circle
|
* The list of users belong to users circle
|
||||||
*
|
|
||||||
* @memberof CircleState
|
|
||||||
*/
|
*/
|
||||||
userTieds: Map<string, UserTie> = Map({})
|
userTieds: Map<string, UserTie> = Map({})
|
||||||
|
|
||||||
@@ -49,8 +43,6 @@ export class CircleState {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* If user circles are loaded {true} or not {false}
|
* If user circles are loaded {true} or not {false}
|
||||||
*
|
|
||||||
* @memberof CircleState
|
|
||||||
*/
|
*/
|
||||||
loaded: boolean = false
|
loaded: boolean = false
|
||||||
|
|
||||||
|
|||||||
@@ -136,11 +136,10 @@ export let circleReducer = (state = Map(new CircleState()), action: ICircleActio
|
|||||||
/**
|
/**
|
||||||
* Map user ties selected to selected circles
|
* Map user ties selected to selected circles
|
||||||
*/
|
*/
|
||||||
const getSelectedCircles = (userTies: { [userId: string]: UserTie }) => {
|
const getSelectedCircles = (userTies: Map<string, any>) => {
|
||||||
let selectedCircles: Map<string, List<string>> = Map({})
|
let selectedCircles: Map<string, List<string>> = Map({})
|
||||||
Object.keys(userTies).forEach((userId: string) => {
|
userTies.forEach((userTie) => {
|
||||||
const userTie = (userTies as { [userId: string]: UserTie })[userId]
|
selectedCircles = selectedCircles.set(userTie.get('userId'), List(userTie.get('circleIdList')))
|
||||||
selectedCircles = selectedCircles.set(userTie.userId!, List(userTie.circleIdList!))
|
|
||||||
})
|
})
|
||||||
|
|
||||||
return selectedCircles
|
return selectedCircles
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import {Map} from 'immutable'
|
|||||||
*/
|
*/
|
||||||
export class CommentState {
|
export class CommentState {
|
||||||
|
|
||||||
|
[key: string]: any
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The list of comments on the posts
|
* The list of comments on the posts
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export let commentReducer = (state = Map(new CommentState()), action: ICommentAc
|
|||||||
/* _____________ CRUD _____________ */
|
/* _____________ CRUD _____________ */
|
||||||
case CommentActionType.ADD_COMMENT:
|
case CommentActionType.ADD_COMMENT:
|
||||||
return state
|
return state
|
||||||
.setIn(['postComments', payload.postId, payload.id], payload)
|
.setIn(['postComments', payload.get('postId'), payload.get('id')], payload)
|
||||||
|
|
||||||
case CommentActionType.ADD_COMMENT_LIST:
|
case CommentActionType.ADD_COMMENT_LIST:
|
||||||
return state
|
return state
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import { Map, fromJS, List } from 'immutable'
|
|||||||
*/
|
*/
|
||||||
export class GlobalState {
|
export class GlobalState {
|
||||||
|
|
||||||
|
[key: string]: any
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set percent of loading progress and visibility for Master component
|
* Set percent of loading progress and visibility for Master component
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import {Map, Collection, List} from 'immutable'
|
|||||||
* @class ImageGalleryState
|
* @class ImageGalleryState
|
||||||
*/
|
*/
|
||||||
export class ImageGalleryState {
|
export class ImageGalleryState {
|
||||||
|
|
||||||
|
[key: string]: any
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Image gallery is open {true} or not {false}
|
* Image gallery is open {true} or not {false}
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import {Map} from 'immutable'
|
|||||||
*/
|
*/
|
||||||
export class NotificationState {
|
export class NotificationState {
|
||||||
|
|
||||||
|
[key: string]: any
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The list of users notification
|
* The list of users notification
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { Map, fromJS, List } from 'immutable'
|
|||||||
* @class PostState
|
* @class PostState
|
||||||
*/
|
*/
|
||||||
export class PostState {
|
export class PostState {
|
||||||
|
[key: string]: any
|
||||||
/**
|
/**
|
||||||
* The list of user posts
|
* The list of user posts
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -14,10 +14,10 @@ import { postReducer } from './posts'
|
|||||||
import { userReducer } from './users'
|
import { userReducer } from './users'
|
||||||
import { voteReducer } from './votes'
|
import { voteReducer } from './votes'
|
||||||
import { serverReducer } from './server'
|
import { serverReducer } from './server'
|
||||||
import { routerReducer, routerMiddleware } from 'react-router-redux'
|
import { connectRouter } from 'connected-react-router/immutable'
|
||||||
|
|
||||||
// - Reducers
|
// - Reducers
|
||||||
export const rootReducer = combineReducers({
|
export const rootReducer = (history: any) => combineReducers({
|
||||||
locale,
|
locale,
|
||||||
imageGallery: imageGalleryReducer,
|
imageGallery: imageGalleryReducer,
|
||||||
post: postReducer,
|
post: postReducer,
|
||||||
@@ -26,7 +26,7 @@ export const rootReducer = combineReducers({
|
|||||||
vote: voteReducer,
|
vote: voteReducer,
|
||||||
server: serverReducer,
|
server: serverReducer,
|
||||||
authorize: authorizeReducer,
|
authorize: authorizeReducer,
|
||||||
router: routerReducer,
|
router: connectRouter(history),
|
||||||
user: userReducer,
|
user: userReducer,
|
||||||
notify: notificationReducer,
|
notify: notificationReducer,
|
||||||
global: globalReducer
|
global: globalReducer
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import {Map} from 'immutable'
|
|||||||
* @class ServerState
|
* @class ServerState
|
||||||
*/
|
*/
|
||||||
export class ServerState {
|
export class ServerState {
|
||||||
|
[key: string]: any
|
||||||
/**
|
/**
|
||||||
* The list of posts server
|
* The list of posts server
|
||||||
* @memberof ServerState
|
* @memberof ServerState
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import { Map, fromJS, List } from 'immutable'
|
|||||||
* @class UserState
|
* @class UserState
|
||||||
*/
|
*/
|
||||||
export class UserState {
|
export class UserState {
|
||||||
|
[key: string]: any
|
||||||
/**
|
/**
|
||||||
* The list of users information
|
* The list of users information
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { Vote } from 'src/core/domain/votes'
|
|||||||
* @class VoteState
|
* @class VoteState
|
||||||
*/
|
*/
|
||||||
export class VoteState {
|
export class VoteState {
|
||||||
|
[key: string]: any
|
||||||
/**
|
/**
|
||||||
* The list of posts vote
|
* The list of posts vote
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ const commentService: ICommentService = provider.get<ICommentService>(SocialProv
|
|||||||
* Creating channel event and subscribing get comments service
|
* Creating channel event and subscribing get comments service
|
||||||
*/
|
*/
|
||||||
function fetchCommentsChannel(postId: string) {
|
function fetchCommentsChannel(postId: string) {
|
||||||
return eventChannel<postComments>((emmiter) => {
|
return eventChannel<Map<string, Map<string, any>>>((emmiter) => {
|
||||||
const unsubscribe = commentService.getComments(postId, (comments: postComments) => {
|
const unsubscribe = commentService.getComments(postId, (comments: Map<string, Map<string, any>>) => {
|
||||||
emmiter(comments)
|
emmiter(comments)
|
||||||
})
|
})
|
||||||
return () => {
|
return () => {
|
||||||
@@ -35,7 +35,7 @@ function fetchCommentsChannel(postId: string) {
|
|||||||
/**
|
/**
|
||||||
* Set comments in store
|
* Set comments in store
|
||||||
*/
|
*/
|
||||||
function* setComments(ownerId: string, postId: string, comments: postComments) {
|
function* setComments(ownerId: string, postId: string, comments: Map<string, Map<string, any>>) {
|
||||||
/**
|
/**
|
||||||
* Workout getting the number of post's comment and getting three last comments
|
* Workout getting the number of post's comment and getting three last comments
|
||||||
*/
|
*/
|
||||||
@@ -61,7 +61,7 @@ function* dbFetchComments(ownerId: string, postId: string) {
|
|||||||
const currentUser = yield select(authorizeSelector.getCurrentUser)
|
const currentUser = yield select(authorizeSelector.getCurrentUser)
|
||||||
const getCommentsRequest = CommentAPI.createGetCommentsRequest(postId)
|
const getCommentsRequest = CommentAPI.createGetCommentsRequest(postId)
|
||||||
yield put(serverActions.sendRequest(getCommentsRequest))
|
yield put(serverActions.sendRequest(getCommentsRequest))
|
||||||
const channelSubscription: Channel<postComments> = yield call(fetchCommentsChannel, postId)
|
const channelSubscription: Channel<Map<string, Map<string, any>>> = yield call(fetchCommentsChannel, postId)
|
||||||
|
|
||||||
let comments = yield take(channelSubscription)
|
let comments = yield take(channelSubscription)
|
||||||
getCommentsRequest.status = ServerRequestStatusType.OK
|
getCommentsRequest.status = ServerRequestStatusType.OK
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
],
|
],
|
||||||
"no-consecutive-blank-lines": true,
|
"no-consecutive-blank-lines": true,
|
||||||
"no-construct": true,
|
"no-construct": true,
|
||||||
"no-debugger": true,
|
"no-debugger": false,
|
||||||
"no-duplicate-variable": true,
|
"no-duplicate-variable": true,
|
||||||
"no-empty": false,
|
"no-empty": false,
|
||||||
"no-eval": true,
|
"no-eval": true,
|
||||||
|
|||||||
Reference in New Issue
Block a user