From 8741d1e50d2e1a23e7d0ef96b8320abdb26832aa Mon Sep 17 00:00:00 2001 From: eternal-flame-AD Date: Tue, 5 Aug 2025 15:31:05 -0500 Subject: [PATCH] suggestions Signed-off-by: eternal-flame-AD --- ui/src/message/Message.tsx | 143 +++++++++++++++---------------------- 1 file changed, 57 insertions(+), 86 deletions(-) diff --git a/ui/src/message/Message.tsx b/ui/src/message/Message.tsx index b947657..47ce682 100644 --- a/ui/src/message/Message.tsx +++ b/ui/src/message/Message.tsx @@ -1,4 +1,4 @@ -import {Button, Theme} from '@mui/material'; +import {Button, Theme, useMediaQuery, useTheme} from '@mui/material'; import IconButton from '@mui/material/IconButton'; import {makeStyles} from 'tss-react/mui'; import Typography from '@mui/material/Typography'; @@ -33,6 +33,7 @@ const useStyles = makeStyles()((theme: Theme) => ({ }, messageContentWrapper: { minWidth: 200, + width: '100%', }, image: { marginRight: 15, @@ -40,34 +41,14 @@ const useStyles = makeStyles()((theme: Theme) => ({ width: 32, height: 32, }, - [theme.breakpoints.down('sm')]: { - display: 'none', - }, - }, - appName: { - opacity: 0.7, }, date: { [theme.breakpoints.down('md')]: { + order: 1, + flexBasis: '100%', opacity: 0.7, }, }, - messageWrapper: { - display: 'grid', - gridTemplateColumns: '70px 1fr', - [theme.breakpoints.down('sm')]: { - gridTemplateColumns: '1fr', - }, - gap: 16, - width: '100%', - }, - actionsWrapper: { - flex: 1, - display: 'flex', - justifyContent: 'flex-end', - flexDirection: 'row', - alignItems: 'flex-start', - }, imageWrapper: { display: 'flex', }, @@ -131,10 +112,12 @@ const Message = ({ onExpand, expanded: initialExpanded, }: IProps) => { + const theme = useTheme(); const [previewRef, setPreviewRef] = React.useState(null); const {classes} = useStyles(); const [expanded, setExpanded] = React.useState(initialExpanded); const [isOverflowing, setOverflowing] = React.useState(false); + const dateWrapped = useMediaQuery(theme.breakpoints.down('md')); React.useEffect(() => { setOverflowing(!!previewRef && previewRef.scrollHeight > previewRef.clientHeight); @@ -163,73 +146,61 @@ const Message = ({ borderLeftWidth: 6, borderLeftStyle: 'solid', }}> -
- {image !== null ? ( - {`${appName} - ) : null} -
-
-
-
- - {title} - -
-
- - {appName} - -
-
-
- - - - - - -
-
-
- - {renderContent()} +
+
+ {image !== null ? ( + {`${appName} + ) : null} +
+
+
+ + {title} + + + + + +
- {isOverflowing && ( - - )} + + + {renderContent()} +
+ {isOverflowing && ( + + )}
);