import { durationFromMs } from 'App/date'; import { Timed } from 'Player'; import React from 'react'; import { Icon } from 'UI'; type SocketMsg = Timed & { channelName: string; data: string; timestamp: number; dir: 'up' | 'down'; messageType: string; }; interface Props { socketMsgList: Array; } const lineLength = 40 function WSModal({ socketMsgList }: Props) { return (
Data
Length
Time
{socketMsgList.map((msg) => ( ))}
); } function MsgDirection({ dir }: { dir: 'up' | 'down' }) { return ( ); } function Row({ msg }) { const [isOpen, setIsOpen] = React.useState(false); return ( <>
lineLength ? 'hover:bg-active-blue cursor-pointer' : '' }`} onClick={() => (msg.data.length > lineLength ? setIsOpen(!isOpen) : null)} style={{ width: 700 }} >
{msg.messageType} {msg.data} {msg.data.length > lineLength ? (
{isOpen ? '-' : '+'}
) : null}
{msg.data.length}
{durationFromMs(msg.time, true)}
{isOpen ? (
{msg.data}
) : null} ); } export default WSModal;