Progress
Albums almost done, group, chat moderation, photo, video page updates
This commit is contained in:
@@ -3,76 +3,60 @@ import PropTypes from 'prop-types'
|
||||
import { connect } from 'react-redux'
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes'
|
||||
import ImmutablePureComponent from 'react-immutable-pure-component'
|
||||
import { injectIntl, defineMessages } from 'react-intl'
|
||||
import { expandAccountMediaTimeline } from '../actions/timelines'
|
||||
import { getAccountGallery } from '../selectors'
|
||||
import { me } from '../initial_state'
|
||||
import {
|
||||
fetchAccountAlbums,
|
||||
expandAccountAlbums,
|
||||
} from '../actions/albums'
|
||||
import ColumnIndicator from '../components/column_indicator'
|
||||
import Heading from '../components/heading'
|
||||
import TabBar from '../components/tab_bar'
|
||||
import MediaItem from '../components/media_item'
|
||||
import LoadMore from '../components/load_more'
|
||||
import Block from '../components/block'
|
||||
import Image from '../components/image'
|
||||
import Album from '../components/album'
|
||||
import Dummy from '../components/dummy'
|
||||
import MediaGalleryPlaceholder from '../components/placeholder/media_gallery_placeholder'
|
||||
|
||||
class AccountAlbums extends ImmutablePureComponent {
|
||||
|
||||
// componentDidMount() {
|
||||
// const { accountId, mediaType } = this.props
|
||||
componentDidMount() {
|
||||
const { accountId, mediaType } = this.props
|
||||
|
||||
// if (accountId && accountId !== -1) {
|
||||
// this.props.dispatch(expandAccountMediaTimeline(accountId, { mediaType }))
|
||||
// }
|
||||
// }
|
||||
if (accountId && accountId !== -1) {
|
||||
this.props.onFetchAccountAlbums(accountId)
|
||||
}
|
||||
}
|
||||
|
||||
// componentWillReceiveProps(nextProps) {
|
||||
// if (
|
||||
// (nextProps.accountId && nextProps.accountId !== this.props.accountId) ||
|
||||
// (nextProps.accountId && nextProps.mediaType !== this.props.mediaType)
|
||||
// ) {
|
||||
// this.props.dispatch(expandAccountMediaTimeline(nextProps.accountId, {
|
||||
// mediaType: nextProps.mediaType,
|
||||
// }))
|
||||
// }
|
||||
// }
|
||||
componentWillReceiveProps(nextProps) {
|
||||
if (nextProps.accountId && nextProps.accountId !== this.props.accountId) {
|
||||
this.props.onFetchAccountAlbums(nextProps.accountId)
|
||||
}
|
||||
}
|
||||
|
||||
// handleScrollToBottom = () => {
|
||||
// if (this.props.hasMore) {
|
||||
// this.handleLoadMore(this.props.attachments.size > 0 ? this.props.attachments.last().getIn(['status', 'id']) : undefined)
|
||||
// }
|
||||
// }
|
||||
handleLoadMore = () => {
|
||||
const { accountId, hasMore } = this.props
|
||||
if (accountId && accountId !== -1 && hasMore) {
|
||||
this.props.onExpandAccountAlbums(accountId)
|
||||
}
|
||||
}
|
||||
|
||||
// handleScroll = (e) => {
|
||||
// const { scrollTop, scrollHeight, clientHeight } = e.target
|
||||
// const offset = scrollHeight - scrollTop - clientHeight
|
||||
|
||||
// if (150 > offset && !this.props.isLoading) {
|
||||
// this.handleScrollToBottom()
|
||||
// }
|
||||
// }
|
||||
|
||||
// handleLoadMore = (maxId) => {
|
||||
// if (this.props.accountId && this.props.accountId !== -1) {
|
||||
// this.props.dispatch(expandAccountMediaTimeline(this.props.accountId, {
|
||||
// maxId,
|
||||
// mediaType: this.props.mediaType,
|
||||
// }))
|
||||
// }
|
||||
// }
|
||||
|
||||
// handleLoadOlder = (e) => {
|
||||
// e.preventDefault()
|
||||
// this.handleScrollToBottom()
|
||||
// }
|
||||
handleLoadOlder = (e) => {
|
||||
e.preventDefault()
|
||||
this.handleLoadMore()
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
account,
|
||||
isMe,
|
||||
albums,
|
||||
account,
|
||||
accountId,
|
||||
hasMore,
|
||||
isLoading,
|
||||
} = this.props
|
||||
|
||||
if (!account) return null
|
||||
const hasAlbums = !!albums ? albums.size > 0 : false
|
||||
|
||||
return (
|
||||
<Block>
|
||||
@@ -95,103 +79,68 @@ class AccountAlbums extends ImmutablePureComponent {
|
||||
|
||||
<div className={[_s.d, _s.w100PC, _s.flexRow, _s.flexWrap, _s.px10, _s.mb15, _s.pb10].join(' ')}>
|
||||
{ isMe && <Album isAddable /> }
|
||||
<Album />
|
||||
<Album />
|
||||
<Album />
|
||||
<Album />
|
||||
<Album />
|
||||
|
||||
<Album isDummy />
|
||||
<Album isDummy />
|
||||
<Album isDummy />
|
||||
<Album isDummy />
|
||||
<Album isDummy />
|
||||
<Album isDummy />
|
||||
{
|
||||
hasAlbums &&
|
||||
albums.map((albums, i) => (
|
||||
<Album
|
||||
key={album.get('id')}
|
||||
album={album}
|
||||
account={account}
|
||||
/>
|
||||
))
|
||||
}
|
||||
|
||||
{
|
||||
Array.apply(null, { length: 8}).map((_, i) => (
|
||||
<Dummy className={[_s.d, _s.minW162PX, _s.px5, _s.flex1].join(' ')} />
|
||||
))
|
||||
}
|
||||
|
||||
{
|
||||
!isLoading && !hasAlbums && me !== accountId &&
|
||||
<ColumnIndicator type='error' message='No albums exist' />
|
||||
}
|
||||
</div>
|
||||
|
||||
{
|
||||
hasMore && !(isLoading && !hasAlbums) &&
|
||||
<LoadMore visible={!isLoading} onClick={this.handleLoadOlder} />
|
||||
}
|
||||
</Block>
|
||||
)
|
||||
// const {
|
||||
// attachments,
|
||||
// isLoading,
|
||||
// hasMore,
|
||||
// intl,
|
||||
// account,
|
||||
// } = this.props
|
||||
|
||||
|
||||
|
||||
// return (
|
||||
// <Block>
|
||||
// <div
|
||||
// role='feed'
|
||||
// onScroll={this.handleScroll}
|
||||
// className={[_s.d, _s.flexRow, _s.flexWrap, _s.py5, _s.px5].join(' ')}
|
||||
// >
|
||||
|
||||
// {
|
||||
// attachments.map((attachment, i) => (
|
||||
// <MediaItem
|
||||
// key={attachment.get('id')}
|
||||
// attachment={attachment}
|
||||
// account={account}
|
||||
// />
|
||||
// ))
|
||||
// }
|
||||
|
||||
// {
|
||||
// isLoading && attachments.size === 0 &&
|
||||
// <div className={[_s.d, _s.w100PC].join(' ')}>
|
||||
// <MediaGalleryPlaceholder />
|
||||
// </div>
|
||||
// }
|
||||
|
||||
// {
|
||||
// !isLoading && attachments.size === 0 &&
|
||||
// <ColumnIndicator type='error' message={intl.formatMessage(messages.none)} />
|
||||
// }
|
||||
// </div>
|
||||
|
||||
// {
|
||||
// hasMore && !(isLoading && attachments.size === 0) &&
|
||||
// <LoadMore visible={!isLoading} onClick={this.handleLoadOlder} />
|
||||
// }
|
||||
// </Block>
|
||||
// )
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const messages = defineMessages({
|
||||
none: { id: 'account_gallery.none', defaultMessage: 'No media to show.' },
|
||||
})
|
||||
|
||||
const mapStateToProps = (state, { account, mediaType }) => {
|
||||
const accountId = !!account ? account.get('id') : -1
|
||||
|
||||
return {
|
||||
accountId,
|
||||
attachments: getAccountGallery(state, accountId, mediaType),
|
||||
isLoading: state.getIn(['timelines', `account:${accountId}:media`, 'isLoading']),
|
||||
hasMore: state.getIn(['timelines', `account:${accountId}:media`, 'hasMore']),
|
||||
albums: state.getIn(['album_lists', accountId, 'items']),
|
||||
isLoading: state.getIn(['album_lists', accountId, 'isLoading'], false),
|
||||
hasMore: state.getIn(['album_lists', accountId, 'hasMore'], false),
|
||||
}
|
||||
}
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
onFetchAccountAlbums(accountId) {
|
||||
|
||||
},
|
||||
onExpandAccountAlbums(accountId) {
|
||||
|
||||
},
|
||||
})
|
||||
|
||||
AccountAlbums.propTypes = {
|
||||
dispatch: PropTypes.func.isRequired,
|
||||
account: ImmutablePropTypes.map,
|
||||
accountId: PropTypes.string,
|
||||
attachments: ImmutablePropTypes.list.isRequired,
|
||||
albums: ImmutablePropTypes.list,
|
||||
isLoading: PropTypes.bool,
|
||||
hasMore: PropTypes.bool,
|
||||
intl: PropTypes.object.isRequired,
|
||||
mediaType: PropTypes.oneOf([
|
||||
'photo',
|
||||
'video',
|
||||
]),
|
||||
}
|
||||
|
||||
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(AccountAlbums))
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(AccountAlbums)
|
||||
172
app/javascript/gabsocial/features/account_photo_gallery.js
Normal file
172
app/javascript/gabsocial/features/account_photo_gallery.js
Normal file
@@ -0,0 +1,172 @@
|
||||
import React from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import { connect } from 'react-redux'
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes'
|
||||
import ImmutablePureComponent from 'react-immutable-pure-component'
|
||||
import { injectIntl, defineMessages } from 'react-intl'
|
||||
import { expandAccountMediaTimeline } from '../actions/timelines'
|
||||
import { getAccountGallery } from '../selectors'
|
||||
import ColumnIndicator from '../components/column_indicator'
|
||||
import MediaItem from '../components/media_item'
|
||||
import Heading from '../components/heading'
|
||||
import TabBar from '../components/tab_bar'
|
||||
import LoadMore from '../components/load_more'
|
||||
import Block from '../components/block'
|
||||
import Dummy from '../components/dummy'
|
||||
import MediaGalleryPlaceholder from '../components/placeholder/media_gallery_placeholder'
|
||||
|
||||
|
||||
class AccountPhotoGallery extends ImmutablePureComponent {
|
||||
|
||||
componentDidMount() {
|
||||
const { accountId } = this.props
|
||||
|
||||
if (accountId && accountId !== -1) {
|
||||
this.props.dispatch(expandAccountMediaTimeline(accountId, { mediaType: 'photo' }))
|
||||
}
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
if (nextProps.accountId && nextProps.accountId !== this.props.accountId) {
|
||||
this.props.dispatch(expandAccountMediaTimeline(nextProps.accountId, {
|
||||
mediaType: 'photo',
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
handleScrollToBottom = () => {
|
||||
if (this.props.hasMore) {
|
||||
this.handleLoadMore(this.props.attachments.size > 0 ? this.props.attachments.last().getIn(['status', 'id']) : undefined)
|
||||
}
|
||||
}
|
||||
|
||||
handleScroll = (e) => {
|
||||
const { scrollTop, scrollHeight, clientHeight } = e.target
|
||||
const offset = scrollHeight - scrollTop - clientHeight
|
||||
|
||||
if (150 > offset && !this.props.isLoading) {
|
||||
this.handleScrollToBottom()
|
||||
}
|
||||
}
|
||||
|
||||
handleLoadMore = (maxId) => {
|
||||
if (this.props.accountId && this.props.accountId !== -1) {
|
||||
this.props.dispatch(expandAccountMediaTimeline(this.props.accountId, {
|
||||
maxId,
|
||||
mediaType: 'photo',
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
handleLoadOlder = (e) => {
|
||||
e.preventDefault()
|
||||
this.handleScrollToBottom()
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
attachments,
|
||||
isLoading,
|
||||
hasMore,
|
||||
intl,
|
||||
account,
|
||||
} = this.props
|
||||
|
||||
if (!account) return null
|
||||
const hasAttachments = !!attachments ? attachments.size > 0 : false
|
||||
console.log("account, isLoading, attachments:", account, isLoading, attachments, hasAttachments)
|
||||
|
||||
return (
|
||||
<Block>
|
||||
<div className={[_s.d, _s.px10, _s.py10].join(' ')}>
|
||||
<div className={[_s.d, _s.px5, _s.py5, _s.mb10].join(' ')}>
|
||||
<Heading size='h2'>Photos</Heading>
|
||||
</div>
|
||||
<TabBar tabs={[
|
||||
{
|
||||
title: 'All Photos',
|
||||
to: `/${account.get('username')}/photos`,
|
||||
},
|
||||
{
|
||||
title: 'Albums',
|
||||
isActive: true,
|
||||
to: `/${account.get('username')}/albums`,
|
||||
},
|
||||
]}/>
|
||||
</div>
|
||||
|
||||
<div
|
||||
role='feed'
|
||||
onScroll={this.handleScroll}
|
||||
className={[_s.d, _s.w100PC, _s.flexRow, _s.flexWrap, _s.px10, _s.mb15, _s.pb10].join(' ')}
|
||||
>
|
||||
|
||||
{
|
||||
hasAttachments &&
|
||||
<React.Fragment>
|
||||
{
|
||||
attachments.map((attachment, i) => (
|
||||
<MediaItem
|
||||
key={attachment.get('id')}
|
||||
attachment={attachment}
|
||||
account={account}
|
||||
/>
|
||||
))
|
||||
}
|
||||
{
|
||||
Array.apply(null, { length: 8}).map((_, i) => (
|
||||
<Dummy className={[_s.d, _s.minW198PX, _s.px5, _s.flex1].join(' ')} />
|
||||
))
|
||||
}
|
||||
</React.Fragment>
|
||||
}
|
||||
|
||||
{
|
||||
isLoading && !hasAttachments &&
|
||||
<div className={[_s.d, _s.w100PC].join(' ')}>
|
||||
<MediaGalleryPlaceholder />
|
||||
</div>
|
||||
}
|
||||
|
||||
{
|
||||
!isLoading && !hasAttachments &&
|
||||
<ColumnIndicator type='error' message={intl.formatMessage(messages.none)} />
|
||||
}
|
||||
</div>
|
||||
|
||||
{
|
||||
hasMore && !(isLoading && !hasAttachments) &&
|
||||
<LoadMore visible={!isLoading} onClick={this.handleLoadOlder} />
|
||||
}
|
||||
</Block>
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const messages = defineMessages({
|
||||
none: { id: 'account_gallery.none', defaultMessage: 'No media to show.' },
|
||||
})
|
||||
|
||||
const mapStateToProps = (state, { account }) => {
|
||||
const accountId = !!account ? account.get('id') : -1
|
||||
|
||||
return {
|
||||
accountId,
|
||||
attachments: getAccountGallery(state, accountId, 'photo'),
|
||||
isLoading: state.getIn(['timelines', `account:${accountId}:media`, 'isLoading']),
|
||||
hasMore: state.getIn(['timelines', `account:${accountId}:media`, 'hasMore']),
|
||||
}
|
||||
}
|
||||
|
||||
AccountPhotoGallery.propTypes = {
|
||||
dispatch: PropTypes.func.isRequired,
|
||||
account: ImmutablePropTypes.map,
|
||||
accountId: PropTypes.string,
|
||||
attachments: ImmutablePropTypes.list.isRequired,
|
||||
isLoading: PropTypes.bool,
|
||||
hasMore: PropTypes.bool,
|
||||
intl: PropTypes.object.isRequired,
|
||||
}
|
||||
|
||||
export default injectIntl(connect(mapStateToProps)(AccountPhotoGallery))
|
||||
@@ -8,27 +8,27 @@ import { expandAccountMediaTimeline } from '../actions/timelines'
|
||||
import { getAccountGallery } from '../selectors'
|
||||
import ColumnIndicator from '../components/column_indicator'
|
||||
import MediaItem from '../components/media_item'
|
||||
import Dummy from '../components/dummy'
|
||||
import LoadMore from '../components/load_more'
|
||||
import Block from '../components/block'
|
||||
import Heading from '../components/heading'
|
||||
import TabBar from '../components/tab_bar'
|
||||
import MediaGalleryPlaceholder from '../components/placeholder/media_gallery_placeholder'
|
||||
|
||||
class AccountGallery extends ImmutablePureComponent {
|
||||
class AccountVideoGallery extends ImmutablePureComponent {
|
||||
|
||||
componentDidMount() {
|
||||
const { accountId, mediaType } = this.props
|
||||
const { accountId } = this.props
|
||||
|
||||
if (accountId && accountId !== -1) {
|
||||
this.props.dispatch(expandAccountMediaTimeline(accountId, { mediaType }))
|
||||
this.props.dispatch(expandAccountMediaTimeline(accountId, { mediaType: 'video' }))
|
||||
}
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
if (
|
||||
(nextProps.accountId && nextProps.accountId !== this.props.accountId) ||
|
||||
(nextProps.accountId && nextProps.mediaType !== this.props.mediaType)
|
||||
) {
|
||||
if (nextProps.accountId && nextProps.accountId !== this.props.accountId) {
|
||||
this.props.dispatch(expandAccountMediaTimeline(nextProps.accountId, {
|
||||
mediaType: nextProps.mediaType,
|
||||
mediaType: 'video',
|
||||
}))
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,7 @@ class AccountGallery extends ImmutablePureComponent {
|
||||
if (this.props.accountId && this.props.accountId !== -1) {
|
||||
this.props.dispatch(expandAccountMediaTimeline(this.props.accountId, {
|
||||
maxId,
|
||||
mediaType: this.props.mediaType,
|
||||
mediaType: 'video',
|
||||
}))
|
||||
}
|
||||
}
|
||||
@@ -73,39 +73,63 @@ class AccountGallery extends ImmutablePureComponent {
|
||||
|
||||
if (!account) return null
|
||||
|
||||
const hasAttachments = !!attachments ? attachments.size > 0 : false
|
||||
|
||||
return (
|
||||
<Block>
|
||||
<div className={[_s.d, _s.px10, _s.py10].join(' ')}>
|
||||
<div className={[_s.d, _s.px5, _s.py5, _s.mb10].join(' ')}>
|
||||
<Heading size='h2'>Videos</Heading>
|
||||
</div>
|
||||
<TabBar tabs={[
|
||||
{
|
||||
title: 'All Videos',
|
||||
to: `/${account.get('username')}/videos`,
|
||||
},
|
||||
]}/>
|
||||
</div>
|
||||
|
||||
<div
|
||||
role='feed'
|
||||
onScroll={this.handleScroll}
|
||||
className={[_s.d, _s.flexRow, _s.flexWrap, _s.py5, _s.px5].join(' ')}
|
||||
className={[_s.d, _s.w100PC, _s.flexRow, _s.flexWrap, _s.px10, _s.mb15, _s.pb10].join(' ')}
|
||||
>
|
||||
|
||||
{
|
||||
attachments.map((attachment, i) => (
|
||||
<MediaItem
|
||||
key={attachment.get('id')}
|
||||
attachment={attachment}
|
||||
account={account}
|
||||
/>
|
||||
))
|
||||
hasAttachments &&
|
||||
<React.Fragment>
|
||||
{
|
||||
attachments.map((attachment, i) => (
|
||||
<MediaItem
|
||||
key={attachment.get('id')}
|
||||
attachment={attachment}
|
||||
account={account}
|
||||
/>
|
||||
))
|
||||
}
|
||||
{
|
||||
Array.apply(null, { length: 8 }).map((_, i) => (
|
||||
<Dummy className={[_s.d, _s.minW232PX, _s.px5, _s.flex1].join(' ')} />
|
||||
))
|
||||
}
|
||||
</React.Fragment>
|
||||
}
|
||||
|
||||
{
|
||||
isLoading && attachments.size === 0 &&
|
||||
isLoading && !hasAttachments &&
|
||||
<div className={[_s.d, _s.w100PC].join(' ')}>
|
||||
<MediaGalleryPlaceholder />
|
||||
</div>
|
||||
}
|
||||
|
||||
{
|
||||
!isLoading && attachments.size === 0 &&
|
||||
!isLoading && !hasAttachments &&
|
||||
<ColumnIndicator type='error' message={intl.formatMessage(messages.none)} />
|
||||
}
|
||||
</div>
|
||||
|
||||
{
|
||||
hasMore && !(isLoading && attachments.size === 0) &&
|
||||
hasMore && !(isLoading && !hasAttachments) &&
|
||||
<LoadMore visible={!isLoading} onClick={this.handleLoadOlder} />
|
||||
}
|
||||
</Block>
|
||||
@@ -118,18 +142,18 @@ const messages = defineMessages({
|
||||
none: { id: 'account_gallery.none', defaultMessage: 'No media to show.' },
|
||||
})
|
||||
|
||||
const mapStateToProps = (state, { account, mediaType }) => {
|
||||
const mapStateToProps = (state, { account }) => {
|
||||
const accountId = !!account ? account.get('id') : -1
|
||||
|
||||
return {
|
||||
accountId,
|
||||
attachments: getAccountGallery(state, accountId, mediaType),
|
||||
attachments: getAccountGallery(state, accountId, 'video'),
|
||||
isLoading: state.getIn(['timelines', `account:${accountId}:media`, 'isLoading']),
|
||||
hasMore: state.getIn(['timelines', `account:${accountId}:media`, 'hasMore']),
|
||||
}
|
||||
}
|
||||
|
||||
AccountGallery.propTypes = {
|
||||
AccountVideoGallery.propTypes = {
|
||||
dispatch: PropTypes.func.isRequired,
|
||||
account: ImmutablePropTypes.map,
|
||||
accountId: PropTypes.string,
|
||||
@@ -137,14 +161,6 @@ AccountGallery.propTypes = {
|
||||
isLoading: PropTypes.bool,
|
||||
hasMore: PropTypes.bool,
|
||||
intl: PropTypes.object.isRequired,
|
||||
mediaType: PropTypes.oneOf([
|
||||
'photo',
|
||||
'video',
|
||||
]),
|
||||
}
|
||||
|
||||
AccountGallery.defaultProps = {
|
||||
mediaType: 'both'
|
||||
}
|
||||
|
||||
export default injectIntl(connect(mapStateToProps)(AccountGallery))
|
||||
export default injectIntl(connect(mapStateToProps)(AccountVideoGallery))
|
||||
@@ -1 +1,67 @@
|
||||
// : todo :
|
||||
import React from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import { connect } from 'react-redux'
|
||||
import { defineMessages, injectIntl } from 'react-intl'
|
||||
import { createAlbum } from '../actions/albums'
|
||||
import { closeModal } from '../actions/modal'
|
||||
import Button from '../components/button'
|
||||
import Input from '../components/input'
|
||||
import Form from '../components/form'
|
||||
import Text from '../components/text'
|
||||
|
||||
class AlbumCreate extends React.PureComponent {
|
||||
|
||||
state = {
|
||||
value: '',
|
||||
}
|
||||
|
||||
onChange = (value) => {
|
||||
this.setState({ value })
|
||||
}
|
||||
|
||||
handleOnSubmit = () => {
|
||||
this.props.onSubmit(this.state.value)
|
||||
}
|
||||
|
||||
render() {
|
||||
const { value } = this.state
|
||||
|
||||
const isDisabled = !value
|
||||
|
||||
return (
|
||||
<Form>
|
||||
<Input
|
||||
title='Title'
|
||||
placeholder='Album title'
|
||||
value={value}
|
||||
onChange={this.onChange}
|
||||
/>
|
||||
|
||||
<Button
|
||||
isDisabled={isDisabled}
|
||||
onClick={this.handleOnSubmit}
|
||||
className={[_s.mt10].join(' ')}
|
||||
>
|
||||
<Text color='inherit' align='center'>
|
||||
Create
|
||||
</Text>
|
||||
</Button>
|
||||
</Form>
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const mapDispatchToProps = (dispatch, { isModal }) => ({
|
||||
onSubmit(title) {
|
||||
if (isModal) dispatch(closeModal())
|
||||
dispatch(createBookmarkCollection(title))
|
||||
},
|
||||
})
|
||||
|
||||
AlbumCreate.propTypes = {
|
||||
onSubmit: PropTypes.func.isRequired,
|
||||
isModal: PropTypes.bool,
|
||||
}
|
||||
|
||||
export default connect(null, mapDispatchToProps)(AlbumCreate)
|
||||
@@ -1,100 +0,0 @@
|
||||
import React from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import { connect } from 'react-redux'
|
||||
import { defineMessages, injectIntl } from 'react-intl'
|
||||
import {
|
||||
updateBookmarkCollection,
|
||||
removeBookmarkCollection,
|
||||
} from '../actions/bookmarks'
|
||||
import { closeModal } from '../actions/modal'
|
||||
import Button from '../components/button'
|
||||
import Input from '../components/input'
|
||||
import Form from '../components/form'
|
||||
import Text from '../components/text'
|
||||
|
||||
class BookmarkCollectionEdit extends React.PureComponent {
|
||||
|
||||
state = {
|
||||
value: '',
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
if (!this.props.bookmarkCollection) {
|
||||
this.props.onFetchBookmarkCollection(this.props.bookmarkCollectionId)
|
||||
}
|
||||
}
|
||||
|
||||
onChange = (value) => {
|
||||
this.setState({ value })
|
||||
}
|
||||
|
||||
handleOnSubmit = () => {
|
||||
this.props.onSubmit(this.state.value)
|
||||
}
|
||||
|
||||
handleOnRemove = () => {
|
||||
this.props.onRemove()
|
||||
}
|
||||
|
||||
render() {
|
||||
const { value } = this.state
|
||||
|
||||
const isDisabled = !value
|
||||
|
||||
return (
|
||||
<Form>
|
||||
<Input
|
||||
title='Title'
|
||||
placeholder='Bookmark collection title'
|
||||
value={value}
|
||||
onChange={this.onChange}
|
||||
/>
|
||||
|
||||
<Button
|
||||
isDisabled={isDisabled}
|
||||
onClick={this.handleOnSubmit}
|
||||
className={[_s.mt10].join(' ')}
|
||||
>
|
||||
<Text color='inherit' align='center'>
|
||||
Update
|
||||
</Text>
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
backgroundColor='danger'
|
||||
color='white'
|
||||
onClick={this.handleOnRemove}
|
||||
className={[_s.mt10].join(' ')}
|
||||
>
|
||||
<Text color='inherit' align='center'>
|
||||
Update
|
||||
</Text>
|
||||
</Button>
|
||||
</Form>
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const mapStateToProps = (state, { bookmarkCollectionId }) => ({
|
||||
bookmarkCollection: state.getIn(['bookmark_collections', bookmarkCollectionId]),
|
||||
})
|
||||
|
||||
const mapDispatchToProps = (dispatch, { isModal, bookmarkCollectionId }) => ({
|
||||
onSubmit(title) {
|
||||
if (isModal) dispatch(closeModal())
|
||||
dispatch(updateBookmarkCollection(title))
|
||||
},
|
||||
onRemove() {
|
||||
if (isModal) dispatch(closeModal())
|
||||
dispatch(removeBookmarkCollection(bookmarkCollectionId))
|
||||
},
|
||||
})
|
||||
|
||||
BookmarkCollectionEdit.propTypes = {
|
||||
onSubmit: PropTypes.func.isRequired,
|
||||
onRemove: PropTypes.func.isRequired,
|
||||
isModal: PropTypes.bool,
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(BookmarkCollectionEdit)
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
import { me, meUsername} from '../initial_state'
|
||||
import {
|
||||
GAB_DECK_MAX_ITEMS,
|
||||
URL_GAB_PRO,
|
||||
MODAL_PRO_UPGRADE,
|
||||
} from '../constants'
|
||||
import {
|
||||
@@ -22,6 +23,7 @@ import { openModal } from '../actions/modal'
|
||||
import WrappedBundle from './ui/util/wrapped_bundle'
|
||||
import DeckColumn from '../components/deck_column'
|
||||
import Text from '../components/text'
|
||||
import Button from '../components/button'
|
||||
import {
|
||||
AccountTimeline,
|
||||
Compose,
|
||||
@@ -186,6 +188,15 @@ class Deck extends React.PureComponent {
|
||||
|
||||
const isEmpty = gabDeckOrder.size === 0
|
||||
|
||||
const title = (
|
||||
<span className={[_s.d, _s.flexRow, _s.jcCenter, _s.aiCenter].join(' ')}>
|
||||
<span className={[_s.d, _s.mr2].join(' ')}>
|
||||
Gab Deck for Gab
|
||||
</span>
|
||||
<span className={[_s.bgPro, _s.cBlack, _s.radiusSmall, _s.px5, _s.py5].join(' ')}>PRO</span>
|
||||
</span>
|
||||
)
|
||||
|
||||
return (
|
||||
<SortableContainer
|
||||
axis='x'
|
||||
@@ -199,16 +210,29 @@ class Deck extends React.PureComponent {
|
||||
<DeckColumn title='Compose' icon='pencil' noButtons>
|
||||
<WrappedBundle component={Compose} />
|
||||
</DeckColumn>
|
||||
{ /** : todo : */
|
||||
{
|
||||
!isPro &&
|
||||
<DeckColumn title='Gab Deck for GabPRO' icon='pro' noButtons>
|
||||
<DeckColumn title={title} icon='pro' noButtons>
|
||||
<div className={[_s.d, _s.px15, _s.py15].join(' ')}>
|
||||
<Text>
|
||||
Gab Deck for GabPRO. Some text about what it does and some buttons on going pro to use it.
|
||||
GabDeck is a unique way to customize your Gab experience. Upgrade to GabPRO to unlock the GabDeck.
|
||||
</Text>
|
||||
<div className={[_s.mt15, _s.d, _s.flexRow].join(' ')}>
|
||||
<Button href={URL_GAB_PRO}>
|
||||
<Text color='inherit' className={_s.px10}>
|
||||
Upgrade to GabPRO
|
||||
</Text>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</DeckColumn>
|
||||
}
|
||||
<DeckColumn title='Explore' icon='explore' noButtons>
|
||||
<WrappedBundle component={ExploreTimeline} />
|
||||
</DeckColumn>
|
||||
<DeckColumn title='News' icon='news' noButtons>
|
||||
<WrappedBundle component={News} componentParams={{ isSmall: true }} />
|
||||
</DeckColumn>
|
||||
<DeckColumn />
|
||||
</React.Fragment>
|
||||
}
|
||||
|
||||
@@ -97,7 +97,6 @@ class ChatMessageScrollingList extends ImmutablePureComponent {
|
||||
}
|
||||
|
||||
getCurrentChatMessageIndex = (id) => {
|
||||
// : todo :
|
||||
return this.props.chatMessageIds.indexOf(id)
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,8 @@ import DeckPage from '../../pages/deck_page'
|
||||
import {
|
||||
About,
|
||||
AccountAlbums,
|
||||
AccountGallery,
|
||||
AccountPhotoGallery,
|
||||
AccountVideoGallery,
|
||||
AccountTimeline,
|
||||
AccountCommentsTimeline,
|
||||
AlbumCreate,
|
||||
@@ -277,17 +278,18 @@ class SwitchingArea extends React.PureComponent {
|
||||
<WrappedRoute path='/:username/followers' page={ProfilePage} component={Followers} content={children} />
|
||||
<WrappedRoute path='/:username/following' page={ProfilePage} component={Following} content={children} />
|
||||
|
||||
<WrappedRoute path='/:username/photos' page={ProfilePage} component={AccountGallery} content={children} componentParams={{ noSidebar: true, mediaType: 'photo' }} />
|
||||
<WrappedRoute path='/:username/videos' page={ProfilePage} component={AccountGallery} content={children} componentParams={{ noSidebar: true, mediaType: 'video' }} />
|
||||
<WrappedRoute path='/:username/albums' page={ProfilePage} component={AccountAlbums} content={children} componentParams={{ noSidebar: true, mediaType: 'photo' }} />
|
||||
<WrappedRoute path='/:username/photos' exact page={ProfilePage} component={AccountPhotoGallery} content={children} componentParams={{ noSidebar: true }} />
|
||||
{ /* <WrappedRoute path='/:username/albums/:albumId' page={ProfilePage} component={AccountGallery} content={children} componentParams={{ noSidebar: true }} /> */ }
|
||||
<WrappedRoute path='/:username/videos' exact page={ProfilePage} component={AccountVideoGallery} content={children} componentParams={{ noSidebar: true }} />
|
||||
<WrappedRoute path='/:username/albums' exact page={ProfilePage} component={AccountAlbums} content={children} componentParams={{ noSidebar: true }} />
|
||||
|
||||
<WrappedRoute path='/:username/album_create' page={ModalPage} component={AlbumCreate} content={children} componentParams={{ title: 'Create Album', page: 'create-album' }} />
|
||||
<WrappedRoute path='/:username/album_edit/:albumId' page={ModalPage} component={AlbumCreate} content={children} componentParams={{ title: 'Create Album', page: 'edit-album' }} />
|
||||
{ /* <WrappedRoute path='/:username/albums/create' exact page={ModalPage} component={AlbumCreate} content={children} componentParams={{ title: 'Create Album', page: 'create-album' }} /> */ }
|
||||
{ /* <WrappedRoute path='/:username/albums/:albumId/edit' page={ModalPage} component={AlbumCreate} content={children} componentParams={{ title: 'Edit Album', page: 'edit-album' }} /> */ }
|
||||
|
||||
<WrappedRoute path='/:username/likes' page={ProfilePage} component={LikedStatuses} content={children} />
|
||||
<WrappedRoute path='/:username/bookmark_collections/create' page={ModalPage} component={BookmarkCollectionCreate} content={children} componentParams={{ title: 'Create Bookmark Collection', page: 'create-bookmark-collection' }} />
|
||||
<WrappedRoute path='/:username/bookmark_collections/:bookmarkCollectionId' page={ProfilePage} component={BookmarkedStatuses} content={children} />
|
||||
<WrappedRoute path='/:username/bookmark_collections/:bookmarkCollectionId/edit' page={ModalPage} component={BookmarkCollectionEdit} content={children} componentParams={{ title: 'Edit Bookmark Collection', page: 'edit-bookmark-collection' }} />
|
||||
<WrappedRoute path='/:username/bookmark_collections/:bookmarkCollectionId/edit' page={ModalPage} component={BookmarkCollectionCreate} content={children} componentParams={{ title: 'Edit Bookmark Collection', page: 'edit-bookmark-collection' }} />
|
||||
<WrappedRoute path='/:username/bookmark_collections' page={ProfilePage} component={BookmarkCollections} content={children} />
|
||||
|
||||
<WrappedRoute path='/:username/posts/:statusId' publicRoute exact page={BasicPage} component={StatusFeature} content={children} componentParams={{ title: 'Status', page: 'status' }} />
|
||||
|
||||
@@ -3,7 +3,8 @@ export function AboutSidebar() { return import(/* webpackChunkName: "components/
|
||||
export function AccountTimeline() { return import(/* webpackChunkName: "features/account_timeline" */'../../account_timeline') }
|
||||
export function AccountCommentsTimeline() { return import(/* webpackChunkName: "features/account_comments_timeline" */'../../account_comments_timeline') }
|
||||
export function AccountAlbums() { return import(/* webpackChunkName: "features/account_albums" */'../../account_albums') }
|
||||
export function AccountGallery() { return import(/* webpackChunkName: "features/account_gallery" */'../../account_gallery') }
|
||||
export function AccountPhotoGallery() { return import(/* webpackChunkName: "features/account_photo_gallery" */'../../account_photo_gallery') }
|
||||
export function AccountVideoGallery() { return import(/* webpackChunkName: "features/account_video_gallery" */'../../account_video_gallery') }
|
||||
export function AlbumCreate() { return import(/* webpackChunkName: "features/album_create" */'../../album_create') }
|
||||
export function AlbumCreateModal() { return import(/* webpackChunkName: "components/album_create_modal" */'../../../components/modal/album_create_modal') }
|
||||
export function Assets() { return import(/* webpackChunkName: "features/about/assets" */'../../about/assets') }
|
||||
@@ -12,8 +13,6 @@ export function BlockedAccounts() { return import(/* webpackChunkName: "features
|
||||
export function BookmarkCollections() { return import(/* webpackChunkName: "features/bookmark_collections" */'../../bookmark_collections') }
|
||||
export function BookmarkCollectionCreate() { return import(/* webpackChunkName: "features/bookmark_collection_create" */'../../bookmark_collection_create') }
|
||||
export function BookmarkCollectionCreateModal() { return import(/* webpackChunkName: "components/bookmark_collection_create_modal" */'../../../components/modal/bookmark_collection_create_modal') }
|
||||
export function BookmarkCollectionEdit() { return import(/* webpackChunkName: "features/bookmark_collection_edit" */'../../bookmark_collection_edit') }
|
||||
export function BookmarkCollectionEditModal() { return import(/* webpackChunkName: "components/bookmark_collection_edit_modal" */'../../../components/modal/bookmark_collection_edit_modal') }
|
||||
export function BookmarkedStatuses() { return import(/* webpackChunkName: "features/bookmarked_statuses" */'../../bookmarked_statuses') }
|
||||
export function BoostModal() { return import(/* webpackChunkName: "components/boost_modal" */'../../../components/modal/boost_modal') }
|
||||
export function CaliforniaConsumerProtection() { return import(/* webpackChunkName: "features/california_consumer_protection" */'../../about/california_consumer_protection') }
|
||||
|
||||
Reference in New Issue
Block a user