Birthdays: renames
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
ecfef7b151
commit
ac42b43fab
11 changed files with 59 additions and 59 deletions
|
@ -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}
|
||||
/>
|
|
@ -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 &&
|
||||
<BirthDateInput
|
||||
value={birthDate}
|
||||
onChange={this.onBirthDateChange}
|
||||
{birthdayRequired &&
|
||||
<BirthdayInput
|
||||
value={birthday}
|
||||
onChange={this.onBirthdayChange}
|
||||
required
|
||||
/>}
|
||||
{instance.get('approval_required') &&
|
||||
|
|
|
@ -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 (
|
||||
<div className='account'>
|
||||
|
@ -72,13 +72,13 @@ class Account extends ImmutablePureComponent {
|
|||
</div>
|
||||
</Permalink>
|
||||
<div
|
||||
className='account__birth-date'
|
||||
className='account__birthday'
|
||||
title={intl.formatMessage(messages.birthDate, {
|
||||
date: formattedBirthDate,
|
||||
date: formattedBirthday,
|
||||
})}
|
||||
>
|
||||
<Icon src={require('@tabler/icons/icons/ballon.svg')} />
|
||||
{formattedBirthDate}
|
||||
{formattedBirthday}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -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}
|
||||
/>
|
||||
<BirthDateInput
|
||||
<BirthdayInput
|
||||
hint={<FormattedMessage id='edit_profile.fields.birthday_label' defaultMessage='Birth date' />}
|
||||
value={this.state.birthDate}
|
||||
onChange={this.handleBirthDateChange}
|
||||
value={this.state.birthday}
|
||||
onChange={this.handleBirthdayChange}
|
||||
/>
|
||||
<div className='fields-row'>
|
||||
<div className='fields-row__column fields-row__column-6'>
|
||||
|
@ -344,7 +344,7 @@ class EditProfile extends ImmutablePureComponent {
|
|||
checked={this.state.discoverable}
|
||||
onChange={this.handleCheckboxChange}
|
||||
/>
|
||||
{supportsBirthDates && <Checkbox
|
||||
{supportsBirthdays && <Checkbox
|
||||
label={<FormattedMessage id='edit_profile.fields.show_birthday_label' defaultMessage='Show my birth date' />}
|
||||
hint={<FormattedMessage id='edit_profile.hints.show_birthday' defaultMessage='Your birth date will be visible on your profile.' />}
|
||||
name='show_birthday'
|
||||
|
|
|
@ -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 = <FormattedMessage id='notifications.column_settings.filter_bar.show' defaultMessage='Show' />;
|
||||
const filterAdvancedStr = <FormattedMessage id='notifications.column_settings.filter_bar.advanced' defaultMessage='Display all categories' />;
|
||||
|
@ -86,7 +86,7 @@ class ColumnSettings extends React.PureComponent {
|
|||
</div>
|
||||
</div>
|
||||
|
||||
{supportsBirthDates &&
|
||||
{supportsBirthdays &&
|
||||
<div role='group' aria-labelledby='notifications-filter-bar'>
|
||||
<span id='notifications-filter-bar' className='column-settings__section'>
|
||||
<FormattedMessage id='notifications.column_settings.birthdays.category' defaultMessage='Birthdays' />
|
||||
|
|
|
@ -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,
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 (
|
||||
<div className='profile-info-panel-content__birth-date' title={formattedBirthDate}>
|
||||
<div className='profile-info-panel-content__birthday' title={formattedBirthday}>
|
||||
<Icon src={require('@tabler/icons/icons/ballon.svg')} />
|
||||
<FormattedMessage
|
||||
id='account.birthday' defaultMessage='Has birthday today!'
|
||||
|
@ -104,11 +104,11 @@ class ProfileInfoPanel extends ImmutablePureComponent {
|
|||
);
|
||||
}
|
||||
return (
|
||||
<div className='profile-info-panel-content__birth-date'>
|
||||
<div className='profile-info-panel-content__birthday'>
|
||||
<Icon src={require('@tabler/icons/icons/ballon.svg')} />
|
||||
<FormattedMessage
|
||||
id='account.birth_date' defaultMessage='Birth date: {date}' values={{
|
||||
date: formattedBirthDate,
|
||||
date: formattedBirthday,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
@ -185,7 +185,7 @@ class ProfileInfoPanel extends ImmutablePureComponent {
|
|||
/>
|
||||
</div>}
|
||||
|
||||
{this.getBirthDate()}
|
||||
{this.getBirthday()}
|
||||
|
||||
<ProfileStats
|
||||
className='profile-info-panel-content__stats'
|
||||
|
|
|
@ -79,7 +79,7 @@ export const getFeatures = createSelector([
|
|||
explicitAddressing: v.software === PLEROMA && gte(v.version, '1.0.0'),
|
||||
accountEndorsements: v.software === PLEROMA && gte(v.version, '2.4.50'),
|
||||
quotePosts: v.software === PLEROMA && gte(v.version, '2.4.50'),
|
||||
birthDates: v.software === PLEROMA && gte(v.version, '2.4.50'),
|
||||
birthdays: v.software === PLEROMA && gte(v.version, '2.4.50'),
|
||||
};
|
||||
});
|
||||
|
||||
|
|
|
@ -555,7 +555,7 @@ a .account__avatar {
|
|||
}
|
||||
}
|
||||
|
||||
.account__birth-date {
|
||||
.account__birthday {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
white-space: nowrap;
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
}
|
||||
|
||||
&__join-date,
|
||||
&__birth-date {
|
||||
&__birthday {
|
||||
display: flex;
|
||||
font-size: 14px;
|
||||
color: var(--primary-text-color--faint);
|
||||
|
|
Loading…
Reference in a new issue