ボタンの復活
This commit is contained in:
parent
667b598e5c
commit
87875c093e
71
app/javascript/mastodon/actions/UtilBtns.js
Normal file
71
app/javascript/mastodon/actions/UtilBtns.js
Normal file
@ -0,0 +1,71 @@
|
||||
import { changeCompose } from '../actions/compose';
|
||||
|
||||
|
||||
|
||||
export const UTILBTNS_GOJI = 'UTILBTNS_GOJI';
|
||||
export const UTILBTNS_HARUKIN = 'UTILBTNS_HARUKIN';
|
||||
|
||||
|
||||
|
||||
export function submitGoji (textarea) {
|
||||
return function (dispatch, getState) {
|
||||
if (!textarea.value) {
|
||||
let text = [
|
||||
"#ゴジモリィィィィイイ",
|
||||
":goji:"
|
||||
].join("\r\n");
|
||||
|
||||
dispatch(submitGojiRequest());
|
||||
dispatch(changeCompose(text));
|
||||
|
||||
textarea.focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function submitGojiRequest () {
|
||||
return {
|
||||
type: UTILBTNS_GOJI
|
||||
}
|
||||
}
|
||||
|
||||
export function submitHarukin (textarea) {
|
||||
return function (dispatch, getState) {
|
||||
const HARUKINS = [":harukin: ", ":harukin_old: ", ":harukin_ika: ", ":harukin_tako: "];
|
||||
const MAX = 6;
|
||||
|
||||
if (!textarea.value) {
|
||||
let text = "";
|
||||
|
||||
let quantity = Math.round(Math.random() * MAX + 1);
|
||||
let type = Math.round(Math.random() * (HARUKINS.length - 1));
|
||||
|
||||
let harukin = HARUKINS[type];
|
||||
|
||||
switch (quantity) {
|
||||
default:
|
||||
text = [
|
||||
harukin.repeat(quantity),
|
||||
"🔥 ".repeat(quantity)
|
||||
].join("\r\n");
|
||||
|
||||
break;
|
||||
|
||||
case MAX + 1:
|
||||
text = `${harukin}💕\r\n`.repeat(6);
|
||||
break;
|
||||
}
|
||||
|
||||
dispatch(submitHarukinRequest());
|
||||
dispatch(changeCompose(text));
|
||||
|
||||
textarea.focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function submitHarukinRequest () {
|
||||
return {
|
||||
type: UTILBTNS_HARUKIN
|
||||
}
|
||||
}
|
@ -20,6 +20,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||
import { length } from 'stringz';
|
||||
import { countableText } from '../util/counter';
|
||||
import Icon from 'mastodon/components/icon';
|
||||
import { UserCounter } from './user_counter';
|
||||
|
||||
const allowedAroundShortCode = '><\u0085\u0020\u00a0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029\u0009\u000a\u000b\u000c\u000d';
|
||||
|
||||
@ -28,6 +29,10 @@ const messages = defineMessages({
|
||||
spoiler_placeholder: { id: 'compose_form.spoiler_placeholder', defaultMessage: 'Write your warning here' },
|
||||
publish: { id: 'compose_form.publish', defaultMessage: 'Toot' },
|
||||
publishLoud: { id: 'compose_form.publish_loud', defaultMessage: '{publish}!' },
|
||||
|
||||
|
||||
utilBtns_goji: { id: 'compose_form.utilBtns_goji', defaultMessage: 'Typo!!!' },
|
||||
utilBtns_harukin: { id: 'compose_form.utilBtns_harukin', defaultMessage: 'Burn Harukin' }
|
||||
});
|
||||
|
||||
export default @injectIntl
|
||||
@ -60,7 +65,9 @@ class ComposeForm extends ImmutablePureComponent {
|
||||
onPickEmoji: PropTypes.func.isRequired,
|
||||
showSearch: PropTypes.bool,
|
||||
anyMedia: PropTypes.bool,
|
||||
singleColumn: PropTypes.bool,
|
||||
singleColumn: PropTypes.bool,
|
||||
onGojiSubmit: PropTypes.func.isRequired,
|
||||
onHarukinSubmit: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
@ -88,7 +95,7 @@ class ComposeForm extends ImmutablePureComponent {
|
||||
const { isSubmitting, isChangingUpload, isUploading, anyMedia } = this.props;
|
||||
const fulltext = [this.props.spoilerText, countableText(this.props.text)].join('');
|
||||
|
||||
if (isSubmitting || isUploading || isChangingUpload || length(fulltext) > 500 || (fulltext.length !== 0 && fulltext.trim().length === 0 && !anyMedia)) {
|
||||
if (isSubmitting || isUploading || isChangingUpload || length(fulltext) > 2048 || (fulltext.length !== 0 && fulltext.trim().length === 0 && !anyMedia)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -177,11 +184,15 @@ class ComposeForm extends ImmutablePureComponent {
|
||||
this.props.onPickEmoji(position, data, needsSpace);
|
||||
}
|
||||
|
||||
|
||||
handleOnGojiSubmit = () => this.props.onGojiSubmit(this.autosuggestTextarea.textarea);
|
||||
handleOnHarukinSubmit = () => this.props.onHarukinSubmit(this.autosuggestTextarea.textarea);
|
||||
|
||||
render () {
|
||||
const { intl, onPaste, showSearch, anyMedia } = this.props;
|
||||
const disabled = this.props.isSubmitting;
|
||||
const text = [this.props.spoilerText, countableText(this.props.text)].join('');
|
||||
const disabledButton = disabled || this.props.isUploading || this.props.isChangingUpload || length(text) > 500 || (text.length !== 0 && text.trim().length === 0 && !anyMedia);
|
||||
const disabledButton = disabled || this.props.isUploading || this.props.isChangingUpload || length(text) > 2048 || (text.length !== 0 && text.trim().length === 0 && !anyMedia);
|
||||
let publishText = '';
|
||||
|
||||
if (this.props.privacy === 'private' || this.props.privacy === 'direct') {
|
||||
@ -243,11 +254,22 @@ class ComposeForm extends ImmutablePureComponent {
|
||||
<PrivacyDropdownContainer />
|
||||
<SpoilerButtonContainer />
|
||||
</div>
|
||||
<div className='character-counter__wrapper'><CharacterCounter max={500} text={text} /></div>
|
||||
<div className='character-counter__wrapper'><CharacterCounter max={2048} text={text} /></div>
|
||||
</div>
|
||||
|
||||
<div className='compose-form__publish'>
|
||||
<div className='compose-form__publish-button-wrapper'><Button text={publishText} onClick={this.handleSubmit} disabled={disabledButton} block /></div>
|
||||
<div className='compose-form__publish-button-wrapper'>
|
||||
|
||||
<Button text={publishText} onClick={this.handleSubmit} disabled={disabledButton} block>
|
||||
<span className="fa fa-send">{publishText}</span>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="compose-form__utilBtns">
|
||||
|
||||
<Button className="compose-form__utilBtns-goji" text={intl.formatMessage(messages.utilBtns_goji)} onClick={this.handleOnGojiSubmit} block />
|
||||
<Button className="compose-form__utilBtns-harukin" text={intl.formatMessage(messages.utilBtns_harukin)} onClick={this.handleOnHarukinSubmit} block />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
@ -0,0 +1,10 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
export default class UserCounter extends React.PureComponent {
|
||||
render () {
|
||||
return (
|
||||
<span>10人</span>
|
||||
);
|
||||
}
|
||||
}
|
@ -11,6 +11,11 @@ import {
|
||||
uploadCompose,
|
||||
} from '../../../actions/compose';
|
||||
|
||||
import {
|
||||
submitGoji,
|
||||
submitHarukin
|
||||
} from '../../../actions/UtilBtns';
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
text: state.getIn(['compose', 'text']),
|
||||
suggestions: state.getIn(['compose', 'suggestions']),
|
||||
@ -60,6 +65,18 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
onPickEmoji (position, data, needsSpace) {
|
||||
dispatch(insertEmojiCompose(position, data, needsSpace));
|
||||
},
|
||||
|
||||
onRisaSubmit (textarea) {
|
||||
dispatch(submitRisa(textarea));
|
||||
},
|
||||
|
||||
onGojiSubmit (textarea) {
|
||||
dispatch(submitGoji(textarea));
|
||||
},
|
||||
|
||||
onHarukinSubmit (textarea) {
|
||||
dispatch(submitHarukin(textarea));
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
|
@ -54,7 +54,7 @@
|
||||
"column.lists": "リスト",
|
||||
"column.mutes": "ミュートしたユーザー",
|
||||
"column.notifications": "通知",
|
||||
"column.pins": "固定されたトゥート",
|
||||
"column.pins": "固定された投稿",
|
||||
"column.public": "連合タイムライン",
|
||||
"column_back_button.label": "戻る",
|
||||
"column_header.hide_settings": "設定を隠す",
|
||||
@ -70,7 +70,7 @@
|
||||
"compose_form.hashtag_warning": "このトゥートは公開設定ではないのでハッシュタグの一覧に表示されません。公開トゥートだけがハッシュタグで検索できます。",
|
||||
"compose_form.lock_disclaimer": "あなたのアカウントは{locked}になっていません。誰でもあなたをフォローすることができ、フォロワー限定の投稿を見ることができます。",
|
||||
"compose_form.lock_disclaimer.lock": "承認制",
|
||||
"compose_form.placeholder": "今なにしてる?",
|
||||
"compose_form.placeholder": "ちょうどL.A.に到着しました。",
|
||||
"compose_form.poll.add_option": "追加",
|
||||
"compose_form.poll.duration": "アンケート期間",
|
||||
"compose_form.poll.option_placeholder": "項目 {number}",
|
||||
@ -83,6 +83,8 @@
|
||||
"compose_form.spoiler.marked": "閲覧注意が設定されています",
|
||||
"compose_form.spoiler.unmarked": "閲覧注意が設定されていません",
|
||||
"compose_form.spoiler_placeholder": "ここに警告を書いてください",
|
||||
"compose_form.utilBtns_goji": "誤字盛!",
|
||||
"compose_form.utilBtns_harukin": "はるきん焼却",
|
||||
"confirmation_modal.cancel": "キャンセル",
|
||||
"confirmations.block.block_and_report": "ブロックし通報",
|
||||
"confirmations.block.confirm": "ブロック",
|
||||
@ -143,7 +145,7 @@
|
||||
"getting_started.invite": "招待",
|
||||
"getting_started.open_source_notice": "Mastodonはオープンソースソフトウェアです。誰でもGitHub ( {github} ) から開発に参加したり、問題を報告したりできます。",
|
||||
"getting_started.security": "セキュリティ",
|
||||
"getting_started.terms": "プライバシーポリシー",
|
||||
"getting_started.terms": "利用規約とプライバシーポリシー",
|
||||
"hashtag.column_header.tag_mode.all": "と {additional}",
|
||||
"hashtag.column_header.tag_mode.any": "か {additional}",
|
||||
"hashtag.column_header.tag_mode.none": "({additional} を除く)",
|
||||
@ -153,6 +155,7 @@
|
||||
"hashtag.column_settings.tag_mode.any": "いずれかを含む",
|
||||
"hashtag.column_settings.tag_mode.none": "これらを除く",
|
||||
"hashtag.column_settings.tag_toggle": "このカラムに追加のタグを含める",
|
||||
"home.column_settings.advanced": "高度な設定",
|
||||
"home.column_settings.basic": "基本設定",
|
||||
"home.column_settings.show_reblogs": "ブースト表示",
|
||||
"home.column_settings.show_replies": "返信表示",
|
||||
@ -230,7 +233,6 @@
|
||||
"mute_modal.hide_notifications": "このユーザーからの通知を隠しますか?",
|
||||
"navigation_bar.apps": "アプリ",
|
||||
"navigation_bar.blocks": "ブロックしたユーザー",
|
||||
"navigation_bar.bookmarks": "ブックマーク",
|
||||
"navigation_bar.community_timeline": "ローカルタイムライン",
|
||||
"navigation_bar.compose": "トゥートの新規作成",
|
||||
"navigation_bar.direct": "ダイレクトメッセージ",
|
||||
@ -241,7 +243,8 @@
|
||||
"navigation_bar.filters": "フィルター設定",
|
||||
"navigation_bar.follow_requests": "フォローリクエスト",
|
||||
"navigation_bar.follows_and_followers": "フォロー・フォロワー",
|
||||
"navigation_bar.info": "このサーバーについて",
|
||||
"navigation_bar.generate_qrcode": "プロフィールのQRコードを生成",
|
||||
"navigation_bar.info": "Yづドンについて",
|
||||
"navigation_bar.keyboard_shortcuts": "ホットキー",
|
||||
"navigation_bar.lists": "リスト",
|
||||
"navigation_bar.logout": "ログアウト",
|
||||
@ -252,7 +255,10 @@
|
||||
"navigation_bar.profile_directory": "ディレクトリ",
|
||||
"navigation_bar.public_timeline": "連合タイムライン",
|
||||
"navigation_bar.security": "セキュリティ",
|
||||
"notification.favourite": "{name}さんがあなたのトゥートをお気に入りに登録しました",
|
||||
"navigation_bar.announcements": "運営からのお知らせ",
|
||||
"navigation_bar.trends": "トレンド",
|
||||
"navigation_bar.bookmarks": "ブックマーク",
|
||||
"notification.favourite": "{name}さんがあなたのトゥートに╰( ^o^)╮-=ニ=一=三★しました",
|
||||
"notification.follow": "{name}さんにフォローされました",
|
||||
"notification.mention": "{name}さんがあなたに返信しました",
|
||||
"notification.poll": "アンケートが終了しました",
|
||||
@ -293,6 +299,7 @@
|
||||
"privacy.public.short": "公開",
|
||||
"privacy.unlisted.long": "公開TLで表示しない",
|
||||
"privacy.unlisted.short": "未収載",
|
||||
"qr_modal.description": "QRコードを読み取って簡単にプロフィールにアクセスしましょう。",
|
||||
"regeneration_indicator.label": "読み込み中…",
|
||||
"regeneration_indicator.sublabel": "ホームタイムラインは準備中です!",
|
||||
"relative_time.days": "{number}日前",
|
||||
|
@ -657,10 +657,29 @@
|
||||
justify-content: flex-end;
|
||||
min-width: 0;
|
||||
flex: 0 0 auto;
|
||||
|
||||
padding-top: 10px;
|
||||
|
||||
.compose-form__publish-button-wrapper {
|
||||
overflow: hidden;
|
||||
padding-top: 10px;
|
||||
|
||||
button {
|
||||
display: inline-block;
|
||||
width: auto;
|
||||
|
||||
margin-right: 0.5em;
|
||||
}
|
||||
|
||||
button:last-child {
|
||||
margin-right: auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.compose-form__utilBtns {
|
||||
padding-top: 10px;
|
||||
|
||||
* {
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2212,6 +2231,7 @@ a.account__display-name {
|
||||
}
|
||||
|
||||
.getting-started__wrapper,
|
||||
.getting-started__trends,
|
||||
.search {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
@ -2318,24 +2338,13 @@ a.account__display-name {
|
||||
margin-bottom: 10px;
|
||||
height: calc(100% - 20px);
|
||||
overflow-y: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
& > a {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
hr {
|
||||
flex: 0 0 auto;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
border-top: 1px solid lighten($ui-base-color, 4%);
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.flex-spacer {
|
||||
background: transparent;
|
||||
}
|
||||
}
|
||||
|
||||
.drawer__pager {
|
||||
@ -2727,10 +2736,8 @@ a.account__display-name {
|
||||
}
|
||||
|
||||
&__trends {
|
||||
background: $ui-base-color;
|
||||
flex: 0 1 auto;
|
||||
opacity: 1;
|
||||
animation: fade 150ms linear;
|
||||
margin-top: 10px;
|
||||
|
||||
@media screen and (max-height: 810px) {
|
||||
.trends__item:nth-child(3) {
|
||||
@ -2747,15 +2754,11 @@ a.account__display-name {
|
||||
@media screen and (max-height: 670px) {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.trends__item {
|
||||
border-bottom: 0;
|
||||
padding: 10px;
|
||||
|
||||
&__current {
|
||||
color: $darker-text-color;
|
||||
}
|
||||
}
|
||||
&__scrollable {
|
||||
max-height: 100%;
|
||||
overflow-y: auto;
|
||||
}
|
||||
}
|
||||
|
||||
@ -5520,6 +5523,12 @@ noscript {
|
||||
}
|
||||
}
|
||||
|
||||
.embed-modal__qrcode {
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.account__moved-note {
|
||||
padding: 14px 10px;
|
||||
padding-bottom: 16px;
|
||||
@ -5984,8 +5993,7 @@ noscript {
|
||||
font-size: 24px;
|
||||
line-height: 36px;
|
||||
font-weight: 500;
|
||||
text-align: right;
|
||||
padding-right: 15px;
|
||||
text-align: center;
|
||||
color: $secondary-text-color;
|
||||
}
|
||||
|
||||
@ -5993,12 +6001,7 @@ noscript {
|
||||
flex: 0 0 auto;
|
||||
width: 50px;
|
||||
|
||||
path:first-child {
|
||||
fill: rgba($highlight-text-color, 0.25) !important;
|
||||
fill-opacity: 1 !important;
|
||||
}
|
||||
|
||||
path:last-child {
|
||||
path {
|
||||
stroke: lighten($highlight-text-color, 6%) !important;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user