Inline Bot Tooltip: Fix layout & sticker sizes (#2510)

This commit is contained in:
Alexander Zinchuk 2023-02-08 00:47:55 +01:00
parent 857abf4048
commit ca01d03190
4 changed files with 29 additions and 22 deletions

View File

@ -37,6 +37,7 @@ type OwnProps<T> = {
isCurrentUserPremium?: boolean; isCurrentUserPremium?: boolean;
sharedCanvasRef?: React.RefObject<HTMLCanvasElement>; sharedCanvasRef?: React.RefObject<HTMLCanvasElement>;
observeIntersection: ObserveFn; observeIntersection: ObserveFn;
noShowPremium?: boolean;
onClick?: (arg: OwnProps<T>['clickArg'], isSilent?: boolean, shouldSchedule?: boolean) => void; onClick?: (arg: OwnProps<T>['clickArg'], isSilent?: boolean, shouldSchedule?: boolean) => void;
clickArg: T; clickArg: T;
onFaveClick?: (sticker: ApiSticker) => void; onFaveClick?: (sticker: ApiSticker) => void;
@ -55,6 +56,7 @@ const StickerButton = <T extends number | ApiSticker | ApiBotInlineMediaResult |
canViewSet, canViewSet,
observeIntersection, observeIntersection,
isCurrentUserPremium, isCurrentUserPremium,
noShowPremium,
sharedCanvasRef, sharedCanvasRef,
onClick, onClick,
clickArg, clickArg,
@ -254,14 +256,14 @@ const StickerButton = <T extends number | ApiSticker | ApiBotInlineMediaResult |
sharedCanvasRef={sharedCanvasRef} sharedCanvasRef={sharedCanvasRef}
customColor={customColor} customColor={customColor}
/> />
{isLocked && ( {!noShowPremium && isLocked && (
<div <div
className="sticker-locked" className="sticker-locked"
> >
<i className="icon-lock-badge" /> <i className="icon-lock-badge" />
</div> </div>
)} )}
{isPremium && !isLocked && ( {!noShowPremium && isPremium && !isLocked && (
<div className="sticker-premium"> <div className="sticker-premium">
<i className="icon-premium" /> <i className="icon-premium" />
</div> </div>

View File

@ -1290,19 +1290,6 @@ const Composer: FC<OwnProps & StateProps> = ({
onInsertUserName={insertMention} onInsertUserName={insertMention}
onClose={closeMentionTooltip} onClose={closeMentionTooltip}
/> />
<InlineBotTooltip
isOpen={isInlineBotTooltipOpen}
botId={inlineBotId}
isGallery={isInlineBotTooltipGallery}
inlineBotResults={inlineBotResults}
switchPm={inlineBotSwitchPm}
loadMore={loadMoreForInlineBot}
isSavedMessages={isChatWithSelf}
canSendGifs={canSendGifs}
isCurrentUserPremium={isCurrentUserPremium}
onSelectResult={handleInlineBotSelect}
onClose={closeInlineBotTooltip}
/>
<BotCommandTooltip <BotCommandTooltip
isOpen={isBotCommandTooltipOpen} isOpen={isBotCommandTooltipOpen}
withUsername={Boolean(chatBotCommands)} withUsername={Boolean(chatBotCommands)}
@ -1312,6 +1299,20 @@ const Composer: FC<OwnProps & StateProps> = ({
/> />
<div id="message-compose"> <div id="message-compose">
<div className="svg-appendix" ref={appendixRef} /> <div className="svg-appendix" ref={appendixRef} />
<InlineBotTooltip
isOpen={isInlineBotTooltipOpen}
botId={inlineBotId}
isGallery={isInlineBotTooltipGallery}
inlineBotResults={inlineBotResults}
switchPm={inlineBotSwitchPm}
loadMore={loadMoreForInlineBot}
isSavedMessages={isChatWithSelf}
canSendGifs={canSendGifs}
isCurrentUserPremium={isCurrentUserPremium}
onSelectResult={handleInlineBotSelect}
onClose={closeInlineBotTooltip}
/>
<ComposerEmbeddedMessage <ComposerEmbeddedMessage
onClear={handleEmbeddedClear} onClear={handleEmbeddedClear}
shouldForceShowEditing={Boolean(shouldForceShowEditing && editingMessage)} shouldForceShowEditing={Boolean(shouldForceShowEditing && editingMessage)}

View File

@ -6,12 +6,13 @@
&.gallery { &.gallery {
display: grid; display: grid;
grid-template-columns: repeat(4, 1fr); grid-template-columns: repeat(8, 1fr);
grid-auto-flow: dense;
grid-gap: 1px; grid-gap: 1px;
padding: 0; padding: 0;
@media (max-width: 600px) { @media (max-width: 600px) {
grid-template-columns: repeat(3, 1fr); grid-template-columns: repeat(4, 1fr);
} }
.switch-pm { .switch-pm {
@ -22,16 +23,12 @@
} }
} }
.GifButton {
grid-column-end: initial;
}
.StickerButton { .StickerButton {
width: initial; width: initial;
height: 0; height: 0;
margin: 0; margin: 0;
padding-bottom: 100%; padding-bottom: 100%;
border-radius: 0; border-radius: var(--border-radius-default);
.AnimatedSticker, .AnimatedSticker,
img, img,
@ -51,4 +48,10 @@
} }
} }
} }
&:not(.gallery) .GifButton {
width: 4rem;
height: 4rem;
margin: 0.5rem;
}
} }

View File

@ -40,6 +40,7 @@ const StickerResult: FC<OwnProps> = ({
clickArg={inlineResult} clickArg={inlineResult}
isSavedMessages={isSavedMessages} isSavedMessages={isSavedMessages}
canViewSet canViewSet
noShowPremium
isCurrentUserPremium={isCurrentUserPremium} isCurrentUserPremium={isCurrentUserPremium}
/> />
); );