diff --git a/app/javascript/gabsocial/actions/favourites.js b/app/javascript/gabsocial/actions/favorites.js similarity index 72% rename from app/javascript/gabsocial/actions/favourites.js rename to app/javascript/gabsocial/actions/favorites.js index 03703853..2e60d271 100644 --- a/app/javascript/gabsocial/actions/favourites.js +++ b/app/javascript/gabsocial/actions/favorites.js @@ -2,13 +2,13 @@ import api, { getLinks } from '../api'; import { importFetchedStatuses } from './importer'; import { me } from '../initial_state'; -export const FAVOURITED_STATUSES_FETCH_REQUEST = 'FAVOURITED_STATUSES_FETCH_REQUEST'; -export const FAVOURITED_STATUSES_FETCH_SUCCESS = 'FAVOURITED_STATUSES_FETCH_SUCCESS'; -export const FAVOURITED_STATUSES_FETCH_FAIL = 'FAVOURITED_STATUSES_FETCH_FAIL'; +export const FAVORITED_STATUSES_FETCH_REQUEST = 'FAVORITED_STATUSES_FETCH_REQUEST'; +export const FAVORITED_STATUSES_FETCH_SUCCESS = 'FAVORITED_STATUSES_FETCH_SUCCESS'; +export const FAVORITED_STATUSES_FETCH_FAIL = 'FAVORITED_STATUSES_FETCH_FAIL'; -export const FAVOURITED_STATUSES_EXPAND_REQUEST = 'FAVOURITED_STATUSES_EXPAND_REQUEST'; -export const FAVOURITED_STATUSES_EXPAND_SUCCESS = 'FAVOURITED_STATUSES_EXPAND_SUCCESS'; -export const FAVOURITED_STATUSES_EXPAND_FAIL = 'FAVOURITED_STATUSES_EXPAND_FAIL'; +export const FAVORITED_STATUSES_EXPAND_REQUEST = 'FAVORITED_STATUSES_EXPAND_REQUEST'; +export const FAVORITED_STATUSES_EXPAND_SUCCESS = 'FAVORITED_STATUSES_EXPAND_SUCCESS'; +export const FAVORITED_STATUSES_EXPAND_FAIL = 'FAVORITED_STATUSES_EXPAND_FAIL'; export function fetchFavoritedStatuses() { return (dispatch, getState) => { @@ -32,14 +32,14 @@ export function fetchFavoritedStatuses() { export function fetchFavoritedStatusesRequest() { return { - type: FAVOURITED_STATUSES_FETCH_REQUEST, + type: FAVORITED_STATUSES_FETCH_REQUEST, skipLoading: true, }; }; export function fetchFavoritedStatusesSuccess(statuses, next) { return { - type: FAVOURITED_STATUSES_FETCH_SUCCESS, + type: FAVORITED_STATUSES_FETCH_SUCCESS, statuses, next, skipLoading: true, @@ -48,7 +48,7 @@ export function fetchFavoritedStatusesSuccess(statuses, next) { export function fetchFavoritedStatusesFail(error) { return { - type: FAVOURITED_STATUSES_FETCH_FAIL, + type: FAVORITED_STATUSES_FETCH_FAIL, error, skipLoading: true, }; @@ -78,13 +78,13 @@ export function expandFavoritedStatuses() { export function expandFavoritedStatusesRequest() { return { - type: FAVOURITED_STATUSES_EXPAND_REQUEST, + type: FAVORITED_STATUSES_EXPAND_REQUEST, }; }; export function expandFavoritedStatusesSuccess(statuses, next) { return { - type: FAVOURITED_STATUSES_EXPAND_SUCCESS, + type: FAVORITED_STATUSES_EXPAND_SUCCESS, statuses, next, }; @@ -92,7 +92,7 @@ export function expandFavoritedStatusesSuccess(statuses, next) { export function expandFavoritedStatusesFail(error) { return { - type: FAVOURITED_STATUSES_EXPAND_FAIL, + type: FAVORITED_STATUSES_EXPAND_FAIL, error, }; }; diff --git a/app/javascript/gabsocial/assets/error_icon.js b/app/javascript/gabsocial/assets/error_icon.js new file mode 100644 index 00000000..889dc2ee --- /dev/null +++ b/app/javascript/gabsocial/assets/error_icon.js @@ -0,0 +1,26 @@ +const ErrorIcon = ({ + className = '', + width = '32px', + height = '32px', + viewBox = '0 0 64 64', + title = 'Error', +}) => ( + + + + + +) + +export default ErrorIcon \ No newline at end of file diff --git a/app/javascript/gabsocial/assets/index.js b/app/javascript/gabsocial/assets/index.js index 32dea336..2d86010b 100644 --- a/app/javascript/gabsocial/assets/index.js +++ b/app/javascript/gabsocial/assets/index.js @@ -9,15 +9,20 @@ import CloseIcon from './close_icon' import CommentIcon from './comment_icon' import DissenterIcon from './dissenter_icon' import EllipsisIcon from './ellipsis_icon' +import ErrorIcon from './error_icon' import GlobeIcon from './globe_icon' import GroupIcon from './group_icon' import HomeIcon from './home_icon' import LikeIcon from './like_icon' +import LinkIcon from './link_icon' import ListIcon from './list_icon' import LoadingIcon from './loading_icon' import MediaIcon from './media_icon' +import MissingIcon from './missing_icon' import MoreIcon from './more_icon' import NotificationsIcon from './notifications_icon' +import PinIcon from './pin_icon' +import PlayIcon from './play_icon' import PollIcon from './poll_icon' import RepostIcon from './repost_icon' import SearchIcon from './search_icon' @@ -40,15 +45,20 @@ export { CommentIcon, DissenterIcon, EllipsisIcon, + ErrorIcon, GlobeIcon, GroupIcon, HomeIcon, LikeIcon, + LinkIcon, ListIcon, LoadingIcon, MediaIcon, + MissingIcon, MoreIcon, NotificationsIcon, + PinIcon, + PlayIcon, PollIcon, RepostIcon, SearchIcon, diff --git a/app/javascript/gabsocial/assets/link_icon.js b/app/javascript/gabsocial/assets/link_icon.js new file mode 100644 index 00000000..7fd270fe --- /dev/null +++ b/app/javascript/gabsocial/assets/link_icon.js @@ -0,0 +1,27 @@ +const LinkIcon = ({ + className = '', + width = '16px', + height = '16px', + viewBox = '0 0 64 64', + title = 'Link', +}) => ( + + + + + + +) + +export default LinkIcon \ No newline at end of file diff --git a/app/javascript/gabsocial/assets/missing_icon.js b/app/javascript/gabsocial/assets/missing_icon.js new file mode 100644 index 00000000..c89b928e --- /dev/null +++ b/app/javascript/gabsocial/assets/missing_icon.js @@ -0,0 +1,29 @@ +const MissingIcon = ({ + className = '', + width = '32px', + height = '32px', + viewBox = '0 0 84 84', + title = 'Missing', +}) => ( + + + + + + + + +) + +export default MissingIcon \ No newline at end of file diff --git a/app/javascript/gabsocial/assets/pin_icon.js b/app/javascript/gabsocial/assets/pin_icon.js new file mode 100644 index 00000000..70d817d1 --- /dev/null +++ b/app/javascript/gabsocial/assets/pin_icon.js @@ -0,0 +1,26 @@ +const PinIcon = ({ + className = '', + width = '16px', + height = '16px', + viewBox = '0 0 32 32', + title = 'Pin', +}) => ( + + + + + +) + +export default PinIcon \ No newline at end of file diff --git a/app/javascript/gabsocial/assets/play_icon.js b/app/javascript/gabsocial/assets/play_icon.js new file mode 100644 index 00000000..b922ff19 --- /dev/null +++ b/app/javascript/gabsocial/assets/play_icon.js @@ -0,0 +1,26 @@ +const PlayIcon = ({ + className = '', + width = '16px', + height = '16px', + viewBox = '0 0 64 64', + title = 'Play', +}) => ( + + + + + + ) + +export default PlayIcon \ No newline at end of file diff --git a/app/javascript/gabsocial/components/account/account.js b/app/javascript/gabsocial/components/account/account.js index 430ed993..f98bfae0 100644 --- a/app/javascript/gabsocial/components/account/account.js +++ b/app/javascript/gabsocial/components/account/account.js @@ -36,6 +36,7 @@ class Account extends ImmutablePureComponent { actionIcon: PropTypes.string, actionTitle: PropTypes.string, onActionClick: PropTypes.func, + compact: PropTypes.bool, } handleFollow = () => { @@ -63,7 +64,15 @@ class Account extends ImmutablePureComponent { } render() { - const { account, intl, hidden, onActionClick, actionIcon, actionTitle } = this.props + const { + account, + intl, + hidden, + onActionClick, + actionIcon, + actionTitle, + compact + } = this.props if (!account) return null @@ -76,6 +85,7 @@ class Account extends ImmutablePureComponent { ) } + const avatarSize = compact ? 42 : 52 let buttons if (onActionClick && actionIcon) { @@ -109,6 +119,50 @@ class Account extends ImmutablePureComponent { } } + // : todo : clean up + + if (compact) { + return ( +
+
+ + + + + +
+ + + +
+ +
+ +
+ +
+
+ ) + } + return (
@@ -118,7 +172,7 @@ class Account extends ImmutablePureComponent { title={account.get('acct')} to={`/${account.get('acct')}`} > - +
@@ -129,6 +183,7 @@ class Account extends ImmutablePureComponent { > + + { + !gap && + + {intl.formatMessage(messages.load_more)} + + } + { + gap && + + + + } + ) } diff --git a/app/javascript/gabsocial/components/media_gallery/index.js b/app/javascript/gabsocial/components/media_gallery/index.js index f2e8c65b..129745e5 100644 --- a/app/javascript/gabsocial/components/media_gallery/index.js +++ b/app/javascript/gabsocial/components/media_gallery/index.js @@ -1 +1 @@ -export { default } from './media_gallery'; \ No newline at end of file +export { default } from './media_gallery' \ No newline at end of file diff --git a/app/javascript/gabsocial/components/modal/modal_base.js b/app/javascript/gabsocial/components/modal/modal_base.js index 822520bb..e8eeb400 100644 --- a/app/javascript/gabsocial/components/modal/modal_base.js +++ b/app/javascript/gabsocial/components/modal/modal_base.js @@ -6,6 +6,7 @@ import { cancelReplyCompose } from '../../actions/compose' const messages = defineMessages({ confirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' }, + delete: { id: 'confirmations.delete.message', defaultMessage: 'Are you sure you want to delete this status?' }, }) const mapStateToProps = state => ({ @@ -58,7 +59,7 @@ class ModalBase extends PureComponent { if (!composeId && composeText && type == 'COMPOSE') { onOpenModal('CONFIRM', { - message: , + message: intl.formatMessage(messages.delete), confirm: intl.formatMessage(messages.confirm), onConfirm: () => onCancelReplyCompose(), onCancel: () => onOpenModal('COMPOSE'), diff --git a/app/javascript/gabsocial/components/panel/group_info_panel.js b/app/javascript/gabsocial/components/panel/group_info_panel.js index f131a793..d3cfab49 100644 --- a/app/javascript/gabsocial/components/panel/group_info_panel.js +++ b/app/javascript/gabsocial/components/panel/group_info_panel.js @@ -1,13 +1,18 @@ +import { Fragment } from 'react' import { defineMessages, injectIntl } from 'react-intl' import ImmutablePureComponent from 'react-immutable-pure-component' import ImmutablePropTypes from 'react-immutable-proptypes' -import { me } from '../../initial_state' import { shortNumberFormat } from '../../utils/numbers' import PanelLayout from './panel_layout' -import UserStat from '../user_stat' +import Button from '../button' +import Divider from '../divider' +import Heading from '../heading' +import Icon from '../icon' +import Text from '../text' const messages = defineMessages({ title: { id: 'about', defaultMessage: 'About' }, + members: { id: 'members', defaultMessage: 'Members' }, }) export default @@ -24,7 +29,45 @@ class GroupInfoPanel extends ImmutablePureComponent { return ( - + { + !!group && + + + + {group.get('title')} + + + + +
+
+ + + {intl.formatMessage(messages.members)} + +
+ +
+ + + + + {group.get('description')} + +
+ }
) } diff --git a/app/javascript/gabsocial/components/panel/profile_info_panel.js b/app/javascript/gabsocial/components/panel/profile_info_panel.js index 2d044fde..d1eb167c 100644 --- a/app/javascript/gabsocial/components/panel/profile_info_panel.js +++ b/app/javascript/gabsocial/components/panel/profile_info_panel.js @@ -1,15 +1,14 @@ +import { Fragment } from 'react' import { defineMessages, injectIntl } from 'react-intl' import { fetchSuggestions, dismissSuggestion } from '../../actions/suggestions' import ImmutablePureComponent from 'react-immutable-pure-component' import ImmutablePropTypes from 'react-immutable-proptypes' import { List as ImmutableList } from 'immutable' -import classNames from 'classnames/bind' import PanelLayout from './panel_layout' +import Divider from '../divider' import Icon from '../icon' import Text from '../text' -const cx = classNames.bind(_s) - const messages = defineMessages({ title: { id: 'about', defaultMessage: 'About' }, linkVerifiedOn: { id: 'account.link_verified_on', defaultMessage: 'Ownership of this link was checked on {date}' }, @@ -19,12 +18,12 @@ const messages = defineMessages({ }) const mapStateToProps = (state, { account }) => { - const identityProofs = !!account ? state.getIn(['identity_proofs', account.get('id')], ImmutableList()) : ImmutableList(); + const identityProofs = !!account ? state.getIn(['identity_proofs', account.get('id')], ImmutableList()) : ImmutableList() return { identityProofs, domain: state.getIn(['meta', 'domain']), - }; -}; + } +} const mapDispatchToProps = dispatch => { @@ -54,29 +53,9 @@ class ProfileInfoPanel extends ImmutablePureComponent { const fields = !account ? null : account.get('fields') const content = !account ? null : { __html: account.get('note_emojified') } - const memberSinceDate = !account ? null : intl.formatDate(account.get('created_at'), { month: 'long', year: 'numeric' }); + const memberSinceDate = !account ? null : intl.formatDate(account.get('created_at'), { month: 'long', year: 'numeric' }) const hasNote = !!content ? (account.get('note').length > 0 && account.get('note') !== '

') : false - const lineClasses = cx({ - default: 1, - flexRow: 1, - alignItemsCenter: 1, - borderTop1PX: 1, - borderColorSecondary: 1, - marginTop10PX: 1, - paddingTop10PX: 1, - }) - - const memberLineClasses = cx({ - default: 1, - flexRow: 1, - alignItemsCenter: 1, - borderTop1PX: hasNote, - borderColorSecondary: hasNote, - marginTop10PX: hasNote, - paddingTop10PX: hasNote, - }) - return ( { @@ -84,10 +63,13 @@ class ProfileInfoPanel extends ImmutablePureComponent {
{ hasNote && -
+ +
+ + } -
+
0 || identityProofs.size > 0) && (
- {identityProofs.map((proof, i) => ( -
-
+ + +
+
- { /* : todo : */ } -
- - - - - - - - -
-
+ { /* : todo : */} +
+ + + + + + + + +
+
+ ))} { fields.map((pair, i) => ( -
-
-
-
+ + +
+
+
+
+
)) } diff --git a/app/javascript/gabsocial/components/panel/who_to_follow_panel.js b/app/javascript/gabsocial/components/panel/who_to_follow_panel.js index 17cb416f..8e425111 100644 --- a/app/javascript/gabsocial/components/panel/who_to_follow_panel.js +++ b/app/javascript/gabsocial/components/panel/who_to_follow_panel.js @@ -42,7 +42,7 @@ class WhoToFollowPanel extends ImmutablePureComponent { const { intl, /* suggestions, */ dismissSuggestion } = this.props; // : testing!!! : const suggestions = [ - "1", + "1","1","1", ] // if (suggestions.isEmpty()) { // return null; diff --git a/app/javascript/gabsocial/components/poll/index.js b/app/javascript/gabsocial/components/poll/index.js index d03385a3..89d61718 100644 --- a/app/javascript/gabsocial/components/poll/index.js +++ b/app/javascript/gabsocial/components/poll/index.js @@ -1 +1 @@ -export { default } from './poll'; \ No newline at end of file +export { default } from './poll' \ No newline at end of file diff --git a/app/javascript/gabsocial/components/popover/popover_base.js b/app/javascript/gabsocial/components/popover/popover_base.js index 5cbfbdf3..6359525a 100644 --- a/app/javascript/gabsocial/components/popover/popover_base.js +++ b/app/javascript/gabsocial/components/popover/popover_base.js @@ -135,10 +135,10 @@ class PopoverBase extends ImmutablePureComponent { return (
-
- { /* */} + { /*
+ {children} -
+
*/}
) } diff --git a/app/javascript/gabsocial/components/popover/popover_root.js b/app/javascript/gabsocial/components/popover/popover_root.js index 78931766..9866aa66 100644 --- a/app/javascript/gabsocial/components/popover/popover_root.js +++ b/app/javascript/gabsocial/components/popover/popover_root.js @@ -48,9 +48,9 @@ class PopoverRoot extends PureComponent { onClose: PropTypes.func.isRequired, } - getSnapshotBeforeUpdate() { - return { visible: !!this.props.type } - } + // getSnapshotBeforeUpdate() { + // return { visible: !!this.props.type } + // } static contextTypes = { router: PropTypes.object, @@ -73,25 +73,25 @@ class PopoverRoot extends PureComponent { } handleDocumentClick = e => { - if (this.node && !this.node.contains(e.target)) { - this.props.onClose() - } + // if (this.node && !this.node.contains(e.target)) { + // this.props.onClose() + // } } componentDidMount() { - document.addEventListener('click', this.handleDocumentClick, false) - document.addEventListener('keydown', this.handleKeyDown, false) - document.addEventListener('touchend', this.handleDocumentClick, listenerOptions) + // document.addEventListener('click', this.handleDocumentClick, false) + // document.addEventListener('keydown', this.handleKeyDown, false) + // document.addEventListener('touchend', this.handleDocumentClick, listenerOptions) - if (this.focusedItem && this.props.openedViaKeyboard) this.focusedItem.focus() + // if (this.focusedItem && this.props.openedViaKeyboard) this.focusedItem.focus() - this.setState({ mounted: true }) + // this.setState({ mounted: true }) } componentWillUnmount() { - document.removeEventListener('click', this.handleDocumentClick, false) - document.removeEventListener('keydown', this.handleKeyDown, false) - document.removeEventListener('touchend', this.handleDocumentClick, listenerOptions) + // document.removeEventListener('click', this.handleDocumentClick, false) + // document.removeEventListener('keydown', this.handleKeyDown, false) + // document.removeEventListener('touchend', this.handleDocumentClick, listenerOptions) } setRef = c => { @@ -159,13 +159,15 @@ class PopoverRoot extends PureComponent { console.log("popover root - type, visible:", type, visible) + // + // { + // visible && + // + // } + // + return ( - - { - visible && - - } - +
) } } \ No newline at end of file diff --git a/app/javascript/gabsocial/components/search_popout/index.js b/app/javascript/gabsocial/components/search_popout/index.js index cf526221..b5f6eeee 100644 --- a/app/javascript/gabsocial/components/search_popout/index.js +++ b/app/javascript/gabsocial/components/search_popout/index.js @@ -1 +1 @@ -export { default } from './search_popout'; \ No newline at end of file +export { default } from './search_popout' \ No newline at end of file diff --git a/app/javascript/gabsocial/components/setting_toggle/index.js b/app/javascript/gabsocial/components/setting_toggle/index.js index d6d85c2b..f5100133 100644 --- a/app/javascript/gabsocial/components/setting_toggle/index.js +++ b/app/javascript/gabsocial/components/setting_toggle/index.js @@ -1 +1 @@ -export { default } from './setting_toggle'; \ No newline at end of file +export { default } from './setting_toggle' \ No newline at end of file diff --git a/app/javascript/gabsocial/components/status/index.js b/app/javascript/gabsocial/components/status/index.js index a460ff60..7c8b359d 100644 --- a/app/javascript/gabsocial/components/status/index.js +++ b/app/javascript/gabsocial/components/status/index.js @@ -1 +1 @@ -export { default } from './status'; \ No newline at end of file +export { default } from './status' \ No newline at end of file diff --git a/app/javascript/gabsocial/components/status/status.js b/app/javascript/gabsocial/components/status/status.js index 9ad85f6f..c5cf3087 100644 --- a/app/javascript/gabsocial/components/status/status.js +++ b/app/javascript/gabsocial/components/status/status.js @@ -321,9 +321,9 @@ class Status extends ImmutablePureComponent { prepend = (
diff --git a/app/javascript/gabsocial/components/status_action_bar/index.js b/app/javascript/gabsocial/components/status_action_bar/index.js index 188c4d30..290dff2f 100644 --- a/app/javascript/gabsocial/components/status_action_bar/index.js +++ b/app/javascript/gabsocial/components/status_action_bar/index.js @@ -1 +1 @@ -export { default } from './status_action_bar'; \ No newline at end of file +export { default } from './status_action_bar' \ No newline at end of file diff --git a/app/javascript/gabsocial/components/status_check_box/index.js b/app/javascript/gabsocial/components/status_check_box/index.js index f56ef7ac..cc445d15 100644 --- a/app/javascript/gabsocial/components/status_check_box/index.js +++ b/app/javascript/gabsocial/components/status_check_box/index.js @@ -1 +1 @@ -export { default } from './status_check_box'; \ No newline at end of file +export { default } from './status_check_box' \ No newline at end of file diff --git a/app/javascript/gabsocial/components/status_content/index.js b/app/javascript/gabsocial/components/status_content/index.js index 30bde49b..c34e7702 100644 --- a/app/javascript/gabsocial/components/status_content/index.js +++ b/app/javascript/gabsocial/components/status_content/index.js @@ -1 +1 @@ -export { default } from './status_content'; \ No newline at end of file +export { default } from './status_content' \ No newline at end of file diff --git a/app/javascript/gabsocial/components/status_list/index.js b/app/javascript/gabsocial/components/status_list/index.js index d885f93e..8c6aec58 100644 --- a/app/javascript/gabsocial/components/status_list/index.js +++ b/app/javascript/gabsocial/components/status_list/index.js @@ -1 +1 @@ -export { default } from './status_list'; \ No newline at end of file +export { default } from './status_list' \ No newline at end of file diff --git a/app/javascript/gabsocial/components/status_list/status_list.js b/app/javascript/gabsocial/components/status_list/status_list.js index 48670c13..dda05a8a 100644 --- a/app/javascript/gabsocial/components/status_list/status_list.js +++ b/app/javascript/gabsocial/components/status_list/status_list.js @@ -98,7 +98,7 @@ export default class StatusList extends ImmutablePureComponent { const { statusIds, featuredStatusIds, onLoadMore, timelineId, totalQueuedItemsCount, isLoading, isPartial, withGroupAdmin, group, promotion, promotedStatus, ...other } = this.props; if (isPartial) { - return ( ); + return } let scrollableContent = (isLoading || statusIds.size > 0) ? ( @@ -110,7 +110,7 @@ export default class StatusList extends ImmutablePureComponent { onClick={onLoadMore} /> ) : ( - + - {promotedStatus && index === promotion.position && ( + { + promotedStatus && index === promotion.position && - )} - + } + )) ) : null; diff --git a/app/javascript/gabsocial/components/tab_bar_item.js b/app/javascript/gabsocial/components/tab_bar_item.js index 6187a28e..347b52c0 100644 --- a/app/javascript/gabsocial/components/tab_bar_item.js +++ b/app/javascript/gabsocial/components/tab_bar_item.js @@ -66,9 +66,6 @@ class TabBarItem extends PureComponent { size: !!large ? 'normal' : 'small', color: isCurrent ? 'brand' : large ? 'secondary' : 'primary', weight: isCurrent ? 'bold' : large ? 'medium' : 'normal', - className: cx({ - paddingHorizontal5PX: large, - }), } return ( diff --git a/app/javascript/gabsocial/components/timeline_compose_block.js b/app/javascript/gabsocial/components/timeline_compose_block.js index 26d07730..cd4de14e 100644 --- a/app/javascript/gabsocial/components/timeline_compose_block.js +++ b/app/javascript/gabsocial/components/timeline_compose_block.js @@ -4,7 +4,6 @@ import { injectIntl, defineMessages } from 'react-intl' import { me } from '../initial_state' import ComposeFormContainer from '../features/compose/containers/compose_form_container' import Block from './block' -import Avatar from './avatar' import Heading from './heading' const messages = defineMessages({ diff --git a/app/javascript/gabsocial/components/timeline_queue_button_header.js b/app/javascript/gabsocial/components/timeline_queue_button_header.js index 88e30861..f2aedae9 100644 --- a/app/javascript/gabsocial/components/timeline_queue_button_header.js +++ b/app/javascript/gabsocial/components/timeline_queue_button_header.js @@ -1,6 +1,8 @@ -import { FormattedMessage } from 'react-intl'; -import classNames from 'classnames'; -import { shortNumberFormat } from '../utils/numbers'; +import { FormattedMessage } from 'react-intl' +import classNames from 'classnames' +import { shortNumberFormat } from '../utils/numbers' +import Button from './button' +import Text from './text' export default class TimelineQueueButtonHeader extends PureComponent { @@ -8,21 +10,24 @@ export default class TimelineQueueButtonHeader extends PureComponent { onClick: PropTypes.func.isRequired, count: PropTypes.number, itemType: PropTypes.string, - }; + floating: PropTypes.bool + } static defaultProps = { count: 0, itemType: 'item', - }; + } render () { - const { count, itemType, onClick } = this.props; + const { count, itemType, onClick } = this.props - const hasItems = (count > 0); + const hasItems = count > 0 + + // : todo : const classes = classNames('timeline-queue-header', { 'timeline-queue-header--extended': hasItems, - }); + }) return (
@@ -40,7 +45,7 @@ export default class TimelineQueueButtonHeader extends PureComponent { }
- ); + ) } } \ No newline at end of file diff --git a/app/javascript/gabsocial/components/toggle_switch/index.js b/app/javascript/gabsocial/components/toggle_switch/index.js index 93032dca..053a3dc5 100644 --- a/app/javascript/gabsocial/components/toggle_switch/index.js +++ b/app/javascript/gabsocial/components/toggle_switch/index.js @@ -1 +1 @@ -export { default } from './toggle_switch'; \ No newline at end of file +export { default } from './toggle_switch' \ No newline at end of file diff --git a/app/javascript/gabsocial/components/trends_panel_item.js b/app/javascript/gabsocial/components/trends_panel_item.js index f1b1bede..f9fd5186 100644 --- a/app/javascript/gabsocial/components/trends_panel_item.js +++ b/app/javascript/gabsocial/components/trends_panel_item.js @@ -16,7 +16,7 @@ export default class TrendingItem extends ImmutablePureComponent { static propTypes = { trend: ImmutablePropTypes.map.isRequired, - }; + } state = { hovering: false, diff --git a/app/javascript/gabsocial/components/trends_panel_item_card.js b/app/javascript/gabsocial/components/trends_panel_item_card.js index ba90cb1e..ff1755c7 100644 --- a/app/javascript/gabsocial/components/trends_panel_item_card.js +++ b/app/javascript/gabsocial/components/trends_panel_item_card.js @@ -14,7 +14,7 @@ export default class TrendingItemCard extends ImmutablePureComponent { static propTypes = { trend: ImmutablePropTypes.map.isRequired, - }; + } state = { hovering: false, diff --git a/app/javascript/gabsocial/components/zoomable_image/index.js b/app/javascript/gabsocial/components/zoomable_image/index.js index 51d88f4f..f1ec8498 100644 --- a/app/javascript/gabsocial/components/zoomable_image/index.js +++ b/app/javascript/gabsocial/components/zoomable_image/index.js @@ -1 +1 @@ -export { default } from './zoomable_image'; \ No newline at end of file +export { default } from './zoomable_image' \ No newline at end of file diff --git a/app/javascript/gabsocial/features/account_gallery/components/media_item/index.js b/app/javascript/gabsocial/features/account_gallery/components/media_item/index.js index f4c1e34d..41638cbd 100644 --- a/app/javascript/gabsocial/features/account_gallery/components/media_item/index.js +++ b/app/javascript/gabsocial/features/account_gallery/components/media_item/index.js @@ -1 +1 @@ -export { default } from './media_item'; \ No newline at end of file +export { default } from './media_item' \ No newline at end of file diff --git a/app/javascript/gabsocial/features/account_gallery/index.js b/app/javascript/gabsocial/features/account_gallery/index.js index c24ac926..27ccdb80 100644 --- a/app/javascript/gabsocial/features/account_gallery/index.js +++ b/app/javascript/gabsocial/features/account_gallery/index.js @@ -1 +1 @@ -export { default } from './account_gallery'; \ No newline at end of file +export { default } from './account_gallery' \ No newline at end of file diff --git a/app/javascript/gabsocial/features/account_timeline/components/header/index.js b/app/javascript/gabsocial/features/account_timeline/components/header/index.js index a997a96d..08b400a2 100644 --- a/app/javascript/gabsocial/features/account_timeline/components/header/index.js +++ b/app/javascript/gabsocial/features/account_timeline/components/header/index.js @@ -1 +1 @@ -export { default } from './header'; \ No newline at end of file +export { default } from './header' \ No newline at end of file diff --git a/app/javascript/gabsocial/features/account_timeline/components/inner_header/index.js b/app/javascript/gabsocial/features/account_timeline/components/inner_header/index.js index 3a95bcab..052b8042 100644 --- a/app/javascript/gabsocial/features/account_timeline/components/inner_header/index.js +++ b/app/javascript/gabsocial/features/account_timeline/components/inner_header/index.js @@ -1 +1 @@ -export { default } from './inner_header'; +export { default } from './inner_header' diff --git a/app/javascript/gabsocial/features/account_timeline/components/moved_note/index.js b/app/javascript/gabsocial/features/account_timeline/components/moved_note/index.js index 57948644..5173652d 100644 --- a/app/javascript/gabsocial/features/account_timeline/components/moved_note/index.js +++ b/app/javascript/gabsocial/features/account_timeline/components/moved_note/index.js @@ -1 +1 @@ -export { default } from './moved_note'; +export { default } from './moved_note' diff --git a/app/javascript/gabsocial/features/account_timeline/components/profile_info_panel/index.js b/app/javascript/gabsocial/features/account_timeline/components/profile_info_panel/index.js index 0102f779..e34e8831 100644 --- a/app/javascript/gabsocial/features/account_timeline/components/profile_info_panel/index.js +++ b/app/javascript/gabsocial/features/account_timeline/components/profile_info_panel/index.js @@ -1 +1 @@ -export { default } from './profile_info_panel'; \ No newline at end of file +export { default } from './profile_info_panel' \ No newline at end of file diff --git a/app/javascript/gabsocial/features/account_timeline/index.js b/app/javascript/gabsocial/features/account_timeline/index.js index 75cb22b9..48037c10 100644 --- a/app/javascript/gabsocial/features/account_timeline/index.js +++ b/app/javascript/gabsocial/features/account_timeline/index.js @@ -1 +1 @@ -export { default } from './account_timeline'; \ No newline at end of file +export { default } from './account_timeline' \ No newline at end of file diff --git a/app/javascript/gabsocial/features/blocks/index.js b/app/javascript/gabsocial/features/blocks/index.js index 0b92db80..9ce30fca 100644 --- a/app/javascript/gabsocial/features/blocks/index.js +++ b/app/javascript/gabsocial/features/blocks/index.js @@ -1 +1 @@ -export { default } from './blocks'; \ No newline at end of file +export { default } from './blocks' \ No newline at end of file diff --git a/app/javascript/gabsocial/features/community_timeline/components/column_settings/index.js b/app/javascript/gabsocial/features/community_timeline/components/column_settings/index.js index 258d0db2..fc57fdd8 100644 --- a/app/javascript/gabsocial/features/community_timeline/components/column_settings/index.js +++ b/app/javascript/gabsocial/features/community_timeline/components/column_settings/index.js @@ -1 +1 @@ -export { default } from './column_settings'; \ No newline at end of file +export { default } from './column_settings' \ No newline at end of file diff --git a/app/javascript/gabsocial/features/community_timeline/index.js b/app/javascript/gabsocial/features/community_timeline/index.js index f64cd1c2..a7a17bfc 100644 --- a/app/javascript/gabsocial/features/community_timeline/index.js +++ b/app/javascript/gabsocial/features/community_timeline/index.js @@ -1 +1 @@ -export { default } from './community_timeline'; \ No newline at end of file +export { default } from './community_timeline' \ No newline at end of file diff --git a/app/javascript/gabsocial/features/compose/components/action_bar/index.js b/app/javascript/gabsocial/features/compose/components/action_bar/index.js index 0a511724..a923c5de 100644 --- a/app/javascript/gabsocial/features/compose/components/action_bar/index.js +++ b/app/javascript/gabsocial/features/compose/components/action_bar/index.js @@ -1 +1 @@ -export { default } from './action_bar'; \ No newline at end of file +export { default } from './action_bar' \ No newline at end of file diff --git a/app/javascript/gabsocial/features/compose/components/character_counter/index.js b/app/javascript/gabsocial/features/compose/components/character_counter/index.js index 2cc2065d..7e3488b1 100644 --- a/app/javascript/gabsocial/features/compose/components/character_counter/index.js +++ b/app/javascript/gabsocial/features/compose/components/character_counter/index.js @@ -1 +1 @@ -export { default } from './character_counter'; \ No newline at end of file +export { default } from './character_counter' \ No newline at end of file diff --git a/app/javascript/gabsocial/features/compose/components/compose_form/index.js b/app/javascript/gabsocial/features/compose/components/compose_form/index.js index 319a9e2b..6335535b 100644 --- a/app/javascript/gabsocial/features/compose/components/compose_form/index.js +++ b/app/javascript/gabsocial/features/compose/components/compose_form/index.js @@ -1 +1 @@ -export { default } from './compose_form'; \ No newline at end of file +export { default } from './compose_form' \ No newline at end of file diff --git a/app/javascript/gabsocial/features/compose/components/emoji_picker_dropdown/index.js b/app/javascript/gabsocial/features/compose/components/emoji_picker_dropdown/index.js index 90acdafb..aeda01f5 100644 --- a/app/javascript/gabsocial/features/compose/components/emoji_picker_dropdown/index.js +++ b/app/javascript/gabsocial/features/compose/components/emoji_picker_dropdown/index.js @@ -1 +1 @@ -export { default } from './emoji_picker_dropdown'; \ No newline at end of file +export { default } from './emoji_picker_dropdown' \ No newline at end of file diff --git a/app/javascript/gabsocial/features/compose/components/navigation_bar/index.js b/app/javascript/gabsocial/features/compose/components/navigation_bar/index.js index 11cd0006..d948f6c9 100644 --- a/app/javascript/gabsocial/features/compose/components/navigation_bar/index.js +++ b/app/javascript/gabsocial/features/compose/components/navigation_bar/index.js @@ -1 +1 @@ -export { default } from './navigation_bar'; \ No newline at end of file +export { default } from './navigation_bar' \ No newline at end of file diff --git a/app/javascript/gabsocial/features/compose/components/poll_form/index.js b/app/javascript/gabsocial/features/compose/components/poll_form/index.js index d0f8eff9..51524efb 100644 --- a/app/javascript/gabsocial/features/compose/components/poll_form/index.js +++ b/app/javascript/gabsocial/features/compose/components/poll_form/index.js @@ -1 +1 @@ -export { default } from './poll_form'; \ No newline at end of file +export { default } from './poll_form' \ No newline at end of file diff --git a/app/javascript/gabsocial/features/compose/components/reply_indicator/index.js b/app/javascript/gabsocial/features/compose/components/reply_indicator/index.js index 67fa3d0f..cddd00dd 100644 --- a/app/javascript/gabsocial/features/compose/components/reply_indicator/index.js +++ b/app/javascript/gabsocial/features/compose/components/reply_indicator/index.js @@ -1 +1 @@ -export { default } from './reply_indicator'; \ No newline at end of file +export { default } from './reply_indicator' \ No newline at end of file diff --git a/app/javascript/gabsocial/features/compose/components/search_results/index.js b/app/javascript/gabsocial/features/compose/components/search_results/index.js index 04acfeda..9b12d240 100644 --- a/app/javascript/gabsocial/features/compose/components/search_results/index.js +++ b/app/javascript/gabsocial/features/compose/components/search_results/index.js @@ -1 +1 @@ -export { default } from './search_results'; \ No newline at end of file +export { default } from './search_results' \ No newline at end of file diff --git a/app/javascript/gabsocial/features/compose/components/upload/index.js b/app/javascript/gabsocial/features/compose/components/upload/index.js index 29607ac6..e482ed01 100644 --- a/app/javascript/gabsocial/features/compose/components/upload/index.js +++ b/app/javascript/gabsocial/features/compose/components/upload/index.js @@ -1 +1 @@ -export { default } from './upload'; \ No newline at end of file +export { default } from './upload' \ No newline at end of file diff --git a/app/javascript/gabsocial/features/compose/components/upload_form/index.js b/app/javascript/gabsocial/features/compose/components/upload_form/index.js index be54af57..b4f93ab9 100644 --- a/app/javascript/gabsocial/features/compose/components/upload_form/index.js +++ b/app/javascript/gabsocial/features/compose/components/upload_form/index.js @@ -1 +1 @@ -export { default } from './upload_form'; \ No newline at end of file +export { default } from './upload_form' \ No newline at end of file diff --git a/app/javascript/gabsocial/features/compose/components/upload_progress/index.js b/app/javascript/gabsocial/features/compose/components/upload_progress/index.js index c2a2d5bc..b6339605 100644 --- a/app/javascript/gabsocial/features/compose/components/upload_progress/index.js +++ b/app/javascript/gabsocial/features/compose/components/upload_progress/index.js @@ -1 +1 @@ -export { default } from './upload_progress'; \ No newline at end of file +export { default } from './upload_progress' \ No newline at end of file diff --git a/app/javascript/gabsocial/features/compose/components/warning/index.js b/app/javascript/gabsocial/features/compose/components/warning/index.js index 4d8ed6cf..f38bc8ee 100644 --- a/app/javascript/gabsocial/features/compose/components/warning/index.js +++ b/app/javascript/gabsocial/features/compose/components/warning/index.js @@ -1 +1 @@ -export { default } from './warning'; \ No newline at end of file +export { default } from './warning' \ No newline at end of file diff --git a/app/javascript/gabsocial/features/compose/index.js b/app/javascript/gabsocial/features/compose/index.js index cbb278c5..f5631b80 100644 --- a/app/javascript/gabsocial/features/compose/index.js +++ b/app/javascript/gabsocial/features/compose/index.js @@ -1 +1 @@ -export { default } from './compose'; \ No newline at end of file +export { default } from './compose' \ No newline at end of file diff --git a/app/javascript/gabsocial/features/domain_blocks/index.js b/app/javascript/gabsocial/features/domain_blocks/index.js index c52b3b89..ab33788b 100644 --- a/app/javascript/gabsocial/features/domain_blocks/index.js +++ b/app/javascript/gabsocial/features/domain_blocks/index.js @@ -1 +1 @@ -export { default } from './domain_blocks'; \ No newline at end of file +export { default } from './domain_blocks' \ No newline at end of file diff --git a/app/javascript/gabsocial/features/favourited_statuses/favourited_statuses.js b/app/javascript/gabsocial/features/favorited_statuses/favorited_statuses.js similarity index 73% rename from app/javascript/gabsocial/features/favourited_statuses/favourited_statuses.js rename to app/javascript/gabsocial/features/favorited_statuses/favorited_statuses.js index 73022459..09ab9370 100644 --- a/app/javascript/gabsocial/features/favourited_statuses/favourited_statuses.js +++ b/app/javascript/gabsocial/features/favorited_statuses/favorited_statuses.js @@ -2,7 +2,7 @@ import ImmutablePropTypes from 'react-immutable-proptypes'; import { FormattedMessage } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { debounce } from 'lodash'; -import { fetchFavoritedStatuses, expandFavoritedStatuses } from '../../actions/favourites'; +import { fetchFavoritedStatuses, expandFavoritedStatuses } from '../../actions/favorites'; import { meUsername } from '../../initial_state'; import StatusList from '../../components/status_list'; import ColumnIndicator from '../../components/column_indicator'; @@ -10,15 +10,15 @@ import ColumnIndicator from '../../components/column_indicator'; const mapStateToProps = (state, { params: { username } }) => { return { isMyAccount: (username.toLowerCase() === meUsername.toLowerCase()), - statusIds: state.getIn(['status_lists', 'favourites', 'items']), - isLoading: state.getIn(['status_lists', 'favourites', 'isLoading'], true), - hasMore: !!state.getIn(['status_lists', 'favourites', 'next']), + statusIds: state.getIn(['status_lists', 'favorites', 'items']), + isLoading: state.getIn(['status_lists', 'favorites', 'isLoading'], true), + hasMore: !!state.getIn(['status_lists', 'favorites', 'next']), }; }; export default @connect(mapStateToProps) -class Favourites extends ImmutablePureComponent { +class Favorites extends ImmutablePureComponent { static propTypes = { dispatch: PropTypes.func.isRequired, @@ -46,11 +46,11 @@ class Favourites extends ImmutablePureComponent { return ( } + emptyMessage={} /> ); } diff --git a/app/javascript/gabsocial/features/favorited_statuses/index.js b/app/javascript/gabsocial/features/favorited_statuses/index.js new file mode 100644 index 00000000..b38a0407 --- /dev/null +++ b/app/javascript/gabsocial/features/favorited_statuses/index.js @@ -0,0 +1 @@ +export { default } from './favorited_statuses' \ No newline at end of file diff --git a/app/javascript/gabsocial/features/favourited_statuses/index.js b/app/javascript/gabsocial/features/favourited_statuses/index.js deleted file mode 100644 index 1606240e..00000000 --- a/app/javascript/gabsocial/features/favourited_statuses/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './favourited_statuses'; \ No newline at end of file diff --git a/app/javascript/gabsocial/features/follow_requests/components/account_authorize/index.js b/app/javascript/gabsocial/features/follow_requests/components/account_authorize/index.js index 0b970c3b..f7a246dc 100644 --- a/app/javascript/gabsocial/features/follow_requests/components/account_authorize/index.js +++ b/app/javascript/gabsocial/features/follow_requests/components/account_authorize/index.js @@ -1 +1 @@ -export { default } from './account_authorize'; \ No newline at end of file +export { default } from './account_authorize' \ No newline at end of file diff --git a/app/javascript/gabsocial/features/follow_requests/index.js b/app/javascript/gabsocial/features/follow_requests/index.js index ffd94ce0..d8439bfb 100644 --- a/app/javascript/gabsocial/features/follow_requests/index.js +++ b/app/javascript/gabsocial/features/follow_requests/index.js @@ -1 +1 @@ -export { default } from './follow_requests'; \ No newline at end of file +export { default } from './follow_requests' \ No newline at end of file diff --git a/app/javascript/gabsocial/features/followers/followers.js b/app/javascript/gabsocial/features/followers/followers.js index 359dd272..898bb0e2 100644 --- a/app/javascript/gabsocial/features/followers/followers.js +++ b/app/javascript/gabsocial/features/followers/followers.js @@ -1,34 +1,36 @@ -import ImmutablePureComponent from 'react-immutable-pure-component'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import { debounce } from 'lodash'; -import { FormattedMessage } from 'react-intl'; -import ColumnIndicator from '../../components/column_indicator'; +import ImmutablePureComponent from 'react-immutable-pure-component' +import ImmutablePropTypes from 'react-immutable-proptypes' +import { debounce } from 'lodash' +import { defineMessages, injectIntl } from 'react-intl' +import ColumnIndicator from '../../components/column_indicator' import { fetchAccount, fetchFollowers, expandFollowers, fetchAccountByUsername, -} from '../../actions/accounts'; -import { me } from '../../initial_state'; -import AccountContainer from '../../containers/account_container'; -import ScrollableList from '../../components/scrollable_list'; +} from '../../actions/accounts' +import { me } from '../../initial_state' +import AccountContainer from '../../containers/account_container' +import ScrollableList from '../../components/scrollable_list' +import Block from '../../components/block' +import Heading from '../../components/heading' const mapStateToProps = (state, { params: { username } }) => { - const accounts = state.getIn(['accounts']); - const accountFetchError = (state.getIn(['accounts', -1, 'username'], '').toLowerCase() == username.toLowerCase()); + const accounts = state.getIn(['accounts']) + const accountFetchError = (state.getIn(['accounts', -1, 'username'], '').toLowerCase() == username.toLowerCase()) - let accountId = -1; + let accountId = -1 if (accountFetchError) { - accountId = null; + accountId = null } else { - let account = accounts.find(acct => username.toLowerCase() == acct.getIn(['acct'], '').toLowerCase()); - accountId = account ? account.getIn(['id'], null) : -1; + let account = accounts.find(acct => username.toLowerCase() == acct.getIn(['acct'], '').toLowerCase()) + accountId = account ? account.getIn(['id'], null) : -1 } - const isBlocked = state.getIn(['relationships', accountId, 'blocked_by'], false); - const isLocked = state.getIn(['accounts', accountId, 'locked'], false); - const isFollowing = state.getIn(['relationships', accountId, 'following'], false); - const unavailable = (me == accountId) ? false : (isBlocked || (isLocked && !isFollowing)); + const isBlocked = state.getIn(['relationships', accountId, 'blocked_by'], false) + const isLocked = state.getIn(['accounts', accountId, 'locked'], false) + const isFollowing = state.getIn(['relationships', accountId, 'following'], false) + const unavailable = (me == accountId) ? false : (isBlocked || (isLocked && !isFollowing)) return { accountId, @@ -36,69 +38,93 @@ const mapStateToProps = (state, { params: { username } }) => { isAccount: !!state.getIn(['accounts', accountId]), accountIds: state.getIn(['user_lists', 'followers', accountId, 'items']), hasMore: !!state.getIn(['user_lists', 'followers', accountId, 'next']), - }; -}; + } +} + +const messages = defineMessages({ + followers: { id: 'account.followers', defaultMessage: 'Followers' }, + empty: { id: 'account.followers.empty', defaultMessage: 'No one follows this user yet.' }, + unavailable: { id: 'empty_column.account_unavailable', defaultMessage: 'Profile unavailable' }, +}) export default @connect(mapStateToProps) +@injectIntl class Followers extends ImmutablePureComponent { static propTypes = { + intl: PropTypes.object.isRequired, params: PropTypes.object.isRequired, dispatch: PropTypes.func.isRequired, accountIds: ImmutablePropTypes.list, hasMore: PropTypes.bool, isAccount: PropTypes.bool, unavailable: PropTypes.bool, - }; + } componentWillMount() { - const { params: { username }, accountId } = this.props; + const { params: { username }, accountId } = this.props if (accountId && accountId !== -1) { - this.props.dispatch(fetchAccount(accountId)); - this.props.dispatch(fetchFollowers(accountId)); + this.props.dispatch(fetchAccount(accountId)) + this.props.dispatch(fetchFollowers(accountId)) } else { - this.props.dispatch(fetchAccountByUsername(username)); + this.props.dispatch(fetchAccountByUsername(username)) } } componentWillReceiveProps(nextProps) { if (nextProps.accountId && nextProps.accountId !== -1 && (nextProps.accountId !== this.props.accountId && nextProps.accountId)) { - this.props.dispatch(fetchAccount(nextProps.accountId)); - this.props.dispatch(fetchFollowers(nextProps.accountId)); + this.props.dispatch(fetchAccount(nextProps.accountId)) + this.props.dispatch(fetchFollowers(nextProps.accountId)) } } handleLoadMore = debounce(() => { if (this.props.accountId && this.props.accountId !== -1) { - this.props.dispatch(expandFollowers(this.props.accountId)); + this.props.dispatch(expandFollowers(this.props.accountId)) } - }, 300, { leading: true }); + }, 300, { leading: true }) render() { - const { accountIds, hasMore, isAccount, accountId, unavailable } = this.props; + const { + accountIds, + hasMore, + isAccount, + accountId, + unavailable, + intl + } = this.props if (!isAccount && accountId !== -1) { - return (); + return } else if (accountId === -1 || (!accountIds)) { - return (); + return } else if (unavailable) { - return (} />); + return } return ( - } - > - {accountIds.map(id => - - )} - - ); + +
+ + {intl.formatMessage(messages.followers)} + +
+
+ + {accountIds.map((id, i) => ( + + ))} + +
+
+ ) } } diff --git a/app/javascript/gabsocial/features/followers/index.js b/app/javascript/gabsocial/features/followers/index.js index 6c1c125d..b5f81827 100644 --- a/app/javascript/gabsocial/features/followers/index.js +++ b/app/javascript/gabsocial/features/followers/index.js @@ -1 +1 @@ -export { default } from './followers'; \ No newline at end of file +export { default } from './followers' \ No newline at end of file diff --git a/app/javascript/gabsocial/features/following/following.js b/app/javascript/gabsocial/features/following/following.js index 7855636b..de2ebe72 100644 --- a/app/javascript/gabsocial/features/following/following.js +++ b/app/javascript/gabsocial/features/following/following.js @@ -1,34 +1,36 @@ -import ImmutablePureComponent from 'react-immutable-pure-component'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import { debounce } from 'lodash'; -import { FormattedMessage } from 'react-intl'; +import ImmutablePureComponent from 'react-immutable-pure-component' +import ImmutablePropTypes from 'react-immutable-proptypes' +import { debounce } from 'lodash' +import { defineMessages, injectIntl } from 'react-intl' import { fetchAccount, fetchFollowing, expandFollowing, fetchAccountByUsername, -} from '../../actions/accounts'; -import { me } from '../../initial_state'; -import AccountContainer from '../../containers/account_container'; -import ColumnIndicator from '../../components/column_indicator'; -import ScrollableList from '../../components/scrollable_list'; +} from '../../actions/accounts' +import { me } from '../../initial_state' +import AccountContainer from '../../containers/account_container' +import ColumnIndicator from '../../components/column_indicator' +import ScrollableList from '../../components/scrollable_list' +import Block from '../../components/block' +import Heading from '../../components/heading' const mapStateToProps = (state, { params: { username } }) => { - const accounts = state.getIn(['accounts']); - const accountFetchError = (state.getIn(['accounts', -1, 'username'], '').toLowerCase() == username.toLowerCase()); + const accounts = state.getIn(['accounts']) + const accountFetchError = (state.getIn(['accounts', -1, 'username'], '').toLowerCase() == username.toLowerCase()) - let accountId = -1; + let accountId = -1 if (accountFetchError) { - accountId = null; + accountId = null } else { - let account = accounts.find(acct => username.toLowerCase() == acct.getIn(['acct'], '').toLowerCase()); - accountId = account ? account.getIn(['id'], null) : -1; + let account = accounts.find(acct => username.toLowerCase() == acct.getIn(['acct'], '').toLowerCase()) + accountId = account ? account.getIn(['id'], null) : -1 } - const isBlocked = state.getIn(['relationships', accountId, 'blocked_by'], false); - const isLocked = state.getIn(['accounts', accountId, 'locked'], false); - const isFollowing = state.getIn(['relationships', accountId, 'following'], false); - const unavailable = (me == accountId) ? false : (isBlocked || (isLocked && !isFollowing)); + const isBlocked = state.getIn(['relationships', accountId, 'blocked_by'], false) + const isLocked = state.getIn(['accounts', accountId, 'locked'], false) + const isFollowing = state.getIn(['relationships', accountId, 'following'], false) + const unavailable = (me == accountId) ? false : (isBlocked || (isLocked && !isFollowing)) return { accountId, @@ -36,71 +38,93 @@ const mapStateToProps = (state, { params: { username } }) => { isAccount: !!state.getIn(['accounts', accountId]), accountIds: state.getIn(['user_lists', 'following', accountId, 'items']), hasMore: !!state.getIn(['user_lists', 'following', accountId, 'next']), - }; -}; - + } +} +const messages = defineMessages({ + follows: { id: 'account.follows', defaultMessage: 'Follows' }, + empty: { id: 'account.follows.empty', defaultMessage: 'This user doesn\'t follow anyone yet.' }, + unavailable: { id: 'empty_column.account_unavailable', defaultMessage: 'Profile unavailable' }, +}) export default @connect(mapStateToProps) +@injectIntl class Following extends ImmutablePureComponent { static propTypes = { + intl: PropTypes.object.isRequired, params: PropTypes.object.isRequired, dispatch: PropTypes.func.isRequired, accountIds: ImmutablePropTypes.list, hasMore: PropTypes.bool, isAccount: PropTypes.bool, unavailable: PropTypes.bool, - }; + } - componentWillMount () { - const { params: { username }, accountId } = this.props; + componentWillMount() { + const { params: { username }, accountId } = this.props if (accountId && accountId !== -1) { - this.props.dispatch(fetchAccount(accountId)); - this.props.dispatch(fetchFollowing(accountId)); + this.props.dispatch(fetchAccount(accountId)) + this.props.dispatch(fetchFollowing(accountId)) } else { - this.props.dispatch(fetchAccountByUsername(username)); + this.props.dispatch(fetchAccountByUsername(username)) } } - componentWillReceiveProps (nextProps) { + componentWillReceiveProps(nextProps) { if (nextProps.accountId && nextProps.accountId !== -1 && (nextProps.accountId !== this.props.accountId && nextProps.accountId)) { - this.props.dispatch(fetchAccount(nextProps.accountId)); - this.props.dispatch(fetchFollowing(nextProps.accountId)); + this.props.dispatch(fetchAccount(nextProps.accountId)) + this.props.dispatch(fetchFollowing(nextProps.accountId)) } } handleLoadMore = debounce(() => { if (this.props.accountId && this.props.accountId !== -1) { - this.props.dispatch(expandFollowing(this.props.accountId)); + this.props.dispatch(expandFollowing(this.props.accountId)) } - }, 300, { leading: true }); + }, 300, { leading: true }) - render () { - const { accountIds, hasMore, isAccount, accountId, unavailable } = this.props; + render() { + const { + accountIds, + hasMore, + isAccount, + accountId, + unavailable, + intl + } = this.props if (!isAccount && accountId !== -1) { - return ( ); + return } else if (accountId === -1 || (!accountIds)) { - return ( ); + return } else if (unavailable) { - return (} />); + return } return ( - } - > - {accountIds.map(id => - - )} - - ); + +
+ + {intl.formatMessage(messages.follows)} + +
+
+ + {accountIds.map((id, i) => ( + + ))} + +
+
+ ) } } \ No newline at end of file diff --git a/app/javascript/gabsocial/features/following/index.js b/app/javascript/gabsocial/features/following/index.js index 94b9c573..a5b0167e 100644 --- a/app/javascript/gabsocial/features/following/index.js +++ b/app/javascript/gabsocial/features/following/index.js @@ -1 +1 @@ -export { default } from './following'; \ No newline at end of file +export { default } from './following' \ No newline at end of file diff --git a/app/javascript/gabsocial/features/generic_not_found/index.js b/app/javascript/gabsocial/features/generic_not_found/index.js index 839ea96d..2d516f0c 100644 --- a/app/javascript/gabsocial/features/generic_not_found/index.js +++ b/app/javascript/gabsocial/features/generic_not_found/index.js @@ -1 +1 @@ -export { default } from './generic_not_found'; \ No newline at end of file +export { default } from './generic_not_found' \ No newline at end of file diff --git a/app/javascript/gabsocial/features/groups/create/index.js b/app/javascript/gabsocial/features/group_create/group_create.js similarity index 52% rename from app/javascript/gabsocial/features/groups/create/index.js rename to app/javascript/gabsocial/features/group_create/group_create.js index 5bb8e6db..6078aab3 100644 --- a/app/javascript/gabsocial/features/groups/create/index.js +++ b/app/javascript/gabsocial/features/group_create/group_create.js @@ -1,7 +1,9 @@ -import { changeValue, submit, reset } from '../../../actions/group_editor'; -import Icon from '../../../components/icon'; -import { defineMessages, injectIntl } from 'react-intl'; -import classNames from 'classnames'; +import { defineMessages, injectIntl } from 'react-intl' +import { changeValue, submit, reset } from '../../actions/group_editor' +import Block from '../../components/block' +import Button from '../../components/button' +import Icon from '../../components/icon' +import Input from '../../components/icon' const messages = defineMessages({ title: { id: 'groups.form.title', defaultMessage: 'Enter a new group title' }, @@ -9,14 +11,14 @@ const messages = defineMessages({ coverImage: { id: 'groups.form.coverImage', defaultMessage: 'Upload a banner image' }, coverImageChange: { id: 'groups.form.coverImageChange', defaultMessage: 'Banner image selected' }, create: { id: 'groups.form.create', defaultMessage: 'Create group' }, -}); +}) const mapStateToProps = state => ({ title: state.getIn(['group_editor', 'title']), description: state.getIn(['group_editor', 'description']), coverImage: state.getIn(['group_editor', 'coverImage']), disabled: state.getIn(['group_editor', 'isSubmitting']), -}); +}) const mapDispatchToProps = dispatch => ({ onTitleChange: value => dispatch(changeValue('title', value)), @@ -24,7 +26,7 @@ const mapDispatchToProps = dispatch => ({ onCoverImageChange: value => dispatch(changeValue('coverImage', value)), onSubmit: routerHistory => dispatch(submit(routerHistory)), reset: () => dispatch(reset()), -}); +}) export default @connect(mapStateToProps, mapDispatchToProps) @@ -43,69 +45,70 @@ class Create extends PureComponent { intl: PropTypes.object.isRequired, onTitleChange: PropTypes.func.isRequired, onSubmit: PropTypes.func.isRequired, - }; + } componentWillMount() { - this.props.reset(); + this.props.reset() } handleTitleChange = e => { - this.props.onTitleChange(e.target.value); + this.props.onTitleChange(e.target.value) } handleDescriptionChange = e => { - this.props.onDescriptionChange(e.target.value); + this.props.onDescriptionChange(e.target.value) } handleCoverImageChange = e => { - this.props.onCoverImageChange(e.target.files[0]); + this.props.onCoverImageChange(e.target.files[0]) } handleSubmit = e => { - e.preventDefault(); - this.props.onSubmit(this.context.router.history); + e.preventDefault() + this.props.onSubmit(this.context.router.history) } - render () { - const { title, description, coverImage, disabled, intl } = this.props; + render() { + const { title, description, coverImage, disabled, intl } = this.props return ( -
-
- -
-
-