Modal Stars Balance Block: Support add stars button (#5624)
This commit is contained in:
parent
f8b13f48c2
commit
e8b4a4c00d
@ -285,6 +285,7 @@ const PremiumGiftModal: FC<OwnProps & StateProps> = ({
|
|||||||
isSlim
|
isSlim
|
||||||
contentClassName={styles.content}
|
contentClassName={styles.content}
|
||||||
className={buildClassName(styles.modalDialog, styles.root)}
|
className={buildClassName(styles.modalDialog, styles.root)}
|
||||||
|
isLowStackPriority
|
||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
className={styles.closeButton}
|
className={styles.closeButton}
|
||||||
@ -296,7 +297,7 @@ const PremiumGiftModal: FC<OwnProps & StateProps> = ({
|
|||||||
>
|
>
|
||||||
<div className={buttonClassName} />
|
<div className={buttonClassName} />
|
||||||
</Button>
|
</Button>
|
||||||
<BalanceBlock className={styles.balance} balance={starBalance} />
|
<BalanceBlock className={styles.balance} balance={starBalance} withAddButton />
|
||||||
<div className={buildClassName(styles.header, isHeaderHidden && styles.hiddenHeader)}>
|
<div className={buildClassName(styles.header, isHeaderHidden && styles.hiddenHeader)}>
|
||||||
<Transition
|
<Transition
|
||||||
name="slideVerticalFade"
|
name="slideVerticalFade"
|
||||||
|
|||||||
@ -76,6 +76,14 @@
|
|||||||
margin-right: 0.25rem;
|
margin-right: 0.25rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sendAsPeersMenuContainer {
|
||||||
|
z-index: 3;
|
||||||
|
display: flex;
|
||||||
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
}
|
||||||
|
|
||||||
.headerControlPanel {
|
.headerControlPanel {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
@ -298,11 +298,15 @@ const PaidReactionModal = ({
|
|||||||
isSlim
|
isSlim
|
||||||
hasAbsoluteCloseButton
|
hasAbsoluteCloseButton
|
||||||
contentClassName={styles.content}
|
contentClassName={styles.content}
|
||||||
|
isLowStackPriority
|
||||||
>
|
>
|
||||||
<div className={styles.headerControlPanel}>
|
<div className={styles.sendAsPeersMenuContainer}>
|
||||||
{sendAsPeersMenu}
|
{sendAsPeersMenu}
|
||||||
<BalanceBlock balance={starBalance} className={styles.modalBalance} />
|
|
||||||
</div>
|
</div>
|
||||||
|
<div className={styles.headerControlPanel}>
|
||||||
|
<BalanceBlock balance={starBalance} className={styles.modalBalance} withAddButton />
|
||||||
|
</div>
|
||||||
|
|
||||||
<StarSlider
|
<StarSlider
|
||||||
className={styles.slider}
|
className={styles.slider}
|
||||||
defaultValue={DEFAULT_STARS_AMOUNT}
|
defaultValue={DEFAULT_STARS_AMOUNT}
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import React, { memo } from '../../../lib/teact/teact';
|
import React, { memo } from '../../../lib/teact/teact';
|
||||||
|
import { getActions } from '../../../global';
|
||||||
|
|
||||||
import type { ApiStarsAmount } from '../../../api/types';
|
import type { ApiStarsAmount } from '../../../api/types';
|
||||||
|
|
||||||
@ -7,24 +8,45 @@ import buildClassName from '../../../util/buildClassName';
|
|||||||
|
|
||||||
import useLang from '../../../hooks/useLang';
|
import useLang from '../../../hooks/useLang';
|
||||||
|
|
||||||
|
import BadgeButton from '../../common/BadgeButton';
|
||||||
|
import Icon from '../../common/icons/Icon';
|
||||||
import StarIcon from '../../common/icons/StarIcon';
|
import StarIcon from '../../common/icons/StarIcon';
|
||||||
|
|
||||||
import styles from './StarsBalanceModal.module.scss';
|
import styles from './StarsBalanceModal.module.scss';
|
||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
balance?: ApiStarsAmount;
|
balance?: ApiStarsAmount;
|
||||||
|
withAddButton?: boolean;
|
||||||
className?: string;
|
className?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
const BalanceBlock = ({ balance, className }: OwnProps) => {
|
const BalanceBlock = ({ balance, className, withAddButton }: OwnProps) => {
|
||||||
const lang = useLang();
|
const lang = useLang();
|
||||||
|
|
||||||
|
const {
|
||||||
|
openStarsBalanceModal,
|
||||||
|
} = getActions();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={buildClassName(styles.balance, className)}>
|
<div className={buildClassName(styles.balanceBlock, className)}>
|
||||||
<span className={styles.smallerText}>{lang('StarsBalance')}</span>
|
<div className={styles.balanceInfo}>
|
||||||
<div className={styles.balanceBottom}>
|
<span className={styles.smallerText}>{lang('StarsBalance')}</span>
|
||||||
<StarIcon type="gold" size="middle" />
|
<div className={styles.balanceBottom}>
|
||||||
{balance !== undefined ? formatStarsAmount(lang, balance) : '…'}
|
<StarIcon type="gold" size="middle" />
|
||||||
|
{balance !== undefined ? formatStarsAmount(lang, balance) : '…'}
|
||||||
|
{withAddButton && (
|
||||||
|
<BadgeButton
|
||||||
|
className={styles.addStarsButton}
|
||||||
|
// eslint-disable-next-line react/jsx-no-bind
|
||||||
|
onClick={() => openStarsBalanceModal({})}
|
||||||
|
>
|
||||||
|
<Icon
|
||||||
|
className={styles.addStarsIcon}
|
||||||
|
name="add"
|
||||||
|
/>
|
||||||
|
</BadgeButton>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -128,7 +128,34 @@
|
|||||||
z-index: 3;
|
z-index: 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
.balance {
|
.addStarsButton {
|
||||||
|
width: 1rem;
|
||||||
|
height: 1rem;
|
||||||
|
padding: 0;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
border-radius: 50%;
|
||||||
|
|
||||||
|
transition: opacity 0.15s;
|
||||||
|
opacity: 1;
|
||||||
|
|
||||||
|
&:hover,
|
||||||
|
&:active {
|
||||||
|
opacity: 0.75;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.addStarsIcon {
|
||||||
|
font-size: 0.75rem !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.balanceBlock {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.balanceInfo {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: flex-end;
|
align-items: flex-end;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user