Boost Modal: Better design (#3913)
This commit is contained in:
parent
2e3c059333
commit
f806faa8c3
@ -16,10 +16,6 @@
|
|||||||
|
|
||||||
max-width: calc(50% - 0.5rem);
|
max-width: calc(50% - 0.5rem);
|
||||||
|
|
||||||
&.standalone {
|
|
||||||
max-width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.minimized {
|
&.minimized {
|
||||||
padding-right: 0;
|
padding-right: 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,7 +21,6 @@ type OwnProps = {
|
|||||||
icon?: IconName;
|
icon?: IconName;
|
||||||
title?: string;
|
title?: string;
|
||||||
isMinimized?: boolean;
|
isMinimized?: boolean;
|
||||||
isStandalone?: boolean;
|
|
||||||
canClose?: boolean;
|
canClose?: boolean;
|
||||||
forceShowSelf?: boolean;
|
forceShowSelf?: boolean;
|
||||||
clickArg?: any;
|
clickArg?: any;
|
||||||
@ -39,7 +38,6 @@ const PickerSelectedItem: FC<OwnProps & StateProps> = ({
|
|||||||
icon,
|
icon,
|
||||||
title,
|
title,
|
||||||
isMinimized,
|
isMinimized,
|
||||||
isStandalone,
|
|
||||||
canClose,
|
canClose,
|
||||||
clickArg,
|
clickArg,
|
||||||
chat,
|
chat,
|
||||||
@ -83,7 +81,6 @@ const PickerSelectedItem: FC<OwnProps & StateProps> = ({
|
|||||||
chat?.isForum && 'forum-avatar',
|
chat?.isForum && 'forum-avatar',
|
||||||
isMinimized && 'minimized',
|
isMinimized && 'minimized',
|
||||||
canClose && 'closeable',
|
canClose && 'closeable',
|
||||||
isStandalone && 'standalone',
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.withBadge {
|
.withBadge {
|
||||||
margin-top: 2rem;
|
margin-top: 3rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.badgeContainer {
|
.badgeContainer {
|
||||||
@ -102,7 +102,7 @@
|
|||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
width: var(--percent);
|
width: max(var(--percent), 0.625rem);
|
||||||
border-top-left-radius: 0.625rem;
|
border-top-left-radius: 0.625rem;
|
||||||
border-bottom-left-radius: 0.625rem;
|
border-bottom-left-radius: 0.625rem;
|
||||||
background-image: var(--premium-gradient);
|
background-image: var(--premium-gradient);
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
border: 0;
|
border: 0;
|
||||||
border-radius: var(--border-radius-default);
|
border-radius: var(--border-radius-modal);
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 600px) {
|
@media (max-width: 600px) {
|
||||||
|
|||||||
@ -2,22 +2,31 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
padding-top: 0 !important;
|
|
||||||
min-height: 14rem;
|
min-height: 14rem;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.modal {
|
||||||
|
:global(.modal-dialog) {
|
||||||
|
max-width: 22.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(.modal-title) {
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
|
||||||
|
padding-left: 0.5rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.loading {
|
.loading {
|
||||||
margin-block: auto;
|
margin-block: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.text-center {
|
|
||||||
text-align: center;
|
|
||||||
text-wrap: balance
|
|
||||||
}
|
|
||||||
|
|
||||||
.description {
|
.description {
|
||||||
padding: 0 0.75rem;
|
padding: 0.5rem;
|
||||||
|
line-height: 1.25;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chip {
|
.chip {
|
||||||
@ -25,7 +34,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.replaceModal :global(.modal-dialog) {
|
.replaceModal :global(.modal-dialog) {
|
||||||
max-width: 22rem;
|
max-width: 20rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.replaceModalContent {
|
.replaceModalContent {
|
||||||
|
|||||||
@ -6,7 +6,6 @@ import type { TabState } from '../../../global/types';
|
|||||||
|
|
||||||
import { getChatTitle } from '../../../global/helpers';
|
import { getChatTitle } from '../../../global/helpers';
|
||||||
import { selectChat } from '../../../global/selectors';
|
import { selectChat } from '../../../global/selectors';
|
||||||
import buildClassName from '../../../util/buildClassName';
|
|
||||||
import { formatDateInFuture } from '../../../util/dateFormat';
|
import { formatDateInFuture } from '../../../util/dateFormat';
|
||||||
import { getServerTime } from '../../../util/serverTime';
|
import { getServerTime } from '../../../util/serverTime';
|
||||||
import { getBoostProgressInfo } from '../../common/helpers/boostInfo';
|
import { getBoostProgressInfo } from '../../common/helpers/boostInfo';
|
||||||
@ -18,7 +17,6 @@ import useLastCallback from '../../../hooks/useLastCallback';
|
|||||||
|
|
||||||
import Avatar from '../../common/Avatar';
|
import Avatar from '../../common/Avatar';
|
||||||
import Icon from '../../common/Icon';
|
import Icon from '../../common/Icon';
|
||||||
import PickerSelectedItem from '../../common/PickerSelectedItem';
|
|
||||||
import PremiumProgress from '../../common/PremiumProgress';
|
import PremiumProgress from '../../common/PremiumProgress';
|
||||||
import Button from '../../ui/Button';
|
import Button from '../../ui/Button';
|
||||||
import ConfirmDialog from '../../ui/ConfirmDialog';
|
import ConfirmDialog from '../../ui/ConfirmDialog';
|
||||||
@ -60,7 +58,6 @@ const BoostModal = ({
|
|||||||
boostedChat,
|
boostedChat,
|
||||||
}: OwnProps & StateProps) => {
|
}: OwnProps & StateProps) => {
|
||||||
const {
|
const {
|
||||||
openChat,
|
|
||||||
applyBoost,
|
applyBoost,
|
||||||
closeBoostModal,
|
closeBoostModal,
|
||||||
requestConfetti,
|
requestConfetti,
|
||||||
@ -129,7 +126,7 @@ const BoostModal = ({
|
|||||||
const currentStoriesPerDay = lang('ChannelBoost.StoriesPerDay', level);
|
const currentStoriesPerDay = lang('ChannelBoost.StoriesPerDay', level);
|
||||||
const nextLevelStoriesPerDay = lang('ChannelBoost.StoriesPerDay', level + 1);
|
const nextLevelStoriesPerDay = lang('ChannelBoost.StoriesPerDay', level + 1);
|
||||||
|
|
||||||
const modalTitle = hasBoost ? lang('ChannelBoost.YouBoostedOtherChannel')
|
const modalTitle = hasBoost ? lang('YouBoostedChannel2', chatTitle)
|
||||||
: level === 0 ? lang('lng_boost_channel_title_first') : lang('lng_boost_channel_title_more');
|
: level === 0 ? lang('lng_boost_channel_title_first') : lang('lng_boost_channel_title_more');
|
||||||
|
|
||||||
let description: string | undefined;
|
let description: string | undefined;
|
||||||
@ -163,11 +160,6 @@ const BoostModal = ({
|
|||||||
};
|
};
|
||||||
}, [chat, chatTitle, info, lang]);
|
}, [chat, chatTitle, info, lang]);
|
||||||
|
|
||||||
const handleOpenChat = useLastCallback(() => {
|
|
||||||
openChat({ id: chat!.id });
|
|
||||||
closeBoostModal();
|
|
||||||
});
|
|
||||||
|
|
||||||
const handleApplyBoost = useLastCallback(() => {
|
const handleApplyBoost = useLastCallback(() => {
|
||||||
closeReplaceModal();
|
closeReplaceModal();
|
||||||
applyBoost({ chatId: chat!.id });
|
applyBoost({ chatId: chat!.id });
|
||||||
@ -175,6 +167,11 @@ const BoostModal = ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const handleButtonClick = useLastCallback(() => {
|
const handleButtonClick = useLastCallback(() => {
|
||||||
|
if (isBoosted) {
|
||||||
|
closeBoostModal();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (applyInfo?.type === 'ok') {
|
if (applyInfo?.type === 'ok') {
|
||||||
handleApplyBoost();
|
handleApplyBoost();
|
||||||
}
|
}
|
||||||
@ -186,10 +183,10 @@ const BoostModal = ({
|
|||||||
if (applyInfo?.type === 'wait') {
|
if (applyInfo?.type === 'wait') {
|
||||||
openWaitDialog();
|
openWaitDialog();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if (isBoosted) {
|
const handleCloseClick = useLastCallback(() => {
|
||||||
closeBoostModal();
|
closeBoostModal();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function renderContent() {
|
function renderContent() {
|
||||||
@ -199,14 +196,6 @@ const BoostModal = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{chat && (
|
|
||||||
<PickerSelectedItem
|
|
||||||
className={styles.chip}
|
|
||||||
peerId={chat.id}
|
|
||||||
isStandalone
|
|
||||||
onClick={handleOpenChat}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
<PremiumProgress
|
<PremiumProgress
|
||||||
leftText={leftText}
|
leftText={leftText}
|
||||||
rightText={rightText}
|
rightText={rightText}
|
||||||
@ -214,25 +203,22 @@ const BoostModal = ({
|
|||||||
floatingBadgeText={value}
|
floatingBadgeText={value}
|
||||||
floatingBadgeIcon="boost"
|
floatingBadgeIcon="boost"
|
||||||
/>
|
/>
|
||||||
<div className={buildClassName(styles.description, styles.textCenter)}>
|
<div className={styles.description}>
|
||||||
{renderText(descriptionText, ['simple_markdown', 'emoji'])}
|
{renderText(descriptionText, ['simple_markdown', 'emoji'])}
|
||||||
</div>
|
</div>
|
||||||
<Button
|
<div className="dialog-buttons">
|
||||||
className={styles.button}
|
<Button isText className="confirm-dialog-button" disabled={!applyInfo} onClick={handleButtonClick}>
|
||||||
size="smaller"
|
{!isBoosted ? (
|
||||||
withPremiumGradient
|
<>
|
||||||
isShiny
|
<Icon name="boost" />
|
||||||
isLoading={!applyInfo}
|
{lang('ChannelBoost.BoostChannel')}
|
||||||
ripple
|
</>
|
||||||
onClick={handleButtonClick}
|
) : lang('OK')}
|
||||||
>
|
</Button>
|
||||||
{!isBoosted ? (
|
<Button isText className="confirm-dialog-button" onClick={handleCloseClick}>
|
||||||
<>
|
{lang('Cancel')}
|
||||||
<Icon name="boost" />
|
</Button>
|
||||||
{lang('ChannelBoost.BoostChannel')}
|
</div>
|
||||||
</>
|
|
||||||
) : lang('OK')}
|
|
||||||
</Button>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -241,10 +227,9 @@ const BoostModal = ({
|
|||||||
<Modal
|
<Modal
|
||||||
isOpen={isOpen}
|
isOpen={isOpen}
|
||||||
title={title}
|
title={title}
|
||||||
|
className={styles.modal}
|
||||||
contentClassName={styles.content}
|
contentClassName={styles.content}
|
||||||
onClose={closeBoostModal}
|
onClose={closeBoostModal}
|
||||||
isSlim
|
|
||||||
hasCloseButton
|
|
||||||
>
|
>
|
||||||
{renderContent()}
|
{renderContent()}
|
||||||
{applyInfo?.type === 'replace' && boostedChatTitle && (
|
{applyInfo?.type === 'replace' && boostedChatTitle && (
|
||||||
@ -262,7 +247,7 @@ const BoostModal = ({
|
|||||||
<Icon name="next" className={styles.arrow} />
|
<Icon name="next" className={styles.arrow} />
|
||||||
<Avatar peer={chat} size="large" />
|
<Avatar peer={chat} size="large" />
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.textCenter}>
|
<div>
|
||||||
{renderText(lang('ChannelBoost.ReplaceBoost', [boostedChatTitle, chatTitle]), ['simple_markdown', 'emoji'])}
|
{renderText(lang('ChannelBoost.ReplaceBoost', [boostedChatTitle, chatTitle]), ['simple_markdown', 'emoji'])}
|
||||||
</div>
|
</div>
|
||||||
<div className="dialog-buttons">
|
<div className="dialog-buttons">
|
||||||
|
|||||||
@ -74,7 +74,7 @@
|
|||||||
margin: 2rem auto;
|
margin: 2rem auto;
|
||||||
background-color: var(--color-background);
|
background-color: var(--color-background);
|
||||||
box-shadow: 0 0.25rem 0.5rem 0.125rem var(--color-default-shadow);
|
box-shadow: 0 0.25rem 0.5rem 0.125rem var(--color-default-shadow);
|
||||||
border-radius: var(--border-radius-default);
|
border-radius: var(--border-radius-modal);
|
||||||
transform: translate3d(0, -1rem, 0);
|
transform: translate3d(0, -1rem, 0);
|
||||||
|
|
||||||
transition: transform 0.2s ease, opacity 0.2s ease;
|
transition: transform 0.2s ease, opacity 0.2s ease;
|
||||||
|
|||||||
@ -202,6 +202,7 @@ $color-message-story-mention-to: #74bcff;
|
|||||||
|
|
||||||
--vh: 1vh;
|
--vh: 1vh;
|
||||||
|
|
||||||
|
--border-radius-modal: 1rem;
|
||||||
--border-radius-default: 0.75rem;
|
--border-radius-default: 0.75rem;
|
||||||
--border-radius-default-small: 0.625rem;
|
--border-radius-default-small: 0.625rem;
|
||||||
--border-radius-default-tiny: 0.375rem;
|
--border-radius-default-tiny: 0.375rem;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user