Hide "become a sustainer" button if you're already a sustainer

This commit is contained in:
Evan Hahn 2021-11-30 10:29:57 -06:00 committed by GitHub
parent 7edf3763a8
commit 67b17ec317
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 318 additions and 26 deletions

View file

@ -36,6 +36,8 @@ export type ItemsStateType = {
readonly preferredLeftPaneWidth?: number;
readonly preferredReactionEmoji?: Array<string>;
readonly areWeASubscriber?: boolean;
};
// Actions

View file

@ -20,6 +20,12 @@ const DEFAULT_PREFERRED_LEFT_PANE_WIDTH = 320;
export const getItems = (state: StateType): ItemsStateType => state.items;
export const getAreWeASubscriber = createSelector(
getItems,
({ areWeASubscriber }: Readonly<ItemsStateType>): boolean =>
Boolean(areWeASubscriber)
);
export const getUserAgent = createSelector(
getItems,
(state: ItemsStateType): string => state.userAgent as string

View file

@ -7,6 +7,7 @@ import type { PropsDataType } from '../../components/conversation/ContactModal';
import { ContactModal } from '../../components/conversation/ContactModal';
import type { StateType } from '../reducer';
import { getAreWeASubscriber } from '../selectors/items';
import { getIntl, getTheme } from '../selectors/user';
import { getBadgesSelector } from '../selectors/badges';
import { getConversationSelector } from '../selectors/conversations';
@ -35,6 +36,7 @@ const mapStateToProps = (state: StateType): PropsDataType => {
}
return {
areWeASubscriber: getAreWeASubscriber(state),
areWeAdmin,
badges: getBadgesSelector(state)(contact.badges),
contact,

View file

@ -13,6 +13,7 @@ import {
getConversationByUuidSelector,
} from '../selectors/conversations';
import { getGroupMemberships } from '../../util/getGroupMemberships';
import { getAreWeASubscriber } from '../selectors/items';
import { getIntl, getTheme } from '../selectors/user';
import type { MediaItemType } from '../../types/MediaItem';
import {
@ -82,6 +83,7 @@ const mapStateToProps = (
return {
...props,
areWeASubscriber: getAreWeASubscriber(state),
badges,
canEditGroupInfo,
candidateContactsToAdd,