Keyboard shortcuts and accessibility
This commit is contained in:
parent
8590a047c7
commit
20a892247f
87 changed files with 3652 additions and 711 deletions
47
ts/state/smart/ShortcutGuideModal.tsx
Normal file
47
ts/state/smart/ShortcutGuideModal.tsx
Normal file
|
@ -0,0 +1,47 @@
|
|||
import { connect } from 'react-redux';
|
||||
import { mapDispatchToProps } from '../actions';
|
||||
import { ShortcutGuideModal } from '../../components/ShortcutGuideModal';
|
||||
import { StateType } from '../reducer';
|
||||
|
||||
import { countStickers } from '../../components/stickers/lib';
|
||||
import { getIntl, getPlatform } from '../selectors/user';
|
||||
import {
|
||||
getBlessedStickerPacks,
|
||||
getInstalledStickerPacks,
|
||||
getKnownStickerPacks,
|
||||
getReceivedStickerPacks,
|
||||
} from '../selectors/stickers';
|
||||
|
||||
type ExternalProps = {
|
||||
close: () => unknown;
|
||||
};
|
||||
|
||||
const mapStateToProps = (state: StateType, props: ExternalProps) => {
|
||||
const { close } = props;
|
||||
|
||||
const blessedPacks = getBlessedStickerPacks(state);
|
||||
const installedPacks = getInstalledStickerPacks(state);
|
||||
const knownPacks = getKnownStickerPacks(state);
|
||||
const receivedPacks = getReceivedStickerPacks(state);
|
||||
|
||||
const hasInstalledStickers =
|
||||
countStickers({
|
||||
knownPacks,
|
||||
blessedPacks,
|
||||
installedPacks,
|
||||
receivedPacks,
|
||||
}) === 0;
|
||||
|
||||
const platform = getPlatform(state);
|
||||
|
||||
return {
|
||||
close,
|
||||
hasInstalledStickers,
|
||||
platform,
|
||||
i18n: getIntl(state),
|
||||
};
|
||||
};
|
||||
|
||||
const smart = connect(mapStateToProps, mapDispatchToProps);
|
||||
|
||||
export const SmartShortcutGuideModal = smart(ShortcutGuideModal);
|
Loading…
Add table
Add a link
Reference in a new issue