From 81ef21a0c802f1d905f37a2a818544a8b400793c Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Sat, 25 Feb 2023 14:34:32 +0100 Subject: [Glitch] Rename JSX files with proper `.jsx` extension Port 44a7d87cb1f5df953b6c14c16c59e2e4ead1bcb9 to glitch-soc Signed-off-by: Claire --- .../notifications/components/admin_report.js | 112 ---------- .../notifications/components/admin_report.jsx | 112 ++++++++++ .../notifications/components/admin_signup.js | 101 --------- .../notifications/components/admin_signup.jsx | 101 +++++++++ .../components/clear_column_button.js | 18 -- .../components/clear_column_button.jsx | 18 ++ .../notifications/components/column_settings.js | 203 ------------------ .../notifications/components/column_settings.jsx | 203 ++++++++++++++++++ .../notifications/components/filter_bar.js | 110 ---------- .../notifications/components/filter_bar.jsx | 110 ++++++++++ .../features/notifications/components/follow.js | 101 --------- .../features/notifications/components/follow.jsx | 101 +++++++++ .../notifications/components/follow_request.js | 132 ------------ .../notifications/components/follow_request.jsx | 132 ++++++++++++ .../components/grant_permission_button.js | 19 -- .../components/grant_permission_button.jsx | 19 ++ .../notifications/components/notification.js | 234 --------------------- .../notifications/components/notification.jsx | 234 +++++++++++++++++++++ .../components/notifications_permission_banner.js | 48 ----- .../components/notifications_permission_banner.jsx | 48 +++++ .../features/notifications/components/overlay.js | 58 ----- .../features/notifications/components/overlay.jsx | 58 +++++ .../notifications/components/pill_bar_button.js | 41 ---- .../notifications/components/pill_bar_button.jsx | 41 ++++ .../features/notifications/components/report.js | 62 ------ .../features/notifications/components/report.jsx | 62 ++++++ .../notifications/components/setting_toggle.js | 36 ---- .../notifications/components/setting_toggle.jsx | 36 ++++ 28 files changed, 1275 insertions(+), 1275 deletions(-) delete mode 100644 app/javascript/flavours/glitch/features/notifications/components/admin_report.js create mode 100644 app/javascript/flavours/glitch/features/notifications/components/admin_report.jsx delete mode 100644 app/javascript/flavours/glitch/features/notifications/components/admin_signup.js create mode 100644 app/javascript/flavours/glitch/features/notifications/components/admin_signup.jsx delete mode 100644 app/javascript/flavours/glitch/features/notifications/components/clear_column_button.js create mode 100644 app/javascript/flavours/glitch/features/notifications/components/clear_column_button.jsx delete mode 100644 app/javascript/flavours/glitch/features/notifications/components/column_settings.js create mode 100644 app/javascript/flavours/glitch/features/notifications/components/column_settings.jsx delete mode 100644 app/javascript/flavours/glitch/features/notifications/components/filter_bar.js create mode 100644 app/javascript/flavours/glitch/features/notifications/components/filter_bar.jsx delete mode 100644 app/javascript/flavours/glitch/features/notifications/components/follow.js create mode 100644 app/javascript/flavours/glitch/features/notifications/components/follow.jsx delete mode 100644 app/javascript/flavours/glitch/features/notifications/components/follow_request.js create mode 100644 app/javascript/flavours/glitch/features/notifications/components/follow_request.jsx delete mode 100644 app/javascript/flavours/glitch/features/notifications/components/grant_permission_button.js create mode 100644 app/javascript/flavours/glitch/features/notifications/components/grant_permission_button.jsx delete mode 100644 app/javascript/flavours/glitch/features/notifications/components/notification.js create mode 100644 app/javascript/flavours/glitch/features/notifications/components/notification.jsx delete mode 100644 app/javascript/flavours/glitch/features/notifications/components/notifications_permission_banner.js create mode 100644 app/javascript/flavours/glitch/features/notifications/components/notifications_permission_banner.jsx delete mode 100644 app/javascript/flavours/glitch/features/notifications/components/overlay.js create mode 100644 app/javascript/flavours/glitch/features/notifications/components/overlay.jsx delete mode 100644 app/javascript/flavours/glitch/features/notifications/components/pill_bar_button.js create mode 100644 app/javascript/flavours/glitch/features/notifications/components/pill_bar_button.jsx delete mode 100644 app/javascript/flavours/glitch/features/notifications/components/report.js create mode 100644 app/javascript/flavours/glitch/features/notifications/components/report.jsx delete mode 100644 app/javascript/flavours/glitch/features/notifications/components/setting_toggle.js create mode 100644 app/javascript/flavours/glitch/features/notifications/components/setting_toggle.jsx (limited to 'app/javascript/flavours/glitch/features/notifications/components') diff --git a/app/javascript/flavours/glitch/features/notifications/components/admin_report.js b/app/javascript/flavours/glitch/features/notifications/components/admin_report.js deleted file mode 100644 index 556df8f66..000000000 --- a/app/javascript/flavours/glitch/features/notifications/components/admin_report.js +++ /dev/null @@ -1,112 +0,0 @@ -// Package imports. -import React from 'react'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import PropTypes from 'prop-types'; -import { FormattedMessage, defineMessages, injectIntl } from 'react-intl'; -import ImmutablePureComponent from 'react-immutable-pure-component'; -import { HotKeys } from 'react-hotkeys'; -import classNames from 'classnames'; - -// Our imports. -import Permalink from 'flavours/glitch/components/permalink'; -import AccountContainer from 'flavours/glitch/containers/account_container'; -import NotificationOverlayContainer from '../containers/overlay_container'; -import Icon from 'flavours/glitch/components/icon'; -import Report from './report'; - -const messages = defineMessages({ - adminReport: { id: 'notification.admin.report', defaultMessage: '{name} reported {target}' }, -}); - -export default class AdminReport extends ImmutablePureComponent { - - static propTypes = { - hidden: PropTypes.bool, - id: PropTypes.string.isRequired, - account: ImmutablePropTypes.map.isRequired, - notification: ImmutablePropTypes.map.isRequired, - unread: PropTypes.bool, - report: ImmutablePropTypes.map.isRequired, - }; - - handleMoveUp = () => { - const { notification, onMoveUp } = this.props; - onMoveUp(notification.get('id')); - }; - - handleMoveDown = () => { - const { notification, onMoveDown } = this.props; - onMoveDown(notification.get('id')); - }; - - handleOpen = () => { - this.handleOpenProfile(); - }; - - handleOpenProfile = () => { - const { notification } = this.props; - this.context.router.history.push(`/@${notification.getIn(['account', 'acct'])}`); - }; - - handleMention = e => { - e.preventDefault(); - - const { notification, onMention } = this.props; - onMention(notification.get('account'), this.context.router.history); - }; - - getHandlers () { - return { - moveUp: this.handleMoveUp, - moveDown: this.handleMoveDown, - open: this.handleOpen, - openProfile: this.handleOpenProfile, - mention: this.handleMention, - reply: this.handleMention, - }; - } - - render () { - const { intl, account, notification, unread, report } = this.props; - - if (!report) { - return null; - } - - // Links to the display name. - const displayName = account.get('display_name_html') || account.get('username'); - const link = ( - - ); - - const targetAccount = report.get('target_account'); - const targetDisplayNameHtml = { __html: targetAccount.get('display_name_html') }; - const targetLink = ; - - return ( - -
-
-
- -
- - - - -
- -
-
- ); - } - -} diff --git a/app/javascript/flavours/glitch/features/notifications/components/admin_report.jsx b/app/javascript/flavours/glitch/features/notifications/components/admin_report.jsx new file mode 100644 index 000000000..556df8f66 --- /dev/null +++ b/app/javascript/flavours/glitch/features/notifications/components/admin_report.jsx @@ -0,0 +1,112 @@ +// Package imports. +import React from 'react'; +import ImmutablePropTypes from 'react-immutable-proptypes'; +import PropTypes from 'prop-types'; +import { FormattedMessage, defineMessages, injectIntl } from 'react-intl'; +import ImmutablePureComponent from 'react-immutable-pure-component'; +import { HotKeys } from 'react-hotkeys'; +import classNames from 'classnames'; + +// Our imports. +import Permalink from 'flavours/glitch/components/permalink'; +import AccountContainer from 'flavours/glitch/containers/account_container'; +import NotificationOverlayContainer from '../containers/overlay_container'; +import Icon from 'flavours/glitch/components/icon'; +import Report from './report'; + +const messages = defineMessages({ + adminReport: { id: 'notification.admin.report', defaultMessage: '{name} reported {target}' }, +}); + +export default class AdminReport extends ImmutablePureComponent { + + static propTypes = { + hidden: PropTypes.bool, + id: PropTypes.string.isRequired, + account: ImmutablePropTypes.map.isRequired, + notification: ImmutablePropTypes.map.isRequired, + unread: PropTypes.bool, + report: ImmutablePropTypes.map.isRequired, + }; + + handleMoveUp = () => { + const { notification, onMoveUp } = this.props; + onMoveUp(notification.get('id')); + }; + + handleMoveDown = () => { + const { notification, onMoveDown } = this.props; + onMoveDown(notification.get('id')); + }; + + handleOpen = () => { + this.handleOpenProfile(); + }; + + handleOpenProfile = () => { + const { notification } = this.props; + this.context.router.history.push(`/@${notification.getIn(['account', 'acct'])}`); + }; + + handleMention = e => { + e.preventDefault(); + + const { notification, onMention } = this.props; + onMention(notification.get('account'), this.context.router.history); + }; + + getHandlers () { + return { + moveUp: this.handleMoveUp, + moveDown: this.handleMoveDown, + open: this.handleOpen, + openProfile: this.handleOpenProfile, + mention: this.handleMention, + reply: this.handleMention, + }; + } + + render () { + const { intl, account, notification, unread, report } = this.props; + + if (!report) { + return null; + } + + // Links to the display name. + const displayName = account.get('display_name_html') || account.get('username'); + const link = ( + + ); + + const targetAccount = report.get('target_account'); + const targetDisplayNameHtml = { __html: targetAccount.get('display_name_html') }; + const targetLink = ; + + return ( + +
+
+
+ +
+ + + + +
+ +
+
+ ); + } + +} diff --git a/app/javascript/flavours/glitch/features/notifications/components/admin_signup.js b/app/javascript/flavours/glitch/features/notifications/components/admin_signup.js deleted file mode 100644 index ead2a9701..000000000 --- a/app/javascript/flavours/glitch/features/notifications/components/admin_signup.js +++ /dev/null @@ -1,101 +0,0 @@ -// Package imports. -import React from 'react'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import PropTypes from 'prop-types'; -import { FormattedMessage } from 'react-intl'; -import ImmutablePureComponent from 'react-immutable-pure-component'; -import { HotKeys } from 'react-hotkeys'; -import classNames from 'classnames'; - -// Our imports. -import Permalink from 'flavours/glitch/components/permalink'; -import AccountContainer from 'flavours/glitch/containers/account_container'; -import NotificationOverlayContainer from '../containers/overlay_container'; -import Icon from 'flavours/glitch/components/icon'; - -export default class NotificationFollow extends ImmutablePureComponent { - - static propTypes = { - hidden: PropTypes.bool, - id: PropTypes.string.isRequired, - account: ImmutablePropTypes.map.isRequired, - notification: ImmutablePropTypes.map.isRequired, - unread: PropTypes.bool, - }; - - handleMoveUp = () => { - const { notification, onMoveUp } = this.props; - onMoveUp(notification.get('id')); - }; - - handleMoveDown = () => { - const { notification, onMoveDown } = this.props; - onMoveDown(notification.get('id')); - }; - - handleOpen = () => { - this.handleOpenProfile(); - }; - - handleOpenProfile = () => { - const { notification } = this.props; - this.context.router.history.push(`/@${notification.getIn(['account', 'acct'])}`); - }; - - handleMention = e => { - e.preventDefault(); - - const { notification, onMention } = this.props; - onMention(notification.get('account'), this.context.router.history); - }; - - getHandlers () { - return { - moveUp: this.handleMoveUp, - moveDown: this.handleMoveDown, - open: this.handleOpen, - openProfile: this.handleOpenProfile, - mention: this.handleMention, - reply: this.handleMention, - }; - } - - render () { - const { account, notification, hidden, unread } = this.props; - - // Links to the display name. - const displayName = account.get('display_name_html') || account.get('username'); - const link = ( - - ); - - // Renders. - return ( - -
-
-
- -
- - -
- -
-
- ); - } - -} diff --git a/app/javascript/flavours/glitch/features/notifications/components/admin_signup.jsx b/app/javascript/flavours/glitch/features/notifications/components/admin_signup.jsx new file mode 100644 index 000000000..ead2a9701 --- /dev/null +++ b/app/javascript/flavours/glitch/features/notifications/components/admin_signup.jsx @@ -0,0 +1,101 @@ +// Package imports. +import React from 'react'; +import ImmutablePropTypes from 'react-immutable-proptypes'; +import PropTypes from 'prop-types'; +import { FormattedMessage } from 'react-intl'; +import ImmutablePureComponent from 'react-immutable-pure-component'; +import { HotKeys } from 'react-hotkeys'; +import classNames from 'classnames'; + +// Our imports. +import Permalink from 'flavours/glitch/components/permalink'; +import AccountContainer from 'flavours/glitch/containers/account_container'; +import NotificationOverlayContainer from '../containers/overlay_container'; +import Icon from 'flavours/glitch/components/icon'; + +export default class NotificationFollow extends ImmutablePureComponent { + + static propTypes = { + hidden: PropTypes.bool, + id: PropTypes.string.isRequired, + account: ImmutablePropTypes.map.isRequired, + notification: ImmutablePropTypes.map.isRequired, + unread: PropTypes.bool, + }; + + handleMoveUp = () => { + const { notification, onMoveUp } = this.props; + onMoveUp(notification.get('id')); + }; + + handleMoveDown = () => { + const { notification, onMoveDown } = this.props; + onMoveDown(notification.get('id')); + }; + + handleOpen = () => { + this.handleOpenProfile(); + }; + + handleOpenProfile = () => { + const { notification } = this.props; + this.context.router.history.push(`/@${notification.getIn(['account', 'acct'])}`); + }; + + handleMention = e => { + e.preventDefault(); + + const { notification, onMention } = this.props; + onMention(notification.get('account'), this.context.router.history); + }; + + getHandlers () { + return { + moveUp: this.handleMoveUp, + moveDown: this.handleMoveDown, + open: this.handleOpen, + openProfile: this.handleOpenProfile, + mention: this.handleMention, + reply: this.handleMention, + }; + } + + render () { + const { account, notification, hidden, unread } = this.props; + + // Links to the display name. + const displayName = account.get('display_name_html') || account.get('username'); + const link = ( + + ); + + // Renders. + return ( + +
+
+
+ +
+ + +
+ +
+
+ ); + } + +} diff --git a/app/javascript/flavours/glitch/features/notifications/components/clear_column_button.js b/app/javascript/flavours/glitch/features/notifications/components/clear_column_button.js deleted file mode 100644 index ee77cfb8e..000000000 --- a/app/javascript/flavours/glitch/features/notifications/components/clear_column_button.js +++ /dev/null @@ -1,18 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import { FormattedMessage } from 'react-intl'; -import Icon from 'flavours/glitch/components/icon'; - -export default class ClearColumnButton extends React.Component { - - static propTypes = { - onClick: PropTypes.func.isRequired, - }; - - render () { - return ( - - ); - } - -} diff --git a/app/javascript/flavours/glitch/features/notifications/components/clear_column_button.jsx b/app/javascript/flavours/glitch/features/notifications/components/clear_column_button.jsx new file mode 100644 index 000000000..ee77cfb8e --- /dev/null +++ b/app/javascript/flavours/glitch/features/notifications/components/clear_column_button.jsx @@ -0,0 +1,18 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { FormattedMessage } from 'react-intl'; +import Icon from 'flavours/glitch/components/icon'; + +export default class ClearColumnButton extends React.Component { + + static propTypes = { + onClick: PropTypes.func.isRequired, + }; + + render () { + return ( + + ); + } + +} diff --git a/app/javascript/flavours/glitch/features/notifications/components/column_settings.js b/app/javascript/flavours/glitch/features/notifications/components/column_settings.js deleted file mode 100644 index 1c04218ba..000000000 --- a/app/javascript/flavours/glitch/features/notifications/components/column_settings.js +++ /dev/null @@ -1,203 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import { FormattedMessage } from 'react-intl'; -import ClearColumnButton from './clear_column_button'; -import GrantPermissionButton from './grant_permission_button'; -import SettingToggle from './setting_toggle'; -import PillBarButton from './pill_bar_button'; -import { PERMISSION_MANAGE_USERS, PERMISSION_MANAGE_REPORTS } from 'flavours/glitch/permissions'; - -export default class ColumnSettings extends React.PureComponent { - - static contextTypes = { - identity: PropTypes.object, - }; - - static propTypes = { - settings: ImmutablePropTypes.map.isRequired, - pushSettings: ImmutablePropTypes.map.isRequired, - onChange: PropTypes.func.isRequired, - onClear: PropTypes.func.isRequired, - onRequestNotificationPermission: PropTypes.func, - alertsEnabled: PropTypes.bool, - browserSupport: PropTypes.bool, - browserPermission: PropTypes.string, - }; - - onPushChange = (path, checked) => { - this.props.onChange(['push', ...path], checked); - }; - - render () { - const { settings, pushSettings, onChange, onClear, alertsEnabled, browserSupport, browserPermission, onRequestNotificationPermission } = this.props; - - const unreadMarkersShowStr = ; - const filterBarShowStr = ; - const filterAdvancedStr = ; - const alertStr = ; - const showStr = ; - const soundStr = ; - - const showPushSettings = pushSettings.get('browserSupport') && pushSettings.get('isSubscribed'); - const pushStr = showPushSettings && ; - - return ( -
- {alertsEnabled && browserSupport && browserPermission === 'denied' && ( -
- -
- )} - - {alertsEnabled && browserSupport && browserPermission === 'default' && ( -
- - - -
- )} - -
- -
- -
- - - - -
- -
-
- -
- - - - -
- - -
-
- -
- - -
- - {showPushSettings && } - - -
-
- -
- - -
- - {showPushSettings && } - - -
-
- -
- - -
- - {showPushSettings && } - - -
-
- -
- - -
- - {showPushSettings && } - - -
-
- -
- - -
- - {showPushSettings && } - - -
-
- -
- - -
- - {showPushSettings && } - - -
-
- -
- - -
- - {showPushSettings && } - - -
-
- -
- - -
- - {showPushSettings && } - - -
-
- - {((this.context.identity.permissions & PERMISSION_MANAGE_USERS) === PERMISSION_MANAGE_USERS) && ( -
- - -
- - {showPushSettings && } - - -
-
- )} - - {((this.context.identity.permissions & PERMISSION_MANAGE_REPORTS) === PERMISSION_MANAGE_REPORTS) && ( -
- - -
- - {showPushSettings && } - - -
-
- )} -
- ); - } - -} diff --git a/app/javascript/flavours/glitch/features/notifications/components/column_settings.jsx b/app/javascript/flavours/glitch/features/notifications/components/column_settings.jsx new file mode 100644 index 000000000..1c04218ba --- /dev/null +++ b/app/javascript/flavours/glitch/features/notifications/components/column_settings.jsx @@ -0,0 +1,203 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import ImmutablePropTypes from 'react-immutable-proptypes'; +import { FormattedMessage } from 'react-intl'; +import ClearColumnButton from './clear_column_button'; +import GrantPermissionButton from './grant_permission_button'; +import SettingToggle from './setting_toggle'; +import PillBarButton from './pill_bar_button'; +import { PERMISSION_MANAGE_USERS, PERMISSION_MANAGE_REPORTS } from 'flavours/glitch/permissions'; + +export default class ColumnSettings extends React.PureComponent { + + static contextTypes = { + identity: PropTypes.object, + }; + + static propTypes = { + settings: ImmutablePropTypes.map.isRequired, + pushSettings: ImmutablePropTypes.map.isRequired, + onChange: PropTypes.func.isRequired, + onClear: PropTypes.func.isRequired, + onRequestNotificationPermission: PropTypes.func, + alertsEnabled: PropTypes.bool, + browserSupport: PropTypes.bool, + browserPermission: PropTypes.string, + }; + + onPushChange = (path, checked) => { + this.props.onChange(['push', ...path], checked); + }; + + render () { + const { settings, pushSettings, onChange, onClear, alertsEnabled, browserSupport, browserPermission, onRequestNotificationPermission } = this.props; + + const unreadMarkersShowStr = ; + const filterBarShowStr = ; + const filterAdvancedStr = ; + const alertStr = ; + const showStr = ; + const soundStr = ; + + const showPushSettings = pushSettings.get('browserSupport') && pushSettings.get('isSubscribed'); + const pushStr = showPushSettings && ; + + return ( +
+ {alertsEnabled && browserSupport && browserPermission === 'denied' && ( +
+ +
+ )} + + {alertsEnabled && browserSupport && browserPermission === 'default' && ( +
+ + + +
+ )} + +
+ +
+ +
+ + + + +
+ +
+
+ +
+ + + + +
+ + +
+
+ +
+ + +
+ + {showPushSettings && } + + +
+
+ +
+ + +
+ + {showPushSettings && } + + +
+
+ +
+ + +
+ + {showPushSettings && } + + +
+
+ +
+ + +
+ + {showPushSettings && } + + +
+
+ +
+ + +
+ + {showPushSettings && } + + +
+
+ +
+ + +
+ + {showPushSettings && } + + +
+
+ +
+ + +
+ + {showPushSettings && } + + +
+
+ +
+ + +
+ + {showPushSettings && } + + +
+
+ + {((this.context.identity.permissions & PERMISSION_MANAGE_USERS) === PERMISSION_MANAGE_USERS) && ( +
+ + +
+ + {showPushSettings && } + + +
+
+ )} + + {((this.context.identity.permissions & PERMISSION_MANAGE_REPORTS) === PERMISSION_MANAGE_REPORTS) && ( +
+ + +
+ + {showPushSettings && } + + +
+
+ )} +
+ ); + } + +} diff --git a/app/javascript/flavours/glitch/features/notifications/components/filter_bar.js b/app/javascript/flavours/glitch/features/notifications/components/filter_bar.js deleted file mode 100644 index c1de0f90e..000000000 --- a/app/javascript/flavours/glitch/features/notifications/components/filter_bar.js +++ /dev/null @@ -1,110 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; -import Icon from 'flavours/glitch/components/icon'; - -const tooltips = defineMessages({ - mentions: { id: 'notifications.filter.mentions', defaultMessage: 'Mentions' }, - favourites: { id: 'notifications.filter.favourites', defaultMessage: 'Favourites' }, - boosts: { id: 'notifications.filter.boosts', defaultMessage: 'Boosts' }, - polls: { id: 'notifications.filter.polls', defaultMessage: 'Poll results' }, - follows: { id: 'notifications.filter.follows', defaultMessage: 'Follows' }, - statuses: { id: 'notifications.filter.statuses', defaultMessage: 'Updates from people you follow' }, -}); - -export default @injectIntl -class FilterBar extends React.PureComponent { - - static propTypes = { - selectFilter: PropTypes.func.isRequired, - selectedFilter: PropTypes.string.isRequired, - advancedMode: PropTypes.bool.isRequired, - intl: PropTypes.object.isRequired, - }; - - onClick (notificationType) { - return () => this.props.selectFilter(notificationType); - } - - render () { - const { selectedFilter, advancedMode, intl } = this.props; - const renderedElement = !advancedMode ? ( -
- - -
- ) : ( -
- - - - - - - -
- ); - return renderedElement; - } - -} diff --git a/app/javascript/flavours/glitch/features/notifications/components/filter_bar.jsx b/app/javascript/flavours/glitch/features/notifications/components/filter_bar.jsx new file mode 100644 index 000000000..c1de0f90e --- /dev/null +++ b/app/javascript/flavours/glitch/features/notifications/components/filter_bar.jsx @@ -0,0 +1,110 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; +import Icon from 'flavours/glitch/components/icon'; + +const tooltips = defineMessages({ + mentions: { id: 'notifications.filter.mentions', defaultMessage: 'Mentions' }, + favourites: { id: 'notifications.filter.favourites', defaultMessage: 'Favourites' }, + boosts: { id: 'notifications.filter.boosts', defaultMessage: 'Boosts' }, + polls: { id: 'notifications.filter.polls', defaultMessage: 'Poll results' }, + follows: { id: 'notifications.filter.follows', defaultMessage: 'Follows' }, + statuses: { id: 'notifications.filter.statuses', defaultMessage: 'Updates from people you follow' }, +}); + +export default @injectIntl +class FilterBar extends React.PureComponent { + + static propTypes = { + selectFilter: PropTypes.func.isRequired, + selectedFilter: PropTypes.string.isRequired, + advancedMode: PropTypes.bool.isRequired, + intl: PropTypes.object.isRequired, + }; + + onClick (notificationType) { + return () => this.props.selectFilter(notificationType); + } + + render () { + const { selectedFilter, advancedMode, intl } = this.props; + const renderedElement = !advancedMode ? ( +
+ + +
+ ) : ( +
+ + + + + + + +
+ ); + return renderedElement; + } + +} diff --git a/app/javascript/flavours/glitch/features/notifications/components/follow.js b/app/javascript/flavours/glitch/features/notifications/components/follow.js deleted file mode 100644 index 434d6609d..000000000 --- a/app/javascript/flavours/glitch/features/notifications/components/follow.js +++ /dev/null @@ -1,101 +0,0 @@ -// Package imports. -import React from 'react'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import PropTypes from 'prop-types'; -import { FormattedMessage } from 'react-intl'; -import ImmutablePureComponent from 'react-immutable-pure-component'; -import { HotKeys } from 'react-hotkeys'; -import classNames from 'classnames'; - -// Our imports. -import Permalink from 'flavours/glitch/components/permalink'; -import AccountContainer from 'flavours/glitch/containers/account_container'; -import NotificationOverlayContainer from '../containers/overlay_container'; -import Icon from 'flavours/glitch/components/icon'; - -export default class NotificationFollow extends ImmutablePureComponent { - - static propTypes = { - hidden: PropTypes.bool, - id: PropTypes.string.isRequired, - account: ImmutablePropTypes.map.isRequired, - notification: ImmutablePropTypes.map.isRequired, - unread: PropTypes.bool, - }; - - handleMoveUp = () => { - const { notification, onMoveUp } = this.props; - onMoveUp(notification.get('id')); - }; - - handleMoveDown = () => { - const { notification, onMoveDown } = this.props; - onMoveDown(notification.get('id')); - }; - - handleOpen = () => { - this.handleOpenProfile(); - }; - - handleOpenProfile = () => { - const { notification } = this.props; - this.context.router.history.push(`/@${notification.getIn(['account', 'acct'])}`); - }; - - handleMention = e => { - e.preventDefault(); - - const { notification, onMention } = this.props; - onMention(notification.get('account'), this.context.router.history); - }; - - getHandlers () { - return { - moveUp: this.handleMoveUp, - moveDown: this.handleMoveDown, - open: this.handleOpen, - openProfile: this.handleOpenProfile, - mention: this.handleMention, - reply: this.handleMention, - }; - } - - render () { - const { account, notification, hidden, unread } = this.props; - - // Links to the display name. - const displayName = account.get('display_name_html') || account.get('username'); - const link = ( - - ); - - // Renders. - return ( - -
-
-
- -
- - -
- -
-
- ); - } - -} diff --git a/app/javascript/flavours/glitch/features/notifications/components/follow.jsx b/app/javascript/flavours/glitch/features/notifications/components/follow.jsx new file mode 100644 index 000000000..434d6609d --- /dev/null +++ b/app/javascript/flavours/glitch/features/notifications/components/follow.jsx @@ -0,0 +1,101 @@ +// Package imports. +import React from 'react'; +import ImmutablePropTypes from 'react-immutable-proptypes'; +import PropTypes from 'prop-types'; +import { FormattedMessage } from 'react-intl'; +import ImmutablePureComponent from 'react-immutable-pure-component'; +import { HotKeys } from 'react-hotkeys'; +import classNames from 'classnames'; + +// Our imports. +import Permalink from 'flavours/glitch/components/permalink'; +import AccountContainer from 'flavours/glitch/containers/account_container'; +import NotificationOverlayContainer from '../containers/overlay_container'; +import Icon from 'flavours/glitch/components/icon'; + +export default class NotificationFollow extends ImmutablePureComponent { + + static propTypes = { + hidden: PropTypes.bool, + id: PropTypes.string.isRequired, + account: ImmutablePropTypes.map.isRequired, + notification: ImmutablePropTypes.map.isRequired, + unread: PropTypes.bool, + }; + + handleMoveUp = () => { + const { notification, onMoveUp } = this.props; + onMoveUp(notification.get('id')); + }; + + handleMoveDown = () => { + const { notification, onMoveDown } = this.props; + onMoveDown(notification.get('id')); + }; + + handleOpen = () => { + this.handleOpenProfile(); + }; + + handleOpenProfile = () => { + const { notification } = this.props; + this.context.router.history.push(`/@${notification.getIn(['account', 'acct'])}`); + }; + + handleMention = e => { + e.preventDefault(); + + const { notification, onMention } = this.props; + onMention(notification.get('account'), this.context.router.history); + }; + + getHandlers () { + return { + moveUp: this.handleMoveUp, + moveDown: this.handleMoveDown, + open: this.handleOpen, + openProfile: this.handleOpenProfile, + mention: this.handleMention, + reply: this.handleMention, + }; + } + + render () { + const { account, notification, hidden, unread } = this.props; + + // Links to the display name. + const displayName = account.get('display_name_html') || account.get('username'); + const link = ( + + ); + + // Renders. + return ( + +
+
+
+ +
+ + +
+ +
+
+ ); + } + +} diff --git a/app/javascript/flavours/glitch/features/notifications/components/follow_request.js b/app/javascript/flavours/glitch/features/notifications/components/follow_request.js deleted file mode 100644 index a3fdf8a61..000000000 --- a/app/javascript/flavours/glitch/features/notifications/components/follow_request.js +++ /dev/null @@ -1,132 +0,0 @@ -import React, { Fragment } from 'react'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import PropTypes from 'prop-types'; -import Avatar from 'flavours/glitch/components/avatar'; -import DisplayName from 'flavours/glitch/components/display_name'; -import Permalink from 'flavours/glitch/components/permalink'; -import IconButton from 'flavours/glitch/components/icon_button'; -import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; -import ImmutablePureComponent from 'react-immutable-pure-component'; -import NotificationOverlayContainer from '../containers/overlay_container'; -import { HotKeys } from 'react-hotkeys'; -import Icon from 'flavours/glitch/components/icon'; -import classNames from 'classnames'; - -const messages = defineMessages({ - authorize: { id: 'follow_request.authorize', defaultMessage: 'Authorize' }, - reject: { id: 'follow_request.reject', defaultMessage: 'Reject' }, -}); - -export default @injectIntl -class FollowRequest extends ImmutablePureComponent { - - static propTypes = { - account: ImmutablePropTypes.map.isRequired, - onAuthorize: PropTypes.func.isRequired, - onReject: PropTypes.func.isRequired, - intl: PropTypes.object.isRequired, - notification: ImmutablePropTypes.map.isRequired, - unread: PropTypes.bool, - }; - - handleMoveUp = () => { - const { notification, onMoveUp } = this.props; - onMoveUp(notification.get('id')); - }; - - handleMoveDown = () => { - const { notification, onMoveDown } = this.props; - onMoveDown(notification.get('id')); - }; - - handleOpen = () => { - this.handleOpenProfile(); - }; - - handleOpenProfile = () => { - const { notification } = this.props; - this.context.router.history.push(`/@${notification.getIn(['account', 'acct'])}`); - }; - - handleMention = e => { - e.preventDefault(); - - const { notification, onMention } = this.props; - onMention(notification.get('account'), this.context.router.history); - }; - - getHandlers () { - return { - moveUp: this.handleMoveUp, - moveDown: this.handleMoveDown, - open: this.handleOpen, - openProfile: this.handleOpenProfile, - mention: this.handleMention, - reply: this.handleMention, - }; - } - - render () { - const { intl, hidden, account, onAuthorize, onReject, notification, unread } = this.props; - - if (!account) { - return
; - } - - if (hidden) { - return ( - - {account.get('display_name')} - {account.get('username')} - - ); - } - - // Links to the display name. - const displayName = account.get('display_name_html') || account.get('username'); - const link = ( - - ); - - return ( - -
-
-
- -
- - -
- -
-
- -
- -
- -
- - -
-
-
- - -
-
- ); - } - -} diff --git a/app/javascript/flavours/glitch/features/notifications/components/follow_request.jsx b/app/javascript/flavours/glitch/features/notifications/components/follow_request.jsx new file mode 100644 index 000000000..a3fdf8a61 --- /dev/null +++ b/app/javascript/flavours/glitch/features/notifications/components/follow_request.jsx @@ -0,0 +1,132 @@ +import React, { Fragment } from 'react'; +import ImmutablePropTypes from 'react-immutable-proptypes'; +import PropTypes from 'prop-types'; +import Avatar from 'flavours/glitch/components/avatar'; +import DisplayName from 'flavours/glitch/components/display_name'; +import Permalink from 'flavours/glitch/components/permalink'; +import IconButton from 'flavours/glitch/components/icon_button'; +import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; +import ImmutablePureComponent from 'react-immutable-pure-component'; +import NotificationOverlayContainer from '../containers/overlay_container'; +import { HotKeys } from 'react-hotkeys'; +import Icon from 'flavours/glitch/components/icon'; +import classNames from 'classnames'; + +const messages = defineMessages({ + authorize: { id: 'follow_request.authorize', defaultMessage: 'Authorize' }, + reject: { id: 'follow_request.reject', defaultMessage: 'Reject' }, +}); + +export default @injectIntl +class FollowRequest extends ImmutablePureComponent { + + static propTypes = { + account: ImmutablePropTypes.map.isRequired, + onAuthorize: PropTypes.func.isRequired, + onReject: PropTypes.func.isRequired, + intl: PropTypes.object.isRequired, + notification: ImmutablePropTypes.map.isRequired, + unread: PropTypes.bool, + }; + + handleMoveUp = () => { + const { notification, onMoveUp } = this.props; + onMoveUp(notification.get('id')); + }; + + handleMoveDown = () => { + const { notification, onMoveDown } = this.props; + onMoveDown(notification.get('id')); + }; + + handleOpen = () => { + this.handleOpenProfile(); + }; + + handleOpenProfile = () => { + const { notification } = this.props; + this.context.router.history.push(`/@${notification.getIn(['account', 'acct'])}`); + }; + + handleMention = e => { + e.preventDefault(); + + const { notification, onMention } = this.props; + onMention(notification.get('account'), this.context.router.history); + }; + + getHandlers () { + return { + moveUp: this.handleMoveUp, + moveDown: this.handleMoveDown, + open: this.handleOpen, + openProfile: this.handleOpenProfile, + mention: this.handleMention, + reply: this.handleMention, + }; + } + + render () { + const { intl, hidden, account, onAuthorize, onReject, notification, unread } = this.props; + + if (!account) { + return
; + } + + if (hidden) { + return ( + + {account.get('display_name')} + {account.get('username')} + + ); + } + + // Links to the display name. + const displayName = account.get('display_name_html') || account.get('username'); + const link = ( + + ); + + return ( + +
+
+
+ +
+ + +
+ +
+
+ +
+ +
+ +
+ + +
+
+
+ + +
+
+ ); + } + +} diff --git a/app/javascript/flavours/glitch/features/notifications/components/grant_permission_button.js b/app/javascript/flavours/glitch/features/notifications/components/grant_permission_button.js deleted file mode 100644 index 798e4c787..000000000 --- a/app/javascript/flavours/glitch/features/notifications/components/grant_permission_button.js +++ /dev/null @@ -1,19 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import { FormattedMessage } from 'react-intl'; - -export default class GrantPermissionButton extends React.PureComponent { - - static propTypes = { - onClick: PropTypes.func.isRequired, - }; - - render () { - return ( - - ); - } - -} diff --git a/app/javascript/flavours/glitch/features/notifications/components/grant_permission_button.jsx b/app/javascript/flavours/glitch/features/notifications/components/grant_permission_button.jsx new file mode 100644 index 000000000..798e4c787 --- /dev/null +++ b/app/javascript/flavours/glitch/features/notifications/components/grant_permission_button.jsx @@ -0,0 +1,19 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { FormattedMessage } from 'react-intl'; + +export default class GrantPermissionButton extends React.PureComponent { + + static propTypes = { + onClick: PropTypes.func.isRequired, + }; + + render () { + return ( + + ); + } + +} diff --git a/app/javascript/flavours/glitch/features/notifications/components/notification.js b/app/javascript/flavours/glitch/features/notifications/components/notification.js deleted file mode 100644 index d1aea1b21..000000000 --- a/app/javascript/flavours/glitch/features/notifications/components/notification.js +++ /dev/null @@ -1,234 +0,0 @@ -// Package imports. -import React from 'react'; -import PropTypes from 'prop-types'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import ImmutablePureComponent from 'react-immutable-pure-component'; - -// Our imports, -import StatusContainer from 'flavours/glitch/containers/status_container'; -import NotificationFollow from './follow'; -import NotificationFollowRequestContainer from '../containers/follow_request_container'; -import NotificationAdminSignup from './admin_signup'; -import NotificationAdminReportContainer from '../containers/admin_report_container'; - -export default class Notification extends ImmutablePureComponent { - - static propTypes = { - notification: ImmutablePropTypes.map.isRequired, - hidden: PropTypes.bool, - onMoveUp: PropTypes.func.isRequired, - onMoveDown: PropTypes.func.isRequired, - onMention: PropTypes.func.isRequired, - getScrollPosition: PropTypes.func, - updateScrollBottom: PropTypes.func, - cacheMediaWidth: PropTypes.func, - cachedMediaWidth: PropTypes.number, - onUnmount: PropTypes.func, - unread: PropTypes.bool, - }; - - render () { - const { - hidden, - notification, - onMoveDown, - onMoveUp, - onMention, - getScrollPosition, - updateScrollBottom, - } = this.props; - - switch(notification.get('type')) { - case 'follow': - return ( -