diff --git a/public/icons/fedi.png b/public/icons/fedi.png new file mode 100644 index 0000000..7229e37 Binary files /dev/null and b/public/icons/fedi.png differ diff --git a/src/components/Display.jsx b/src/components/Display.jsx index 3a5333d..2dd664d 100644 --- a/src/components/Display.jsx +++ b/src/components/Display.jsx @@ -6,9 +6,10 @@ import { sanitizeUrl } from "@braintree/sanitize-url"; import Tooltip from "@mui/joy/Tooltip"; import Link from "@mui/joy/Link"; - import Chip from "@mui/joy/Chip"; +import FediVerse from "../../public/icons/fedi.png"; + // time in formats `2023-07-14T04:12:07.720101` are in GMT and must be adjusted to unix epoch for moment display// replace .720101 with Z export function MomentAdjustedTimeAgo({ children, ...props }) { if (children.includes("T")) { @@ -52,8 +53,10 @@ export const SquareChip = ({ { ); }; + +export const FediverseChipLink = ({ href, ...props }) => { + return ( + + e.stopPropagation()} + startDecorator={ + + } + sx={{ + fontWeight: "normal", + userSelect: "none", + borderRadius: 4, + "--Chip-gap": 0, + }} + {...props} + /> + + ); +}; diff --git a/src/components/ListItem/Comment.jsx b/src/components/ListItem/Comment.jsx index 1198665..01ff95e 100644 --- a/src/components/ListItem/Comment.jsx +++ b/src/components/ListItem/Comment.jsx @@ -2,6 +2,7 @@ import React from "react"; import Box from "@mui/joy/Box"; import Typography from "@mui/joy/Typography"; +import Alert from "@mui/joy/Alert"; import ThumbsUpDownIcon from "@mui/icons-material/ThumbsUpDown"; import ThumbDownIcon from "@mui/icons-material/ThumbDown"; @@ -9,6 +10,7 @@ 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"; @@ -17,16 +19,40 @@ import { BanUserCommunityButton, BanUserSiteButton, PurgeUserSiteButton } from " import { PersonMetaLine, ReportDetails } from "./Common.jsx"; -import { MomentAdjustedTimeAgo, SanitizedLink } from "../Display.jsx"; +import { MomentAdjustedTimeAgo, SanitizedLink, FediverseChipLink } from "../Display.jsx"; + +import { getSiteData } from "../../hooks/getSiteData"; const CommentContentDetail = ({ report }) => { + const { baseUrl, siteData, localPerson, userRole } = getSiteData(); + + // we need to merge the `post.id` and the current instance's `base_url` to get the link + const localPostLink = `https://${baseUrl}/comment/${report.comment.id}`; + + // link across instances + // split ap_id + const apId = report.post.ap_id.split("/")[2]; + const fediversePostLink = report.post.ap_id; + return ( + {/* Comment Title */} + + {/* + + */} + + Open Comment in Context + + + {/* Comment Meta */} + {baseUrl != apId && } + {report.comment.published && ( - {report.comment.published} + Created {report.comment.published} )} @@ -60,15 +86,25 @@ const CommentContentDetail = ({ report }) => { )} - {/* Comment Title */} - - {/* - - */} - - Show Comment in Context - - + {/* Comment Content */} + } + variant="outlined" + color="neutral" + sx={{ mt: 1 }} + // endDecorator={ + // + // + // + // + // + // + // } + > + {report.comment.content} + { px: 1, }} /> - - {/* Comment Content */} - - {report.comment.content} - ); }; diff --git a/src/components/ListItem/Common.jsx b/src/components/ListItem/Common.jsx index 14f0b33..f4aa25f 100644 --- a/src/components/ListItem/Common.jsx +++ b/src/components/ListItem/Common.jsx @@ -18,7 +18,7 @@ import BlockIcon from "@mui/icons-material/Block"; import SmartToyIcon from "@mui/icons-material/SmartToy"; import DeleteIcon from "@mui/icons-material/Delete"; -import { SanitizedLink, SquareChip } from "../Display.jsx"; +import { SquareChip, MomentAdjustedTimeAgo, SanitizedLink, FediverseChipLink } from "../Display.jsx"; import { UserTooltip } from "../Tooltip.jsx"; import { parseActorId } from "../../utils.js"; @@ -196,6 +196,13 @@ export function ReportDetails({ report, creator }) { }} >
+ + {report.published && ( + + Reported {report.published} + + )} + { {/* Post Content */} - } + variant="outlined" + color="neutral" + sx={{ mt: 1 }} + // endDecorator={ + // + // + // + // + // + // + // } > {report.private_message.content} - + {/* Report Status */} diff --git a/src/components/ListItem/Post.jsx b/src/components/ListItem/Post.jsx index 2d64713..d461ca8 100644 --- a/src/components/ListItem/Post.jsx +++ b/src/components/ListItem/Post.jsx @@ -3,17 +3,24 @@ import React from "react"; import Box from "@mui/joy/Box"; import Typography from "@mui/joy/Typography"; +import { sanitizeUrl } from "@braintree/sanitize-url"; + import ThumbsUpDownIcon from "@mui/icons-material/ThumbsUpDown"; import ThumbDownIcon from "@mui/icons-material/ThumbDown"; import DoneAllIcon from "@mui/icons-material/DoneAll"; import BlockIcon from "@mui/icons-material/Block"; import DeleteOutlineIcon from "@mui/icons-material/DeleteOutline"; +import Tooltip from "@mui/joy/Tooltip"; +import Link from "@mui/joy/Link"; +import Chip from "@mui/joy/Chip"; + import StickyNote2Icon from "@mui/icons-material/StickyNote2"; import ForumIcon from "@mui/icons-material/Forum"; import DraftsIcon from "@mui/icons-material/Drafts"; +import LinkIcon from "@mui/icons-material/Link"; -import { SquareChip } from "../Display.jsx"; +import { SquareChip, MomentAdjustedTimeAgo, SanitizedLink, FediverseChipLink } from "../Display.jsx"; import Image from "../Image.jsx"; import { ResolvePostReportButton, RemovePostButton, PurgePostButton } from "../Actions/PostButtons.jsx"; @@ -21,13 +28,42 @@ import { ResolvePostReportButton, RemovePostButton, PurgePostButton } from "../A import { BanUserCommunityButton, BanUserSiteButton, PurgeUserSiteButton } from "../Actions/GenButtons.jsx"; import { PersonMetaLine, ReportDetails } from "./Common.jsx"; -import { MomentAdjustedTimeAgo, SanitizedLink } from "../Display.jsx"; + +import { getSiteData } from "../../hooks/getSiteData"; const PostContentDetail = ({ report }) => { + const { baseUrl, siteData, localPerson, userRole } = getSiteData(); + + // we need to merge the `post.id` and the current instance's `base_url` to get the link + const localPostLink = `https://${baseUrl}/post/${report.post.id}`; + + // link across instances + // split ap_id + const apId = report.post.ap_id.split("/")[2]; + const fediversePostLink = report.post.ap_id; + return ( + {/* Post Title */} + + {/* + + */} + + {report.post.name} + + + {/* Post Meta */} + {baseUrl != apId && } + {report.post.nsfw == true && ( NSFW @@ -43,7 +79,7 @@ const PostContentDetail = ({ report }) => { {report.post.published && ( - {report.post.published} + Created {report.post.published} )} @@ -87,22 +123,6 @@ const PostContentDetail = ({ report }) => { )} - {/* Post Title */} - - {/* - - */} - - {report.post.name} - - -