phone: pill clears the portrait, portrait bubbles keep a text floor, status block collapses
Some checks failed
Build pull request / Build pull request (pull_request) Failing after 3m31s

- the name pill is at most bubble width minus portrait minus 30px, so it cannot reach the face
- a bubble with a portrait is at least portrait + 170px wide, so text beside a right portrait
  no longer wraps into a ~100px column
- <=480px: the pose status block shows only the newest mood plus "+N more" on one line, tap to
  expand; the read-receipt line is hidden and its slot is an 8px margin under the composer

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Void 2026-11-08 17:41:04 +00:00
commit 58df7b833c
6 changed files with 127 additions and 9 deletions

View file

@ -156,6 +156,8 @@ export const BubbleContentArrowLeft = style({
// beside its bubble on wide screens; on phones it floats inside the bubble, overhanging the top
// edge, and the text wraps around its silhouette (shape-outside on the alpha channel).
const PHONE = 'screen and (max-width: 700px)';
const PHONE_PORTRAIT = 'min(38vw, 160px)';
const PHONE_TEXT_FLOOR = toRem(170);
const PORTRAIT = toRem(124);
const POSE_GUTTER = toRem(14);
const BUBBLE_CORNER = toRem(6);
@ -209,6 +211,10 @@ export const BubbleHeaderPose = style({
border: `1px solid ${color.Secondary.ContainerLine}`,
borderRadius: toRem(999),
whiteSpace: 'nowrap',
// Never wider than the bubble minus the portrait, so it cannot reach the portrait's face.
maxWidth: `calc(100% - ${PHONE_PORTRAIT} - ${toRem(30)})`,
overflow: 'hidden',
textOverflow: 'ellipsis',
},
},
});
@ -232,6 +238,9 @@ export const BubbleContentPose = style({
'@media': {
[PHONE]: {
display: 'flow-root',
// A bubble with a portrait is at least portrait + a readable column wide, or the text
// beside the portrait collapses to a strip.
minWidth: `min(100%, calc(${PHONE_PORTRAIT} + ${PHONE_TEXT_FLOOR}))`,
borderTopLeftRadius: config.radii.R500,
padding: `${toRem(24)} ${toRem(14)} ${toRem(14)}`,
},
@ -262,7 +271,7 @@ export const PoseButton = style({
[PHONE]: {
position: 'static',
float: 'left',
width: 'min(38vw, 160px)',
width: PHONE_PORTRAIT,
height: 'auto',
margin: `${toRem(-82)} ${toRem(8)} 0 ${toRem(-12)}`,
shapeMargin: toRem(7),

View file

@ -1,6 +1,13 @@
import { describe, expect, it } from 'vitest';
import catalogue from './catalogue.json';
import { mindOfSender, poseSrc, poseStatusLine, poseStatuses, resolvePose } from './poses';
import {
mindOfSender,
poseSrc,
poseStatusLine,
poseStatuses,
resolvePose,
splitNewestStatus,
} from './poses';
describe('resolvePose', () => {
it('keeps shared and own-signature labels from the catalogue', () => {
@ -81,3 +88,17 @@ describe('poseStatusLine', () => {
);
});
});
describe('splitNewestStatus', () => {
const s = (mind: string, since: number) => ({ mind, pose: 'happy', since });
it('picks the status that changed last and keeps the others in their order', () => {
const { newest, rest } = splitNewestStatus([s('eureka', 100), s('void', 300), s('nibu', 200)]);
expect(newest?.mind).toBe('void');
expect(rest.map((r) => r.mind)).toEqual(['eureka', 'nibu']);
});
it('has no newest for an empty list', () => {
expect(splitNewestStatus([])).toEqual({ newest: undefined, rest: [] });
});
});

View file

@ -68,6 +68,17 @@ export const poseStatuses = (events: PoseEvent[]): PoseStatus[] => {
});
};
// The status that changed last, and the rest in their given order (phones show only the first).
export const splitNewestStatus = (
statuses: PoseStatus[]
): { newest: PoseStatus | undefined; rest: PoseStatus[] } => {
let newest: PoseStatus | undefined;
statuses.forEach((st) => {
if (!newest || st.since > newest.since) newest = st;
});
return { newest, rest: statuses.filter((st) => st !== newest) };
};
const two = (n: number) => String(n).padStart(2, '0');
// Client-status text. Rendered locally only; it is never sent to a room.