Fix reactionpicker for fedibird

This commit is contained in:
noellabo 2021-08-28 14:57:34 +09:00
parent d95b76fdd8
commit 55889974a3
10 changed files with 42 additions and 9 deletions

View file

@ -269,7 +269,7 @@ class ReactionPickerDropdownMenu extends React.PureComponent {
// It should not be transformed when mounting because the resulting // It should not be transformed when mounting because the resulting
// size will be used to determine the coordinate of the menu by // size will be used to determine the coordinate of the menu by
// react-overlays // react-overlays
<div className={`dropdown-menu ${placement}`} style={{ ...style, opacity: opacity, transform: mounted ? `scale(${scaleX}, ${scaleY})` : null }} ref={this.setRef}> <div className={`dropdown-menu dropdown-menu-reaction ${placement}`} style={{ ...style, opacity: opacity, transform: mounted ? `scale(${scaleX}, ${scaleY})` : null }} ref={this.setRef}>
<div className={`dropdown-menu__arrow ${placement}`} style={{ left: arrowOffsetLeft, top: arrowOffsetTop }} /> <div className={`dropdown-menu__arrow ${placement}`} style={{ left: arrowOffsetLeft, top: arrowOffsetTop }} />
<ReactionPicker <ReactionPicker
custom_emojis={custom_emojis} custom_emojis={custom_emojis}
@ -297,6 +297,7 @@ export default class ReactionPickerDropdown extends React.PureComponent {
static propTypes = { static propTypes = {
icon: PropTypes.string.isRequired, icon: PropTypes.string.isRequired,
size: PropTypes.number.isRequired, size: PropTypes.number.isRequired,
title: PropTypes.string.isRequired,
active: PropTypes.bool, active: PropTypes.bool,
pressed: PropTypes.bool, pressed: PropTypes.bool,
iconButtonClass: PropTypes.string, iconButtonClass: PropTypes.string,
@ -393,7 +394,7 @@ export default class ReactionPickerDropdown extends React.PureComponent {
const open = this.state.id === openDropdownId; const open = this.state.id === openDropdownId;
return ( return (
<div> <div className='emoji-picker-dropdown'>
<IconButton <IconButton
icon={icon} icon={icon}
title={title} title={title}

View file

@ -32,6 +32,7 @@ const messages = defineMessages({
favourite: { id: 'status.favourite', defaultMessage: 'Favourite' }, favourite: { id: 'status.favourite', defaultMessage: 'Favourite' },
bookmark: { id: 'status.bookmark', defaultMessage: 'Bookmark' }, bookmark: { id: 'status.bookmark', defaultMessage: 'Bookmark' },
removeBookmark: { id: 'status.remove_bookmark', defaultMessage: 'Remove bookmark' }, removeBookmark: { id: 'status.remove_bookmark', defaultMessage: 'Remove bookmark' },
emoji_reaction: { id: 'status.emoji_reaction', defaultMessage: 'Emoji reaction' },
open: { id: 'status.open', defaultMessage: 'Expand this status' }, open: { id: 'status.open', defaultMessage: 'Expand this status' },
report: { id: 'status.report', defaultMessage: 'Report @{name}' }, report: { id: 'status.report', defaultMessage: 'Report @{name}' },
muteConversation: { id: 'status.mute_conversation', defaultMessage: 'Mute conversation' }, muteConversation: { id: 'status.mute_conversation', defaultMessage: 'Mute conversation' },
@ -390,6 +391,7 @@ class StatusActionBar extends ImmutablePureComponent {
className='status__action-bar-button' className='status__action-bar-button'
disabled={anonymousAccess} disabled={anonymousAccess}
status={status} status={status}
title={intl.formatMessage(messages.emoji_reaction)}
icon='smile-o' icon='smile-o'
size={18} size={18}
direction='right' direction='right'

View file

@ -101,6 +101,9 @@ const mapDispatchToProps = (dispatch, { status, onPickEmoji, scrollKey }) => ({
dispatch(isUserTouching() ? openModal('REACTION', { dispatch(isUserTouching() ? openModal('REACTION', {
status: status, status: status,
onPickEmoji: onPickEmoji, onPickEmoji: onPickEmoji,
onSkinTone: skinTone => {
dispatch(changeSetting(['skinTone'], skinTone));
},
custom_emojis: getCustomEmojis(state), custom_emojis: getCustomEmojis(state),
skinTone: state.getIn(['settings', 'skinTone']), skinTone: state.getIn(['settings', 'skinTone']),
frequentlyUsedEmojis: getFrequentlyUsedEmojis(state), frequentlyUsedEmojis: getFrequentlyUsedEmojis(state),

View file

@ -24,6 +24,7 @@ const messages = defineMessages({
quote: { id: 'status.quote', defaultMessage: 'Quote' }, quote: { id: 'status.quote', defaultMessage: 'Quote' },
favourite: { id: 'status.favourite', defaultMessage: 'Favourite' }, favourite: { id: 'status.favourite', defaultMessage: 'Favourite' },
bookmark: { id: 'status.bookmark', defaultMessage: 'Bookmark' }, bookmark: { id: 'status.bookmark', defaultMessage: 'Bookmark' },
emoji_reaction: { id: 'status.emoji_reaction', defaultMessage: 'Emoji reaction' },
more: { id: 'status.more', defaultMessage: 'More' }, more: { id: 'status.more', defaultMessage: 'More' },
mute: { id: 'status.mute', defaultMessage: 'Mute @{name}' }, mute: { id: 'status.mute', defaultMessage: 'Mute @{name}' },
muteConversation: { id: 'status.mute_conversation', defaultMessage: 'Mute conversation' }, muteConversation: { id: 'status.mute_conversation', defaultMessage: 'Mute conversation' },
@ -327,13 +328,15 @@ class ActionBar extends React.PureComponent {
{show_quote_button && <div className='detailed-status__button'><IconButton disabled={!publicStatus || expired} title={!publicStatus ? intl.formatMessage(messages.cannot_quote) : intl.formatMessage(messages.quote)} icon='quote-right' onClick={this.handleQuoteClick} /></div>} {show_quote_button && <div className='detailed-status__button'><IconButton disabled={!publicStatus || expired} title={!publicStatus ? intl.formatMessage(messages.cannot_quote) : intl.formatMessage(messages.quote)} icon='quote-right' onClick={this.handleQuoteClick} /></div>}
{shareButton} {shareButton}
<div className='detailed-status__button'><IconButton className='bookmark-icon' active={status.get('bookmarked')} disabled={!status.get('bookmarked') && expired} title={intl.formatMessage(messages.bookmark)} icon='bookmark' onClick={this.handleBookmarkClick} /></div> <div className='detailed-status__button'><IconButton className='bookmark-icon' active={status.get('bookmarked')} disabled={!status.get('bookmarked') && expired} title={intl.formatMessage(messages.bookmark)} icon='bookmark' onClick={this.handleBookmarkClick} /></div>
{enableReaction && <div className='status__action-bar-dropdown'>
{enableReaction && <div className='detailed-status__action-bar-dropdown'>
<ReactionPickerDropdownContainer <ReactionPickerDropdownContainer
disabled={expired} disabled={expired}
active={status.get('emoji_reactioned')} active={status.get('emoji_reactioned')}
pressed={status.get('emoji_reactioned')} pressed={status.get('emoji_reactioned')}
className='status__action-bar-button' className='status__action-bar-button'
status={status} status={status}
title={intl.formatMessage(messages.emoji_reaction)}
icon='smile-o' icon='smile-o'
size={18} size={18}
direction='right' direction='right'
@ -341,6 +344,7 @@ class ActionBar extends React.PureComponent {
onRemoveEmoji={this.handleEmojiRemove} onRemoveEmoji={this.handleEmojiRemove}
/> />
</div>} </div>}
<div className='detailed-status__action-bar-dropdown'> <div className='detailed-status__action-bar-dropdown'>
<DropdownMenuContainer size={18} icon='ellipsis-h' status={status} items={menu} direction='left' title={intl.formatMessage(messages.more)} /> <DropdownMenuContainer size={18} icon='ellipsis-h' status={status} items={menu} direction='left' title={intl.formatMessage(messages.more)} />
</div> </div>

View file

@ -76,7 +76,7 @@ export default class ModalRoot extends React.PureComponent {
} }
renderLoading = modalId => () => { renderLoading = modalId => () => {
return ['MEDIA', 'VIDEO', 'BOOST', 'CONFIRM', 'ACTIONS', 'CALENDAR', 'REACTON'].indexOf(modalId) === -1 ? <ModalLoading /> : null; return ['MEDIA', 'VIDEO', 'BOOST', 'CONFIRM', 'ACTIONS', 'CALENDAR', 'REACTION'].indexOf(modalId) === -1 ? <ModalLoading /> : null;
} }
renderError = (props) => { renderError = (props) => {

View file

@ -6,14 +6,11 @@ import StatusContent from '../../../components/status_content';
import Avatar from '../../../components/avatar'; import Avatar from '../../../components/avatar';
import RelativeTimestamp from '../../../components/relative_timestamp'; import RelativeTimestamp from '../../../components/relative_timestamp';
import DisplayName from '../../../components/display_name'; import DisplayName from '../../../components/display_name';
import IconButton from '../../../components/icon_button';
import classNames from 'classnames';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import { supportsPassiveEvents } from 'detect-passive-events'; import { supportsPassiveEvents } from 'detect-passive-events';
import { EmojiPicker as EmojiPickerAsync } from '../util/async-components'; import { EmojiPicker as EmojiPickerAsync } from '../util/async-components';
import { buildCustomEmojis, categoriesFromEmojis } from '../../emoji/emoji'; import { buildCustomEmojis, categoriesFromEmojis } from '../../emoji/emoji';
import { assetHost } from 'mastodon/utils/config';
const messages = defineMessages({ const messages = defineMessages({
emoji: { id: 'emoji_button.label', defaultMessage: 'Insert emoji' }, emoji: { id: 'emoji_button.label', defaultMessage: 'Insert emoji' },
@ -188,7 +185,6 @@ class ReactionPicker extends React.PureComponent {
showPreview={false} showPreview={false}
showSkinTones={false} showSkinTones={false}
notFound={notFoundFn} notFound={notFoundFn}
autoFocus
emojiTooltip emojiTooltip
style={{width: '100%'}} style={{width: '100%'}}
/> />

View file

@ -494,6 +494,7 @@
"status.detailed_status": "Detailed conversation view", "status.detailed_status": "Detailed conversation view",
"status.direct": "Direct message @{name}", "status.direct": "Direct message @{name}",
"status.embed": "Embed", "status.embed": "Embed",
"status.emoji_reaction": "Emoji reaction",
"status.favourite": "Favourite", "status.favourite": "Favourite",
"status.filtered": "Filtered", "status.filtered": "Filtered",
"status.load_more": "Load more", "status.load_more": "Load more",

View file

@ -495,6 +495,7 @@
"status.detailed_status": "詳細な会話ビュー", "status.detailed_status": "詳細な会話ビュー",
"status.direct": "@{name}さんにダイレクトメッセージ", "status.direct": "@{name}さんにダイレクトメッセージ",
"status.embed": "埋め込み", "status.embed": "埋め込み",
"status.emoji_reaction": "絵文字リアクション",
"status.favourite": "お気に入り", "status.favourite": "お気に入り",
"status.filtered": "フィルターされました", "status.filtered": "フィルターされました",
"status.load_more": "もっと見る", "status.load_more": "もっと見る",

View file

@ -362,6 +362,7 @@ html {
// Change the background colors of modals // Change the background colors of modals
.actions-modal, .actions-modal,
.reaction-modal,
.boost-modal, .boost-modal,
.confirmation-modal, .confirmation-modal,
.mute-modal, .mute-modal,

View file

@ -5430,7 +5430,31 @@ a.status-card.compact:hover {
} }
} }
.reaction-modal, .dropdown-menu.dropdown-menu-reaction {
padding: 0;
background-color: $white;
.emoji-mart {
border-radius: 4px;
}
}
.reaction-modal {
max-height: 80vh;
max-width: 80vw;
.status {
overflow-y: auto;
max-height: 300px;
border-bottom-width: 0;
}
.status + .emoji-mart .emoji-mart-bar:first-child {
border-top-width: 1px;
border-top-left-radius: unset;
border-top-right-radius: unset;
}
}
.actions-modal { .actions-modal {
max-height: 80vh; max-height: 80vh;
max-width: 80vw; max-width: 80vw;