Progress
This commit is contained in:
@@ -11,7 +11,6 @@ export default class Header extends ImmutablePureComponent {
|
||||
onFollow: PropTypes.func.isRequired,
|
||||
onBlock: PropTypes.func.isRequired,
|
||||
onMention: PropTypes.func.isRequired,
|
||||
onDirect: PropTypes.func.isRequired,
|
||||
onRepostToggle: PropTypes.func.isRequired,
|
||||
onReport: PropTypes.func.isRequired,
|
||||
onMute: PropTypes.func.isRequired,
|
||||
@@ -39,10 +38,6 @@ export default class Header extends ImmutablePureComponent {
|
||||
this.props.onMention(this.props.account, this.context.router.history);
|
||||
}
|
||||
|
||||
handleDirect = () => {
|
||||
this.props.onDirect(this.props.account, this.context.router.history);
|
||||
}
|
||||
|
||||
handleReport = () => {
|
||||
this.props.onReport(this.props.account);
|
||||
}
|
||||
@@ -93,7 +88,6 @@ export default class Header extends ImmutablePureComponent {
|
||||
onFollow={this.handleFollow}
|
||||
onBlock={this.handleBlock}
|
||||
onMention={this.handleMention}
|
||||
onDirect={this.handleDirect}
|
||||
onRepostToggle={this.handleRepostToggle}
|
||||
onReport={this.handleReport}
|
||||
onMute={this.handleMute}
|
||||
|
||||
79
app/javascript/gabsocial/features/community_timeline.js
Normal file
79
app/javascript/gabsocial/features/community_timeline.js
Normal file
@@ -0,0 +1,79 @@
|
||||
import { defineMessages, injectIntl } from 'react-intl'
|
||||
import { expandCommunityTimeline } from '../actions/timelines'
|
||||
import { connectCommunityStream } from '../actions/streaming'
|
||||
import StatusListContainer from '../containers/status_list_container'
|
||||
|
||||
const messages = defineMessages({
|
||||
empty: { id: 'empty_column.community', defaultMessage: 'The community timeline is empty. Write something publicly to get the ball rolling!' },
|
||||
})
|
||||
|
||||
const mapStateToProps = state => {
|
||||
const onlyMedia = state.getIn(['settings', 'community', 'other', 'onlyMedia'])
|
||||
|
||||
return {
|
||||
onlyMedia,
|
||||
}
|
||||
}
|
||||
|
||||
export default
|
||||
@connect(mapStateToProps)
|
||||
@injectIntl
|
||||
class CommunityTimeline extends PureComponent {
|
||||
|
||||
static contextTypes = {
|
||||
router: PropTypes.object,
|
||||
}
|
||||
|
||||
static propTypes = {
|
||||
dispatch: PropTypes.func.isRequired,
|
||||
intl: PropTypes.object.isRequired,
|
||||
onlyMedia: PropTypes.bool,
|
||||
}
|
||||
|
||||
componentDidMount () {
|
||||
const { dispatch, onlyMedia } = this.props
|
||||
|
||||
dispatch(expandCommunityTimeline({ onlyMedia }))
|
||||
this.disconnect = dispatch(connectCommunityStream({ onlyMedia }))
|
||||
}
|
||||
|
||||
componentDidUpdate (prevProps) {
|
||||
if (prevProps.onlyMedia !== this.props.onlyMedia) {
|
||||
const { dispatch, onlyMedia } = this.props
|
||||
|
||||
this.disconnect()
|
||||
|
||||
dispatch(expandCommunityTimeline({ onlyMedia }))
|
||||
this.disconnect = dispatch(connectCommunityStream({ onlyMedia }))
|
||||
}
|
||||
}
|
||||
|
||||
componentWillUnmount () {
|
||||
if (this.disconnect) {
|
||||
this.disconnect()
|
||||
this.disconnect = null
|
||||
}
|
||||
}
|
||||
|
||||
handleLoadMore = maxId => {
|
||||
const { dispatch, onlyMedia } = this.props
|
||||
|
||||
dispatch(expandCommunityTimeline({ maxId, onlyMedia }))
|
||||
}
|
||||
|
||||
render () {
|
||||
const { intl, onlyMedia } = this.props
|
||||
|
||||
const emptyMessage = intl.formatMessage(messages.empty)
|
||||
|
||||
return (
|
||||
<StatusListContainer
|
||||
scrollKey='community_timeline'
|
||||
timelineId={`community${onlyMedia ? ':media' : ''}`}
|
||||
onLoadMore={this.handleLoadMore}
|
||||
emptyMessage={emptyMessage}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,109 +0,0 @@
|
||||
import { defineMessages, injectIntl } from 'react-intl'
|
||||
import {
|
||||
expandCommunityTimeline,
|
||||
expandPublicTimeline,
|
||||
} from '../../actions/timelines'
|
||||
import {
|
||||
connectCommunityStream,
|
||||
connectPublicStream,
|
||||
} from '../../actions/streaming'
|
||||
import StatusListContainer from '../../containers/status_list_container'
|
||||
|
||||
const messages = defineMessages({
|
||||
empty: { id: 'empty_column.community', defaultMessage: 'The community timeline is empty. Write something publicly to get the ball rolling!' },
|
||||
})
|
||||
|
||||
const mapStateToProps = state => {
|
||||
const allFediverse = state.getIn(['settings', 'community', 'other', 'allFediverse'])
|
||||
const onlyMedia = state.getIn(['settings', 'community', 'other', 'onlyMedia'])
|
||||
|
||||
const timelineId = allFediverse ? 'public' : 'community'
|
||||
|
||||
return {
|
||||
timelineId,
|
||||
allFediverse,
|
||||
onlyMedia,
|
||||
}
|
||||
}
|
||||
|
||||
export default
|
||||
@connect(mapStateToProps)
|
||||
@injectIntl
|
||||
class CommunityTimeline extends PureComponent {
|
||||
|
||||
static contextTypes = {
|
||||
router: PropTypes.object,
|
||||
}
|
||||
|
||||
static propTypes = {
|
||||
dispatch: PropTypes.func.isRequired,
|
||||
intl: PropTypes.object.isRequired,
|
||||
onlyMedia: PropTypes.bool,
|
||||
allFediverse: PropTypes.bool,
|
||||
timelineId: PropTypes.string,
|
||||
}
|
||||
|
||||
componentDidMount () {
|
||||
const { dispatch, onlyMedia, allFediverse } = this.props
|
||||
|
||||
if (allFediverse) {
|
||||
dispatch(expandPublicTimeline({ onlyMedia }))
|
||||
this.disconnect = dispatch(connectPublicStream({ onlyMedia }))
|
||||
}
|
||||
else {
|
||||
dispatch(expandCommunityTimeline({ onlyMedia }))
|
||||
this.disconnect = dispatch(connectCommunityStream({ onlyMedia }))
|
||||
}
|
||||
}
|
||||
|
||||
componentDidUpdate (prevProps) {
|
||||
if (prevProps.onlyMedia !== this.props.onlyMedia || prevProps.allFediverse !== this.props.allFediverse) {
|
||||
const { dispatch, onlyMedia, allFediverse } = this.props
|
||||
|
||||
this.disconnect()
|
||||
|
||||
if (allFediverse) {
|
||||
dispatch(expandPublicTimeline({ onlyMedia }))
|
||||
this.disconnect = dispatch(connectPublicStream({ onlyMedia }))
|
||||
}
|
||||
else {
|
||||
dispatch(expandCommunityTimeline({ onlyMedia }))
|
||||
this.disconnect = dispatch(connectCommunityStream({ onlyMedia }))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
componentWillUnmount () {
|
||||
if (this.disconnect) {
|
||||
this.disconnect()
|
||||
this.disconnect = null
|
||||
}
|
||||
}
|
||||
|
||||
handleLoadMore = maxId => {
|
||||
const { dispatch, onlyMedia, allFediverse } = this.props
|
||||
|
||||
if (allFediverse) {
|
||||
dispatch(expandPublicTimeline({ maxId, onlyMedia }))
|
||||
}
|
||||
else {
|
||||
dispatch(expandCommunityTimeline({ maxId, onlyMedia }))
|
||||
}
|
||||
}
|
||||
|
||||
render () {
|
||||
const { intl, onlyMedia, timelineId } = this.props
|
||||
|
||||
const emptyMessage = intl.formatMessage(messages.empty)
|
||||
|
||||
return (
|
||||
<StatusListContainer
|
||||
scrollKey={`${timelineId}_timeline`}
|
||||
timelineId={`${timelineId}${onlyMedia ? ':media' : ''}`}
|
||||
onLoadMore={this.handleLoadMore}
|
||||
emptyMessage={emptyMessage}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import SettingSwitch from '../../../../components/setting_switch';
|
||||
import { changeSetting } from '../../../../actions/settings';
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
settings: state.getIn(['settings', 'community']),
|
||||
});
|
||||
|
||||
const mapDispatchToProps = (dispatch) => {
|
||||
return {
|
||||
onChange(key, checked) {
|
||||
dispatch(changeSetting(['community', ...key], checked));
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export default
|
||||
@connect(mapStateToProps, mapDispatchToProps)
|
||||
class ColumnSettings extends ImmutablePureComponent {
|
||||
|
||||
static propTypes = {
|
||||
settings: ImmutablePropTypes.map.isRequired,
|
||||
onChange: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
render () {
|
||||
const { settings, onChange } = this.props;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<SettingSwitch
|
||||
settings={settings}
|
||||
settingPath={['other', 'onlyMedia']}
|
||||
onChange={onChange}
|
||||
label={<FormattedMessage id='community.column_settings.media_only' defaultMessage='Media Only' />}
|
||||
/>
|
||||
<SettingSwitch
|
||||
settings={settings}
|
||||
settingPath={['other', 'allFediverse']}
|
||||
onChange={onChange}
|
||||
label={<FormattedMessage id='community.column_settings.all_fediverse' defaultMessage='All Fediverse' />}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
export { default } from './column_settings'
|
||||
@@ -1 +0,0 @@
|
||||
export { default } from './community_timeline'
|
||||
@@ -4,7 +4,7 @@ import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||
import detectPassiveEvents from 'detect-passive-events';
|
||||
import Overlay from 'react-overlays/lib/Overlay';
|
||||
import { EmojiPicker as EmojiPickerAsync } from '../../../ui/util/async-components';
|
||||
import { EmojiPicker as EmojiPickerAsync } from '../../../ui/util/async_components';
|
||||
import { buildCustomEmojis } from '../../../../components/emoji/emoji';
|
||||
|
||||
const messages = defineMessages({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes'
|
||||
import ImmutablePureComponent from 'react-immutable-pure-component'
|
||||
import { fetchGroups } from '../actions/groups'
|
||||
import Block from '../components/block'
|
||||
import ScrollableList from '../components/scrollable_list'
|
||||
import GroupCollectionItem from '../components/group_collection_item'
|
||||
|
||||
const mapStateToProps = (state, { activeTab }) => ({
|
||||
@@ -30,15 +30,19 @@ class GroupsCollection extends ImmutablePureComponent {
|
||||
render() {
|
||||
const { groupIds } = this.props
|
||||
|
||||
console.log("groupIds: ", groupIds)
|
||||
|
||||
|
||||
return (
|
||||
<div className={[_s.default, _s.flexRow, _s.flexWrap].join(' ')}>
|
||||
{
|
||||
groupIds.map((groupId, i) => (
|
||||
<GroupCollectionItem key={`group-collection-item-${i}`} id={groupId} />
|
||||
))
|
||||
}
|
||||
<ScrollableList
|
||||
scrollKey='groups_collection'
|
||||
emptyMessage={''}
|
||||
>
|
||||
{
|
||||
groupIds.map((groupId, i) => (
|
||||
<GroupCollectionItem key={`group-collection-item-${i}`} id={groupId} />
|
||||
))
|
||||
}
|
||||
</ScrollableList>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { defineMessages, injectIntl } from 'react-intl'
|
||||
import { expandHomeTimeline } from '../../actions/timelines'
|
||||
import StatusListContainer from '../../containers/status_list_container'
|
||||
import { expandHomeTimeline } from '../actions/timelines'
|
||||
import StatusListContainer from '../containers/status_list_container'
|
||||
|
||||
const messages = defineMessages({
|
||||
title: { id: 'column.home', defaultMessage: 'Home' },
|
||||
@@ -72,4 +72,4 @@ class HomeTimeline extends PureComponent {
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import { changeSetting, saveSettings } from '../../../../actions/settings';
|
||||
import SettingSwitch from '../../../../components/setting_switch';
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
settings: state.getIn(['settings', 'home']),
|
||||
});
|
||||
|
||||
const mapDispatchToProps = dispatch => ({
|
||||
onChange(key, checked) {
|
||||
dispatch(changeSetting(['home', ...key], checked));
|
||||
},
|
||||
onSave() {
|
||||
dispatch(saveSettings());
|
||||
},
|
||||
});
|
||||
|
||||
export default
|
||||
@connect(mapStateToProps, mapDispatchToProps)
|
||||
class ColumnSettings extends ImmutablePureComponent {
|
||||
|
||||
static propTypes = {
|
||||
settings: ImmutablePropTypes.map.isRequired,
|
||||
onChange: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
render () {
|
||||
const { settings, onChange } = this.props;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<FormattedMessage id='home.column_settings.basic' defaultMessage='Basic' />
|
||||
|
||||
<SettingSwitch
|
||||
prefix='home_timeline'
|
||||
settings={settings}
|
||||
settingPath={['shows', 'repost']}
|
||||
onChange={onChange}
|
||||
label={<FormattedMessage id='home.column_settings.show_reposts' defaultMessage='Show reposts' />}
|
||||
/>
|
||||
|
||||
<SettingSwitch
|
||||
prefix='home_timeline'
|
||||
settings={settings}
|
||||
settingPath={['shows', 'reply']}
|
||||
onChange={onChange}
|
||||
label={<FormattedMessage id='home.column_settings.show_replies' defaultMessage='Show replies' />}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
export { default } from './column_settings'
|
||||
@@ -3,6 +3,8 @@ import classNames from 'classnames';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import { closeOnboarding } from '../actions/onboarding';
|
||||
|
||||
// : todo :
|
||||
|
||||
class FrameWelcome extends Component {
|
||||
static propTypes = {
|
||||
domain: PropTypes.string.isRequired,
|
||||
|
||||
@@ -61,6 +61,7 @@ class ListCreate extends PureComponent {
|
||||
|
||||
<Button
|
||||
className={_s.ml10}
|
||||
type='submit'
|
||||
>
|
||||
<Text color='white'>
|
||||
{intl.formatMessage(messages.create)}
|
||||
|
||||
@@ -1,20 +1,16 @@
|
||||
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
|
||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
import { debounce } from 'lodash';
|
||||
import { fetchMutes, expandMutes } from '../actions/mutes';
|
||||
import AccountContainer from '../containers/account_container';
|
||||
import ColumnIndicator from '../components/column_indicator';
|
||||
import ScrollableList from '../components/scrollable_list';
|
||||
|
||||
const messages = defineMessages({
|
||||
heading: { id: 'column.mutes', defaultMessage: 'Muted users' },
|
||||
});
|
||||
import { injectIntl, FormattedMessage } from 'react-intl'
|
||||
import ImmutablePureComponent from 'react-immutable-pure-component'
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes'
|
||||
import { debounce } from 'lodash'
|
||||
import { fetchMutes, expandMutes } from '../actions/mutes'
|
||||
import AccountContainer from '../containers/account_container'
|
||||
import ColumnIndicator from '../components/column_indicator'
|
||||
import ScrollableList from '../components/scrollable_list'
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
accountIds: state.getIn(['user_lists', 'mutes', 'items']),
|
||||
hasMore: !!state.getIn(['user_lists', 'mutes', 'next']),
|
||||
});
|
||||
})
|
||||
|
||||
export default
|
||||
@connect(mapStateToProps)
|
||||
@@ -26,19 +22,18 @@ class Mutes extends ImmutablePureComponent {
|
||||
dispatch: PropTypes.func.isRequired,
|
||||
hasMore: PropTypes.bool,
|
||||
accountIds: ImmutablePropTypes.list,
|
||||
intl: PropTypes.object.isRequired,
|
||||
};
|
||||
}
|
||||
|
||||
componentWillMount() {
|
||||
this.props.dispatch(fetchMutes());
|
||||
this.props.dispatch(fetchMutes())
|
||||
}
|
||||
|
||||
handleLoadMore = debounce(() => {
|
||||
this.props.dispatch(expandMutes());
|
||||
}, 300, { leading: true });
|
||||
this.props.dispatch(expandMutes())
|
||||
}, 300, { leading: true })
|
||||
|
||||
render() {
|
||||
const { intl, hasMore, accountIds } = this.props;
|
||||
const { hasMore, accountIds } = this.props
|
||||
|
||||
if (!accountIds) {
|
||||
return <ColumnIndicator type='loading' />
|
||||
@@ -53,7 +48,7 @@ class Mutes extends ImmutablePureComponent {
|
||||
>
|
||||
{
|
||||
accountIds.map(id =>
|
||||
<AccountContainer key={id} id={id} />
|
||||
<AccountContainer key={`mutes-${id}`} id={id} compact />
|
||||
)
|
||||
}
|
||||
</ScrollableList>
|
||||
|
||||
@@ -72,8 +72,6 @@ const makeMapStateToProps = () => {
|
||||
|
||||
// ONLY Direct descendants
|
||||
descendantsIds = state.getIn(['contexts', 'replies', status.get('id')])
|
||||
|
||||
console.log("descendantsIds:", descendantsIds)
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -19,6 +19,9 @@ import ModalRoot from '../../components/modal/modal_root'
|
||||
import PopoverRoot from '../../components/popover/popover_root'
|
||||
import UploadArea from '../../components/upload_area'
|
||||
import ProfilePage from '../../pages/profile_page'
|
||||
import CommunityPage from '../../pages/community_page'
|
||||
import HashtagPage from '../../pages/hashtag_page'
|
||||
import ShortcutsPage from '../../pages/shortcuts_page'
|
||||
import GroupPage from '../../pages/group_page'
|
||||
import GroupsPage from '../../pages/groups_page'
|
||||
import SearchPage from '../../pages/search_page'
|
||||
@@ -60,8 +63,9 @@ import {
|
||||
Notifications,
|
||||
Reposts,
|
||||
Search,
|
||||
Shortcuts,
|
||||
Status,
|
||||
} from './util/async-components'
|
||||
} from './util/async_components'
|
||||
import { me, meUsername } from '../../initial_state'
|
||||
|
||||
// Dummy import, to make sure that <Status /> ends up in the application bundle.
|
||||
@@ -141,7 +145,7 @@ class SwitchingArea extends PureComponent {
|
||||
<Redirect from='/' to='/home' exact />
|
||||
<WrappedRoute path='/home' exact page={HomePage} component={HomeTimeline} content={children} />
|
||||
|
||||
<WrappedRoute path='/timeline/all' exact page={BasicPage} component={CommunityTimeline} content={children} componentParams={{ title: 'Hashtag Timeline' }} />
|
||||
<WrappedRoute path='/timeline/all' exact page={CommunityPage} component={CommunityTimeline} content={children} componentParams={{ title: 'Community Timeline' }} />
|
||||
|
||||
<WrappedRoute path='/groups' exact page={GroupsPage} component={GroupsCollection} content={children} componentParams={{ activeTab: 'featured' }} />
|
||||
<WrappedRoute path='/groups/new' exact page={GroupsPage} component={GroupsCollection} content={children} componentParams={{ activeTab: 'new' }} />
|
||||
@@ -154,7 +158,9 @@ class SwitchingArea extends PureComponent {
|
||||
<WrappedRoute path='/groups/:id/edit' page={ModalPage} component={GroupCreate} content={children} componentParams={{ title: 'Edit Group' }} />
|
||||
<WrappedRoute path='/groups/:id' page={GroupPage} component={GroupTimeline} content={children} />
|
||||
|
||||
<WrappedRoute path='/tags/:id' publicRoute page={BasicPage} component={HashtagTimeline} content={children} componentParams={{ title: 'Hashtag' }} />
|
||||
<WrappedRoute path='/tags/:id' publicRoute page={HashtagPage} component={HashtagTimeline} content={children} componentParams={{ title: 'Hashtag' }} />
|
||||
|
||||
<WrappedRoute path='/shortcuts' publicRoute page={ShortcutsPage} component={Shortcuts} content={children} />
|
||||
|
||||
<WrappedRoute path='/lists' exact page={ListsPage} component={ListsDirectory} content={children} />
|
||||
<WrappedRoute path='/lists/create' exact page={ModalPage} component={ListCreate} content={children} componentParams={{ title: 'Create List' }} />
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
import { getWindowDimension } from '../../../utils/is_mobile'
|
||||
|
||||
const initialState = getWindowDimension()
|
||||
|
||||
export default class Responsive extends PureComponent {
|
||||
static propTypes = {
|
||||
min: PropTypes.number,
|
||||
max: PropTypes.number,
|
||||
}
|
||||
|
||||
static defaultProps = {
|
||||
min: 0,
|
||||
max: Infinity,
|
||||
}
|
||||
|
||||
state = {
|
||||
width: initialState.width,
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
window.addEventListener('resize', this.handleResize, false)
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
window.removeEventListener('resize', this.handleResize, false)
|
||||
}
|
||||
|
||||
handleResize = () => {
|
||||
const { width } = getWindowDimension()
|
||||
|
||||
this.setState({ width })
|
||||
}
|
||||
|
||||
shouldRender = (min, max, width) => {
|
||||
return width > min && width < max
|
||||
}
|
||||
|
||||
render() {
|
||||
const { children, min, max } = this.props
|
||||
const { width } = this.state
|
||||
|
||||
const shouldRender = this.shouldRender(min, max, width)
|
||||
|
||||
console.log("shouldRender:", min, max, width, shouldRender)
|
||||
|
||||
return shouldRender ? children : null
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user