Merge branch 'birthdays' of https://gitlab.com/mkljczk/soapbox-fe into birthdays

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak 2022-01-26 18:43:44 +01:00
commit 6c11d2f0bf
4 changed files with 23 additions and 20 deletions

View File

@ -10,7 +10,7 @@ import IconButton from 'soapbox/components/icon_button';
import { getFeatures } from 'soapbox/utils/features'; import { getFeatures } from 'soapbox/utils/features';
const messages = defineMessages({ const messages = defineMessages({
birthdayPlaceholder: { id: 'edit_profile.fields.birthday_placeholder', defaultMessage: 'Your birth date' }, birthdayPlaceholder: { id: 'edit_profile.fields.birthday_placeholder', defaultMessage: 'Your birthday' },
previousMonth: { id: 'datepicker.previous_month', defaultMessage: 'Previous month' }, previousMonth: { id: 'datepicker.previous_month', defaultMessage: 'Previous month' },
nextMonth: { id: 'datepicker.next_month', defaultMessage: 'Next month' }, nextMonth: { id: 'datepicker.next_month', defaultMessage: 'Next month' },
previousYear: { id: 'datepicker.previous_year', defaultMessage: 'Previous year' }, previousYear: { id: 'datepicker.previous_year', defaultMessage: 'Previous year' },
@ -114,7 +114,6 @@ class EditProfile extends ImmutablePureComponent {
<div className='datepicker__input'> <div className='datepicker__input'>
<DatePicker <DatePicker
selected={value} selected={value}
dateFormat='d MMMM yyyy'
wrapperClassName='react-datepicker-wrapper' wrapperClassName='react-datepicker-wrapper'
onChange={onChange} onChange={onChange}
placeholderText={intl.formatMessage(messages.birthdayPlaceholder)} placeholderText={intl.formatMessage(messages.birthdayPlaceholder)}

View File

@ -12,7 +12,7 @@ import Permalink from 'soapbox/components/permalink';
import { makeGetAccount } from 'soapbox/selectors'; import { makeGetAccount } from 'soapbox/selectors';
const messages = defineMessages({ const messages = defineMessages({
birthDate: { id: 'account.birth_date', defaultMessage: 'Birth date: {date}' }, birthday: { id: 'account.birthday', defaultMessage: 'Born {date}' },
}); });
const makeMapStateToProps = () => { const makeMapStateToProps = () => {
@ -73,7 +73,7 @@ class Account extends ImmutablePureComponent {
</Permalink> </Permalink>
<div <div
className='account__birthday' className='account__birthday'
title={intl.formatMessage(messages.birthDate, { title={intl.formatMessage(messages.birthday, {
date: formattedBirthday, date: formattedBirthday,
})} })}
> >

View File

@ -50,7 +50,7 @@ const messages = defineMessages({
error: { id: 'edit_profile.error', defaultMessage: 'Profile update failed' }, error: { id: 'edit_profile.error', defaultMessage: 'Profile update failed' },
bioPlaceholder: { id: 'edit_profile.fields.bio_placeholder', defaultMessage: 'Tell us about yourself.' }, bioPlaceholder: { id: 'edit_profile.fields.bio_placeholder', defaultMessage: 'Tell us about yourself.' },
displayNamePlaceholder: { id: 'edit_profile.fields.display_name_placeholder', defaultMessage: 'Name' }, displayNamePlaceholder: { id: 'edit_profile.fields.display_name_placeholder', defaultMessage: 'Name' },
birthdayPlaceholder: { id: 'edit_profile.fields.birthday_placeholder', defaultMessage: 'Your birth date' }, birthdayPlaceholder: { id: 'edit_profile.fields.birthday_placeholder', defaultMessage: 'Your birthday' },
}); });
const makeMapStateToProps = () => { const makeMapStateToProps = () => {
@ -290,11 +290,22 @@ class EditProfile extends ImmutablePureComponent {
onChange={this.handleTextChange} onChange={this.handleTextChange}
rows={3} rows={3}
/> />
{supportsBirthdays && (
<>
<BirthdayInput <BirthdayInput
hint={<FormattedMessage id='edit_profile.fields.birthday_label' defaultMessage='Birth date' />} hint={<FormattedMessage id='edit_profile.fields.birthday_label' defaultMessage='Birthday' />}
value={this.state.birthday} value={this.state.birthday}
onChange={this.handleBirthdayChange} onChange={this.handleBirthdayChange}
/> />
<Checkbox
label={<FormattedMessage id='edit_profile.fields.show_birthday_label' defaultMessage='Show my birthday' />}
hint={<FormattedMessage id='edit_profile.hints.show_birthday' defaultMessage='Your birthday will be visible on your profile.' />}
name='show_birthday'
checked={this.state.show_birthday}
onChange={this.handleCheckboxChange}
/>
</>
)}
<div className='fields-row'> <div className='fields-row'>
<div className='fields-row__column fields-row__column-6'> <div className='fields-row__column fields-row__column-6'>
<ProfilePreview account={this.makePreviewAccount()} /> <ProfilePreview account={this.makePreviewAccount()} />
@ -349,13 +360,6 @@ class EditProfile extends ImmutablePureComponent {
checked={this.state.discoverable} checked={this.state.discoverable}
onChange={this.handleCheckboxChange} onChange={this.handleCheckboxChange}
/> />
{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'
checked={this.state.show_birthday}
onChange={this.handleCheckboxChange}
/>}
{supportsEmailList && <Checkbox {supportsEmailList && <Checkbox
label={<FormattedMessage id='edit_profile.fields.accepts_email_list_label' defaultMessage='Subscribe to newsletter' />} label={<FormattedMessage id='edit_profile.fields.accepts_email_list_label' defaultMessage='Subscribe to newsletter' />}
hint={<FormattedMessage id='edit_profile.hints.accepts_email_list' defaultMessage='Opt-in to news and marketing updates.' />} hint={<FormattedMessage id='edit_profile.hints.accepts_email_list' defaultMessage='Opt-in to news and marketing updates.' />}

View File

@ -98,7 +98,7 @@ class ProfileInfoPanel extends ImmutablePureComponent {
<div className='profile-info-panel-content__birthday' title={formattedBirthday}> <div className='profile-info-panel-content__birthday' title={formattedBirthday}>
<Icon src={require('@tabler/icons/icons/ballon.svg')} /> <Icon src={require('@tabler/icons/icons/ballon.svg')} />
<FormattedMessage <FormattedMessage
id='account.birthday' defaultMessage='Has birthday today!' id='account.birthday_today' defaultMessage='Birthday is today!'
/> />
</div> </div>
); );
@ -107,7 +107,7 @@ class ProfileInfoPanel extends ImmutablePureComponent {
<div className='profile-info-panel-content__birthday'> <div className='profile-info-panel-content__birthday'>
<Icon src={require('@tabler/icons/icons/ballon.svg')} /> <Icon src={require('@tabler/icons/icons/ballon.svg')} />
<FormattedMessage <FormattedMessage
id='account.birth_date' defaultMessage='Birth date: {date}' values={{ id='account.birthday' defaultMessage='Born {date}' values={{
date: formattedBirthday, date: formattedBirthday,
}} }}
/> />