From 3ddd46456c72bcf516e2a58684b97828f2da9eda Mon Sep 17 00:00:00 2001 From: Domenic Horner Date: Wed, 1 Nov 2023 20:16:27 +0800 Subject: [PATCH] me image fixes --- src/components/Image.jsx | 9 ++++-- src/components/ListItem/Comment.jsx | 6 ++-- src/components/ListItem/Common.jsx | 48 ++++++++++++++++++++--------- src/components/ListItem/PM.jsx | 1 + src/components/ListItem/Post.jsx | 18 ++++++----- 5 files changed, 55 insertions(+), 27 deletions(-) diff --git a/src/components/Image.jsx b/src/components/Image.jsx index 561a53b..7e52389 100644 --- a/src/components/Image.jsx +++ b/src/components/Image.jsx @@ -27,18 +27,21 @@ function RenderImage({ imageSrc, imageAlt = "" }) { height={"100%"} width={"100%"} loading="lazy" - style={{ visible: imageLoaded ? "visible" : "hidden" }} + style={{ + visible: imageLoaded ? "visible" : "hidden", + // fit image to container + }} onLoad={() => setImageLoaded(true)} onError={() => setImageError(true)} /> ); } -export default function LazyImage({ width = 175, imageSrc, imageAlt = "" }) { +export default function LazyImage({ width = 200, imageSrc, imageAlt = "" }) { const isImage = imageSrc.match(/\.(jpeg|jpg|gif|png)$/) != null; return ( - + {isImage ? ( diff --git a/src/components/ListItem/Comment.jsx b/src/components/ListItem/Comment.jsx index 8fadb41..7715fb1 100644 --- a/src/components/ListItem/Comment.jsx +++ b/src/components/ListItem/Comment.jsx @@ -3,13 +3,11 @@ import React from "react"; import Box from "@mui/joy/Box"; import Typography from "@mui/joy/Typography"; import Alert from "@mui/joy/Alert"; +import Divider from "@mui/joy/Divider"; -import ThumbsUpDownIcon from "@mui/icons-material/ThumbsUpDown"; -import ThumbDownIcon from "@mui/icons-material/ThumbDown"; import DoneAllIcon from "@mui/icons-material/DoneAll"; import DeleteOutlineIcon from "@mui/icons-material/DeleteOutline"; import ForumIcon from "@mui/icons-material/Forum"; -import DraftsIcon from "@mui/icons-material/Drafts"; import FormatQuoteIcon from "@mui/icons-material/FormatQuote"; import { SquareChip } from "../Display.jsx"; @@ -159,6 +157,8 @@ export default function CommentListItem({ report }) { {/* */} + + diff --git a/src/components/ListItem/Common.jsx b/src/components/ListItem/Common.jsx index 7529608..708d77d 100644 --- a/src/components/ListItem/Common.jsx +++ b/src/components/ListItem/Common.jsx @@ -2,6 +2,8 @@ import React from "react"; import Alert from "@mui/joy/Alert"; import Card from "@mui/joy/Card"; + +import Avatar from "@mui/joy/Avatar"; import Box from "@mui/joy/Box"; import Typography from "@mui/joy/Typography"; import Badge from "@mui/joy/Badge"; @@ -25,6 +27,22 @@ import { parseActorId } from "../../utils.js"; import { getSiteData } from "../../hooks/getSiteData"; +export function UserAvatar({ source, ...props }) { + return ( + + ); +} + export function ReportListItem({ itemType, report, children }) { let itemColor; let itemIcon; @@ -130,7 +148,7 @@ export function PersonMetaLine({ creator, by = false, sx }) { const actorInstanceBaseUrl = creator.actor_id.split("/")[2]; const fediverseUserLink = creator.actor_id; - // console.log("creator", actorInstanceBaseUrl, fediverseUserLink); + // console.log("creator", creator); let localUserLink = `https://${baseUrl}/u/${creator.name}`; if (baseUrl != actorInstanceBaseUrl) localUserLink = `${localUserLink}@${actorInstanceBaseUrl}`; @@ -144,16 +162,20 @@ export function PersonMetaLine({ creator, by = false, sx }) { ...sx, }} > - - {by && "by "} - {creator.display_name && `${creator.display_name} `} + {by && by} + + {creator.display_name && ( + {creator.display_name} + )} - + {creator.name} - - @{creator.actor_id.split("/")[2]} - + @{creator.actor_id.split("/")[2]} - + {/* Post Author Meta */} - + {baseUrl != actorInstanceBaseUrl && } {creator.admin && ( @@ -199,7 +219,7 @@ export function PersonMetaLine({ creator, by = false, sx }) { {creator.deleted && ( } /> )} - + ); } @@ -279,7 +299,7 @@ export function ReportDetails({ report, creator }) { variant={"soft"} color="warning" sx={{ - mt: 2, + mt: 1, mb: 1, p: 2, }} diff --git a/src/components/ListItem/PM.jsx b/src/components/ListItem/PM.jsx index d8281af..b8be4c4 100644 --- a/src/components/ListItem/PM.jsx +++ b/src/components/ListItem/PM.jsx @@ -3,6 +3,7 @@ import React from "react"; import Box from "@mui/joy/Box"; import Typography from "@mui/joy/Typography"; import Alert from "@mui/joy/Alert"; +import Divider from "@mui/joy/Divider"; import DoneAllIcon from "@mui/icons-material/DoneAll"; import DeleteOutlineIcon from "@mui/icons-material/DeleteOutline"; diff --git a/src/components/ListItem/Post.jsx b/src/components/ListItem/Post.jsx index 39e62c0..cfaa1bd 100644 --- a/src/components/ListItem/Post.jsx +++ b/src/components/ListItem/Post.jsx @@ -3,6 +3,7 @@ import React from "react"; import Box from "@mui/joy/Box"; import Typography from "@mui/joy/Typography"; import Alert from "@mui/joy/Alert"; +import Divider from "@mui/joy/Divider"; import DoneAllIcon from "@mui/icons-material/DoneAll"; import BlockIcon from "@mui/icons-material/Block"; @@ -175,19 +176,20 @@ export default function PostListItem({ report }) { > + {/* Show External Link or Image for URLs */} {report.post.url && ( @@ -223,6 +225,8 @@ export default function PostListItem({ report }) { {/* @TODO Maybe only show purge is post is deleted?? */} + +