import { Frame } from "~/types"; import React, { PropsWithChildren, useContext } from "react"; import { Col, ListGroup, Row } from "react-bootstrap"; import classNames from "classnames"; import styles from "./Frames.module.scss"; import dayjs from "dayjs"; import ReactJson from "react-json-view"; import { SettingsContext } from "~/contexts/Settings"; function isJson(data: any): boolean { try { JSON.parse(data); return true; } catch { return false; } } interface FramesProps { frames: Frame[]; } export default function Frames({ frames, }: PropsWithChildren): JSX.Element { return ( {frames.length > 0 ? ( frames.map((frame) => { // Inbound relative to the client const inbound = frame.type !== "websocket_inbound"; const body = frame.type !== "websocket_disconnect" ? atob(frame.payload.body) : null; return ( {dayjs(frame.payload?.timestamp).format("HH:mm:ss.SSS")} {inbound ? "▼" : "▲"} {body} ); }) ) : (

No messages

)}
); }