kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
actions: useEmoji --> chooseEmoji
rodzic
0b0a548f8c
commit
cdda5363f6
|
@ -13,7 +13,7 @@ import toast from 'soapbox/toast';
|
||||||
import { isLoggedIn } from 'soapbox/utils/auth';
|
import { isLoggedIn } from 'soapbox/utils/auth';
|
||||||
import { getFeatures, parseVersion } from 'soapbox/utils/features';
|
import { getFeatures, parseVersion } from 'soapbox/utils/features';
|
||||||
|
|
||||||
import { useEmoji } from './emojis';
|
import { chooseEmoji } from './emojis';
|
||||||
import { importFetchedAccounts } from './importer';
|
import { importFetchedAccounts } from './importer';
|
||||||
import { uploadFile, updateMedia } from './media';
|
import { uploadFile, updateMedia } from './media';
|
||||||
import { openModal, closeModal } from './modals';
|
import { openModal, closeModal } from './modals';
|
||||||
|
@ -631,7 +631,7 @@ const selectComposeSuggestion = (composeId: string, position: number, token: str
|
||||||
completion = isNativeEmoji(suggestion) ? suggestion.native : suggestion.colons;
|
completion = isNativeEmoji(suggestion) ? suggestion.native : suggestion.colons;
|
||||||
startPosition = position - 1;
|
startPosition = position - 1;
|
||||||
|
|
||||||
dispatch(useEmoji(suggestion));
|
dispatch(chooseEmoji(suggestion));
|
||||||
} else if (typeof suggestion === 'string' && suggestion[0] === '#') {
|
} else if (typeof suggestion === 'string' && suggestion[0] === '#') {
|
||||||
completion = suggestion;
|
completion = suggestion;
|
||||||
startPosition = position - 1;
|
startPosition = position - 1;
|
||||||
|
|
|
@ -3,12 +3,12 @@ import { saveSettings } from './settings';
|
||||||
import type { Emoji } from 'soapbox/features/emoji';
|
import type { Emoji } from 'soapbox/features/emoji';
|
||||||
import type { AppDispatch } from 'soapbox/store';
|
import type { AppDispatch } from 'soapbox/store';
|
||||||
|
|
||||||
const EMOJI_USE = 'EMOJI_USE';
|
const EMOJI_CHOOSE = 'EMOJI_CHOOSE';
|
||||||
|
|
||||||
const useEmoji = (emoji: Emoji) =>
|
const chooseEmoji = (emoji: Emoji) =>
|
||||||
(dispatch: AppDispatch) => {
|
(dispatch: AppDispatch) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: EMOJI_USE,
|
type: EMOJI_CHOOSE,
|
||||||
emoji,
|
emoji,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -16,6 +16,6 @@ const useEmoji = (emoji: Emoji) =>
|
||||||
};
|
};
|
||||||
|
|
||||||
export {
|
export {
|
||||||
EMOJI_USE,
|
EMOJI_CHOOSE,
|
||||||
useEmoji,
|
chooseEmoji,
|
||||||
};
|
};
|
||||||
|
|
|
@ -33,7 +33,7 @@ import React, {
|
||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
|
|
||||||
import { clearComposeSuggestions, fetchComposeSuggestions } from 'soapbox/actions/compose';
|
import { clearComposeSuggestions, fetchComposeSuggestions } from 'soapbox/actions/compose';
|
||||||
import { useEmoji as chooseEmoji } from 'soapbox/actions/emojis';
|
import { chooseEmoji } from 'soapbox/actions/emojis';
|
||||||
import AutosuggestEmoji from 'soapbox/components/autosuggest-emoji';
|
import AutosuggestEmoji from 'soapbox/components/autosuggest-emoji';
|
||||||
import { useAppDispatch, useCompose } from 'soapbox/hooks';
|
import { useAppDispatch, useCompose } from 'soapbox/hooks';
|
||||||
import { selectAccount } from 'soapbox/selectors';
|
import { selectAccount } from 'soapbox/selectors';
|
||||||
|
|
|
@ -3,7 +3,7 @@ import React, { useEffect, useState, useLayoutEffect } from 'react';
|
||||||
import { defineMessages, useIntl } from 'react-intl';
|
import { defineMessages, useIntl } from 'react-intl';
|
||||||
import { createSelector } from 'reselect';
|
import { createSelector } from 'reselect';
|
||||||
|
|
||||||
import { useEmoji } from 'soapbox/actions/emojis';
|
import { chooseEmoji } from 'soapbox/actions/emojis';
|
||||||
import { changeSetting } from 'soapbox/actions/settings';
|
import { changeSetting } from 'soapbox/actions/settings';
|
||||||
import { useAppDispatch, useAppSelector, useTheme } from 'soapbox/hooks';
|
import { useAppDispatch, useAppSelector, useTheme } from 'soapbox/hooks';
|
||||||
import { RootState } from 'soapbox/store';
|
import { RootState } from 'soapbox/store';
|
||||||
|
@ -160,7 +160,7 @@ const EmojiPickerDropdown: React.FC<IEmojiPickerDropdown> = ({
|
||||||
} as CustomEmoji;
|
} as CustomEmoji;
|
||||||
}
|
}
|
||||||
|
|
||||||
dispatch(useEmoji(pickedEmoji)); // eslint-disable-line react-hooks/rules-of-hooks
|
dispatch(chooseEmoji(pickedEmoji));
|
||||||
|
|
||||||
if (onPickEmoji) {
|
if (onPickEmoji) {
|
||||||
onPickEmoji(pickedEmoji);
|
onPickEmoji(pickedEmoji);
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { AnyAction } from 'redux';
|
||||||
|
|
||||||
import { ME_FETCH_SUCCESS } from 'soapbox/actions/me';
|
import { ME_FETCH_SUCCESS } from 'soapbox/actions/me';
|
||||||
|
|
||||||
import { EMOJI_USE } from '../actions/emojis';
|
import { EMOJI_CHOOSE } from '../actions/emojis';
|
||||||
import { NOTIFICATIONS_FILTER_SET } from '../actions/notifications';
|
import { NOTIFICATIONS_FILTER_SET } from '../actions/notifications';
|
||||||
import { SEARCH_FILTER_SET } from '../actions/search';
|
import { SEARCH_FILTER_SET } from '../actions/search';
|
||||||
import {
|
import {
|
||||||
|
@ -40,7 +40,7 @@ export default function settings(state: State = ImmutableMap<string, any>({ save
|
||||||
return state
|
return state
|
||||||
.setIn(action.path, action.value)
|
.setIn(action.path, action.value)
|
||||||
.set('saved', false);
|
.set('saved', false);
|
||||||
case EMOJI_USE:
|
case EMOJI_CHOOSE:
|
||||||
return updateFrequentEmojis(state, action.emoji);
|
return updateFrequentEmojis(state, action.emoji);
|
||||||
case SETTING_SAVE:
|
case SETTING_SAVE:
|
||||||
return state.set('saved', true);
|
return state.set('saved', true);
|
||||||
|
|
Ładowanie…
Reference in New Issue