diff --git a/src/views/mod-tools/views/chatlog/ChatlogView.scss b/src/views/mod-tools/views/chatlog/ChatlogView.scss index 332ccc31..6d9ceb16 100644 --- a/src/views/mod-tools/views/chatlog/ChatlogView.scss +++ b/src/views/mod-tools/views/chatlog/ChatlogView.scss @@ -16,12 +16,15 @@ div.chatlog-entry { border-bottom: 1px solid rgba(0, 0, 0, 0.2); - .username { color: #1E7295; text-decoration: underline; width: $username-col-width; } + + .message { + word-break: break-all; + } } } } diff --git a/src/views/mod-tools/views/chatlog/ChatlogView.tsx b/src/views/mod-tools/views/chatlog/ChatlogView.tsx index b56a9b86..67eab764 100644 --- a/src/views/mod-tools/views/chatlog/ChatlogView.tsx +++ b/src/views/mod-tools/views/chatlog/ChatlogView.tsx @@ -1,6 +1,6 @@ import { UserProfileComposer } from '@nitrots/nitro-renderer'; import { FC } from 'react'; -import { AutoSizer, CellMeasurerCache, List, ListRowProps, ListRowRenderer } from 'react-virtualized'; +import { AutoSizer, List, ListRowProps, ListRowRenderer } from 'react-virtualized'; import { SendMessageHook } from '../../../../hooks'; import { ChatlogViewProps } from './ChatlogView.types'; @@ -8,10 +8,14 @@ export const ChatlogView: FC = props => { const { record = null } = props; - const cache = new CellMeasurerCache({ - defaultHeight: 20, - fixedWidth: true - }); + const getRowHeight = ({ index }) => + { + const item = record.chatlog[index]; + + if(item.message.length < 40) return 20; + else if(item.message.length < 70) return 42; + else return 62; + }; const rowRenderer: ListRowRenderer = (props: ListRowProps) => { @@ -21,7 +25,7 @@ export const ChatlogView: FC = props =>
{item.timestamp}
SendMessageHook(new UserProfileComposer(item.userId))}>{item.userName}
-
{item.message}
+
{item.message}
); } @@ -30,9 +34,9 @@ export const ChatlogView: FC = props => <> {record &&
-
Time
-
User
-
Message
+
Time
+
User
+
Message
@@ -43,7 +47,7 @@ export const ChatlogView: FC = props => width={width} height={height} rowCount={record.chatlog.length} - rowHeight={20} + rowHeight={getRowHeight} className={'chatlog-container'} rowRenderer={rowRenderer} /> )