~cytrogen/masto-fe

8979b709750493763368bca9b2fac79902086f48 — Eugen Rochko 2 years ago 1c61869
Add default post text to onboarding flow in web UI (#24705)

M app/javascript/mastodon/actions/compose.js => app/javascript/mastodon/actions/compose.js +2 -1
@@ 126,9 126,10 @@ export function resetCompose() {
  };
}

export const focusCompose = routerHistory => dispatch => {
export const focusCompose = (routerHistory, defaultText) => dispatch => {
  dispatch({
    type: COMPOSE_FOCUS,
    defaultText,
  });

  ensureComposeIsVisible(routerHistory);

M app/javascript/mastodon/features/onboarding/index.jsx => app/javascript/mastodon/features/onboarding/index.jsx +8 -4
@@ 16,9 16,13 @@ import Follows from './follows';
import Share from './share';
import Step from './components/step';
import ArrowSmallRight from './components/arrow_small_right';
import { FormattedMessage } from 'react-intl';
import { FormattedMessage, injectIntl, defineMessages } from 'react-intl';
import { debounce } from 'lodash';

const messages = defineMessages({
  template: { id: 'onboarding.compose.template', defaultMessage: 'Hello #Mastodon!' },
});

const mapStateToProps = () => {
  const getAccount = makeGetAccount();



@@ 61,10 65,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 = () => {


@@ 138,4 142,4 @@ class Onboarding extends ImmutablePureComponent {

}

export default connect(mapStateToProps)(Onboarding);
export default connect(mapStateToProps)(injectIntl(Onboarding));

M app/javascript/mastodon/locales/defaultMessages.json => app/javascript/mastodon/locales/defaultMessages.json +4 -0
@@ 3212,6 3212,10 @@
  {
    "descriptors": [
      {
        "defaultMessage": "Hello #Mastodon!",
        "id": "onboarding.compose.template"
      },
      {
        "defaultMessage": "You've made it!",
        "id": "onboarding.start.title"
      },

M app/javascript/mastodon/locales/en.json => app/javascript/mastodon/locales/en.json +1 -0
@@ 445,6 445,7 @@
  "onboarding.actions.close": "Don't show this screen again",
  "onboarding.actions.go_to_explore": "See what's trending",
  "onboarding.actions.go_to_home": "Go to your home feed",
  "onboarding.compose.template": "Hello #Mastodon!",
  "onboarding.follows.empty": "Unfortunately, no results can be shown right now. You can try using search or browsing the explore page to find people to follow, or try again later.",
  "onboarding.follows.lead": "You curate your own home feed. The more people you follow, the more active and interesting it will be. These profiles may be a good starting point—you can always unfollow them later!",
  "onboarding.follows.title": "Popular on Mastodon",

M app/javascript/mastodon/reducers/compose.js => app/javascript/mastodon/reducers/compose.js +1 -1
@@ 528,7 528,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;
  }