phone text flow: portrait width floor, list markers, in-flow preview banner, pretend-server notice
- portrait on phones is min(38vw,160px), was min(50vw,210px): at 390px the text column beside it was ~85px - outside list markers ignored the portrait silhouette and landed under the art; inside markers wrap with the text - Jump to Latest sits 8px (was 16px) above the timeline's lower edge - preview banner is in flow above the app, not fixed over the room header and connection strip - on the pretend server the training line and the registration checkbox say nothing is trained (trainingNoticeText); the real sentence and its wording are unchanged and still await Meta's legal read Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
636cad9655
commit
16cc05a33b
7 changed files with 63 additions and 11 deletions
|
|
@ -262,7 +262,7 @@ export const PoseButton = style({
|
|||
[PHONE]: {
|
||||
position: 'static',
|
||||
float: 'left',
|
||||
width: 'min(50vw, 210px)',
|
||||
width: 'min(38vw, 160px)',
|
||||
height: 'auto',
|
||||
margin: `${toRem(-82)} ${toRem(8)} 0 ${toRem(-12)}`,
|
||||
shapeMargin: toRem(7),
|
||||
|
|
@ -387,6 +387,18 @@ globalStyle(`${BubbleContentPose} > div`, {
|
|||
},
|
||||
});
|
||||
|
||||
// An outside list marker hangs left of its item's text and ignores the portrait's silhouette, so
|
||||
// beside a left portrait the number lands under the art. Inside, it is a word on the first line
|
||||
// and wraps around the silhouette like the rest.
|
||||
globalStyle(`${BubbleContentPose} ol, ${BubbleContentPose} ul`, {
|
||||
'@media': {
|
||||
[PHONE]: {
|
||||
listStylePosition: 'inside',
|
||||
paddingLeft: 0,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
// While the background scene runs (html[data-scene]) a chat bubble is the one filled surface in
|
||||
// the app: its own colour at half strength over a blur of the scene, so the words stay readable
|
||||
// and the ridge shows through. The arrow wedge is opaque, so it goes.
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ export const TimelineFloat = recipe({
|
|||
top: config.space.S400,
|
||||
},
|
||||
Bottom: {
|
||||
bottom: config.space.S400,
|
||||
bottom: config.space.S200,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import { Text, color, config } from 'folds';
|
|||
import { Room } from 'matrix-js-sdk';
|
||||
import React from 'react';
|
||||
import { useStateEvent } from '../../hooks/useStateEvent';
|
||||
import { useClientConfig } from '../../hooks/useClientConfig';
|
||||
import {
|
||||
ROOM_NOTICE_EVENT_TYPE,
|
||||
parseRoomNotice,
|
||||
|
|
@ -12,7 +13,8 @@ import {
|
|||
// collector reads the version from the same event, so nothing is stored in the browser.
|
||||
export function RoomTrainingLine({ room }: { room: Room }) {
|
||||
const event = useStateEvent(room, ROOM_NOTICE_EVENT_TYPE);
|
||||
const line = roomTrainingLine(parseRoomNotice(event?.getContent()));
|
||||
const { previewDemo } = useClientConfig();
|
||||
const line = roomTrainingLine(parseRoomNotice(event?.getContent()), previewDemo);
|
||||
if (!line) return null;
|
||||
return (
|
||||
<Text
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { Box, Checkbox, Text, color, config } from 'folds';
|
||||
import React from 'react';
|
||||
import { TRAINING_NOTICE_TEXT } from '../../utils/trainingNotice';
|
||||
import { useClientConfig } from '../../hooks/useClientConfig';
|
||||
import { trainingNoticeText } from '../../utils/trainingNotice';
|
||||
|
||||
type TrainingNoticeProps = {
|
||||
checked: boolean;
|
||||
|
|
@ -9,6 +10,7 @@ type TrainingNoticeProps = {
|
|||
|
||||
// Registration only: ticking it is the newcomer's acceptance of the current notice version.
|
||||
export function TrainingNotice({ checked, onToggle }: TrainingNoticeProps) {
|
||||
const { previewDemo } = useClientConfig();
|
||||
return (
|
||||
<Box
|
||||
direction="Column"
|
||||
|
|
@ -34,7 +36,7 @@ export function TrainingNotice({ checked, onToggle }: TrainingNoticeProps) {
|
|||
checked={checked}
|
||||
onClick={onToggle}
|
||||
/>
|
||||
{TRAINING_NOTICE_TEXT}
|
||||
{trainingNoticeText(previewDemo)}
|
||||
</Text>
|
||||
</Box>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,9 @@ import {
|
|||
ROOM_NOTICE_EVENT_TYPE,
|
||||
TRAINING_NOTICE_TEXT,
|
||||
parseRoomNotice,
|
||||
PREVIEW_NOTICE_TEXT,
|
||||
roomTrainingLine,
|
||||
trainingNoticeText,
|
||||
} from './trainingNotice';
|
||||
|
||||
const lineFor = (content: unknown) => roomTrainingLine(parseRoomNotice(content));
|
||||
|
|
@ -66,3 +68,23 @@ describe('training notice', () => {
|
|||
expect(lineFor({ version: 1, scope: ['train'] })).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe('training notice on the pretend server', () => {
|
||||
it('states that nothing is trained instead of the real sentence', () => {
|
||||
expect(trainingNoticeText(true)).toBe(PREVIEW_NOTICE_TEXT);
|
||||
expect(PREVIEW_NOTICE_TEXT).not.toContain('may be used to train');
|
||||
expect(PREVIEW_NOTICE_TEXT.toLowerCase()).toContain('pretend');
|
||||
});
|
||||
|
||||
it('keeps the ruled sentence everywhere else', () => {
|
||||
expect(trainingNoticeText(false)).toBe(TRAINING_NOTICE_TEXT);
|
||||
expect(trainingNoticeText(undefined)).toBe(TRAINING_NOTICE_TEXT);
|
||||
});
|
||||
|
||||
it('shows the same text in a train room and at registration', () => {
|
||||
const notice = parseRoomNotice({ version: 1, scope: 'train' });
|
||||
expect(roomTrainingLine(notice, true)).toBe(trainingNoticeText(true));
|
||||
expect(roomTrainingLine(notice, false)).toBe(trainingNoticeText(false));
|
||||
expect(roomTrainingLine(parseRoomNotice({ version: 1, scope: 'show' }), true)).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -3,6 +3,15 @@ import { StateEvent } from '../../types/matrix/room';
|
|||
export const TRAINING_NOTICE_TEXT =
|
||||
"Everything said here may be used to train GameCult's AI stewards.";
|
||||
|
||||
// The preview build runs against a pretend server where nothing is trained, so the real sentence
|
||||
// would be false there. The real wording awaits Meta's legal read (Heimdall's consent text, open).
|
||||
export const PREVIEW_NOTICE_TEXT =
|
||||
'Pretend server: nothing you type here is stored or used to train anything.';
|
||||
|
||||
/** The one sentence every first-typing surface shows: the real one, or the pretend server's. */
|
||||
export const trainingNoticeText = (previewDemo?: boolean): string =>
|
||||
previewDemo === true ? PREVIEW_NOTICE_TEXT : TRAINING_NOTICE_TEXT;
|
||||
|
||||
/**
|
||||
* Heimdall's ruling: a room's notice is a room state event, not a pinned message. Type below,
|
||||
* state_key '', content `{version, scope}`; scope exactly one of show, study or train. Heimdall's
|
||||
|
|
@ -31,5 +40,7 @@ export const parseRoomNotice = (content: unknown): RoomNotice | undefined => {
|
|||
};
|
||||
|
||||
/** The line a room shows: only a notice that says `train` in terms gets the train sentence. */
|
||||
export const roomTrainingLine = (notice: RoomNotice | undefined): string | undefined =>
|
||||
notice?.scope === 'train' ? TRAINING_NOTICE_TEXT : undefined;
|
||||
export const roomTrainingLine = (
|
||||
notice: RoomNotice | undefined,
|
||||
previewDemo?: boolean
|
||||
): string | undefined => (notice?.scope === 'train' ? trainingNoticeText(previewDemo) : undefined);
|
||||
|
|
|
|||
|
|
@ -30,15 +30,18 @@ const BANNER_TEXT = 'preview: pretend server. Any password works.';
|
|||
const FOREIGN_SESSION_TEXT =
|
||||
'preview: pretend server. A login for another server is stored here and cannot be used.';
|
||||
|
||||
// In flow, above the app: body becomes a column and the app root takes the rest, so the banner
|
||||
// never covers the room header or the connection strip.
|
||||
const showBanner = (text: string) => {
|
||||
const el = document.createElement('div');
|
||||
el.textContent = text;
|
||||
el.setAttribute('role', 'status');
|
||||
el.style.cssText =
|
||||
'position:fixed;top:0;left:50%;transform:translateX(-50%);z-index:2147483647;max-width:96vw;' +
|
||||
'padding:0 8px;font:10px/1.5 system-ui,sans-serif;white-space:nowrap;opacity:0.9;color:#1b1b1b;background:#ffc46b;' +
|
||||
'border-radius:0 0 6px 6px;pointer-events:none;text-align:center';
|
||||
document.body.appendChild(el);
|
||||
'flex:none;padding:2px 8px;font:11px/1.4 system-ui,sans-serif;color:#1b1b1b;background:#ffc46b;text-align:center';
|
||||
const root = document.getElementById('root');
|
||||
document.body.style.cssText += ';display:flex;flex-direction:column';
|
||||
if (root) root.style.cssText += ';flex:1;min-height:0;height:auto';
|
||||
document.body.insertBefore(el, root);
|
||||
};
|
||||
|
||||
// The preview host's CSP sandbox has no allow-forms, so the browser cancels a native form
|
||||
|
|
|
|||
Loading…
Reference in a new issue