supporting EURO icon
This commit is contained in:
parent
cc8812d751
commit
631d3cc1f3
9 changed files with 62 additions and 9 deletions
|
@ -2,6 +2,8 @@ import { connect } from 'react-redux';
|
||||||
import { doOpenModal } from 'redux/actions/app';
|
import { doOpenModal } from 'redux/actions/app';
|
||||||
import { makeSelectTagInClaimOrChannelForUri, selectClaimForUri } from 'redux/selectors/claims';
|
import { makeSelectTagInClaimOrChannelForUri, selectClaimForUri } from 'redux/selectors/claims';
|
||||||
import ClaimSupportButton from './view';
|
import ClaimSupportButton from './view';
|
||||||
|
import { selectClientSetting } from 'redux/selectors/settings';
|
||||||
|
import * as SETTINGS from 'constants/settings';
|
||||||
|
|
||||||
const DISABLE_SUPPORT_TAG = 'disable-support';
|
const DISABLE_SUPPORT_TAG = 'disable-support';
|
||||||
|
|
||||||
|
@ -14,6 +16,7 @@ const select = (state, props) => {
|
||||||
return {
|
return {
|
||||||
disableSupport: makeSelectTagInClaimOrChannelForUri(uri, DISABLE_SUPPORT_TAG)(state),
|
disableSupport: makeSelectTagInClaimOrChannelForUri(uri, DISABLE_SUPPORT_TAG)(state),
|
||||||
isRepost,
|
isRepost,
|
||||||
|
preferredCurrency: selectClientSetting(state, SETTINGS.PREFERRED_CURRENCY),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -13,18 +13,32 @@ type Props = {
|
||||||
disableSupport: boolean,
|
disableSupport: boolean,
|
||||||
isRepost?: boolean,
|
isRepost?: boolean,
|
||||||
doOpenModal: (id: string, {}) => void,
|
doOpenModal: (id: string, {}) => void,
|
||||||
|
preferredCurrency: ?string,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function ClaimSupportButton(props: Props) {
|
export default function ClaimSupportButton(props: Props) {
|
||||||
const { uri, fileAction, isRepost, disableSupport, doOpenModal } = props;
|
const { uri, fileAction, isRepost, disableSupport, doOpenModal, preferredCurrency } = props;
|
||||||
|
|
||||||
|
const currencyToUse = preferredCurrency;
|
||||||
|
|
||||||
|
const iconToUse = {
|
||||||
|
EUR: {
|
||||||
|
icon: ICONS.EURO,
|
||||||
|
iconSize: 16,
|
||||||
|
},
|
||||||
|
USD: {
|
||||||
|
icon: ICONS.FINANCE,
|
||||||
|
iconSize: fileAction ? 22 : undefined,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
return disableSupport ? null : (
|
return disableSupport ? null : (
|
||||||
<Tooltip title={__('Support this claim')} arrow={false}>
|
<Tooltip title={__('Support this claim')} arrow={false}>
|
||||||
<Button
|
<Button
|
||||||
button={!fileAction ? 'alt' : undefined}
|
button={!fileAction ? 'alt' : undefined}
|
||||||
className={classnames('support-claim-button', { 'button--file-action': fileAction })}
|
className={classnames('support-claim-button', { 'button--file-action': fileAction })}
|
||||||
icon={ICONS.FINANCE}
|
icon={iconToUse[currencyToUse].icon}
|
||||||
iconSize={fileAction ? 22 : undefined}
|
iconSize={iconToUse[currencyToUse].iconSize}
|
||||||
label={isRepost ? __('Support Repost') : __('Support --[button to support a claim]--')}
|
label={isRepost ? __('Support Repost') : __('Support --[button to support a claim]--')}
|
||||||
requiresAuth
|
requiresAuth
|
||||||
onClick={() => doOpenModal(MODALS.SEND_TIP, { uri, isSupport: true })}
|
onClick={() => doOpenModal(MODALS.SEND_TIP, { uri, isSupport: true })}
|
||||||
|
|
|
@ -15,6 +15,8 @@ import { selectActiveChannelClaim } from 'redux/selectors/app';
|
||||||
import { selectSettingsByChannelId } from 'redux/selectors/comments';
|
import { selectSettingsByChannelId } from 'redux/selectors/comments';
|
||||||
import { getChannelIdFromClaim } from 'util/claim';
|
import { getChannelIdFromClaim } from 'util/claim';
|
||||||
import { doOpenModal } from 'redux/actions/app';
|
import { doOpenModal } from 'redux/actions/app';
|
||||||
|
import { selectClientSetting } from 'redux/selectors/settings';
|
||||||
|
import * as SETTINGS from 'constants/settings';
|
||||||
|
|
||||||
const select = (state, props) => {
|
const select = (state, props) => {
|
||||||
const { uri } = props;
|
const { uri } = props;
|
||||||
|
@ -42,6 +44,7 @@ const select = (state, props) => {
|
||||||
isFetchingChannels: selectFetchingMyChannels(state),
|
isFetchingChannels: selectFetchingMyChannels(state),
|
||||||
settingsByChannelId: selectSettingsByChannelId(state),
|
settingsByChannelId: selectSettingsByChannelId(state),
|
||||||
supportDisabled: makeSelectTagInClaimOrChannelForUri(uri, DISABLE_SUPPORT_TAG)(state),
|
supportDisabled: makeSelectTagInClaimOrChannelForUri(uri, DISABLE_SUPPORT_TAG)(state),
|
||||||
|
preferredCurrency: selectClientSetting(state, SETTINGS.PREFERRED_CURRENCY),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,7 @@ type Props = {
|
||||||
doSendCashTip: (TipParams, anonymous: boolean, UserParams, claimId: string, stripe: ?string, (any) => void) => string,
|
doSendCashTip: (TipParams, anonymous: boolean, UserParams, claimId: string, stripe: ?string, (any) => void) => string,
|
||||||
doSendTip: (params: {}, isSupport: boolean, successCb: (any) => void, errorCb: (any) => void, boolean) => void,
|
doSendTip: (params: {}, isSupport: boolean, successCb: (any) => void, errorCb: (any) => void, boolean) => void,
|
||||||
doOpenModal: (id: string, any) => void,
|
doOpenModal: (id: string, any) => void,
|
||||||
|
preferredCurrency?: boolean,
|
||||||
};
|
};
|
||||||
|
|
||||||
export function CommentCreate(props: Props) {
|
export function CommentCreate(props: Props) {
|
||||||
|
@ -101,6 +102,7 @@ export function CommentCreate(props: Props) {
|
||||||
doSendTip,
|
doSendTip,
|
||||||
setQuickReply,
|
setQuickReply,
|
||||||
doOpenModal,
|
doOpenModal,
|
||||||
|
preferredCurrency,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const isMobile = useIsMobile();
|
const isMobile = useIsMobile();
|
||||||
|
@ -382,6 +384,9 @@ export function CommentCreate(props: Props) {
|
||||||
setTipSelector(false);
|
setTipSelector(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let fiatIconToUse = ICONS.FINANCE;
|
||||||
|
if (preferredCurrency === 'EUR') fiatIconToUse = ICONS.EURO;
|
||||||
|
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
// Effects
|
// Effects
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
@ -640,7 +645,7 @@ export function CommentCreate(props: Props) {
|
||||||
<Button
|
<Button
|
||||||
{...submitButtonProps}
|
{...submitButtonProps}
|
||||||
disabled={disabled || tipSelectorError || !minAmountMet}
|
disabled={disabled || tipSelectorError || !minAmountMet}
|
||||||
icon={activeTab === TAB_LBC ? ICONS.LBC : ICONS.FINANCE}
|
icon={activeTab === TAB_LBC ? ICONS.LBC : fiatIconToUse}
|
||||||
label={__('Review')}
|
label={__('Review')}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setReviewingSupportComment(true);
|
setReviewingSupportComment(true);
|
||||||
|
|
|
@ -1194,6 +1194,26 @@ export const icons = {
|
||||||
<path d="M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6" />
|
<path d="M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6" />
|
||||||
</g>
|
</g>
|
||||||
),
|
),
|
||||||
|
[ICONS.EURO]: (props: CustomProps) => (
|
||||||
|
<svg
|
||||||
|
{...props}
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
viewBox="0 0 48 48"
|
||||||
|
width={props.size || '16'}
|
||||||
|
height={props.size || '18'}
|
||||||
|
fill="none"
|
||||||
|
strokeLinecap="round"
|
||||||
|
strokeLinejoin="round"
|
||||||
|
strokeWidth="1.5"
|
||||||
|
stroke="currentColor"
|
||||||
|
>
|
||||||
|
<g transform="matrix(2,0,0,2,0,0)">
|
||||||
|
<path d="M19.5,23.25a11.25,11.25,0,0,1,0-22.5" />
|
||||||
|
<path d="M4.5 9.75L16.5 9.75" />
|
||||||
|
<path d="M4.5 14.25L13.5 14.25" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
),
|
||||||
[ICONS.RABBIT_HOLE]: (props: CustomProps) => (
|
[ICONS.RABBIT_HOLE]: (props: CustomProps) => (
|
||||||
<svg
|
<svg
|
||||||
{...props}
|
{...props}
|
||||||
|
|
|
@ -2,10 +2,13 @@ import { connect } from 'react-redux';
|
||||||
import { selectBalance } from 'redux/selectors/wallet';
|
import { selectBalance } from 'redux/selectors/wallet';
|
||||||
import { selectClaimForUri } from 'redux/selectors/claims';
|
import { selectClaimForUri } from 'redux/selectors/claims';
|
||||||
import WalletTipAmountSelector from './view';
|
import WalletTipAmountSelector from './view';
|
||||||
|
import { selectClientSetting } from 'redux/selectors/settings';
|
||||||
|
import * as SETTINGS from 'constants/settings';
|
||||||
|
|
||||||
const select = (state, props) => ({
|
const select = (state, props) => ({
|
||||||
balance: selectBalance(state),
|
balance: selectBalance(state),
|
||||||
claim: selectClaimForUri(state, props.uri),
|
claim: selectClaimForUri(state, props.uri),
|
||||||
|
preferredCurrency: selectClientSetting(state, SETTINGS.PREFERRED_CURRENCY),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(select)(WalletTipAmountSelector);
|
export default connect(select)(WalletTipAmountSelector);
|
||||||
|
|
|
@ -28,13 +28,13 @@ type Props = {
|
||||||
customTipAmount?: number,
|
customTipAmount?: number,
|
||||||
exchangeRate?: any,
|
exchangeRate?: any,
|
||||||
fiatConversion?: boolean,
|
fiatConversion?: boolean,
|
||||||
tipError: boolean,
|
|
||||||
tipError: string,
|
tipError: string,
|
||||||
uri: string,
|
uri: string,
|
||||||
onChange: (number) => void,
|
onChange: (number) => void,
|
||||||
setConvertedAmount?: (number) => void,
|
setConvertedAmount?: (number) => void,
|
||||||
setDisableSubmitButton: (boolean) => void,
|
setDisableSubmitButton: (boolean) => void,
|
||||||
setTipError: (any) => void,
|
setTipError: (any) => void,
|
||||||
|
preferredCurrency?: boolean,
|
||||||
};
|
};
|
||||||
|
|
||||||
function WalletTipAmountSelector(props: Props) {
|
function WalletTipAmountSelector(props: Props) {
|
||||||
|
@ -52,6 +52,7 @@ function WalletTipAmountSelector(props: Props) {
|
||||||
setConvertedAmount,
|
setConvertedAmount,
|
||||||
setDisableSubmitButton,
|
setDisableSubmitButton,
|
||||||
setTipError,
|
setTipError,
|
||||||
|
preferredCurrency,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const isMobile = useIsMobile();
|
const isMobile = useIsMobile();
|
||||||
|
@ -229,6 +230,9 @@ function WalletTipAmountSelector(props: Props) {
|
||||||
<div className={classnames('help', customClassName)}>{helpMessage}</div>
|
<div className={classnames('help', customClassName)}>{helpMessage}</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let fiatIconToUse = ICONS.FINANCE;
|
||||||
|
if (preferredCurrency === 'EUR') fiatIconToUse = ICONS.EURO;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="section">
|
<div className="section">
|
||||||
|
@ -244,7 +248,7 @@ function WalletTipAmountSelector(props: Props) {
|
||||||
'button-toggle--disabled': amount > balance,
|
'button-toggle--disabled': amount > balance,
|
||||||
})}
|
})}
|
||||||
label={defaultAmount}
|
label={defaultAmount}
|
||||||
icon={activeTab === TAB_LBC ? ICONS.LBC : ICONS.FINANCE}
|
icon={activeTab === TAB_LBC ? ICONS.LBC : fiatIconToUse}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
handleCustomPriceChange(defaultAmount);
|
handleCustomPriceChange(defaultAmount);
|
||||||
setUseCustomTip(false);
|
setUseCustomTip(false);
|
||||||
|
@ -258,7 +262,7 @@ function WalletTipAmountSelector(props: Props) {
|
||||||
className={classnames('button-toggle button-toggle--expandformobile', {
|
className={classnames('button-toggle button-toggle--expandformobile', {
|
||||||
'button-toggle--active': useCustomTip,
|
'button-toggle--active': useCustomTip,
|
||||||
})}
|
})}
|
||||||
icon={activeTab === TAB_LBC ? ICONS.LBC : ICONS.FINANCE}
|
icon={activeTab === TAB_LBC ? ICONS.LBC : fiatIconToUse}
|
||||||
label={__('Custom')}
|
label={__('Custom')}
|
||||||
onClick={() => setUseCustomTip(true)}
|
onClick={() => setUseCustomTip(true)}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -206,3 +206,4 @@ export const UPGRADE = 'Upgrade';
|
||||||
export const DISMISS_ALL = 'DismissAll';
|
export const DISMISS_ALL = 'DismissAll';
|
||||||
export const SUBMIT = 'Submit';
|
export const SUBMIT = 'Submit';
|
||||||
export const FILTERED_BY_LANG = 'FilteredByLang';
|
export const FILTERED_BY_LANG = 'FilteredByLang';
|
||||||
|
export const EURO = 'Euro';
|
||||||
|
|
|
@ -728,7 +728,7 @@ export const doSendCashTip = (tipParams, anonymous, userParams, claimId, stripeE
|
||||||
creator_channel_claim_id: tipParams.channelClaimId,
|
creator_channel_claim_id: tipParams.channelClaimId,
|
||||||
tipper_channel_name: anonymous ? '' : userParams.activeChannelName,
|
tipper_channel_name: anonymous ? '' : userParams.activeChannelName,
|
||||||
tipper_channel_claim_id: anonymous ? '' : userParams.activeChannelId,
|
tipper_channel_claim_id: anonymous ? '' : userParams.activeChannelId,
|
||||||
currency: 'USD',
|
currency: 'EUR',
|
||||||
anonymous: anonymous,
|
anonymous: anonymous,
|
||||||
source_claim_id: claimId,
|
source_claim_id: claimId,
|
||||||
environment: stripeEnvironment,
|
environment: stripeEnvironment,
|
||||||
|
@ -738,7 +738,7 @@ export const doSendCashTip = (tipParams, anonymous, userParams, claimId, stripeE
|
||||||
.then((customerTipResponse) => {
|
.then((customerTipResponse) => {
|
||||||
dispatch(
|
dispatch(
|
||||||
doToast({
|
doToast({
|
||||||
message: __("You sent $%tipAmount% as a tip to %tipChannelName%, I'm sure they appreciate it!", {
|
message: __('You sent $%tipAmount% as a tip to %tipChannelName%, I\'m sure they appreciate it!', {
|
||||||
tipAmount: tipParams.tipAmount,
|
tipAmount: tipParams.tipAmount,
|
||||||
tipChannelName: tipParams.tipChannelName,
|
tipChannelName: tipParams.tipChannelName,
|
||||||
}),
|
}),
|
||||||
|
|
Loading…
Reference in a new issue