diff --git a/web/src/pages/SysopModerate.tsx b/web/src/pages/SysopModerate.tsx index 305dc34..04ba399 100644 --- a/web/src/pages/SysopModerate.tsx +++ b/web/src/pages/SysopModerate.tsx @@ -7,6 +7,47 @@ import { Button } from "../components/form/Form"; import { usePageTitle } from "../hooks/usePageTitle"; import { useModerationMutations } from "../hooks/useModerationMutations"; +interface ModerationListItemProps { + label: string; + href: string; + title: string; + actionLabel: string; + onAction?: () => void; +} + +function ModerationListItem({ + label, + href, + title, + actionLabel, + onAction, +}: ModerationListItemProps) { + return ( +
+ + {label} + + {onAction && ( + + )} +
+ ); +} + export default function SysopModerate() { const { user } = useAuth(); const [identifier, setIdentifier] = useState(""); @@ -59,29 +100,16 @@ export default function SysopModerate() {
{Object.keys(banRkeys).map((did) => ( -
- - {bannedHandles[did] ?? did} - - {banRkeys[did] && ( - - )} -
+ label={bannedHandles[did] ?? did} + href={`https://pdsls.dev/at/${did}`} + actionLabel="unban" + onAction={ + banRkeys[did] ? () => onUnban(banRkeys[did]) : undefined + } + /> ))}
@@ -99,29 +127,18 @@ export default function SysopModerate() {
{hidden.map((post) => ( -
- - {post.handle} — {post.title || post.body} - - {hideRkeys[post.uri] && ( - - )} -
+ label={`${post.handle} — ${post.title || post.body}`} + href={`https://pdsls.dev/${post.uri}`} + actionLabel="unhide" + onAction={ + hideRkeys[post.uri] + ? () => onUnhide(hideRkeys[post.uri]) + : undefined + } + /> ))}