mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-26 09:01:36 +01:00
[Glitch] Add default post text to onboarding flow in web UI
Port 8979b70975
to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
parent
e0b401e295
commit
542f2fb1e0
3 changed files with 10 additions and 7 deletions
|
@ -145,9 +145,10 @@ export function resetCompose() {
|
|||
};
|
||||
}
|
||||
|
||||
export const focusCompose = routerHistory => dispatch => {
|
||||
export const focusCompose = (routerHistory, defaultText) => dispatch => {
|
||||
dispatch({
|
||||
type: COMPOSE_FOCUS,
|
||||
defaultText,
|
||||
});
|
||||
|
||||
ensureComposeIsVisible(routerHistory);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import { FormattedMessage, injectIntl, defineMessages } from 'react-intl';
|
||||
|
||||
import { Helmet } from 'react-helmet';
|
||||
import { Link } from 'react-router-dom';
|
||||
|
@ -25,7 +25,9 @@ import Step from './components/step';
|
|||
import Follows from './follows';
|
||||
import Share from './share';
|
||||
|
||||
|
||||
const messages = defineMessages({
|
||||
template: { id: 'onboarding.compose.template', defaultMessage: 'Hello #Mastodon!' },
|
||||
});
|
||||
|
||||
const mapStateToProps = () => {
|
||||
const getAccount = makeGetAccount();
|
||||
|
@ -69,10 +71,10 @@ class Onboarding extends ImmutablePureComponent {
|
|||
};
|
||||
|
||||
handleComposeClick = () => {
|
||||
const { dispatch } = this.props;
|
||||
const { dispatch, intl } = this.props;
|
||||
const { router } = this.context;
|
||||
|
||||
dispatch(focusCompose(router.history));
|
||||
dispatch(focusCompose(router.history, intl.formatMessage(messages.template)));
|
||||
};
|
||||
|
||||
handleShareClick = () => {
|
||||
|
@ -146,4 +148,4 @@ class Onboarding extends ImmutablePureComponent {
|
|||
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps)(Onboarding);
|
||||
export default connect(mapStateToProps)(injectIntl(Onboarding));
|
||||
|
|
|
@ -653,7 +653,7 @@ export default function compose(state = initialState, action) {
|
|||
case COMPOSE_LANGUAGE_CHANGE:
|
||||
return state.set('language', action.language);
|
||||
case COMPOSE_FOCUS:
|
||||
return state.set('focusDate', new Date());
|
||||
return state.set('focusDate', new Date()).update('text', text => text.length > 0 ? text : action.defaultText);
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue