Skip to content

Commit e27095e

Browse files
morethanwordsclaude
andcommitted
Composer: the send price shows whole above the send button, and a lone button fills its plate
- The price of a paid message was cut off at the top and on the right: the composer's row has clipped everything since the rich-text composer, and the badge, which stands above the button, was centred over it and ran past the composer's end. The row now clips only across, and the badge stays centred while no wider than the button and ends flush with it past that, growing out of the button's middle either way, mirrored right to left. - A control plate with nothing on either side (a lone Mute, Join or Unpin) kept the room of both side icons, so its button was narrower than the plate. Such a plate now drops its side slots and the button spans it; with one icon shown the slots stay symmetric as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 6498342 commit e27095e

4 files changed

Lines changed: 32 additions & 9 deletions

File tree

‎src/components/chat/controlPlate.tsx‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ import classNames from '@helpers/string/classNames';
88
*/
99
export const CHAT_INPUT_PLATE_CLASS = 'chat-input-plate';
1010

11+
/**
12+
* A plate with nothing on either side for now: the side slots go and the centre
13+
* spans the whole plate — they are kept only to balance an icon on one side.
14+
*/
15+
export const CHAT_INPUT_PLATE_SINGLE_CLASS = 'is-single';
16+
1117
/**
1218
* Unified chat-input control plate.
1319
*
@@ -19,9 +25,10 @@ export const CHAT_INPUT_PLATE_CLASS = 'chat-input-plate';
1925
* The layout mirrors the topbar translation plate (`translation.tsx`): an
2026
* optional icon button on each side and a centered main button —
2127
* `Button.Icon + Button + Button.Icon`. The side slots reserve symmetric
22-
* space even when empty so the centre button always stays centred, which
28+
* space even when one is empty so the centre button always stays centred, which
2329
* makes every plate exactly the same width as the message-input row. Plates
2430
* therefore cross-fade in place (opacity only) instead of morphing width.
31+
* With both sides empty the plate takes `CHAT_INPUT_PLATE_SINGLE_CLASS`.
2532
*/
2633
export default function ChatInputPlate(props: {
2734
class?: string,

‎src/components/chat/input.ts‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import {
3535
InputMedia
3636
} from '@layer';
3737
import StickersHelper from '@components/chat/stickersHelper';
38-
import ChatInputPlate from '@components/chat/controlPlate';
38+
import ChatInputPlate, {CHAT_INPUT_PLATE_SINGLE_CLASS} from '@components/chat/controlPlate';
3939
import showSendGiftPopup from '@components/popups/sendGift';
4040
import ButtonIcon from '@components/buttonIcon';
4141
import ButtonMenuToggle from '@components/buttonMenuToggle';
@@ -556,6 +556,7 @@ export default class ChatInput {
556556
private channelMuteBtn: HTMLButtonElement;
557557
private directControlBtn: HTMLButtonElement;
558558
private giftControlBtn: HTMLButtonElement;
559+
private controlPlate: HTMLElement;
559560
private rowsWrapperWrapper: HTMLDivElement;
560561
private controlContainer: HTMLElement;
561562
private fakeSelectionWrapper: HTMLDivElement;
@@ -1857,7 +1858,9 @@ export default class ChatInput {
18571858
// The control container is now a single uniform-width plate:
18581859
// Button.Icon + Button + Button.Icon (see controlPlate.tsx). All the
18591860
// single-button states share the centre slot — only one is ever visible.
1860-
const controlPlate = ChatInputPlate({
1861+
// Both side buttons start hidden, so the centre one spans the plate.
1862+
const controlPlate = this.controlPlate = ChatInputPlate({
1863+
class: CHAT_INPUT_PLATE_SINGLE_CLASS,
18611864
left: this.directControlBtn,
18621865
right: this.giftControlBtn,
18631866
center: [
@@ -3089,8 +3092,11 @@ export default class ChatInput {
30893092
// has a linked direct-messages chat) on the left, gift on the right.
30903093
// Both are channel-only — a gigagroup or megagroup join just shows the
30913094
// centre button.
3092-
this.directControlBtn.classList.toggle('hide', !(good && channel?.linked_monoforum_id));
3093-
this.giftControlBtn.classList.toggle('hide', !(good && isBroadcast));
3095+
const hasDirect = !!(good && channel?.linked_monoforum_id);
3096+
const hasGift = good && isBroadcast;
3097+
this.directControlBtn.classList.toggle('hide', !hasDirect);
3098+
this.giftControlBtn.classList.toggle('hide', !hasGift);
3099+
this.controlPlate.classList.toggle(CHAT_INPUT_PLATE_SINGLE_CLASS, !hasDirect && !hasGift);
30943100
}
30953101

30963102
if(this.chat && this.welcomeLimitPlate) {

‎src/scss/partials/_chat.scss‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,11 @@
746746
justify-content: center;
747747
}
748748

749+
// * nothing on either side (CHAT_INPUT_PLATE_SINGLE_CLASS): the centre spans the plate
750+
&.is-single &-side {
751+
display: none;
752+
}
753+
749754
&-button {
750755
width: 100%;
751756
max-width: 100%;
@@ -1014,7 +1019,8 @@
10141019
--offset-translateX: 0px;
10151020
align-items: flex-end;
10161021
min-height: var(--chat-input-height);
1017-
overflow: hidden;
1022+
// * only across: the send price stands above the composer's top edge
1023+
overflow-x: clip;
10181024

10191025
.new-message-bot-commands,
10201026
.new-message-send-as-container {

‎src/scss/partials/_starsBadge.scss‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,17 @@
2525
}
2626

2727
.btn-send-stars-badge {
28+
// * over the middle of the send button while no wider than it, flush with its end past that:
29+
// * the composer ends right after the button (1.25rem is half the button)
30+
--shift: min(50%, 1.25rem);
2831
top: 0;
29-
left: 50%;
32+
inset-inline-end: 50%;
3033

3134
--scale: 0;
3235

33-
transform: translate(-50%, -11px) scale(var(--scale));
34-
transform-origin: center 50px;
36+
transform: translate(calc(var(--shift) * var(--reflect)), -11px) scale(var(--scale));
37+
// * grows out of the button's middle
38+
transform-origin: calc(50% + (50% - var(--shift)) * var(--reflect)) 50px;
3539
transition: transform 0.2s, opacity 0.2s;
3640

3741
z-index: 4;

0 commit comments

Comments
 (0)