11import { Box , IconButton , ListItemIcon , ListItemText , Menu , MenuItem , Tooltip , Typography } from '@mui/material'
22
33import { type Message , type RerouteMessageSchema } from '@concrnt/worldlib'
4- import { Profile } from '@concrnt/client'
54import RepeatIcon from '@mui/icons-material/Repeat'
65import { CCAvatar } from '../ui/CCAvatar'
76import { Link as RouterLink } from 'react-router-dom'
87import { TimeDiff } from '../ui/TimeDiff'
98import { MessageContainer } from './MessageContainer'
109import MoreHorizIcon from '@mui/icons-material/MoreHoriz'
11- import { useEffect , useState } from 'react'
10+ import { useState } from 'react'
1211import ManageSearchIcon from '@mui/icons-material/ManageSearch'
1312import DeleteForeverIcon from '@mui/icons-material/DeleteForever'
1413import { useClient } from '../../context/ClientContext'
@@ -32,27 +31,9 @@ export const RerouteMessageFrame = (props: RerouteMessageFrameProp): JSX.Element
3231 const { client } = useClient ( )
3332 const inspector = useInspector ( )
3433 const [ menuAnchor , setMenuAnchor ] = useState < null | HTMLElement > ( null )
35- const [ character , setProfile ] = useState < Profile < any > | null > ( null )
3634 const confirm = useConfirm ( )
3735
38- const profileOverride = props . message . document . body . profileOverride
39-
40- const avatarURL =
41- character ?. parsedDoc . body . avatar ?? profileOverride ?. avatar ?? props . message . authorUser ?. profile ?. avatar
42- const username =
43- character ?. parsedDoc . body . username ??
44- profileOverride ?. username ??
45- props . message . authorUser ?. profile ?. username ??
46- 'Anonymous'
47- const link = profileOverride ?. link ?? '/' + props . message . author
48-
49- useEffect ( ( ) => {
50- if ( profileOverride ?. profileID ) {
51- client . api . getProfile ( profileOverride . profileID , props . message . author ) . then ( ( character ) => {
52- setProfile ( character ?? null )
53- } )
54- }
55- } , [ profileOverride ?. profileID ] )
36+ const link = props . message . document . body . profileOverride ?. link ?? '/' + props . message . author
5637
5738 return (
5839 < >
@@ -73,7 +54,7 @@ export const RerouteMessageFrame = (props: RerouteMessageFrameProp): JSX.Element
7354 to = { link }
7455 >
7556 < CCAvatar
76- avatarURL = { avatarURL }
57+ avatarURL = { props . message . authorProfile . avatar }
7758 identiconSource = { props . message . author }
7859 sx = { {
7960 width : { xs : '12px' , sm : '18px' } ,
@@ -100,9 +81,9 @@ export const RerouteMessageFrame = (props: RerouteMessageFrameProp): JSX.Element
10081 } }
10182 >
10283 < CCLink to = { link } underline = "hover" color = "inherit" >
103- { username }
84+ { props . message . authorProfile . username ?? 'anonymous' }
10485 </ CCLink >
105- { profileOverride ?. avatar && < FaTheaterMasks /> } rerouted{ ' ' }
86+ { props . message . authorProfile . original && < FaTheaterMasks /> } rerouted{ ' ' }
10687 { props . message . document . body . body && 'with comment:' }
10788 </ Box >
10889 < Box display = "flex" gap = { 0.5 } >
0 commit comments