From ac42b43fab73a80380b0dd66b6ad031733faba57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Tue, 25 Jan 2022 21:09:30 +0100 Subject: [PATCH] Birthdays: renames MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- ...{birth_date_input.js => birthday_input.js} | 12 +++---- .../components/registration_form.js | 28 ++++++++-------- app/soapbox/features/birthdays/account.js | 12 +++---- app/soapbox/features/edit_profile/index.js | 32 +++++++++---------- .../components/column_settings.js | 6 ++-- .../containers/column_settings_container.js | 2 +- app/soapbox/features/notifications/index.js | 2 +- .../ui/components/profile_info_panel.js | 18 +++++------ app/soapbox/utils/features.js | 2 +- app/styles/accounts.scss | 2 +- app/styles/components/profile-info-panel.scss | 2 +- 11 files changed, 59 insertions(+), 59 deletions(-) rename app/soapbox/components/{birth_date_input.js => birthday_input.js} (78%) diff --git a/app/soapbox/components/birth_date_input.js b/app/soapbox/components/birthday_input.js similarity index 78% rename from app/soapbox/components/birth_date_input.js rename to app/soapbox/components/birthday_input.js index b07c54515..cb1408d51 100644 --- a/app/soapbox/components/birth_date_input.js +++ b/app/soapbox/components/birthday_input.js @@ -9,14 +9,14 @@ import 'react-datepicker/dist/react-datepicker.css'; import { getFeatures } from 'soapbox/utils/features'; const messages = defineMessages({ - birthDatePlaceholder: { id: 'edit_profile.fields.birthday_placeholder', defaultMessage: 'Your birth date' }, + birthdayPlaceholder: { id: 'edit_profile.fields.birthday_placeholder', defaultMessage: 'Your birth date' }, }); const mapStateToProps = state => { const features = getFeatures(state.get('instance')); return { - supportsBirthDates: features.birthDates, + supportsBirthdays: features.birthdays, minAge: state.getIn(['instance', 'pleroma', 'metadata', 'birthday_min_age']), }; }; @@ -28,16 +28,16 @@ class EditProfile extends ImmutablePureComponent { static propTypes = { hint: PropTypes.node, required: PropTypes.bool, - supportsBirthDates: PropTypes.bool, + supportsBirthdays: PropTypes.bool, minAge: PropTypes.number, onChange: PropTypes.func.isRequired, value: PropTypes.instanceOf(Date), }; render() { - const { intl, value, onChange, supportsBirthDates, hint, required, minAge } = this.props; + const { intl, value, onChange, supportsBirthdays, hint, required, minAge } = this.props; - if (!supportsBirthDates) return null; + if (!supportsBirthdays) return null; const maxDate = new Date(); maxDate.setDate(maxDate.getDate() - minAge); @@ -55,7 +55,7 @@ class EditProfile extends ImmutablePureComponent { dateFormat='d MMMM yyyy' wrapperClassName='react-datepicker-wrapper' onChange={onChange} - placeholderText={intl.formatMessage(messages.birthDatePlaceholder)} + placeholderText={intl.formatMessage(messages.birthdayPlaceholder)} maxDate={maxDate} required={required} /> diff --git a/app/soapbox/features/auth_login/components/registration_form.js b/app/soapbox/features/auth_login/components/registration_form.js index 52272f1f9..127916a19 100644 --- a/app/soapbox/features/auth_login/components/registration_form.js +++ b/app/soapbox/features/auth_login/components/registration_form.js @@ -14,7 +14,7 @@ import { accountLookup } from 'soapbox/actions/accounts'; import { register, verifyCredentials } from 'soapbox/actions/auth'; import { openModal } from 'soapbox/actions/modal'; import { getSettings } from 'soapbox/actions/settings'; -import BirthDateInput from 'soapbox/components/birth_date_input'; +import BirthdayInput from 'soapbox/components/birthday_input'; import ShowablePassword from 'soapbox/components/showable_password'; import CaptchaField from 'soapbox/features/auth_login/components/captcha'; import { @@ -47,7 +47,7 @@ const mapStateToProps = (state, props) => ({ needsApproval: state.getIn(['instance', 'approval_required']), supportsEmailList: getFeatures(state.get('instance')).emailList, supportsAccountLookup: getFeatures(state.get('instance')).accountLookup, - birthDateRequired: state.getIn(['instance', 'pleroma', 'metadata', 'birthday_required']), + birthdayRequired: state.getIn(['instance', 'pleroma', 'metadata', 'birthday_required']), }); export default @connect(mapStateToProps) @@ -63,7 +63,7 @@ class RegistrationForm extends ImmutablePureComponent { supportsEmailList: PropTypes.bool, supportsAccountLookup: PropTypes.bool, inviteToken: PropTypes.string, - birthDateRequired: PropTypes.bool, + birthdayRequired: PropTypes.bool, } static contextTypes = { @@ -132,9 +132,9 @@ class RegistrationForm extends ImmutablePureComponent { this.setState({ passwordMismatch: !this.passwordsMatch() }); } - onBirthDateChange = birthDate => { + onBirthdayChange = birthday => { this.setState({ - birthDate, + birthday, }); } @@ -206,7 +206,7 @@ class RegistrationForm extends ImmutablePureComponent { onSubmit = e => { const { dispatch, inviteToken } = this.props; - const { birthDate } = this.state; + const { birthday } = this.state; if (!this.passwordsMatch()) { this.setState({ passwordMismatch: true }); @@ -222,8 +222,8 @@ class RegistrationForm extends ImmutablePureComponent { params.set('token', inviteToken); } - if (birthDate) { - params.set('birthday', birthDate.toISOString().slice(0, 10)); + if (birthday) { + params.set('birthday', birthday.toISOString().slice(0, 10)); } }); @@ -259,8 +259,8 @@ class RegistrationForm extends ImmutablePureComponent { } render() { - const { instance, intl, supportsEmailList, birthDateRequired } = this.props; - const { params, usernameUnavailable, passwordConfirmation, passwordMismatch, birthDate } = this.state; + const { instance, intl, supportsEmailList, birthdayRequired } = this.props; + const { params, usernameUnavailable, passwordConfirmation, passwordMismatch, birthday } = this.state; const isLoading = this.state.captchaLoading || this.state.submissionLoading; return ( @@ -325,10 +325,10 @@ class RegistrationForm extends ImmutablePureComponent { error={passwordMismatch === true} required /> - {birthDateRequired && - } {instance.get('approval_required') && diff --git a/app/soapbox/features/birthdays/account.js b/app/soapbox/features/birthdays/account.js index 4a266cd8f..847e28de2 100644 --- a/app/soapbox/features/birthdays/account.js +++ b/app/soapbox/features/birthdays/account.js @@ -56,10 +56,10 @@ class Account extends ImmutablePureComponent { if (!account) return null; - const birthDate = account.getIn(['pleroma', 'birthday']); - if (!birthDate) return null; + const birthday = account.getIn(['pleroma', 'birthday']); + if (!birthday) return null; - const formattedBirthDate = intl.formatDate(birthDate, { day: 'numeric', month: 'short', year: 'numeric' }); + const formattedBirthday = intl.formatDate(birthday, { day: 'numeric', month: 'short', year: 'numeric' }); return (
@@ -72,13 +72,13 @@ class Account extends ImmutablePureComponent {
- {formattedBirthDate} + {formattedBirthday}
diff --git a/app/soapbox/features/edit_profile/index.js b/app/soapbox/features/edit_profile/index.js index 426af2a39..cf73ddbc4 100644 --- a/app/soapbox/features/edit_profile/index.js +++ b/app/soapbox/features/edit_profile/index.js @@ -14,7 +14,7 @@ import { updateNotificationSettings } from 'soapbox/actions/accounts'; import { patchMe } from 'soapbox/actions/me'; import snackbar from 'soapbox/actions/snackbar'; import { getSoapboxConfig } from 'soapbox/actions/soapbox'; -import BirthDateInput from 'soapbox/components/birth_date_input'; +import BirthdayInput from 'soapbox/components/birthday_input'; import Icon from 'soapbox/components/icon'; import { SimpleForm, @@ -50,7 +50,7 @@ const messages = defineMessages({ error: { id: 'edit_profile.error', defaultMessage: 'Profile update failed' }, bioPlaceholder: { id: 'edit_profile.fields.bio_placeholder', defaultMessage: 'Tell us about yourself.' }, displayNamePlaceholder: { id: 'edit_profile.fields.display_name_placeholder', defaultMessage: 'Name' }, - birthDatePlaceholder: { id: 'edit_profile.fields.birthday_placeholder', defaultMessage: 'Your birth date' }, + birthdayPlaceholder: { id: 'edit_profile.fields.birthday_placeholder', defaultMessage: 'Your birth date' }, }); const makeMapStateToProps = () => { @@ -67,7 +67,7 @@ const makeMapStateToProps = () => { maxFields: state.getIn(['instance', 'pleroma', 'metadata', 'fields_limits', 'max_fields'], 4), verifiedCanEditName: soapbox.get('verifiedCanEditName'), supportsEmailList: features.emailList, - supportsBirthDates: features.birthDates, + supportsBirthdays: features.birthdays, }; }; @@ -99,7 +99,7 @@ class EditProfile extends ImmutablePureComponent { maxFields: PropTypes.number, verifiedCanEditName: PropTypes.bool, supportsEmailList: PropTypes.bool, - supportsBirthDates: PropTypes.bool, + supportsBirthdays: PropTypes.bool, }; state = { @@ -113,8 +113,8 @@ class EditProfile extends ImmutablePureComponent { const strangerNotifications = account.getIn(['pleroma', 'notification_settings', 'block_from_strangers']); const acceptsEmailList = account.getIn(['pleroma', 'accepts_email_list']); const discoverable = account.getIn(['source', 'pleroma', 'discoverable']); - const birthDate = account.getIn(['pleroma', 'birthday']); - const showBirthDate = account.getIn(['source', 'pleroma', 'show_birthday']); + const birthday = account.getIn(['pleroma', 'birthday']); + const showBirthday = account.getIn(['source', 'pleroma', 'show_birthday']); const initialState = account.withMutations(map => { map.merge(map.get('source')); @@ -124,8 +124,8 @@ class EditProfile extends ImmutablePureComponent { map.set('accepts_email_list', acceptsEmailList); map.set('hide_network', hidesNetwork(account)); map.set('discoverable', discoverable); - map.set('show_birthday', showBirthDate); - if (birthDate) map.set('birthDate', new Date(birthDate)); + map.set('show_birthday', showBirthday); + if (birthday) map.set('birthday', new Date(birthday)); unescapeParams(map, ['display_name', 'bio']); }); @@ -166,7 +166,7 @@ class EditProfile extends ImmutablePureComponent { hide_follows: state.hide_network, hide_followers_count: state.hide_network, hide_follows_count: state.hide_network, - birthday: state.birthDate?.toISOString().slice(0, 10), + birthday: state.birthday?.toISOString().slice(0, 10), show_birthday: state.show_birthday, }, this.getFieldParams().toJS()); } @@ -235,9 +235,9 @@ class EditProfile extends ImmutablePureComponent { }; } - handleBirthDateChange = birthDate => { + handleBirthdayChange = birthday => { this.setState({ - birthDate, + birthday, }); } @@ -256,7 +256,7 @@ class EditProfile extends ImmutablePureComponent { } render() { - const { intl, maxFields, account, verifiedCanEditName, supportsBirthDates, supportsEmailList } = this.props; + const { intl, maxFields, account, verifiedCanEditName, supportsBirthdays, supportsEmailList } = this.props; const verified = isVerified(account); const canEditName = verifiedCanEditName || !verified; @@ -285,10 +285,10 @@ class EditProfile extends ImmutablePureComponent { onChange={this.handleTextChange} rows={3} /> - } - value={this.state.birthDate} - onChange={this.handleBirthDateChange} + value={this.state.birthday} + onChange={this.handleBirthdayChange} />
@@ -344,7 +344,7 @@ class EditProfile extends ImmutablePureComponent { checked={this.state.discoverable} onChange={this.handleCheckboxChange} /> - {supportsBirthDates && } hint={} name='show_birthday' diff --git a/app/soapbox/features/notifications/components/column_settings.js b/app/soapbox/features/notifications/components/column_settings.js index 39dd79836..63093ec78 100644 --- a/app/soapbox/features/notifications/components/column_settings.js +++ b/app/soapbox/features/notifications/components/column_settings.js @@ -24,7 +24,7 @@ class ColumnSettings extends React.PureComponent { onClear: PropTypes.func.isRequired, onClose: PropTypes.func.isRequired, supportsEmojiReacts: PropTypes.bool, - supportsBirthDates: PropTypes.bool, + supportsBirthdays: PropTypes.bool, }; onPushChange = (path, checked) => { @@ -40,7 +40,7 @@ class ColumnSettings extends React.PureComponent { } render() { - const { intl, settings, pushSettings, onChange, onClear, onClose, supportsEmojiReacts, supportsBirthDates } = this.props; + const { intl, settings, pushSettings, onChange, onClear, onClose, supportsEmojiReacts, supportsBirthdays } = this.props; const filterShowStr = ; const filterAdvancedStr = ; @@ -86,7 +86,7 @@ class ColumnSettings extends React.PureComponent {
- {supportsBirthDates && + {supportsBirthdays &&
diff --git a/app/soapbox/features/notifications/containers/column_settings_container.js b/app/soapbox/features/notifications/containers/column_settings_container.js index 05dc1f0eb..292c08961 100644 --- a/app/soapbox/features/notifications/containers/column_settings_container.js +++ b/app/soapbox/features/notifications/containers/column_settings_container.js @@ -24,7 +24,7 @@ const mapStateToProps = state => { settings: getSettings(state).get('notifications'), pushSettings: state.get('push_notifications'), supportsEmojiReacts: features.emojiReacts, - supportsBirthDates: features.birthDates, + supportsBirthdays: features.birthdays, }; }; diff --git a/app/soapbox/features/notifications/index.js b/app/soapbox/features/notifications/index.js index 29434fa65..b3afd7c2f 100644 --- a/app/soapbox/features/notifications/index.js +++ b/app/soapbox/features/notifications/index.js @@ -51,7 +51,7 @@ const mapStateToProps = state => { const settings = getSettings(state); const instance = state.get('instance'); const features = getFeatures(instance); - const showBirthdayReminders = settings.getIn(['notifications', 'birthdays', 'show']) && settings.getIn(['notifications', 'quickFilter', 'active']) === 'all' && features.birthDates; + const showBirthdayReminders = settings.getIn(['notifications', 'birthdays', 'show']) && settings.getIn(['notifications', 'quickFilter', 'active']) === 'all' && features.birthdays; const birthdays = showBirthdayReminders && state.getIn(['user_lists', 'birthday_reminders', state.get('me')]); return { diff --git a/app/soapbox/features/ui/components/profile_info_panel.js b/app/soapbox/features/ui/components/profile_info_panel.js index adf092155..f90cac95d 100644 --- a/app/soapbox/features/ui/components/profile_info_panel.js +++ b/app/soapbox/features/ui/components/profile_info_panel.js @@ -80,22 +80,22 @@ class ProfileInfoPanel extends ImmutablePureComponent { return badges; } - getBirthDate = () => { + getBirthday = () => { const { account, intl } = this.props; - const birthDate = account.getIn(['pleroma', 'birthday']); - if (!birthDate) return null; + const birthday = account.getIn(['pleroma', 'birthday']); + if (!birthday) return null; - const formattedBirthDate = intl.formatDate(birthDate, { day: 'numeric', month: 'long', year: 'numeric' }); + const formattedBirthday = intl.formatDate(birthday, { day: 'numeric', month: 'long', year: 'numeric' }); - const date = new Date(birthDate); + const date = new Date(birthday); const today = new Date(); const hasBirthday = date.getDate() === today.getDate() && date.getMonth() === today.getMonth(); if (hasBirthday) { return ( -
+
+
@@ -185,7 +185,7 @@ class ProfileInfoPanel extends ImmutablePureComponent { />
} - {this.getBirthDate()} + {this.getBirthday()}