UNPKG

@tycoonsystems/tycoon-modules

Version:
1 lines 1.6 kB
import React from"react";import ChatStyles from"../Chat.module.scss";import{scrollChatDown}from"@tycoonsystems/tycoon-modules/streaming/chat//utility";import{resolveImage}from"@tycoonsystems/tycoon-modules/utility/utility/image";const Module=a=>{var{replyToId:e,replyToUsername:t,replyToContent:l,useThreadOffset:r}=a;const s=React.useRef();return React.useEffect(()=>{setTimeout(()=>{s?.current&&scrollChatDown(s,"smooth")},150)},[e]),React.createElement(React.Fragment,null,e&&t?React.createElement("div",null,l&&Array.isArray(l)&&0<l.length?React.createElement("div",{className:ChatStyles.replyToRepliesContainer+" Chat_ReplyToRepliesContainer",style:{top:`-${4<l.length?4+r:l.length+r}rem`},ref:s},React.createElement("div",{className:ChatStyles.threadLabel+" Chat_ThreadLabel"},"Thread"),React.createElement("div",{className:`${ChatStyles.chatLogContainer} ${ChatStyles.chatLogContainerReplies} Chat_chatLogContainerReplies`},l.slice(0).reverse().map((e,t)=>t<4?React.createElement("div",{className:`${ChatStyles.replyToRepliesThread} ${ChatStyles.chatLogMain} Chat_ReplyToRepliesThread`,style:{display:"flex",gap:".25rem"},key:t,index:t},e?.avatar?React.createElement("div",{className:ChatStyles.chatMessageAvatarContainer+" Chat_ChatMessageAvatarContainer"},React.createElement("img",{src:resolveImage(a,null,e.avatar),style:{borderRadius:"1rem"}})):null,React.createElement("div",{className:"Chat_ReplyToRepliesUsername"},React.createElement("b",null,e.username??"")),React.createElement("div",{className:"Chat_ReplyToRepliesContent"},e.content??"")):null))):null):null)};export default Module;