Progress
This commit is contained in:
@@ -79,6 +79,7 @@ class ComposeForm extends ImmutablePureComponent {
|
||||
isModalOpen: PropTypes.bool,
|
||||
scheduledAt: PropTypes.instanceOf(Date),
|
||||
setScheduledAt: PropTypes.func.isRequired,
|
||||
replyToId: PropTypes.string,
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
@@ -231,7 +232,6 @@ class ComposeForm extends ImmutablePureComponent {
|
||||
scheduledAt,
|
||||
spoiler
|
||||
} = this.props
|
||||
const condensed = shouldCondense && !this.props.text && !this.state.composeFocused;
|
||||
const disabled = this.props.isSubmitting;
|
||||
const text = [this.props.spoilerText, countableText(this.props.text)].join('');
|
||||
const disabledButton = disabled || this.props.isUploading || this.props.isChangingUpload || length(text) > maxPostCharacterCount || (text.length !== 0 && text.trim().length === 0 && !anyMedia);
|
||||
|
||||
@@ -7,6 +7,11 @@ import { WhoToFollowPanel } from '../../../../components/panel'
|
||||
// import TrendsPanel from '../../ui/components/trends_panel'
|
||||
import GroupListItem from '../../../../components/group_list_item'
|
||||
import Block from '../../../../components/block'
|
||||
import Heading from '../../../../components/heading'
|
||||
import Button from '../../../../components/button'
|
||||
import Text from '../../../../components/text'
|
||||
|
||||
import AccountContainer from '../../../../containers/account_container'
|
||||
|
||||
export default class SearchResults extends ImmutablePureComponent {
|
||||
|
||||
@@ -25,9 +30,7 @@ export default class SearchResults extends ImmutablePureComponent {
|
||||
|
||||
if (results.isEmpty() && isSmallScreen) {
|
||||
return (
|
||||
<div className='search-results'>
|
||||
<WhoToFollowPanel />
|
||||
</div>
|
||||
<div />
|
||||
)
|
||||
}
|
||||
|
||||
@@ -37,23 +40,39 @@ export default class SearchResults extends ImmutablePureComponent {
|
||||
const showGroups = pathname === '/search/groups'
|
||||
const isTop = !showPeople && !showHashtags && !showGroups
|
||||
|
||||
let accounts, statuses, hashtags, groups;
|
||||
let count = 0;
|
||||
let accounts, statuses, hashtags, groups
|
||||
|
||||
if (results.get('accounts') && results.get('accounts').size > 0 && (isTop || showPeople)) {
|
||||
const size = isTop ? Math.min(results.get('accounts').size, 5) : results.get('accounts').size;
|
||||
count += size;
|
||||
accounts = (
|
||||
<div className='search-results__section'>
|
||||
<h5><Icon id='user' fixedWidth /><FormattedMessage id='search_results.accounts' defaultMessage='People' /></h5>
|
||||
{results.get('accounts').slice(0, size).map(accountId => <AccountContainer key={accountId} id={accountId} />)}
|
||||
<div className={[_s.default, _s.py15, _s.px15].join(' ')}>
|
||||
<div className={[_s.default, _s.flexRow, _s.mb15].join(' ')}>
|
||||
<Heading size='h3'>
|
||||
People
|
||||
</Heading>
|
||||
<div className={[_s.default, _s.marginLeftAuto].join(' ')}>
|
||||
<Button
|
||||
text
|
||||
backgroundColor='none'
|
||||
color='brand'
|
||||
to='/search/people'
|
||||
>
|
||||
<Text size='small' color='inherit' weight='bold'>
|
||||
See All
|
||||
</Text>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{
|
||||
results.get('accounts').slice(0, size).map(accountId => <AccountContainer expanded key={accountId} id={accountId} />)
|
||||
}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (results.get('groups') && results.get('groups').size > 0 && (isTop || showGroups)) {
|
||||
const size = isTop ? Math.min(results.get('groups').size, 5) : results.get('groups').size;
|
||||
count += size;
|
||||
groups = (
|
||||
<div className='search-results__section'>
|
||||
<h5><Icon id='users' fixedWidth /><FormattedMessage id='search_results.groups' defaultMessage='Groups' /></h5>
|
||||
@@ -64,7 +83,6 @@ export default class SearchResults extends ImmutablePureComponent {
|
||||
|
||||
if (results.get('hashtags') && results.get('hashtags').size > 0 && (isTop || showHashtags)) {
|
||||
const size = isTop ? Math.min(results.get('hashtags').size, 5) : results.get('hashtags').size;
|
||||
count += size;
|
||||
hashtags = (
|
||||
<div className='search-results__section'>
|
||||
<h5><Icon id='hashtag' fixedWidth /><FormattedMessage id='search_results.hashtags' defaultMessage='Hashtags' /></h5>
|
||||
@@ -75,17 +93,6 @@ export default class SearchResults extends ImmutablePureComponent {
|
||||
|
||||
return (
|
||||
<Block>
|
||||
<div className='search-results__header'>
|
||||
<Icon id='search' fixedWidth />
|
||||
<FormattedMessage
|
||||
id='search_results.total'
|
||||
defaultMessage='{count, number} {count, plural, one {result} other {results}}'
|
||||
values={{
|
||||
count
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{accounts}
|
||||
{groups}
|
||||
{statuses}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { List as ImmutableList } from 'immutable'
|
||||
import ComposeForm from '../components/compose_form'
|
||||
import {
|
||||
changeCompose,
|
||||
@@ -12,29 +13,31 @@ import {
|
||||
} from '../../../actions/compose'
|
||||
import { me } from '../../../initial_state'
|
||||
|
||||
const mapStateToProps = (state, { status }) => {
|
||||
const mapStateToProps = (state, { replyToId }) => {
|
||||
|
||||
// : todo :
|
||||
//everything needs to be in relation to if there's a status or not
|
||||
const reduxReplyToId = state.getIn(['compose', 'in_reply_to'])
|
||||
const isMatch = reduxReplyToId || replyToId ? reduxReplyToId === replyToId : true
|
||||
|
||||
// console.log("isMatch:", isMatch, reduxReplyToId, replyToId)
|
||||
|
||||
return {
|
||||
edit: state.getIn(['compose', 'id']) !== null,
|
||||
text: state.getIn(['compose', 'text']),
|
||||
suggestions: state.getIn(['compose', 'suggestions']),
|
||||
spoiler: state.getIn(['compose', 'spoiler']),
|
||||
spoilerText: state.getIn(['compose', 'spoiler_text']),
|
||||
privacy: state.getIn(['compose', 'privacy']),
|
||||
focusDate: state.getIn(['compose', 'focusDate']),
|
||||
caretPosition: state.getIn(['compose', 'caretPosition']),
|
||||
preselectDate: state.getIn(['compose', 'preselectDate']),
|
||||
isSubmitting: state.getIn(['compose', 'is_submitting']),
|
||||
isChangingUpload: state.getIn(['compose', 'is_changing_upload']),
|
||||
isUploading: state.getIn(['compose', 'is_uploading']),
|
||||
showSearch: state.getIn(['search', 'submitted']) && !state.getIn(['search', 'hidden']),
|
||||
anyMedia: state.getIn(['compose', 'media_attachments']).size > 0,
|
||||
isModalOpen: state.get('modal').modalType === 'COMPOSE',
|
||||
quoteOfId: state.getIn(['compose', 'quote_of_id']),
|
||||
scheduledAt: state.getIn(['compose', 'scheduled_at']),
|
||||
edit: !isMatch ? null : state.getIn(['compose', 'id']) !== null,
|
||||
text: !isMatch ? '' : state.getIn(['compose', 'text']),
|
||||
suggestions: !isMatch ? ImmutableList() : state.getIn(['compose', 'suggestions']),
|
||||
spoiler: !isMatch ? false : state.getIn(['compose', 'spoiler']),
|
||||
spoilerText: !isMatch ? '' : state.getIn(['compose', 'spoiler_text']),
|
||||
privacy: !isMatch ? null : state.getIn(['compose', 'privacy']),
|
||||
focusDate: !isMatch ? null : state.getIn(['compose', 'focusDate']),
|
||||
caretPosition: !isMatch ? null : state.getIn(['compose', 'caretPosition']),
|
||||
preselectDate: !isMatch ? null : state.getIn(['compose', 'preselectDate']),
|
||||
isSubmitting: !isMatch ? false : state.getIn(['compose', 'is_submitting']),
|
||||
isChangingUpload: !isMatch ? false : state.getIn(['compose', 'is_changing_upload']),
|
||||
isUploading: !isMatch ? false : state.getIn(['compose', 'is_uploading']),
|
||||
showSearch: !isMatch ? false : state.getIn(['search', 'submitted']) && !state.getIn(['search', 'hidden']),
|
||||
anyMedia: !isMatch ? false : state.getIn(['compose', 'media_attachments']).size > 0,
|
||||
isModalOpen: !isMatch ? false : state.get('modal').modalType === 'COMPOSE',
|
||||
quoteOfId: !isMatch ? null : state.getIn(['compose', 'quote_of_id']),
|
||||
scheduledAt: !isMatch ? null : state.getIn(['compose', 'scheduled_at']),
|
||||
account: state.getIn(['accounts', me]),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user