Fixed issue with composer destination in group, timeline

• Fixed:
- mobile composer min height
- issue with composer destination in group, timeline (hopefully)
This commit is contained in:
mgabdev 2020-12-31 21:46:31 -05:00
parent 27f1de6af3
commit 89225194ed
4 changed files with 25 additions and 15 deletions

View File

@ -289,6 +289,11 @@ export const handleComposeSubmit = (dispatch, getState, response, status) => {
dispatch(insertIntoTagHistory(response.data.tags, status))
dispatch(submitComposeSuccess({ ...response.data }))
// If is group, reset composer to be in group
if (response.data.group) {
dispatch(changeComposeGroupId(response.data.group.id))
}
// To make the app more responsive, immediately push the status into the timeline
// : todo : push into comment, reload parent status, etc.
const insertIfOnline = (timelineId) => {

View File

@ -151,8 +151,6 @@ class ComposeForm extends ImmutablePureComponent {
}
componentDidUpdate(prevProps) {
if (!this.autosuggestTextarea) return
// This statement does several things:
// - If we're beginning a reply, and,
// - Replying to zero or one users, places the cursor at the end of the textbox.
@ -281,9 +279,16 @@ class ComposeForm extends ImmutablePureComponent {
borderColorSecondary: 1,
})
const innerClasses = CX({
d: 1,
calcMaxH410PX: 1,
minH98PX: formLocation === 'timeline',
minH200PX: ['standalone', 'modal'].indexOf(formLocation) > -1,
})
return (
<div className={[_s.d, _s.w100PC, _s.flexGrow1, _s.bgPrimary].join(' ')}>
<div className={[_s.d, _s.calcMaxH410PX, _s.minH98PX].join(' ')}>
<div className={innerClasses}>
<ComposeDestinationHeader formLocation={formLocation} account={account} isModal={isModalOpen} />

View File

@ -1,11 +1,13 @@
import React from 'react'
import PropTypes from 'prop-types'
import { connect } from 'react-redux'
import Sticky from 'react-stickynode'
import {
CX,
BREAKPOINT_EXTRA_SMALL,
} from '../constants'
import { me } from '../initial_state'
import { changeComposeGroupId } from '../actions/compose'
import LoggedOutSidebar from '../components/sidebar/logged_out_sidebar'
import DefaultSidebar from '../components/sidebar/default_sidebar'
import SidebarPanelGroup from '../components/sidebar_panel_group'
@ -24,6 +26,12 @@ import {
class Layout extends React.PureComponent {
componentDidMount() {
if (['group', 'compose'].indexOf(this.props.page) === -1) {
this.props.dispatch(changeComposeGroupId(null))
}
}
render() {
const {
actions,
@ -179,4 +187,4 @@ Layout.propTypes = {
title: PropTypes.string,
}
export default Layout
export default connect()(Layout)

View File

@ -5,7 +5,6 @@ import { defineMessages, injectIntl } from 'react-intl'
import ImmutablePropTypes from 'react-immutable-proptypes'
import ImmutablePureComponent from 'react-immutable-pure-component'
import { fetchGroup } from '../actions/groups'
import { changeComposeGroupId } from '../actions/compose'
import PageTitle from '../features/ui/util/page_title'
import GroupLayout from '../layouts/group_layout'
import TimelineComposeBlock from '../components/timeline_compose_block'
@ -16,18 +15,11 @@ import Divider from '../components/divider'
class GroupPage extends ImmutablePureComponent {
componentDidMount() {
if (!this.props.group) {
this.props.dispatch(fetchGroup(this.props.params.id))
}
this.props.dispatch(fetchGroup(this.props.params.id))
}
componentWillUnmount() {
//Reset group composer
this.props.dispatch(changeComposeGroupId(null))
}
componentDidUpdate(prevProps) {
if (!!this.props.group && prevProps.params.id !== this.props.params.id) {
if (prevProps.params.id !== this.props.params.id) {
this.props.dispatch(fetchGroup(this.props.params.id))
}
}
@ -51,7 +43,7 @@ class GroupPage extends ImmutablePureComponent {
if (!!group) {
if (group.get('archived')) return null
}
return (
<GroupLayout
title={'Group'}