diff --git a/app/javascript/gabsocial/actions/notifications.js b/app/javascript/gabsocial/actions/notifications.js index 6ea1baf8..655bce69 100644 --- a/app/javascript/gabsocial/actions/notifications.js +++ b/app/javascript/gabsocial/actions/notifications.js @@ -167,7 +167,13 @@ export function expandNotifications({ maxId } = {}, done = noOp) { done(); return; } + + console.log("activeFilter:", activeFilter) + console.log("excludeTypesFromSettings(getState()):", excludeTypesFromSettings(getState())) + console.log("excludeTypesFromFilter(activeFilter):", excludeTypesFromFilter(activeFilter)) + // : todo : + // filter verified and following here too const params = { max_id: maxId, exclude_types: activeFilter === 'all' diff --git a/app/javascript/gabsocial/assets/code_icon.js b/app/javascript/gabsocial/assets/code_icon.js new file mode 100644 index 00000000..2ac11ce6 --- /dev/null +++ b/app/javascript/gabsocial/assets/code_icon.js @@ -0,0 +1,28 @@ +const CodeIcon = ({ + className = '', + width = '24px', + height = '24px', + viewBox = '0 0 48 48', + title = 'Code', +}) => ( + + + + + + + +) + +export default CodeIcon \ No newline at end of file diff --git a/app/javascript/gabsocial/assets/copy_icon.js b/app/javascript/gabsocial/assets/copy_icon.js new file mode 100644 index 00000000..2b8e4e25 --- /dev/null +++ b/app/javascript/gabsocial/assets/copy_icon.js @@ -0,0 +1,27 @@ +const CopyIcon = ({ + className = '', + width = '24px', + height = '24px', + viewBox = '0 0 48 48', + title = 'Copy', +}) => ( + + + + + + +) + +export default CopyIcon \ No newline at end of file diff --git a/app/javascript/gabsocial/assets/email_icon.js b/app/javascript/gabsocial/assets/email_icon.js new file mode 100644 index 00000000..9860041d --- /dev/null +++ b/app/javascript/gabsocial/assets/email_icon.js @@ -0,0 +1,26 @@ +const EmailIcon = ({ + className = '', + width = '24px', + height = '24px', + viewBox = '0 0 48 48', + title = 'Email', +}) => ( + + + + + +) + +export default EmailIcon \ No newline at end of file diff --git a/app/javascript/gabsocial/assets/lock_filled_icon.js b/app/javascript/gabsocial/assets/lock_filled_icon.js new file mode 100644 index 00000000..ff28e505 --- /dev/null +++ b/app/javascript/gabsocial/assets/lock_filled_icon.js @@ -0,0 +1,26 @@ +const LockFilledIcon = ({ + className = '', + width = '24px', + height = '24px', + viewBox = '0 0 48 48', + title = 'Lock', +}) => ( + + + + + +) + +export default LockFilledIcon \ No newline at end of file diff --git a/app/javascript/gabsocial/assets/lock_icon.js b/app/javascript/gabsocial/assets/lock_icon.js new file mode 100644 index 00000000..5f1504c1 --- /dev/null +++ b/app/javascript/gabsocial/assets/lock_icon.js @@ -0,0 +1,26 @@ +const LockIcon = ({ + className = '', + width = '24px', + height = '24px', + viewBox = '0 0 48 48', + title = 'Lock', +}) => ( + + + + + +) + +export default LockIcon \ No newline at end of file diff --git a/app/javascript/gabsocial/assets/unlock_filled_icon.js b/app/javascript/gabsocial/assets/unlock_filled_icon.js new file mode 100644 index 00000000..5cc39ae9 --- /dev/null +++ b/app/javascript/gabsocial/assets/unlock_filled_icon.js @@ -0,0 +1,26 @@ +const UnlockFilledIcon = ({ + className = '', + width = '24px', + height = '24px', + viewBox = '0 0 48 48', + title = 'Unlock', +}) => ( + + + + + +) + +export default UnlockFilledIcon \ No newline at end of file diff --git a/app/javascript/gabsocial/components/icon.js b/app/javascript/gabsocial/components/icon.js index 9e3f50be..3bb55333 100644 --- a/app/javascript/gabsocial/components/icon.js +++ b/app/javascript/gabsocial/components/icon.js @@ -10,10 +10,13 @@ import CalendarIcon from '../assets/calendar_icon' import ChatIcon from '../assets/chat_icon' import CircleIcon from '../assets/circle_icon' import CloseIcon from '../assets/close_icon' +import CodeIcon from '../assets/code_icon' import CommentIcon from '../assets/comment_icon' +import CopyIcon from '../assets/copy_icon' import DissenterIcon from '../assets/dissenter_icon' import DonorIcon from '../assets/donor_icon' import EllipsisIcon from '../assets/ellipsis_icon' +import EmailIcon from '../assets/email_icon' import ErrorIcon from '../assets/error_icon' import FullscreenIcon from '../assets/fullscreen_icon' import GabLogoIcon from '../assets/gab_logo' @@ -31,6 +34,8 @@ import LinkIcon from '../assets/link_icon' import ListIcon from '../assets/list_icon' import ListAddIcon from '../assets/list_add_icon' import LoadingIcon from '../assets/loading_icon' +import LockIcon from '../assets/lock_icon' +import LockFilledIcon from '../assets/lock_filled_icon' import MediaIcon from '../assets/media_icon' import MinimizeFullscreenIcon from '../assets/minimize_fullscreen_icon' import MissingIcon from '../assets/missing_icon' @@ -54,6 +59,7 @@ import TextSizeIcon from '../assets/text_size_icon' import TrendsIcon from '../assets/trends_icon' import ULListIcon from '../assets/ul_list_icon' import UnderlineIcon from '../assets/underline_icon' +import UnlockFilledIcon from '../assets/unlock_filled_icon' import VerifiedIcon from '../assets/verified_icon' import WarningIcon from '../assets/warning_icon' @@ -69,10 +75,13 @@ const ICONS = { 'calendar': CalendarIcon, 'chat': ChatIcon, 'close': CloseIcon, +'code': CodeIcon, 'comment': CommentIcon, +'copy': CopyIcon, 'dissenter': DissenterIcon, 'donor': DonorIcon, 'ellipsis': EllipsisIcon, +'email': EmailIcon, 'error': ErrorIcon, 'fullscreen': FullscreenIcon, 'gab-logo': GabLogoIcon, @@ -90,6 +99,8 @@ const ICONS = { 'list': ListIcon, 'list-add': ListAddIcon, 'loading': LoadingIcon, +'lock': LockIcon, +'lock-filled': LockFilledIcon, 'media': MediaIcon, 'minimize-fullscreen': MinimizeFullscreenIcon, 'missing': MissingIcon, @@ -113,6 +124,7 @@ const ICONS = { 'trends': TrendsIcon, 'ul-list': ULListIcon, 'underline': UnderlineIcon, +'unlock-filled': UnlockFilledIcon, 'verified': VerifiedIcon, 'warning': WarningIcon, '': CircleIcon, diff --git a/app/javascript/gabsocial/components/list.js b/app/javascript/gabsocial/components/list.js index d4d0b9c8..de47a037 100644 --- a/app/javascript/gabsocial/components/list.js +++ b/app/javascript/gabsocial/components/list.js @@ -9,7 +9,10 @@ export default class List extends ImmutablePureComponent { items: PropTypes.array, scrollKey: PropTypes.string, emptyMessage: PropTypes.any, - small: PropTypes.bool, + size: PropTypes.oneOf([ + 'small', + 'large' + ]), onLoadMore: PropTypes.func, hasMore: PropTypes.bool, } @@ -20,7 +23,7 @@ export default class List extends ImmutablePureComponent { scrollKey, emptyMessage, hasMore, - small, + size, onLoadMore } = this.props @@ -35,7 +38,7 @@ export default class List extends ImmutablePureComponent { { items.map((item, i) => ( } diff --git a/app/javascript/gabsocial/components/modal/block_account_modal.js b/app/javascript/gabsocial/components/modal/block_account_modal.js index 52084f57..8ac66ef2 100644 --- a/app/javascript/gabsocial/components/modal/block_account_modal.js +++ b/app/javascript/gabsocial/components/modal/block_account_modal.js @@ -33,6 +33,7 @@ class BlockAccountModal extends PureComponent { static propTypes = { account: PropTypes.object.isRequired, onConfirm: PropTypes.func.isRequired, + onClose: PropTypes.func.isRequired, intl: PropTypes.object.isRequired, } @@ -41,7 +42,7 @@ class BlockAccountModal extends PureComponent { } render() { - const { account, intl } = this.props + const { account, intl, onClose } = this.props const title = intl.formatMessage(messages.title, { name: !!account ? account.get('acct') : '', @@ -56,6 +57,7 @@ class BlockAccountModal extends PureComponent { message={message} confirm={intl.formatMessage(messages.block)} onConfirm={this.handleClick} + onClose={onClose} /> ) } diff --git a/app/javascript/gabsocial/components/modal/community_timeline_settings_modal.js b/app/javascript/gabsocial/components/modal/community_timeline_settings_modal.js index 7697542f..4c78749b 100644 --- a/app/javascript/gabsocial/components/modal/community_timeline_settings_modal.js +++ b/app/javascript/gabsocial/components/modal/community_timeline_settings_modal.js @@ -1,7 +1,6 @@ import { defineMessages, injectIntl } from 'react-intl' import ImmutablePureComponent from 'react-immutable-pure-component' import ImmutablePropTypes from 'react-immutable-proptypes' -import { closeModal } from '../../actions/modal' import { changeSetting, saveSettings } from '../../actions/settings' import ModalLayout from './modal_layout' import Button from '../button' @@ -19,14 +18,14 @@ const mapStateToProps = state => ({ settings: state.getIn(['settings', 'community']), }) -const mapDispatchToProps = dispatch => { +const mapDispatchToProps = (dispatch, { onClose }) => { return { onChange(key, checked) { dispatch(changeSetting(['community', ...key], checked)) }, onSave() { dispatch(saveSettings()) - dispatch(closeModal()) + onClose() }, } } @@ -48,7 +47,7 @@ class CommunityTimelineSettingsModal extends ImmutablePureComponent { } render() { - const { intl, settings, onChange } = this.props + const { intl, settings, onChange, onClose } = this.props return ( +
{intl.formatMessage(messages.instructions)} diff --git a/app/javascript/gabsocial/components/modal/gif_picker_modal.js b/app/javascript/gabsocial/components/modal/gif_picker_modal.js index 959f6354..eab17b1e 100644 --- a/app/javascript/gabsocial/components/modal/gif_picker_modal.js +++ b/app/javascript/gabsocial/components/modal/gif_picker_modal.js @@ -6,7 +6,6 @@ import { setSelectedGif, changeGifSearchText } from '../../actions/tenor' -import { closeModal } from '../../actions/modal' import Block from '../block' import Button from '../button' import ColumnIndicator from '../column_indicator' @@ -29,12 +28,12 @@ const mapStateToProps = (state) => ({ searchText: state.getIn(['tenor', 'searchText']), }) -export const mapDispatchToProps = (dispatch) => ({ +export const mapDispatchToProps = (dispatch, { onClose }) => ({ handleCloseModal() { dispatch(changeGifSearchText('')) dispatch(clearGifResults()) - dispatch(closeModal()) + onClose() }, handleFetchCategories: () => { diff --git a/app/javascript/gabsocial/components/modal/group_create_modal.js b/app/javascript/gabsocial/components/modal/group_create_modal.js index 3b972016..cb4c5d95 100644 --- a/app/javascript/gabsocial/components/modal/group_create_modal.js +++ b/app/javascript/gabsocial/components/modal/group_create_modal.js @@ -13,15 +13,17 @@ class GroupCreateModal extends ImmutablePureComponent { static propTypes = { intl: PropTypes.object.isRequired, + onClose: PropTypes.func.isRequired, } render() { - const { intl } = this.props + const { intl, onClose } = this.props return ( diff --git a/app/javascript/gabsocial/components/modal/group_delete_modal.js b/app/javascript/gabsocial/components/modal/group_delete_modal.js index 110bdedc..1b7541d5 100644 --- a/app/javascript/gabsocial/components/modal/group_delete_modal.js +++ b/app/javascript/gabsocial/components/modal/group_delete_modal.js @@ -25,6 +25,7 @@ class GroupDeleteModal extends PureComponent { static propTypes = { group: PropTypes.object.isRequired, onConfirm: PropTypes.func.isRequired, + onClose: PropTypes.func.isRequired, intl: PropTypes.object.isRequired, } @@ -33,7 +34,7 @@ class GroupDeleteModal extends PureComponent { } render() { - const { group, intl } = this.props + const { group, intl, onClose } = this.props const title = intl.formatMessage(messages.title, { group: !!group ? account.get('title') : '', @@ -48,6 +49,7 @@ class GroupDeleteModal extends PureComponent { message={message} confirm={intl.formatMessage(messages.delete)} onConfirm={this.handleClick} + onClose={onClose} /> ) } diff --git a/app/javascript/gabsocial/components/modal/hashtag_timeline_settings_modal.js b/app/javascript/gabsocial/components/modal/hashtag_timeline_settings_modal.js index 4f140278..8c39005a 100644 --- a/app/javascript/gabsocial/components/modal/hashtag_timeline_settings_modal.js +++ b/app/javascript/gabsocial/components/modal/hashtag_timeline_settings_modal.js @@ -1,7 +1,6 @@ import { defineMessages, injectIntl } from 'react-intl' import ImmutablePureComponent from 'react-immutable-pure-component' import ImmutablePropTypes from 'react-immutable-proptypes' -import { closeModal } from '../../actions/modal' import { changeSetting, saveSettings } from '../../actions/settings' import ModalLayout from './modal_layout' import Button from '../button' @@ -19,14 +18,14 @@ const mapStateToProps = state => ({ settings: state.getIn(['settings', 'community']), }) -const mapDispatchToProps = dispatch => { +const mapDispatchToProps = (dispatch, { onClose }) => { return { onChange(key, checked) { dispatch(changeSetting(['community', ...key], checked)) }, onSave() { dispatch(saveSettings()) - dispatch(closeModal()) + onClose() }, } } @@ -41,6 +40,7 @@ class HashtagTimelineSettingsModal extends ImmutablePureComponent { settings: ImmutablePropTypes.map.isRequired, onChange: PropTypes.func.isRequired, onSave: PropTypes.func.isRequired, + onClose: PropTypes.func.isRequired, } handleSaveAndClose = () => { @@ -48,7 +48,7 @@ class HashtagTimelineSettingsModal extends ImmutablePureComponent { } render() { - const { intl, settings, onChange } = this.props + const { intl, settings, onChange, onClose } = this.props // : todo : @@ -56,8 +56,9 @@ class HashtagTimelineSettingsModal extends ImmutablePureComponent { - +
({ settings: state.getIn(['settings', 'home']), }) -const mapDispatchToProps = dispatch => { +const mapDispatchToProps = (dispatch, {onClose}) => { return { onChange(key, checked) { dispatch(changeSetting(['home', ...key], checked)) }, onSave() { dispatch(saveSettings()) - dispatch(closeModal()) + onClose() }, } } @@ -43,6 +42,7 @@ class HomeTimelineSettingsModal extends ImmutablePureComponent { intl: PropTypes.object.isRequired, settings: ImmutablePropTypes.map.isRequired, onChange: PropTypes.func.isRequired, + onClose: PropTypes.func.isRequired, onSave: PropTypes.func.isRequired, } @@ -51,12 +51,13 @@ class HomeTimelineSettingsModal extends ImmutablePureComponent { } render() { - const { intl, settings, onChange } = this.props + const { intl, settings, onChange, onClose } = this.props return (
diff --git a/app/javascript/gabsocial/components/modal/hotkeys_modal.js b/app/javascript/gabsocial/components/modal/hotkeys_modal.js index df14a686..8bceac98 100644 --- a/app/javascript/gabsocial/components/modal/hotkeys_modal.js +++ b/app/javascript/gabsocial/components/modal/hotkeys_modal.js @@ -42,13 +42,17 @@ class HotkeysModal extends ImmutablePureComponent { static propTypes = { intl: PropTypes.object.isRequired, + onClose: PropTypes.func.isRequired, } render() { - const { intl } = this.props + const { intl, onClose } = this.props return ( - +
diff --git a/app/javascript/gabsocial/components/modal/list_create_modal.js b/app/javascript/gabsocial/components/modal/list_create_modal.js index 86686788..26c2d70e 100644 --- a/app/javascript/gabsocial/components/modal/list_create_modal.js +++ b/app/javascript/gabsocial/components/modal/list_create_modal.js @@ -13,15 +13,17 @@ class ListCreateModal extends ImmutablePureComponent { static propTypes = { intl: PropTypes.object.isRequired, + onClose: PropTypes.func.isRequired, } render() { - const { intl } = this.props + const { intl, onClose } = this.props return ( diff --git a/app/javascript/gabsocial/components/modal/list_delete_modal.js b/app/javascript/gabsocial/components/modal/list_delete_modal.js index d41f99fe..213561ba 100644 --- a/app/javascript/gabsocial/components/modal/list_delete_modal.js +++ b/app/javascript/gabsocial/components/modal/list_delete_modal.js @@ -33,7 +33,7 @@ class ListDeleteModal extends PureComponent { } render() { - const { list, intl } = this.props + const { list, intl, onClose } = this.props const title = intl.formatMessage(messages.title, { list: !!list ? account.get('title') : '', @@ -48,6 +48,7 @@ class ListDeleteModal extends PureComponent { message={message} confirm={intl.formatMessage(messages.delete)} onConfirm={this.handleClick} + onClose={onClose} /> ) } diff --git a/app/javascript/gabsocial/components/modal/list_timeline_settings_modal.js b/app/javascript/gabsocial/components/modal/list_timeline_settings_modal.js index 2732357d..2b615b43 100644 --- a/app/javascript/gabsocial/components/modal/list_timeline_settings_modal.js +++ b/app/javascript/gabsocial/components/modal/list_timeline_settings_modal.js @@ -1,7 +1,6 @@ import { defineMessages, injectIntl } from 'react-intl' import ImmutablePureComponent from 'react-immutable-pure-component' import ImmutablePropTypes from 'react-immutable-proptypes' -import { closeModal } from '../../actions/modal' import { changeSetting, saveSettings } from '../../actions/settings' import ModalLayout from './modal_layout' import Button from '../button' @@ -22,14 +21,14 @@ const mapStateToProps = state => ({ settings: state.getIn(['settings', 'list']), }) -const mapDispatchToProps = dispatch => { +const mapDispatchToProps = (dispatch, { onClose }) => { return { onChange(key, checked) { dispatch(changeSetting(['list', ...key], checked)) }, onSave() { dispatch(saveSettings()) - dispatch(closeModal()) + onClose() }, } } @@ -43,6 +42,7 @@ class ListTimelineSettingsModal extends ImmutablePureComponent { intl: PropTypes.object.isRequired, settings: ImmutablePropTypes.map.isRequired, onChange: PropTypes.func.isRequired, + onClose: PropTypes.func.isRequired, onSave: PropTypes.func.isRequired, } @@ -51,12 +51,13 @@ class ListTimelineSettingsModal extends ImmutablePureComponent { } render() { - const { intl, settings, onChange } = this.props + const { intl, settings, onChange, onClose } = this.props return (
diff --git a/app/javascript/gabsocial/components/modal/modal_base.js b/app/javascript/gabsocial/components/modal/modal_base.js index 1b39762e..a8b65e28 100644 --- a/app/javascript/gabsocial/components/modal/modal_base.js +++ b/app/javascript/gabsocial/components/modal/modal_base.js @@ -54,9 +54,11 @@ class ModalBase extends PureComponent { } } - handleOnClose = () => { + handleOnClose = (e) => { const { onOpenModal, composeText, composeId, onClose, intl, type, onCancelReplyCompose } = this.props + if (this.dialog !== e.target) return + if (!composeId && composeText && type == 'COMPOSE') { onOpenModal('CONFIRM', { message: intl.formatMessage(messages.delete), @@ -108,8 +110,12 @@ class ModalBase extends PureComponent { return Array(...this.node.parentElement.childNodes).filter(node => node !== this.node) } - setRef = ref => { - this.node = ref + setRef = (n) => { + this.node = n + } + + setDialog = (n) => { + this.dialog = n } render () { @@ -133,10 +139,11 @@ class ModalBase extends PureComponent {
{children} diff --git a/app/javascript/gabsocial/components/modal/modal_layout.js b/app/javascript/gabsocial/components/modal/modal_layout.js index ad0c542d..209389cf 100644 --- a/app/javascript/gabsocial/components/modal/modal_layout.js +++ b/app/javascript/gabsocial/components/modal/modal_layout.js @@ -1,6 +1,5 @@ import { defineMessages, injectIntl } from 'react-intl' import classNames from 'classnames/bind' -import { closeModal } from '../../actions/modal' import Button from '../button' import Block from '../block' import Heading from '../heading' @@ -11,16 +10,7 @@ const messages = defineMessages({ close: { id: 'lightbox.close', defaultMessage: 'Close' }, }) -const mapDispatchToProps = dispatch => { - return { - handleCloseModal() { - dispatch(closeModal()) - }, - } -} - export default -@connect(null, mapDispatchToProps) @injectIntl class ModalLayout extends PureComponent { static propTypes = { @@ -38,11 +28,7 @@ class ModalLayout extends PureComponent { } onHandleCloseModal = () => { - if (this.props.onClose) { - this.props.onClose(); - } else { - this.props.handleCloseModal() - } + this.props.onClose() } render() { diff --git a/app/javascript/gabsocial/components/modal/modal_root.js b/app/javascript/gabsocial/components/modal/modal_root.js index 15dbb4b3..2e883dd9 100644 --- a/app/javascript/gabsocial/components/modal/modal_root.js +++ b/app/javascript/gabsocial/components/modal/modal_root.js @@ -114,8 +114,7 @@ class ModalRoot extends PureComponent { } onClickClose = () => { - const { onClose, type } = this.props - onClose(type) + this.props.onClose(this.props.type) } render() { diff --git a/app/javascript/gabsocial/components/modal/mute_modal.js b/app/javascript/gabsocial/components/modal/mute_modal.js index ffd29ca7..d381bbdb 100644 --- a/app/javascript/gabsocial/components/modal/mute_modal.js +++ b/app/javascript/gabsocial/components/modal/mute_modal.js @@ -34,6 +34,7 @@ class MuteModal extends PureComponent { account: PropTypes.object.isRequired, onConfirm: PropTypes.func.isRequired, intl: PropTypes.object.isRequired, + onClose: PropTypes.func.isRequired, } handleClick = () => { @@ -41,7 +42,7 @@ class MuteModal extends PureComponent { } render() { - const { account, intl } = this.props + const { account, intl, onClose } = this.props const title = intl.formatMessage(messages.title, { name: !!account ? account.get('acct') : '', @@ -56,6 +57,7 @@ class MuteModal extends PureComponent { message={message} confirm={intl.formatMessage(messages.mute)} onConfirm={this.handleClick} + onClose={onClose} /> ) } diff --git a/app/javascript/gabsocial/components/modal/pro_upgrade_modal.js b/app/javascript/gabsocial/components/modal/pro_upgrade_modal.js index 09e617eb..f78d0c12 100644 --- a/app/javascript/gabsocial/components/modal/pro_upgrade_modal.js +++ b/app/javascript/gabsocial/components/modal/pro_upgrade_modal.js @@ -16,13 +16,18 @@ class ProUpgradeModal extends ImmutablePureComponent { static propTypes = { intl: PropTypes.object.isRequired, + onClose: PropTypes.func.isRequired, } render() { - const { intl } = this.props + const { intl, onClose } = this.props return ( - + {intl.formatMessage(messages.text)} diff --git a/app/javascript/gabsocial/components/modal/report_modal.js b/app/javascript/gabsocial/components/modal/report_modal.js index 648c7526..e29fbf74 100644 --- a/app/javascript/gabsocial/components/modal/report_modal.js +++ b/app/javascript/gabsocial/components/modal/report_modal.js @@ -20,13 +20,13 @@ const messages = defineMessages({ forwardHint: { id: 'report.forward_hint', defaultMessage: 'The account is from another server. Send an anonymized copy of the report there as well?' }, forward: { id: 'report.forward', defaultMessage: 'Forward to {target}' }, target: { id: 'report.target', defaultMessage: 'Report {target}' }, -}); +}) const makeMapStateToProps = () => { - const getAccount = makeGetAccount(); + const getAccount = makeGetAccount() const mapStateToProps = state => { - const accountId = state.getIn(['reports', 'new', 'account_id']); + const accountId = state.getIn(['reports', 'new', 'account_id']) return { isSubmitting: state.getIn(['reports', 'new', 'isSubmitting']), @@ -34,11 +34,11 @@ const makeMapStateToProps = () => { comment: state.getIn(['reports', 'new', 'comment']), forward: state.getIn(['reports', 'new', 'forward']), statusIds: OrderedSet(state.getIn(['timelines', `account:${accountId}:with_replies`, 'items'])).union(state.getIn(['reports', 'new', 'status_ids'])), - }; - }; + } + } - return mapStateToProps; -}; + return mapStateToProps +} export default @connect(makeMapStateToProps) @@ -53,33 +53,34 @@ class ReportModal extends ImmutablePureComponent { forward: PropTypes.bool, dispatch: PropTypes.func.isRequired, intl: PropTypes.object.isRequired, - }; + onClose: PropTypes.func.isRequired, + } handleCommentChange = e => { - this.props.dispatch(changeReportComment(e.target.value)); + this.props.dispatch(changeReportComment(e.target.value)) } handleForwardChange = e => { - this.props.dispatch(changeReportForward(e.target.checked)); + this.props.dispatch(changeReportForward(e.target.checked)) } handleSubmit = () => { - this.props.dispatch(submitReport()); + this.props.dispatch(submitReport()) } handleKeyDown = e => { if (e.keyCode === 13 && (e.ctrlKey || e.metaKey)) { - this.handleSubmit(); + this.handleSubmit() } } componentDidMount () { - this.props.dispatch(expandAccountTimeline(this.props.account.get('id'), { withReplies: true })); + this.props.dispatch(expandAccountTimeline(this.props.account.get('id'), { withReplies: true })) } componentWillReceiveProps (nextProps) { if (this.props.account !== nextProps.account && nextProps.account) { - this.props.dispatch(expandAccountTimeline(nextProps.account.get('id'), { withReplies: true })); + this.props.dispatch(expandAccountTimeline(nextProps.account.get('id'), { withReplies: true })) } } @@ -96,7 +97,7 @@ class ReportModal extends ImmutablePureComponent { if (!account) return null - const domain = account.get('acct').split('@')[1]; + const domain = account.get('acct').split('@')[1] return (
@@ -168,7 +170,7 @@ class ReportModal extends ImmutablePureComponent {
- ); + ) } } diff --git a/app/javascript/gabsocial/components/modal/status_revisions_modal.js b/app/javascript/gabsocial/components/modal/status_revisions_modal.js index 4d823c82..f420bc4c 100644 --- a/app/javascript/gabsocial/components/modal/status_revisions_modal.js +++ b/app/javascript/gabsocial/components/modal/status_revisions_modal.js @@ -39,6 +39,7 @@ class StatusRevisionsModal extends ImmutablePureComponent { loading: PropTypes.bool.isRequired, error: PropTypes.bool, revisions: ImmutablePropTypes.list.isRequired, + onClose: PropTypes.func.isRequired, } componentDidMount() { @@ -49,14 +50,16 @@ class StatusRevisionsModal extends ImmutablePureComponent { const { intl, status, - revisions + revisions, + onClose } = this.props - console.log("revisions:", revisions) - console.log("revisions.size:", revisions.size) - return ( - +
{ diff --git a/app/javascript/gabsocial/components/modal/unauthorized_modal.js b/app/javascript/gabsocial/components/modal/unauthorized_modal.js index d818640f..494ebce0 100644 --- a/app/javascript/gabsocial/components/modal/unauthorized_modal.js +++ b/app/javascript/gabsocial/components/modal/unauthorized_modal.js @@ -19,13 +19,17 @@ class UnauthorizedModal extends ImmutablePureComponent { static propTypes = { intl: PropTypes.object.isRequired, + onClose: PropTypes.func.isRequired, } render() { const { intl } = this.props return ( - +
{intl.formatMessage(messages.text)} diff --git a/app/javascript/gabsocial/components/modal/unfollow_modal.js b/app/javascript/gabsocial/components/modal/unfollow_modal.js index c878e233..63dbe9c2 100644 --- a/app/javascript/gabsocial/components/modal/unfollow_modal.js +++ b/app/javascript/gabsocial/components/modal/unfollow_modal.js @@ -31,6 +31,7 @@ class UnfollowModal extends PureComponent { isSubmitting: PropTypes.bool.isRequired, account: PropTypes.object.isRequired, onConfirm: PropTypes.func.isRequired, + onClose: PropTypes.func.isRequired, intl: PropTypes.object.isRequired, } @@ -61,6 +62,7 @@ class UnfollowModal extends PureComponent { title={`Mute @${account.get('acct')}`} message={} confirm={} + onClose={onClose} onConfirm={() => { // dispatch(blockDomain(domain)) // dispatch(blockDomain(domain)) diff --git a/app/javascript/gabsocial/components/panel/media_gallery_panel.js b/app/javascript/gabsocial/components/panel/media_gallery_panel.js index cfdfcadc..71a667a6 100644 --- a/app/javascript/gabsocial/components/panel/media_gallery_panel.js +++ b/app/javascript/gabsocial/components/panel/media_gallery_panel.js @@ -37,13 +37,13 @@ class MediaGalleryPanel extends ImmutablePureComponent { const { accountId } = this.props if (accountId) { - this.props.dispatch(expandAccountMediaTimeline(accountId, {limit: 8})) + this.props.dispatch(expandAccountMediaTimeline(accountId, { limit: 8 })) } } componentWillReceiveProps(nextProps) { if (nextProps.accountId && nextProps.accountId !== this.props.accountId) { - this.props.dispatch(expandAccountMediaTimeline(nextProps.accountId, {limit: 8})) + this.props.dispatch(expandAccountMediaTimeline(nextProps.accountId, { limit: 8 })) } } diff --git a/app/javascript/gabsocial/components/panel/notification_filter_panel.js b/app/javascript/gabsocial/components/panel/notification_filter_panel.js index b8bdd430..cb6512b8 100644 --- a/app/javascript/gabsocial/components/panel/notification_filter_panel.js +++ b/app/javascript/gabsocial/components/panel/notification_filter_panel.js @@ -1,33 +1,59 @@ import { defineMessages, injectIntl } from 'react-intl' import ImmutablePureComponent from 'react-immutable-pure-component' +import ImmutablePropTypes from 'react-immutable-proptypes' +import { changeSetting, saveSettings } from '../../actions/settings' import PanelLayout from './panel_layout' -import Switch from '../switch' +import SettingSwitch from '../setting_switch' const messages = defineMessages({ title: { id: 'notification_filters', defaultMessage: 'Notification Filters' }, + onlyVerified: { id: 'notification_only_verified', defaultMessage: 'Only Verified Users' }, + onlyFollowing: { id: 'notification_only_following', defaultMessage: 'Only People I Follow' }, }) +const mapStateToProps = state => ({ + settings: state.getIn(['settings', 'notifications']), +}) + +const mapDispatchToProps = (dispatch) => { + return { + onChange(key, checked) { + dispatch(changeSetting(['notifications', ...key], checked)) + dispatch(saveSettings()) + }, + } +} + export default @injectIntl +@connect(mapStateToProps, mapDispatchToProps) class NotificationFilterPanel extends ImmutablePureComponent { static propTypes = { intl: PropTypes.object.isRequired, + onChange: PropTypes.func.isRequired, + settings: ImmutablePropTypes.map.isRequired, } render() { - const { intl } = this.props + const { intl, onChange, settings } = this.props return ( - - - ) diff --git a/app/javascript/gabsocial/components/panel/trends_panel.js b/app/javascript/gabsocial/components/panel/trends_panel.js index ac29c477..1d3635b7 100644 --- a/app/javascript/gabsocial/components/panel/trends_panel.js +++ b/app/javascript/gabsocial/components/panel/trends_panel.js @@ -7,7 +7,7 @@ import ColumnIndicator from '../column_indicator' import TrendingItem from '../trends_item' const messages = defineMessages({ - title: { id:'trends.title', defaultMessage: 'Trending right now' }, + title: { id: 'trends.title', defaultMessage: 'Trending right now' }, }) const mapStateToProps = state => ({ @@ -31,7 +31,7 @@ class TrendsPanel extends ImmutablePureComponent { onFetchGabTrends: PropTypes.func.isRequired, } - componentWillMount () { + componentWillMount() { this.props.onFetchGabTrends() } @@ -52,7 +52,7 @@ class TrendsPanel extends ImmutablePureComponent { gabtrends && gabtrends.slice(0, 8).map((trend, i) => ( +
{children} diff --git a/app/javascript/gabsocial/components/popover/profile_options_popover.js b/app/javascript/gabsocial/components/popover/profile_options_popover.js index 1b8ff20e..ee59bfcc 100644 --- a/app/javascript/gabsocial/components/popover/profile_options_popover.js +++ b/app/javascript/gabsocial/components/popover/profile_options_popover.js @@ -310,7 +310,7 @@ class ProfileOptionsPopover extends PureComponent { ) diff --git a/app/javascript/gabsocial/components/popover/sidebar_more_popover.js b/app/javascript/gabsocial/components/popover/sidebar_more_popover.js index e0eff14c..dc42de57 100644 --- a/app/javascript/gabsocial/components/popover/sidebar_more_popover.js +++ b/app/javascript/gabsocial/components/popover/sidebar_more_popover.js @@ -6,6 +6,7 @@ export default class SidebarMorePopover extends PureComponent { return ( ) diff --git a/app/javascript/gabsocial/components/popover/status_options_popover.js b/app/javascript/gabsocial/components/popover/status_options_popover.js index b43d8b74..981da2d5 100644 --- a/app/javascript/gabsocial/components/popover/status_options_popover.js +++ b/app/javascript/gabsocial/components/popover/status_options_popover.js @@ -142,9 +142,9 @@ class StatusOptionsPopover extends ImmutablePureComponent { return ( ) diff --git a/app/javascript/gabsocial/components/popover/status_share_popover.js b/app/javascript/gabsocial/components/popover/status_share_popover.js index 4f61a98a..daa9120b 100644 --- a/app/javascript/gabsocial/components/popover/status_share_popover.js +++ b/app/javascript/gabsocial/components/popover/status_share_popover.js @@ -24,6 +24,8 @@ const messages = defineMessages({ // }); +// : todo : + export default @injectIntl // @connect(makeMapStateToProps, mapDispatchToProps) @@ -60,8 +62,9 @@ class StatusSharePopover extends ImmutablePureComponent { const { intl } = this.props return ( - +
-
+
+ { + account && account.get('locked') && + + }
diff --git a/app/javascript/gabsocial/components/sidebar.js b/app/javascript/gabsocial/components/sidebar.js index 2168c585..7fba7643 100644 --- a/app/javascript/gabsocial/components/sidebar.js +++ b/app/javascript/gabsocial/components/sidebar.js @@ -37,7 +37,7 @@ const mapStateToProps = state => { return { account: getAccount(state, me), - sidebarOpen: state.get('sidebar').sidebarOpen, + moreOpen: state.get('popover').popoverType === 'SIDEBAR_MORE', notificationCount: state.getIn(['notifications', 'unread']), homeItemsQueueCount: state.getIn(['timelines', 'home', 'totalQueuedItemsCount']), showCommunityTimeline: state.getIn(['settings', 'community', 'shows', 'inSidebar']), @@ -64,8 +64,8 @@ class Sidebar extends ImmutablePureComponent { static propTypes = { intl: PropTypes.object.isRequired, account: ImmutablePropTypes.map, - sidebarOpen: PropTypes.bool, showCommunityTimeline: PropTypes.bool, + moreOpen: PropTypes.bool, onClose: PropTypes.func.isRequired, onOpenComposeModal: PropTypes.func.isRequired, openSidebarMorePopover: PropTypes.func.isRequired, @@ -73,39 +73,11 @@ class Sidebar extends ImmutablePureComponent { homeItemsQueueCount: PropTypes.number.isRequired, } - state = { - moreOpen: false, - } - - componentDidUpdate() { - if (!me) return - - if (this.props.sidebarOpen) { - document.body.classList.add('with-modals--active') - } else { - document.body.classList.remove('with-modals--active') - } - } - - toggleMore = () => { - this.setState({ - moreOpen: !this.state.moreOpen - }) - } - - handleSidebarClose = () => { - this.props.onClose() - this.setState({ - moreOpen: false, - }) - } - handleOpenComposeModal = () => { this.props.onOpenComposeModal() } handleOpenSidebarMorePopover =() => { - console.log("handleOpenSidebarMorePopover") this.props.openSidebarMorePopover({ targetRef: this.moreBtnRef, position: 'top', @@ -118,14 +90,13 @@ class Sidebar extends ImmutablePureComponent { render() { const { - sidebarOpen, intl, account, notificationCount, homeItemsQueueCount, - showCommunityTimeline + showCommunityTimeline, + moreOpen } = this.props - const { moreOpen } = this.state // : todo : if (!me || !account) return null @@ -133,9 +104,6 @@ class Sidebar extends ImmutablePureComponent { const acct = account.get('acct') const isPro = account.get('is_pro') - const moreIcon = moreOpen ? 'minus' : 'plus' - const moreContainerStyle = { display: moreOpen ? 'block' : 'none' } - console.log("showCommunityTimeline:", showCommunityTimeline) const menuItems = [ @@ -182,7 +150,8 @@ class Sidebar extends ImmutablePureComponent { title: 'More', icon: 'more', onClick: this.handleOpenSidebarMorePopover, - buttonRef: this.setMoreButtonRef + buttonRef: this.setMoreButtonRef, + active: moreOpen, }, ] @@ -243,7 +212,7 @@ class Sidebar extends ImmutablePureComponent { ) }) } - Shortcuts + { /* Shortcuts */ } { shortcutItems.map((shortcutItem, i) => ( diff --git a/app/javascript/gabsocial/components/sidebar_header.js b/app/javascript/gabsocial/components/sidebar_header.js index 1a139a2a..4931731e 100644 --- a/app/javascript/gabsocial/components/sidebar_header.js +++ b/app/javascript/gabsocial/components/sidebar_header.js @@ -28,16 +28,15 @@ class SidebarHeader extends ImmutablePureComponent { const { account } = this.props const isPro = account.get('is_pro') - const gabLogoClasses = isPro ? _s.fillColorGabPro : _s.fillColorBrand return (

-

diff --git a/app/javascript/gabsocial/pages/notifications_page.js b/app/javascript/gabsocial/pages/notifications_page.js index 4a506eee..b06923cd 100644 --- a/app/javascript/gabsocial/pages/notifications_page.js +++ b/app/javascript/gabsocial/pages/notifications_page.js @@ -22,8 +22,9 @@ const makeMapStateToProps = state => ({ }); const mapDispatchToProps = (dispatch) => ({ - selectFilter (newActiveFilter) { - dispatch(setFilter(newActiveFilter)); + selectFilter(newActiveFilter) { + console.log("newActiveFilter:", newActiveFilter) + dispatch(setFilter(newActiveFilter)) }, }); @@ -42,43 +43,45 @@ class NotificationsPage extends PureComponent { document.title = 'Notifications - Gab' } - onClick (notificationType) { - return () => this.props.selectFilter(notificationType); + onClick(notificationType) { + this.props.selectFilter(notificationType); } render() { - const { children } = this.props + const { children, selectedFilter } = this.props + + console.log("selectedFilter:", selectedFilter) const tabs = [ { title: 'All', - onClick: null, - active: false, + onClick: () => this.onClick('all'), + active: selectedFilter === 'all', }, { title: 'Mentions', - onClick: null, - active: false, + onClick: () => this.onClick('mention'), + active: selectedFilter === 'mention', }, { title: 'Likes', - onClick: null, - active: false, + onClick: () => this.onClick('favourite'), + active: selectedFilter === 'favourite', }, { title: 'Reposts', - onClick: null, - active: false, + onClick: () => this.onClick('reblog'), + active: selectedFilter === 'reblog', }, { title: 'Polls', - onClick: null, - active: false, + onClick: () => this.onClick('poll'), + active: selectedFilter === 'poll', }, { title: 'Follows', - onClick: null, - active: false, + onClick: () => this.onClick('follow'), + active: selectedFilter === 'follow', }, ] diff --git a/app/javascript/gabsocial/pages/profile_page.js b/app/javascript/gabsocial/pages/profile_page.js index 4a7e1955..34bfb13d 100644 --- a/app/javascript/gabsocial/pages/profile_page.js +++ b/app/javascript/gabsocial/pages/profile_page.js @@ -69,7 +69,7 @@ class ProfilePage extends ImmutablePureComponent { - + { !unavailable && } )} diff --git a/app/javascript/gabsocial/reducers/notifications.js b/app/javascript/gabsocial/reducers/notifications.js index 2def0e56..65ea0586 100644 --- a/app/javascript/gabsocial/reducers/notifications.js +++ b/app/javascript/gabsocial/reducers/notifications.js @@ -64,13 +64,13 @@ const expandNormalizedNotifications = (state, notifications, next) => { let items = ImmutableList() - // : todo filter notiications here: + console.log("notifications:", notificationss) notifications.forEach((n) => { const notification = notificationToMap(n) const statusId = notification.get('status') const type = notification.get('type') - + switch (type) { case 'follow': { follows = follows.set(follows.size, notification) @@ -131,6 +131,8 @@ const expandNormalizedNotifications = (state, notifications, next) => { } } + console.log("final items: ", items) + return state.withMutations(mutable => { if (!items.isEmpty()) { mutable.update('items', list => { diff --git a/app/javascript/gabsocial/reducers/settings.js b/app/javascript/gabsocial/reducers/settings.js index 343df4e1..f238e998 100644 --- a/app/javascript/gabsocial/reducers/settings.js +++ b/app/javascript/gabsocial/reducers/settings.js @@ -47,6 +47,8 @@ const initialState = ImmutableMap({ // : todo : put all notification settings actually IN settings quickFilter: ImmutableMap({ active: 'all', + onlyVerifed: false, + onlyFollowing: false, }), }), diff --git a/app/javascript/styles/global.css b/app/javascript/styles/global.css index 70e59e7f..ae11103a 100644 --- a/app/javascript/styles/global.css +++ b/app/javascript/styles/global.css @@ -472,8 +472,8 @@ body { max-height: 80vh; } -.heightMax56PX { - max-height: 56px; +.heightMax60PX { + max-height: 60px; } .heightMin50VH { @@ -830,6 +830,10 @@ body { margin-right: 10px; } +.mr15 { + margin-right: 15px; +} + .ml15 { margin-left: 15px; }