import { Box, Icon, IconSrc, color } from 'folds'; import React, { ReactNode, useRef } from 'react'; import classNames from 'classnames'; import * as layoutCss from '../layout/layout.css'; import { ChannelEventContent } from '../layout/Channel'; import { useStreamLayoutDebug } from '../layout/streamDebug'; import { ScreenSize, useScreenSizeContext } from '../../../hooks/useScreenSize'; export type EventContentProps = { time: ReactNode; iconSrc: IconSrc; content: ReactNode; railStart?: boolean; railEnd?: boolean; // M3: pick rendering. `'stream'` = 3-track rail/dot grid (DM/Bots). // `'channel'` = no-rail flex row (channels timeline). Time slot is // dropped for channels — syslines render compact without timestamp. layout?: 'stream' | 'channel'; }; export function EventContent({ time, iconSrc, content, railStart, railEnd, layout = 'stream', }: EventContentProps) { const compact = useScreenSizeContext() === ScreenSize.Mobile; const rootRef = useRef(null); const timeRef = useRef(null); const railRef = useRef(null); const dotRef = useRef(null); const bodyRef = useRef(null); useStreamLayoutDebug( 'sysline', { root: rootRef, timeColumn: timeRef, rail: railRef, dot: dotRef, content: bodyRef, }, true ); if (layout === 'channel') { return ; } // Sysline = thin one-line state-event row that lives ON the rail. // Same 2-track grid as message rows (StreamRoot) — track 1 dot column, // track 2 body — so the dot's X aligns with the dots above and below it. // The timestamp trails the body (content → time), mirroring the message // header's nick → time order now that the dot leads the row. return (
{content}
{time && ( {time} )}
); }