Progress, Deck done
This commit is contained in:
@@ -95,9 +95,8 @@ const messages = defineMessages({
|
||||
|
||||
const emptyList = ImmutableList()
|
||||
|
||||
const mapStateToProps = (state, { account, commentsOnly = false }) => {
|
||||
const accountId = !!account ? account.getIn(['id'], null) : -1
|
||||
|
||||
const mapStateToProps = (state, { id, account, commentsOnly = false }) => {
|
||||
const accountId = !!id ? id : !!account ? account.getIn(['id'], null) : -1
|
||||
const path = commentsOnly ? `${accountId}:comments_only` : accountId
|
||||
|
||||
return {
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import React from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import { connect } from 'react-redux'
|
||||
import { fetchChatConversationAccountSuggestions } from '../actions/chats'
|
||||
import {
|
||||
fetchChatConversationAccountSuggestions,
|
||||
clearChatConversationAccountSuggestions,
|
||||
} from '../actions/chats'
|
||||
import { createChatConversation } from '../actions/chat_conversations'
|
||||
import Account from '../components/account'
|
||||
import Button from '../components/button'
|
||||
@@ -22,6 +25,11 @@ class ChatConversationCreate extends React.PureComponent {
|
||||
|
||||
handleOnCreateChatConversation = (accountId) => {
|
||||
this.props.onCreateChatConversation(accountId)
|
||||
this.props.onClearChatConversationAccountSuggestions()
|
||||
|
||||
if (this.props.isModal && !!this.props.onCloseModal) {
|
||||
this.props.onCloseModal()
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
@@ -47,7 +55,7 @@ class ChatConversationCreate extends React.PureComponent {
|
||||
suggestionsIds.map((accountId) => (
|
||||
<Account
|
||||
compact
|
||||
key={`remove-from-list-${accountId}`}
|
||||
key={`chat-conversation-account-create-${accountId}`}
|
||||
id={accountId}
|
||||
onActionClick={() => this.handleOnCreateChatConversation(accountId)}
|
||||
actionIcon='add'
|
||||
@@ -67,12 +75,15 @@ const mapStateToProps = (state) => ({
|
||||
})
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
onChange: (value) => {
|
||||
onChange(value) {
|
||||
dispatch(fetchChatConversationAccountSuggestions(value))
|
||||
},
|
||||
onCreateChatConversation: (accountId) => {
|
||||
onCreateChatConversation(accountId) {
|
||||
dispatch(createChatConversation(accountId))
|
||||
},
|
||||
onClearChatConversationAccountSuggestions() {
|
||||
dispatch(clearChatConversationAccountSuggestions())
|
||||
}
|
||||
})
|
||||
|
||||
ChatConversationCreate.propTypes = {
|
||||
|
||||
@@ -30,10 +30,18 @@ class ComposeDestinationHeader extends ImmutablePureComponent {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { account, isModal, formLocation } = this.props
|
||||
const {
|
||||
account,
|
||||
isModal,
|
||||
composeGroup,
|
||||
formLocation,
|
||||
} = this.props
|
||||
|
||||
const isIntroduction = formLocation === 'introduction'
|
||||
const title = 'Post to timeline'
|
||||
|
||||
let groupTitle = !!composeGroup ? composeGroup.get('title') : ''
|
||||
groupTitle = groupTitle.length > 32 ? `${groupTitle.substring(0, 32).trim()}...` : groupTitle
|
||||
const title = !!composeGroup ? `Post to ${groupTitle}` : 'Post to timeline'
|
||||
|
||||
return (
|
||||
<div className={[_s.d, _s.flexRow, _s.aiCenter, _s.bgPrimary, _s.w100PC, _s.h40PX, _s.pr15].join(' ')}>
|
||||
@@ -76,6 +84,15 @@ class ComposeDestinationHeader extends ImmutablePureComponent {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
const composeGroupId = state.getIn(['compose', 'group_id'])
|
||||
|
||||
return {
|
||||
composeGroupId,
|
||||
composeGroup: state.getIn(['groups', composeGroupId]),
|
||||
}
|
||||
}
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
onOpenModal() {
|
||||
dispatch(openModal(MODAL_COMPOSE))
|
||||
@@ -96,4 +113,4 @@ ComposeDestinationHeader.propTypes = {
|
||||
formLocation: PropTypes.string,
|
||||
}
|
||||
|
||||
export default connect(null, mapDispatchToProps)(ComposeDestinationHeader)
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(ComposeDestinationHeader)
|
||||
@@ -134,6 +134,11 @@ class ComposeForm extends ImmutablePureComponent {
|
||||
|
||||
componentDidMount() {
|
||||
document.addEventListener('click', this.handleClick, false)
|
||||
|
||||
const { groupId } = this.props
|
||||
if (groupId) {
|
||||
this.props.onChangeComposeGroupId(groupId)
|
||||
}
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
changeComposeSpoilerText,
|
||||
uploadCompose,
|
||||
changeScheduledAt,
|
||||
changeComposeGroupId,
|
||||
} from '../../../actions/compose'
|
||||
import { openModal } from '../../../actions/modal'
|
||||
import { MODAL_COMPOSE } from '../../../constants'
|
||||
@@ -132,6 +133,10 @@ const mapDispatchToProps = (dispatch, { isStandalone }) => ({
|
||||
openComposeModal() {
|
||||
dispatch(openModal(MODAL_COMPOSE))
|
||||
},
|
||||
|
||||
onChangeComposeGroupId(groupId) {
|
||||
dispatch(changeComposeGroupId(groupId))
|
||||
}
|
||||
})
|
||||
|
||||
function mergeProps(stateProps, dispatchProps, ownProps) {
|
||||
|
||||
@@ -73,9 +73,9 @@ class Deck extends React.PureComponent {
|
||||
getDeckColumn = (deckColumn, index) => {
|
||||
if (!deckColumn || !this.props.isPro) return null
|
||||
|
||||
let Component = null
|
||||
let Component, noRefresh, accountId, icon = null
|
||||
let componentParams = {}
|
||||
let title, subtitle, icon = ''
|
||||
let title, subtitle = ''
|
||||
|
||||
switch (deckColumn) {
|
||||
case 'notifications':
|
||||
@@ -92,6 +92,7 @@ class Deck extends React.PureComponent {
|
||||
title = 'Compose'
|
||||
icon = 'pencil'
|
||||
Component = Compose
|
||||
noRefresh = true
|
||||
break
|
||||
case 'likes':
|
||||
title = 'Likes'
|
||||
@@ -127,7 +128,11 @@ class Deck extends React.PureComponent {
|
||||
|
||||
if (!Component) {
|
||||
if (deckColumn.indexOf('user.') > -1) {
|
||||
|
||||
const userAccountId = deckColumn.replace('user.', '')
|
||||
title = 'User'
|
||||
Component = AccountTimeline
|
||||
componentParams = { id: userAccountId }
|
||||
accountId = userAccountId
|
||||
} else if (deckColumn.indexOf('list.') > -1) {
|
||||
const listId = deckColumn.replace('list.', '')
|
||||
title = 'List'
|
||||
@@ -162,7 +167,14 @@ class Deck extends React.PureComponent {
|
||||
index={index}
|
||||
sortIndex={index}
|
||||
>
|
||||
<DeckColumn title={title} subtitle={subtitle} icon={icon} index={index}>
|
||||
<DeckColumn
|
||||
title={title}
|
||||
subtitle={subtitle}
|
||||
icon={icon}
|
||||
index={index}
|
||||
noRefresh={noRefresh}
|
||||
accountId={accountId}
|
||||
>
|
||||
<WrappedBundle component={Component} componentParams={componentParams} />
|
||||
</DeckColumn>
|
||||
</SortableItem>
|
||||
|
||||
@@ -182,9 +182,7 @@ class SlideFirstPost extends React.PureComponent {
|
||||
<Text size='large' className={_s.pb10}>Now let's make your very first Gab post! Please introduce yourself to the Gab community. How did you hear about Gab? What are you interested in?</Text>
|
||||
<br />
|
||||
|
||||
<Divider />
|
||||
|
||||
<div className={[_s.d, _s.mt15, _s.boxShadowBlock, _s.radiusSmall].join(' ')}>
|
||||
<div className={[_s.d, _s.boxShadowBlock, _s.overflowHidden, _s.radiusSmall].join(' ')}>
|
||||
<ComposeFormContainer
|
||||
formLocation='introduction'
|
||||
groupId={GAB_COM_INTRODUCE_YOURSELF_GROUP_ID}
|
||||
|
||||
@@ -141,7 +141,9 @@ class ChatMessageItem extends ImmutablePureComponent {
|
||||
<div className={[_s.d, _s.w100PC, _s.pb15].join(' ')}>
|
||||
|
||||
<div className={messageContainerClasses}>
|
||||
<Avatar account={chatMessage.get('account')} size={38} />
|
||||
<NavLink to={`/${chatMessage.getIn(['account', 'username'])}`}>
|
||||
<Avatar account={chatMessage.get('account')} size={38} />
|
||||
</NavLink>
|
||||
<div className={messageInnerContainerClasses}>
|
||||
<div className={[_s.py5, _s.dangerousContent, _s.cPrimary].join(' ')} dangerouslySetInnerHTML={content} />
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user