Re-add clear notifications button (#3708)

* Re-add clear notifications button

* remove connect() in column_settings

* one line

* remove unused props
This commit is contained in:
Yamagishi Kazutoshi 2017-06-12 19:26:23 +09:00 committed by Eugen Rochko
parent abbdacedc5
commit 72133fbed6
32 changed files with 46 additions and 89 deletions

View file

@ -1,28 +1,19 @@
import React from 'react';
import PropTypes from 'prop-types';
import { defineMessages, injectIntl } from 'react-intl';
const messages = defineMessages({
clear: { id: 'notifications.clear', defaultMessage: 'Clear notifications' },
});
import { FormattedMessage } from 'react-intl';
class ClearColumnButton extends React.Component {
static propTypes = {
onClick: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
};
render () {
const { intl } = this.props;
return (
<div role='button' title={intl.formatMessage(messages.clear)} className='column-icon column-icon-clear' tabIndex='0' onClick={this.props.onClick}>
<i className='fa fa-eraser' />
</div>
<button className='text-btn column-header__setting-btn' tabIndex='0' onClick={this.props.onClick}><i className='fa fa-eraser' /> <FormattedMessage id='notifications.clear' defaultMessage='Clear notifications' /></button>
);
}
}
export default injectIntl(ClearColumnButton);
export default ClearColumnButton;

View file

@ -1,27 +1,22 @@
import React from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import { FormattedMessage } from 'react-intl';
import ColumnCollapsable from '../../../components/column_collapsable';
import ClearColumnButton from './clear_column_button';
import SettingToggle from './setting_toggle';
const messages = defineMessages({
settings: { id: 'notifications.settings', defaultMessage: 'Column settings' },
});
class ColumnSettings extends React.PureComponent {
static propTypes = {
settings: ImmutablePropTypes.map.isRequired,
onChange: PropTypes.func.isRequired,
onSave: PropTypes.func.isRequired,
intl: PropTypes.shape({
formatMessage: PropTypes.func.isRequired,
}).isRequired,
onClear: PropTypes.func.isRequired,
};
render () {
const { settings, intl, onChange, onSave } = this.props;
const { settings, onChange, onSave, onClear } = this.props;
const alertStr = <FormattedMessage id='notifications.column_settings.alert' defaultMessage='Desktop notifications' />;
const showStr = <FormattedMessage id='notifications.column_settings.show' defaultMessage='Show in column' />;
@ -29,6 +24,10 @@ class ColumnSettings extends React.PureComponent {
return (
<div>
<div className='column-settings__row'>
<ClearColumnButton onClick={onClear} />
</div>
<span className='column-settings__section'><FormattedMessage id='notifications.column_settings.follow' defaultMessage='New followers:' /></span>
<div className='column-settings__row'>
@ -66,4 +65,4 @@ class ColumnSettings extends React.PureComponent {
}
export default injectIntl(ColumnSettings);
export default ColumnSettings;

View file

@ -1,12 +1,20 @@
import { connect } from 'react-redux';
import { defineMessages, injectIntl } from 'react-intl';
import ColumnSettings from '../components/column_settings';
import { changeSetting, saveSettings } from '../../../actions/settings';
import { clearNotifications } from '../../../actions/notifications';
import { openModal } from '../../../actions/modal';
const messages = defineMessages({
clearMessage: { id: 'notifications.clear_confirmation', defaultMessage: 'Are you sure you want to permanently clear all your notifications?' },
clearConfirm: { id: 'notifications.clear', defaultMessage: 'Clear notifications' },
});
const mapStateToProps = state => ({
settings: state.getIn(['settings', 'notifications']),
});
const mapDispatchToProps = dispatch => ({
const mapDispatchToProps = (dispatch, { intl }) => ({
onChange (key, checked) {
dispatch(changeSetting(['notifications', ...key], checked));
@ -16,6 +24,14 @@ const mapDispatchToProps = dispatch => ({
dispatch(saveSettings());
},
onClear () {
dispatch(openModal('CONFIRM', {
message: intl.formatMessage(messages.clearMessage),
confirm: intl.formatMessage(messages.clearConfirm),
onConfirm: () => dispatch(clearNotifications()),
}));
},
});
export default connect(mapStateToProps, mapDispatchToProps)(ColumnSettings);
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(ColumnSettings));

View file

@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import Column from '../../components/column';
import ColumnHeader from '../../components/column_header';
import { expandNotifications, clearNotifications, scrollTopNotifications } from '../../actions/notifications';
import { expandNotifications, scrollTopNotifications } from '../../actions/notifications';
import { addColumn, removeColumn, moveColumn } from '../../actions/columns';
import NotificationContainer from './containers/notification_container';
import { ScrollContainer } from 'react-router-scroll';
@ -13,13 +13,9 @@ import ColumnSettingsContainer from './containers/column_settings_container';
import { createSelector } from 'reselect';
import Immutable from 'immutable';
import LoadMore from '../../components/load_more';
import ClearColumnButton from './components/clear_column_button';
import { openModal } from '../../actions/modal';
const messages = defineMessages({
title: { id: 'column.notifications', defaultMessage: 'Notifications' },
clearMessage: { id: 'notifications.clear_confirmation', defaultMessage: 'Are you sure you want to permanently clear all your notifications?' },
clearConfirm: { id: 'notifications.clear', defaultMessage: 'Clear notifications' },
});
const getNotifications = createSelector([
@ -79,16 +75,6 @@ class Notifications extends React.PureComponent {
this.props.dispatch(expandNotifications());
}
handleClear = () => {
const { dispatch, intl } = this.props;
dispatch(openModal('CONFIRM', {
message: intl.formatMessage(messages.clearMessage),
confirm: intl.formatMessage(messages.clearConfirm),
onConfirm: () => dispatch(clearNotifications()),
}));
}
handlePin = () => {
const { columnId, dispatch } = this.props;

View file

@ -107,7 +107,6 @@
"notifications.column_settings.reblog": "الترقيّات:",
"notifications.column_settings.show": "إعرِضها في عمود",
"notifications.column_settings.sound": "أصدر صوتا",
"notifications.settings": "إعدادات العمود",
"onboarding.done": "تم",
"onboarding.next": "التالي",
"onboarding.page_five.public_timelines": "تُعرَض في الخيط الزمني المحلي المشاركات العامة المحررة من طرف جميع المسجلين في {domain}. أما في الخيط الزمني الموحد ، فإنه يتم عرض جميع المشاركات العامة المنشورة من طرف جميع الأشخاص المتابَعين من طرف أعضاء {domain}. هذه هي الخيوط الزمنية العامة، وهي طريقة رائعة للتعرف أشخاص جدد.",

View file

@ -107,7 +107,6 @@
"notifications.column_settings.reblog": "Споделяния:",
"notifications.column_settings.show": "Покажи в колона",
"notifications.column_settings.sound": "Play sound",
"notifications.settings": "Column settings",
"onboarding.done": "Done",
"onboarding.next": "Next",
"onboarding.page_five.public_timelines": "The local timeline shows public posts from everyone on {domain}. The federated timeline shows public posts from everyone who people on {domain} follow. These are the Public Timelines, a great way to discover new people.",

View file

@ -107,7 +107,6 @@
"notifications.column_settings.reblog": "Boosts:",
"notifications.column_settings.show": "Mostrar en la columna",
"notifications.column_settings.sound": "Reproduïr so",
"notifications.settings": "Ajustos de columna",
"onboarding.done": "Fet",
"onboarding.next": "Següent",
"onboarding.page_five.public_timelines": "La línia de temps local mostra missatges públics de tothom de {domain}. La línia de temps federada mostra els missatges públics de tothom que la gent de {domain} segueix. Aquests són les línies de temps Públiques, una bona manera de descobrir noves persones.",

View file

@ -107,7 +107,6 @@
"notifications.column_settings.reblog": "Geteilte Beiträge:",
"notifications.column_settings.show": "In der Spalte anzeigen",
"notifications.column_settings.sound": "Ton abspielen",
"notifications.settings": "Spalteneinstellungen",
"onboarding.done": "Done",
"onboarding.next": "Next",
"onboarding.page_five.public_timelines": "The local timeline shows public posts from everyone on {domain}. The federated timeline shows public posts from everyone who people on {domain} follow. These are the Public Timelines, a great way to discover new people.",

View file

@ -828,10 +828,6 @@
},
{
"descriptors": [
{
"defaultMessage": "Column settings",
"id": "notifications.settings"
},
{
"defaultMessage": "Desktop notifications",
"id": "notifications.column_settings.alert"
@ -882,10 +878,6 @@
},
{
"descriptors": [
{
"defaultMessage": "Notifications",
"id": "column.notifications"
},
{
"defaultMessage": "Are you sure you want to permanently clear all your notifications?",
"id": "notifications.clear_confirmation"
@ -893,6 +885,15 @@
{
"defaultMessage": "Clear notifications",
"id": "notifications.clear"
}
],
"path": "app/javascript/mastodon/features/notifications/containers/column_settings_container.json"
},
{
"descriptors": [
{
"defaultMessage": "Notifications",
"id": "column.notifications"
},
{
"defaultMessage": "You don't have any notifications yet. Interact with others to start the conversation.",

View file

@ -107,7 +107,6 @@
"notifications.column_settings.reblog": "Boosts:",
"notifications.column_settings.show": "Show in column",
"notifications.column_settings.sound": "Play sound",
"notifications.settings": "Column settings",
"onboarding.done": "Done",
"onboarding.next": "Next",
"onboarding.page_five.public_timelines": "The local timeline shows public posts from everyone on {domain}. The federated timeline shows public posts from everyone who people on {domain} follow. These are the Public Timelines, a great way to discover new people.",

View file

@ -107,7 +107,6 @@
"notifications.column_settings.reblog": "Diskonigoj:",
"notifications.column_settings.show": "Montri en kolono",
"notifications.column_settings.sound": "Play sound",
"notifications.settings": "Column settings",
"onboarding.done": "Done",
"onboarding.next": "Next",
"onboarding.page_five.public_timelines": "The local timeline shows public posts from everyone on {domain}. The federated timeline shows public posts from everyone who people on {domain} follow. These are the Public Timelines, a great way to discover new people.",

View file

@ -107,7 +107,6 @@
"notifications.column_settings.reblog": "Retoots:",
"notifications.column_settings.show": "Mostrar en columna",
"notifications.column_settings.sound": "Play sound",
"notifications.settings": "Column settings",
"onboarding.done": "Done",
"onboarding.next": "Next",
"onboarding.page_five.public_timelines": "The local timeline shows public posts from everyone on {domain}. The federated timeline shows public posts from everyone who people on {domain} follow. These are the Public Timelines, a great way to discover new people.",

View file

@ -107,7 +107,6 @@
"notifications.column_settings.reblog": "بازبوق‌ها:",
"notifications.column_settings.show": "نمایش در ستون",
"notifications.column_settings.sound": "پخش صدا",
"notifications.settings": "تنظیمات ستون",
"onboarding.done": "پایان",
"onboarding.next": "بعدی",
"onboarding.page_five.public_timelines": "نوشته‌های محلی یعنی نوشته‌های همهٔ کاربران {domain}. نوشته‌های همه‌جا یعنی نوشته‌های همهٔ کسانی که کاربران {domain} آن‌ها را پی می‌گیرند. این فهرست‌های عمومی راه خوبی برای یافتن کاربران تازه هستند.",

View file

@ -107,7 +107,6 @@
"notifications.column_settings.reblog": "Buusteja:",
"notifications.column_settings.show": "Näytä sarakkeessa",
"notifications.column_settings.sound": "Play sound",
"notifications.settings": "Column settings",
"onboarding.done": "Done",
"onboarding.next": "Next",
"onboarding.page_five.public_timelines": "The local timeline shows public posts from everyone on {domain}. The federated timeline shows public posts from everyone who people on {domain} follow. These are the Public Timelines, a great way to discover new people.",

View file

@ -107,7 +107,6 @@
"notifications.column_settings.reblog": "Partages :",
"notifications.column_settings.show": "Afficher dans la colonne",
"notifications.column_settings.sound": "Émettre un son",
"notifications.settings": "Paramètres de la colonne",
"onboarding.done": "Effectué",
"onboarding.next": "Suivant",
"onboarding.page_five.public_timelines": "Le fil public global affiche les posts de tou⋅te⋅s les utilisateurs⋅trices suivi⋅es par les membres de {domain}. Le fil public local est identique mais se limite aux utilisateurs⋅trices de {domain}.",

View file

@ -107,7 +107,6 @@
"notifications.column_settings.reblog": "הדהודים:",
"notifications.column_settings.show": "הצגה בטור",
"notifications.column_settings.sound": "שמע מופעל",
"notifications.settings": "הגדרות טור",
"onboarding.done": "יציאה",
"onboarding.next": "הלאה",
"onboarding.page_five.public_timelines": "ציר הזמן המקומי מראה הודעות פומביות מכל באי קהילת {domain}. ציר הזמן העולמי מראה הודעות פומביות מאת כי מי שבאי קהילת {domain} עוקבים אחריו. אלו צירי הזמן הפומביים, דרך נהדרת לגלות אנשים חדשים.",

View file

@ -107,7 +107,6 @@
"notifications.column_settings.reblog": "Boosts:",
"notifications.column_settings.show": "Prikaži u stupcu",
"notifications.column_settings.sound": "Sviraj zvuk",
"notifications.settings": "Postavke rubrike",
"onboarding.done": "Učinjeno",
"onboarding.next": "Sljedeća",
"onboarding.page_five.public_timelines": "The local timeline prikazuje javne postove svih na {domain}. Federalni timeline pokazuje javne postove svih sa {domain} domena koje slijediš. To je sjajan način da otkriješ nove ljude.",

View file

@ -107,7 +107,6 @@
"notifications.column_settings.reblog": "Boosts:",
"notifications.column_settings.show": "Show in column",
"notifications.column_settings.sound": "Play sound",
"notifications.settings": "Column settings",
"onboarding.done": "Done",
"onboarding.next": "Next",
"onboarding.page_five.public_timelines": "The local timeline shows public posts from everyone on {domain}. The federated timeline shows public posts from everyone who people on {domain} follow. These are the Public Timelines, a great way to discover new people.",

View file

@ -107,7 +107,6 @@
"notifications.column_settings.reblog": "Boost:",
"notifications.column_settings.show": "Tampilkan dalam kolom",
"notifications.column_settings.sound": "Mainkan suara",
"notifications.settings": "Pengaturan kolom",
"onboarding.done": "Selesei",
"onboarding.next": "Selanjutnya",
"onboarding.page_five.public_timelines": "Linimasa lokal menampilkan semua postingan publik dari semua orang di {domain}. Linimasa gabungan menampilkan postingan publik dari semua orang yang diikuti oleh {domain}. Ini semua adalah Linimasa Publik, cara terbaik untuk bertemu orang lain.",

View file

@ -107,7 +107,6 @@
"notifications.column_settings.reblog": "Repeti:",
"notifications.column_settings.show": "Montrar en kolumno",
"notifications.column_settings.sound": "Plear sono",
"notifications.settings": "Aranji di kolumno",
"onboarding.done": "Done",
"onboarding.next": "Next",
"onboarding.page_five.public_timelines": "The local timeline shows public posts from everyone on {domain}. The federated timeline shows public posts from everyone who people on {domain} follow. These are the Public Timelines, a great way to discover new people.",

View file

@ -107,7 +107,6 @@
"notifications.column_settings.reblog": "Post condivisi:",
"notifications.column_settings.show": "Mostra in colonna",
"notifications.column_settings.sound": "Riproduci suono",
"notifications.settings": "Impostazioni colonna",
"onboarding.done": "Done",
"onboarding.next": "Next",
"onboarding.page_five.public_timelines": "The local timeline shows public posts from everyone on {domain}. The federated timeline shows public posts from everyone who people on {domain} follow. These are the Public Timelines, a great way to discover new people.",

View file

@ -107,7 +107,6 @@
"notifications.column_settings.reblog": "ブースト",
"notifications.column_settings.show": "カラムに表示",
"notifications.column_settings.sound": "通知音を再生",
"notifications.settings": "カラム設定",
"onboarding.done": "完了",
"onboarding.next": "次へ",
"onboarding.page_five.public_timelines": "連合タイムラインでは{domain}の人がフォローしているMastodon全体での公開投稿を表示します。同じくローカルタイムラインでは{domain}のみの公開投稿を表示します。",

View file

@ -107,7 +107,6 @@
"notifications.column_settings.reblog": "Boosts:",
"notifications.column_settings.show": "In kolom tonen",
"notifications.column_settings.sound": "Geluid afspelen",
"notifications.settings": "Kolom-instellingen",
"onboarding.done": "Klaar",
"onboarding.next": "Volgende",
"onboarding.page_five.public_timelines": "De lokale tijdlijn toont openbare toots van iedereen op {domain}. De globale tijdlijn toont openbare toots van iedereen die door gebruikers van {domain} worden gevolgd, dus ook mensen van andere Mastodon-servers. Dit zijn de openbare tijdlijnen en vormen een uitstekende manier om nieuwe mensen te ontdekken.",

View file

@ -107,7 +107,6 @@
"notifications.column_settings.reblog": "Fremhevet:",
"notifications.column_settings.show": "Vis i kolonne",
"notifications.column_settings.sound": "Spill lyd",
"notifications.settings": "Kolonneinstillinger",
"onboarding.done": "Ferdig",
"onboarding.next": "Neste",
"onboarding.page_five.public_timelines": "Den lokale tidslinjen viser offentlige poster fra alle på {domain}. Felles tidslinje viser offentlige poster fra alle som brukere på {domain} følger. Dette er de offentlige tidslinjene, et fint sted å oppdage nye brukere.",

View file

@ -107,7 +107,6 @@
"notifications.column_settings.reblog": "Partatges :",
"notifications.column_settings.show": "Mostrar dins la colomna",
"notifications.column_settings.sound": "Emetre un son",
"notifications.settings": "Paramètres de la colomna",
"onboarding.done": "Fach",
"onboarding.next": "Seguent",
"onboarding.page_five.public_timelines": "Lo flux local mòstra los estatuts publics del monde de vòstra intància, aquí {domain}. Lo flux federat mòstra los estatuts publics de tot lo mond sus {domain} sègon. Son los fluxes publics, un bon biais de trobar de mond.",

View file

@ -107,7 +107,6 @@
"notifications.column_settings.reblog": "Podbili:",
"notifications.column_settings.show": "Pokaż w kolumnie",
"notifications.column_settings.sound": "Odtwarzaj dźwięk",
"notifications.settings": "Ustawienia kolumny",
"onboarding.done": "Gotowe",
"onboarding.next": "Dalej",
"onboarding.page_five.public_timelines": "Lokalna oś czasu zawiera wszystkie publiczne wpisy z {domain}. Federalna oś czasu wyświetla publiczne wpisy obserwowanych przez członków {domain}. Są to publiczne osie czasu najlepszy sposób na poznanie nowych osób.",

View file

@ -107,7 +107,6 @@
"notifications.column_settings.reblog": "Partilhas:",
"notifications.column_settings.show": "Mostrar nas colunas",
"notifications.column_settings.sound": "Reproduzir som",
"notifications.settings": "Parâmetros da listagem de Notificações",
"onboarding.done": "Done",
"onboarding.next": "Next",
"onboarding.page_five.public_timelines": "The local timeline shows public posts from everyone on {domain}. The federated timeline shows public posts from everyone who people on {domain} follow. These are the Public Timelines, a great way to discover new people.",

View file

@ -107,7 +107,6 @@
"notifications.column_settings.reblog": "Продвижения:",
"notifications.column_settings.show": "Показывать в колонке",
"notifications.column_settings.sound": "Проигрывать звук",
"notifications.settings": "Настройки колонки",
"onboarding.done": "Готово",
"onboarding.next": "Далее",
"onboarding.page_five.public_timelines": "Локальная лента показывает публичные посты всех пользователей {domain}. Глобальная лента показывает публичные посты всех людей, на которых подписаны пользователи {domain}. Это - публичные ленты, отличный способ найти новые знакомства.",

View file

@ -107,7 +107,6 @@
"notifications.column_settings.reblog": "Boosts:",
"notifications.column_settings.show": "Show in column",
"notifications.column_settings.sound": "Play sound",
"notifications.settings": "Column settings",
"onboarding.done": "Done",
"onboarding.next": "Next",
"onboarding.page_five.public_timelines": "The local timeline shows public posts from everyone on {domain}. The federated timeline shows public posts from everyone who people on {domain} follow. These are the Public Timelines, a great way to discover new people.",

View file

@ -107,7 +107,6 @@
"notifications.column_settings.reblog": "Boostlar:",
"notifications.column_settings.show": "Bildirimlerde göster",
"notifications.column_settings.sound": "Ses çal",
"notifications.settings": "Bildirim ayarları",
"onboarding.done": "Tamam",
"onboarding.next": "Sıradaki",
"onboarding.page_five.public_timelines": "Yerel zaman tüneli, bu sunucudaki herkesten gelen gönderileri gösterir.Federe zaman tüneli, kullanıcıların diğer sunuculardan takip ettiği kişilerin herkese açık gönderilerini gösterir. Bunlar herkese açık zaman tünelleridir ve yeni insanlarla tanışmak için harika yerlerdir. The federated timeline shows public posts from everyone who people on {domain} follow. These are the Public Timelines, a great way to discover new ",

View file

@ -107,7 +107,6 @@
"notifications.column_settings.reblog": "Передмухи:",
"notifications.column_settings.show": "Показати в колонці",
"notifications.column_settings.sound": "Відтворювати звук",
"notifications.settings": "Налаштування колонки",
"onboarding.done": "Готово",
"onboarding.next": "Далі",
"onboarding.page_five.public_timelines": "Локальна стрічка показує публічні пости усіх користувачів {domain}. Глобальна стрічка показує публічні пости усіх людей, на яких підписані користувачі {domain}. Це публичні стрічки, відмінний спосіб знайти нових людей.",

View file

@ -106,22 +106,6 @@
}
}
.column-icon-clear {
font-size: 16px;
padding: 15px;
position: absolute;
right: 48px;
top: 0;
cursor: pointer;
z-index: 2;
}
@media screen and (min-width: 1025px) {
.column-icon-clear {
top: 10px;
}
}
.icon-button {
display: inline-block;
padding: 0;
@ -2238,6 +2222,12 @@ button.icon-button.active i.fa-retweet {
margin-bottom: 10px;
}
.column-settings__row {
.text-btn {
margin-bottom: 15px;
}
}
.modal-container__nav {
align-items: center;
background: rgba($base-overlay-background, 0.5);