~cytrogen/masto-fe

ref: f8dc013b0d81d5d463c086e291ce99ab1d796a9d masto-fe/app/javascript/mastodon/features/compose/containers/spoiler_button_container.js -rw-r--r-- 912 bytes
f8dc013b — Cytrogen [feature] Add language selector to local settings 13 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { injectIntl, defineMessages } from "react-intl";

import { connect } from "react-redux";

import { changeComposeSpoilerness } from "../../../actions/compose";
import TextIconButton from "../components/text_icon_button";

const messages = defineMessages({
  marked: { id: "compose_form.spoiler.marked", defaultMessage: "Text is hidden behind warning" },
  unmarked: { id: "compose_form.spoiler.unmarked", defaultMessage: "Text is not hidden" },
});

const mapStateToProps = (state, { intl }) => ({
  label: "CW",
  title: intl.formatMessage(state.getIn(["compose", "spoiler"]) ? messages.marked : messages.unmarked),
  active: state.getIn(["compose", "spoiler"]),
  ariaControls: "cw-spoiler-input",
});

const mapDispatchToProps = dispatch => ({

  onClick () {
    dispatch(changeComposeSpoilerness());
  },

});

export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(TextIconButton));