@tribe-nest/forge 3.59.0 → 3.61.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -1
- package/src/_tests/testCommunity.tsx +28 -0
- package/src/contexts/CartContext.tsx +34 -1
- package/src/contexts/CommunityContext.tsx +192 -0
- package/src/contexts/PublicAuthContext.tsx +15 -3
- package/src/data/queries/_tests/metaSignals.spec.tsx +130 -0
- package/src/data/queries/useAccount.ts +33 -2
- package/src/data/queries/useAnalytics.ts +6 -6
- package/src/data/queries/useCallChat.ts +2 -2
- package/src/data/queries/useChat.ts +52 -40
- package/src/data/queries/useCheckouts.ts +2 -1
- package/src/data/queries/useCoachingAvailability.ts +10 -1
- package/src/data/queries/useCommunities.ts +345 -0
- package/src/data/queries/useCommunity.ts +450 -102
- package/src/data/queries/useCommunityAgent.ts +247 -0
- package/src/data/queries/useCommunityCalendar.ts +150 -0
- package/src/data/queries/useCommunityClassroom.ts +75 -0
- package/src/data/queries/useCommunityMembers.ts +108 -0
- package/src/data/queries/useCommunityModeration.ts +327 -0
- package/src/data/queries/useCommunityWiki.ts +137 -0
- package/src/data/queries/useCourses.ts +2 -0
- package/src/data/queries/useEmailSignIn.ts +79 -0
- package/src/data/queries/useEvents.ts +6 -1
- package/src/data/queries/useForms.ts +5 -1
- package/src/data/queries/useLeadMagnet.ts +6 -2
- package/src/data/queries/useMembership.ts +32 -7
- package/src/data/queries/useMembershipCalls.ts +116 -7
- package/src/data/queries/useMyBookings.ts +24 -1
- package/src/data/queries/useMyTickets.ts +24 -1
- package/src/data/queries/useNotifications.ts +6 -2
- package/src/data/queries/useOrders.ts +2 -1
- package/src/data/queries/usePWA.ts +111 -35
- package/src/data/queries/usePostCollections.ts +28 -16
- package/src/data/queries/usePosts.ts +16 -14
- package/src/data/queries/useSiteApp.ts +130 -0
- package/src/data/queries/useSubscriptions.ts +28 -9
- package/src/i18n/de.json +891 -2
- package/src/i18n/en.json +891 -2
- package/src/index.ts +36 -7
- package/src/runtime/pages.spec.ts +36 -0
- package/src/runtime/pages.ts +52 -27
- package/src/server/_tests/buildWebManifest.spec.ts +1 -1
- package/src/server/_tests/forgeServiceWorkerScript.spec.ts +4 -4
- package/src/types/models.ts +11 -0
- package/src/ui/analytics/ForgeAnalytics.tsx +64 -34
- package/src/ui/analytics/PageMetaPixel.tsx +23 -8
- package/src/ui/analytics/_tests/ForgeAnalytics.meta.spec.tsx +129 -0
- package/src/ui/analytics/_tests/metaCommerceEvents.spec.tsx +159 -0
- package/src/ui/analytics/useMetaEvents.ts +78 -0
- package/src/ui/format/_tests/membershipGate.spec.ts +6 -6
- package/src/ui/format/membershipGate.ts +19 -15
- package/src/ui/headless/_tests/communityAgent.spec.tsx +519 -0
- package/src/ui/headless/_tests/communityCalendar.spec.tsx +195 -0
- package/src/ui/headless/_tests/communityClassroom.spec.tsx +120 -0
- package/src/ui/headless/_tests/communityGate.spec.tsx +80 -0
- package/src/ui/headless/_tests/communityHarness.tsx +212 -0
- package/src/ui/headless/_tests/communityMembers.spec.tsx +316 -0
- package/src/ui/headless/_tests/communityPoll.spec.tsx +389 -0
- package/src/ui/headless/_tests/communityProvider.spec.tsx +151 -0
- package/src/ui/headless/_tests/memberHomeBar.spec.ts +84 -0
- package/src/ui/headless/_tests/siteAppBar.spec.ts +83 -0
- package/src/ui/headless/_tests/siteAppHarness.ts +19 -0
- package/src/ui/headless/_tests/siteAppHome.spec.ts +226 -0
- package/src/ui/headless/_tests/siteAppPrompts.spec.ts +185 -0
- package/src/ui/headless/_tests/useCommunityInvite.spec.tsx +104 -0
- package/src/ui/headless/_tests/useCommunityJoin.spec.tsx +596 -0
- package/src/ui/headless/_tests/useCommunityMembership.spec.tsx +179 -0
- package/src/ui/headless/_tests/useCommunityModeration.spec.tsx +420 -0
- package/src/ui/headless/_tests/useCommunityReads.spec.tsx +295 -0
- package/src/ui/headless/_tests/useCommunityUpgrade.spec.tsx +157 -0
- package/src/ui/headless/_tests/useCommunityWiki.spec.tsx +224 -0
- package/src/ui/headless/_tests/useSiteApp.spec.tsx +52 -0
- package/src/ui/headless/_tests/wikiMediaImage.spec.tsx +132 -0
- package/src/ui/headless/auth/useEmailCodeSignIn.ts +186 -0
- package/src/ui/headless/auth/useSignupForm.ts +30 -3
- package/src/ui/headless/chat/useChatAttachmentUpload.ts +9 -6
- package/src/ui/headless/chat/useChatRoom.ts +35 -1
- package/src/ui/headless/communities/CommunityGate.tsx +67 -0
- package/src/ui/headless/communities/index.ts +96 -0
- package/src/ui/headless/communities/paths.ts +36 -0
- package/src/ui/headless/communities/useCommunity.ts +140 -0
- package/src/ui/headless/communities/useCommunityAbout.ts +71 -0
- package/src/ui/headless/communities/useCommunityCalendar.ts +156 -0
- package/src/ui/headless/communities/useCommunityClassroom.ts +84 -0
- package/src/ui/headless/communities/useCommunityHome.ts +91 -0
- package/src/ui/headless/communities/useCommunityInvite.ts +116 -0
- package/src/ui/headless/communities/useCommunityJoin.ts +494 -0
- package/src/ui/headless/communities/useCommunityMembership.ts +182 -0
- package/src/ui/headless/communities/useCommunityUpgrade.ts +213 -0
- package/src/ui/headless/communities/useCommunityWiki.ts +266 -0
- package/src/ui/headless/communities/useMyMemberships.ts +59 -0
- package/src/ui/headless/community/communityPoll.ts +297 -0
- package/src/ui/headless/community/countries.ts +123 -0
- package/src/ui/headless/community/index.ts +81 -1
- package/src/ui/headless/community/linkPreview.ts +71 -0
- package/src/ui/headless/community/richLexical.ts +27 -2
- package/src/ui/headless/community/useCommunityAgent.ts +285 -0
- package/src/ui/headless/community/useCommunityAttachmentUpload.ts +7 -3
- package/src/ui/headless/community/useCommunityMembers.ts +175 -0
- package/src/ui/headless/community/useCommunityModeration.ts +300 -0
- package/src/ui/headless/community/useCommunitySpaceFeed.ts +22 -4
- package/src/ui/headless/community/useCommunityThread.ts +16 -3
- package/src/ui/headless/community/useMentionComposer.ts +17 -9
- package/src/ui/headless/community/useRichMentionComposer.ts +21 -5
- package/src/ui/headless/downloads/index.ts +8 -0
- package/src/ui/headless/downloads/useDownloadPage.ts +134 -0
- package/src/ui/headless/index.ts +21 -4
- package/src/ui/headless/memberHome/index.ts +11 -1
- package/src/ui/headless/memberHome/memberHomeBar.ts +91 -0
- package/src/ui/headless/memberHome/useMemberHomeNav.ts +84 -44
- package/src/ui/headless/membership/_tests/membershipCheckoutRefetch.spec.tsx +8 -0
- package/src/ui/headless/membership/_tests/useMembershipCheckoutApplication.spec.tsx +5 -4
- package/src/ui/headless/membership/_tests/useMembershipCheckoutQuestionnaire.spec.tsx +1 -1
- package/src/ui/headless/membership/_tests/useMembershipCheckoutTrial.spec.tsx +1 -1
- package/src/ui/headless/membership/useMembershipCheckout.ts +89 -22
- package/src/ui/headless/membership/useMembershipGateNotice.ts +25 -7
- package/src/ui/headless/portal/index.ts +57 -0
- package/src/ui/headless/portal/usePortal.ts +274 -0
- package/src/ui/headless/portal/usePortalFiles.ts +68 -0
- package/src/ui/headless/portal/usePortalMessages.ts +189 -0
- package/src/ui/headless/portal/usePortalPreview.ts +142 -0
- package/src/ui/headless/posts/upsell.ts +54 -8
- package/src/ui/headless/posts/useMemberPostsFeed.ts +6 -5
- package/src/ui/headless/posts/usePostCollectionDetail.ts +7 -4
- package/src/ui/headless/posts/usePostCollectionsList.ts +6 -5
- package/src/ui/headless/posts/usePostItem.ts +6 -5
- package/src/ui/headless/siteApp/appBar.ts +102 -0
- package/src/ui/headless/siteApp/appHome.ts +344 -0
- package/src/ui/headless/siteApp/appPrompts.ts +229 -0
- package/src/ui/headless/siteApp/index.ts +58 -0
- package/src/ui/headless/siteApp/useAppHome.ts +210 -0
- package/src/ui/headless/siteApp/useAppInstallRequest.ts +16 -0
- package/src/ui/headless/work/index.ts +2 -0
- package/src/ui/headless/work/useWorkPortal.ts +37 -26
- package/src/ui/index.ts +28 -12
- package/src/ui/styled/AccountDashboard.tsx +754 -602
- package/src/ui/styled/AiAgentWidget.tsx +13 -1
- package/src/ui/styled/ChatRoom.tsx +126 -16
- package/src/ui/styled/Checkout.tsx +8 -0
- package/src/ui/styled/CheckoutConfirmation.tsx +8 -0
- package/src/ui/styled/CoachingConfirmation.tsx +8 -0
- package/src/ui/styled/CoachingDetail.tsx +2 -0
- package/src/ui/styled/CourseConfirmation.tsx +5 -0
- package/src/ui/styled/CourseDetail.tsx +2 -0
- package/src/ui/styled/DownloadPage.tsx +263 -0
- package/src/ui/styled/EventConfirmation.tsx +10 -0
- package/src/ui/styled/EventDetail.tsx +10 -0
- package/src/ui/styled/FilmLibrary.tsx +22 -9
- package/src/ui/styled/MembershipCheckout.tsx +37 -17
- package/src/ui/styled/MembershipTierCallout.tsx +20 -1
- package/src/ui/styled/MembershipTiers.tsx +49 -11
- package/src/ui/styled/MusicLinkPage.tsx +5 -5
- package/src/ui/styled/Paywall.tsx +1 -1
- package/src/ui/styled/ProductDetail.tsx +12 -0
- package/src/ui/styled/PwaRegistration.tsx +5 -1
- package/src/ui/styled/SignupForm.tsx +18 -3
- package/src/ui/styled/_tests/AccountDashboardBookingCall.spec.tsx +6 -6
- package/src/ui/styled/_tests/AccountDashboardMemberships.spec.tsx +151 -0
- package/src/ui/styled/_tests/AccountDashboardRentals.spec.tsx +1 -1
- package/src/ui/styled/_tests/AccountNotifications.spec.tsx +135 -0
- package/src/ui/styled/_tests/CourseCallsSection.spec.tsx +7 -1
- package/src/ui/styled/_tests/DownloadPage.spec.tsx +68 -0
- package/src/ui/styled/_tests/MembershipCheckout.spec.tsx +54 -11
- package/src/ui/styled/_tests/membershipTierCallout.spec.tsx +1 -1
- package/src/ui/styled/_tests/membershipTiersCuratedAccess.spec.tsx +1 -1
- package/src/ui/styled/app/AppBar.tsx +298 -0
- package/src/ui/styled/app/AppHome.tsx +1139 -0
- package/src/ui/styled/app/AppHomeMark.tsx +66 -0
- package/src/ui/styled/app/AppPrompts.tsx +464 -0
- package/src/ui/styled/app/_tests/AppBar.spec.tsx +96 -0
- package/src/ui/styled/app/_tests/AppHome.spec.tsx +209 -0
- package/src/ui/styled/app/_tests/AppPrompts.spec.tsx +232 -0
- package/src/ui/styled/app/index.ts +7 -0
- package/src/ui/styled/chat/ChatThreadPanel.tsx +29 -4
- package/src/ui/styled/chat/MessageBubble.tsx +43 -6
- package/src/ui/styled/communities/CommunitiesList.tsx +88 -0
- package/src/ui/styled/communities/CommunityAbout.tsx +145 -0
- package/src/ui/styled/communities/CommunityCalendar.tsx +484 -0
- package/src/ui/styled/communities/CommunityClassroom.tsx +302 -0
- package/src/ui/styled/communities/CommunityHome.tsx +298 -0
- package/src/ui/styled/communities/CommunityJoinSheet.tsx +544 -0
- package/src/ui/styled/communities/CommunityMembershipMenu.tsx +249 -0
- package/src/ui/styled/communities/CommunityPending.tsx +49 -0
- package/src/ui/styled/communities/CommunityPublicWiki.tsx +75 -0
- package/src/ui/styled/communities/CommunityUpgradeSheet.tsx +137 -0
- package/src/ui/styled/communities/CommunityWiki.tsx +289 -0
- package/src/ui/styled/communities/MyMembershipsList.tsx +115 -0
- package/src/ui/styled/communities/_tests/CommunityAppHome.spec.tsx +92 -0
- package/src/ui/styled/communities/_tests/CommunityClassroomCalendar.spec.tsx +453 -0
- package/src/ui/styled/communities/_tests/CommunityMobile.spec.tsx +399 -0
- package/src/ui/styled/communities/_tests/CommunityPages.spec.tsx +102 -0
- package/src/ui/styled/communities/_tests/CommunityWiki.spec.tsx +223 -0
- package/src/ui/styled/communities/index.ts +19 -0
- package/src/ui/styled/communities/shared.tsx +177 -0
- package/src/ui/styled/community/CommunityAgent.tsx +286 -0
- package/src/ui/styled/community/CommunityComposer.tsx +266 -15
- package/src/ui/styled/community/CommunityFeed.tsx +50 -1
- package/src/ui/styled/community/CommunityLinkPreview.tsx +159 -0
- package/src/ui/styled/community/CommunityMemberGlobe.tsx +171 -0
- package/src/ui/styled/community/CommunityMemberProfile.tsx +137 -4
- package/src/ui/styled/community/CommunityMembers.tsx +387 -0
- package/src/ui/styled/community/CommunityModeration.tsx +587 -0
- package/src/ui/styled/community/CommunityModerationState.tsx +127 -0
- package/src/ui/styled/community/CommunityModeratorMenu.tsx +317 -0
- package/src/ui/styled/community/CommunityNotifications.tsx +52 -6
- package/src/ui/styled/community/CommunityPollCard.tsx +250 -0
- package/src/ui/styled/community/CommunityPostCard.tsx +110 -34
- package/src/ui/styled/community/CommunityPostDetail.tsx +157 -71
- package/src/ui/styled/community/CommunityRichText.tsx +177 -32
- package/src/ui/styled/community/CommunitySpaces.tsx +49 -14
- package/src/ui/styled/community/_tests/CommunityAgent.spec.tsx +571 -0
- package/src/ui/styled/community/_tests/CommunityComposer.spec.tsx +4 -1
- package/src/ui/styled/community/_tests/CommunityLinkPreview.spec.tsx +167 -0
- package/src/ui/styled/community/_tests/CommunityMembers.spec.tsx +137 -0
- package/src/ui/styled/community/_tests/CommunityModeration.spec.tsx +291 -0
- package/src/ui/styled/community/_tests/CommunityPoll.spec.tsx +386 -0
- package/src/ui/styled/community/_tests/CommunityPostDetail.spec.tsx +4 -1
- package/src/ui/styled/community/index.ts +37 -2
- package/src/ui/styled/forge-utilities.css +253 -0
- package/src/ui/styled/members/CallRecordingActions.tsx +182 -0
- package/src/ui/styled/members/CallTranscriptViewer.tsx +424 -0
- package/src/ui/styled/members/MemberCallsCalendar.tsx +41 -54
- package/src/ui/styled/members/MemberHomeLayout.tsx +327 -29
- package/src/ui/styled/members/MemberPostCard.tsx +9 -5
- package/src/ui/styled/members/MemberPostsFeed.tsx +3 -2
- package/src/ui/styled/members/PostCollectionDetail.tsx +18 -10
- package/src/ui/styled/members/PostCollectionsGrid.tsx +24 -10
- package/src/ui/styled/members/_tests/MemberCallsCalendar.spec.tsx +167 -8
- package/src/ui/styled/members/callTranscriptText.ts +67 -0
- package/src/ui/styled/members/index.ts +8 -0
- package/src/ui/styled/portal/PortalAccountSection.tsx +61 -0
- package/src/ui/styled/portal/PortalActivity.tsx +167 -0
- package/src/ui/styled/portal/PortalBilling.tsx +197 -0
- package/src/ui/styled/portal/PortalFiles.tsx +279 -0
- package/src/ui/styled/portal/PortalHome.tsx +401 -0
- package/src/ui/styled/portal/PortalMessages.tsx +300 -0
- package/src/ui/styled/portal/PortalPreviewBanner.tsx +75 -0
- package/src/ui/styled/portal/PortalProjects.tsx +407 -0
- package/src/ui/styled/portal/PortalShell.tsx +397 -0
- package/src/ui/styled/portal/_tests/PortalAppHome.spec.tsx +90 -0
- package/src/ui/styled/portal/_tests/PortalFiles.spec.tsx +159 -0
- package/src/ui/styled/portal/_tests/PortalHome.spec.tsx +148 -0
- package/src/ui/styled/portal/_tests/PortalMessages.spec.tsx +168 -0
- package/src/ui/styled/portal/_tests/PortalPreviewBanner.spec.tsx +132 -0
- package/src/ui/styled/portal/_tests/portalNav.spec.ts +123 -0
- package/src/ui/styled/portal/index.ts +13 -0
- package/src/ui/styled/portal/portalNav.ts +260 -0
- package/src/ui/styled/portal/shared.tsx +206 -0
- package/src/ui/styled/work/WorkInviteAccept.tsx +228 -168
- package/src/ui/styled/work/WorkPortalProjects.tsx +68 -120
- package/src/ui/styled/work/WorkProjectDocuments.tsx +99 -128
- package/src/ui/styled/work/WorkProjectInvoices.tsx +91 -86
- package/src/ui/styled/work/WorkProjectReport.tsx +11 -17
- package/src/ui/styled/work/WorkReportBody.tsx +223 -248
- package/src/ui/styled/work/WorkTaskAttachments.tsx +23 -29
- package/src/ui/styled/work/WorkTaskComments.tsx +75 -102
- package/src/ui/styled/work/WorkTaskDetail.tsx +48 -59
- package/src/ui/styled/work/WorkTokenReport.tsx +8 -16
- package/src/ui/styled/work/index.ts +1 -1
- package/src/utils/_tests/metaEvents.spec.ts +264 -0
- package/src/utils/_tests/safeRedirect.spec.ts +2 -2
- package/src/utils/landing.ts +19 -6
- package/src/utils/metaEvents.ts +302 -0
- package/src/ui/headless/membership/MembershipGate.tsx +0 -44
- package/src/ui/styled/_tests/AccountDashboardCommunity.spec.tsx +0 -149
- package/src/ui/styled/_tests/AccountDashboardTrial.spec.tsx +0 -105
|
@@ -0,0 +1,587 @@
|
|
|
1
|
+
import { useState, type CSSProperties, type ReactNode } from "react";
|
|
2
|
+
import { Flag, History, ShieldCheck } from "lucide-react";
|
|
3
|
+
import { useThemeTokens } from "../../theme/ForgeThemeProvider";
|
|
4
|
+
import { useForgeT } from "../../../i18n";
|
|
5
|
+
import {
|
|
6
|
+
describeHoldReason,
|
|
7
|
+
useCommunityModeration,
|
|
8
|
+
type CommunityReportResolution,
|
|
9
|
+
} from "../../headless/community/useCommunityModeration";
|
|
10
|
+
import type {
|
|
11
|
+
CommunityModerationLogEntry,
|
|
12
|
+
CommunityModerationReport,
|
|
13
|
+
CommunityPendingPost,
|
|
14
|
+
CommunityPendingReply,
|
|
15
|
+
} from "../../../data/queries/useCommunityModeration";
|
|
16
|
+
import { CallHelpHint } from "../../media/CallHelpHint";
|
|
17
|
+
import { Loading } from "../Loading";
|
|
18
|
+
import { timeAgo } from "./util";
|
|
19
|
+
|
|
20
|
+
export interface CommunityModerationProps {
|
|
21
|
+
/** Opens a post (a reported post, or a held reply's post). Omitted, rows do not link. */
|
|
22
|
+
onOpenPost?: (postId: string) => void;
|
|
23
|
+
/** Log page size. Default 20. */
|
|
24
|
+
logPageSize?: number;
|
|
25
|
+
className?: string;
|
|
26
|
+
style?: CSSProperties;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const LOG_ACTION_KEYS: Record<string, string> = {
|
|
30
|
+
hold: "forge.community_moderation.action_hold",
|
|
31
|
+
approve: "forge.community_moderation.action_approve",
|
|
32
|
+
reject: "forge.community_moderation.action_reject",
|
|
33
|
+
pin: "forge.community_moderation.action_pin",
|
|
34
|
+
unpin: "forge.community_moderation.action_unpin",
|
|
35
|
+
lock: "forge.community_moderation.action_lock",
|
|
36
|
+
unlock: "forge.community_moderation.action_unlock",
|
|
37
|
+
remove: "forge.community_moderation.action_remove",
|
|
38
|
+
restore: "forge.community_moderation.action_restore",
|
|
39
|
+
mute: "forge.community_moderation.action_mute",
|
|
40
|
+
unmute: "forge.community_moderation.action_unmute",
|
|
41
|
+
ban: "forge.community_moderation.action_ban",
|
|
42
|
+
unban: "forge.community_moderation.action_unban",
|
|
43
|
+
role_member: "forge.community_moderation.action_role_member",
|
|
44
|
+
role_moderator: "forge.community_moderation.action_role_moderator",
|
|
45
|
+
adjust_points: "forge.community_moderation.action_adjust_points",
|
|
46
|
+
report_resolved: "forge.community_moderation.action_report_resolved",
|
|
47
|
+
report_resolved_hidden: "forge.community_moderation.action_report_resolved_hidden",
|
|
48
|
+
report_dismissed: "forge.community_moderation.action_report_dismissed",
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* The Moderation tab of a community's member home, for its moderators (and
|
|
53
|
+
* the profile's owners and admins): open reports to resolve or dismiss, posts
|
|
54
|
+
* and replies held for approval, and the moderation log with an undo on every
|
|
55
|
+
* removal. Shows nothing but a notice to anyone else, and the server refuses
|
|
56
|
+
* them regardless. Built on `useCommunityModeration`.
|
|
57
|
+
*/
|
|
58
|
+
export function CommunityModeration({ onOpenPost, logPageSize, className, style }: CommunityModerationProps) {
|
|
59
|
+
const t = useThemeTokens();
|
|
60
|
+
const tr = useForgeT();
|
|
61
|
+
const mod = useCommunityModeration({ logPageSize });
|
|
62
|
+
const border = `1px solid ${t.border}`;
|
|
63
|
+
|
|
64
|
+
if (mod.isChecking) return <Loading />;
|
|
65
|
+
|
|
66
|
+
if (!mod.canModerate) {
|
|
67
|
+
return (
|
|
68
|
+
<div
|
|
69
|
+
className={className}
|
|
70
|
+
style={{ border, borderRadius: t.cornerRadius, padding: 28, textAlign: "center", color: t.muted, ...style }}
|
|
71
|
+
>
|
|
72
|
+
{tr("forge.community_moderation.not_moderator")}
|
|
73
|
+
</div>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const held = mod.pendingPosts.length + mod.pendingReplies.length;
|
|
78
|
+
const rowError = (id: string) =>
|
|
79
|
+
mod.error?.id === id ? (
|
|
80
|
+
<p role="alert" style={{ margin: 0, fontSize: 12, color: t.text, fontWeight: 600 }}>
|
|
81
|
+
{mod.error.message ?? tr("forge.community_moderation.error")}
|
|
82
|
+
</p>
|
|
83
|
+
) : null;
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<div
|
|
87
|
+
className={className}
|
|
88
|
+
data-testid="community-moderation"
|
|
89
|
+
style={{ display: "flex", flexDirection: "column", gap: 22, color: t.text, ...style }}
|
|
90
|
+
>
|
|
91
|
+
<div style={{ display: "flex", alignItems: "center", gap: 8 }}>
|
|
92
|
+
<h2
|
|
93
|
+
style={{
|
|
94
|
+
margin: 0,
|
|
95
|
+
fontSize: 18,
|
|
96
|
+
fontFamily: t.headingFontFamily,
|
|
97
|
+
color: t.text,
|
|
98
|
+
display: "flex",
|
|
99
|
+
alignItems: "center",
|
|
100
|
+
gap: 8,
|
|
101
|
+
}}
|
|
102
|
+
>
|
|
103
|
+
<ShieldCheck size={18} style={{ color: t.primary }} /> {tr("forge.community_moderation.title")}
|
|
104
|
+
</h2>
|
|
105
|
+
<CallHelpHint label={tr("forge.community_moderation.help_label")}>
|
|
106
|
+
{tr("forge.community_moderation.help")}
|
|
107
|
+
</CallHelpHint>
|
|
108
|
+
</div>
|
|
109
|
+
|
|
110
|
+
{mod.queueError && (
|
|
111
|
+
<p role="alert" style={{ margin: 0, fontSize: 13, color: t.text, fontWeight: 600 }}>
|
|
112
|
+
{tr("forge.community_moderation.queue_error")}
|
|
113
|
+
</p>
|
|
114
|
+
)}
|
|
115
|
+
|
|
116
|
+
{/* Reports */}
|
|
117
|
+
<Section
|
|
118
|
+
testId="community-moderation-reports"
|
|
119
|
+
icon={<Flag size={15} />}
|
|
120
|
+
title={tr("forge.community_moderation.reports_title", { count: mod.reportsTotal })}
|
|
121
|
+
help={
|
|
122
|
+
<CallHelpHint label={tr("forge.community_moderation.reports_help_label")}>
|
|
123
|
+
{tr("forge.community_moderation.reports_help")}
|
|
124
|
+
</CallHelpHint>
|
|
125
|
+
}
|
|
126
|
+
>
|
|
127
|
+
{mod.isLoading ? (
|
|
128
|
+
<Loading />
|
|
129
|
+
) : mod.reports.length === 0 ? (
|
|
130
|
+
<Empty>{tr("forge.community_moderation.reports_empty")}</Empty>
|
|
131
|
+
) : (
|
|
132
|
+
mod.reports.map((report) => (
|
|
133
|
+
<ReportRow
|
|
134
|
+
key={report.id}
|
|
135
|
+
report={report}
|
|
136
|
+
busy={mod.busyId === report.id}
|
|
137
|
+
onOpenPost={onOpenPost}
|
|
138
|
+
onResolve={(resolution) => mod.resolveReport(report.id, resolution)}
|
|
139
|
+
error={rowError(report.id)}
|
|
140
|
+
/>
|
|
141
|
+
))
|
|
142
|
+
)}
|
|
143
|
+
</Section>
|
|
144
|
+
|
|
145
|
+
{/* Held for approval */}
|
|
146
|
+
<Section
|
|
147
|
+
testId="community-moderation-held"
|
|
148
|
+
icon={<ShieldCheck size={15} />}
|
|
149
|
+
title={tr("forge.community_moderation.held_title", { count: held })}
|
|
150
|
+
help={
|
|
151
|
+
<CallHelpHint label={tr("forge.community_moderation.held_help_label")}>
|
|
152
|
+
{tr("forge.community_moderation.held_help")}
|
|
153
|
+
</CallHelpHint>
|
|
154
|
+
}
|
|
155
|
+
>
|
|
156
|
+
{mod.isLoading ? (
|
|
157
|
+
<Loading />
|
|
158
|
+
) : held === 0 ? (
|
|
159
|
+
<Empty>{tr("forge.community_moderation.held_empty")}</Empty>
|
|
160
|
+
) : (
|
|
161
|
+
<>
|
|
162
|
+
{mod.pendingPosts.map((item) => (
|
|
163
|
+
<HeldRow
|
|
164
|
+
key={item.id}
|
|
165
|
+
kind={tr("forge.community_moderation.held_kind_post", { space: item.spaceName ?? "" })}
|
|
166
|
+
item={item}
|
|
167
|
+
busy={mod.busyId === item.id}
|
|
168
|
+
onApprove={() => mod.approvePost(item)}
|
|
169
|
+
onReject={(reason) => mod.rejectPost(item, reason)}
|
|
170
|
+
error={rowError(item.id)}
|
|
171
|
+
/>
|
|
172
|
+
))}
|
|
173
|
+
{mod.pendingReplies.map((item) => (
|
|
174
|
+
<HeldRow
|
|
175
|
+
key={item.id}
|
|
176
|
+
kind={tr("forge.community_moderation.held_kind_reply", {
|
|
177
|
+
post: item.postTitle || tr("forge.community_moderation.held_untitled"),
|
|
178
|
+
})}
|
|
179
|
+
item={item}
|
|
180
|
+
busy={mod.busyId === item.id}
|
|
181
|
+
onOpen={onOpenPost ? () => onOpenPost(item.postId) : undefined}
|
|
182
|
+
onApprove={() => mod.approveReply(item)}
|
|
183
|
+
onReject={(reason) => mod.rejectReply(item, reason)}
|
|
184
|
+
error={rowError(item.id)}
|
|
185
|
+
/>
|
|
186
|
+
))}
|
|
187
|
+
</>
|
|
188
|
+
)}
|
|
189
|
+
</Section>
|
|
190
|
+
|
|
191
|
+
{/* Log */}
|
|
192
|
+
<Section
|
|
193
|
+
testId="community-moderation-log"
|
|
194
|
+
icon={<History size={15} />}
|
|
195
|
+
title={tr("forge.community_moderation.log_title")}
|
|
196
|
+
>
|
|
197
|
+
{mod.log.isLoading ? (
|
|
198
|
+
<Loading />
|
|
199
|
+
) : mod.log.entries.length === 0 ? (
|
|
200
|
+
<Empty>{tr("forge.community_moderation.log_empty")}</Empty>
|
|
201
|
+
) : (
|
|
202
|
+
mod.log.entries.map((entry) => (
|
|
203
|
+
<LogRow
|
|
204
|
+
key={entry.id}
|
|
205
|
+
entry={entry}
|
|
206
|
+
canRestore={mod.log.restorable.has(entry.id)}
|
|
207
|
+
busy={mod.busyId === entry.id}
|
|
208
|
+
onRestore={() => mod.log.restore(entry)}
|
|
209
|
+
error={rowError(entry.id)}
|
|
210
|
+
/>
|
|
211
|
+
))
|
|
212
|
+
)}
|
|
213
|
+
{(mod.log.hasPreviousPage || mod.log.hasNextPage) && (
|
|
214
|
+
<div style={{ display: "flex", alignItems: "center", justifyContent: "center", gap: 10, marginTop: 4 }}>
|
|
215
|
+
<PagerButton disabled={!mod.log.hasPreviousPage} onClick={mod.log.previousPage}>
|
|
216
|
+
{tr("forge.community_moderation.previous")}
|
|
217
|
+
</PagerButton>
|
|
218
|
+
<span style={{ fontSize: 12, color: t.muted }}>
|
|
219
|
+
{tr("forge.community_moderation.page", { page: mod.log.page })}
|
|
220
|
+
</span>
|
|
221
|
+
<PagerButton disabled={!mod.log.hasNextPage} onClick={mod.log.nextPage}>
|
|
222
|
+
{tr("forge.community_moderation.next")}
|
|
223
|
+
</PagerButton>
|
|
224
|
+
</div>
|
|
225
|
+
)}
|
|
226
|
+
</Section>
|
|
227
|
+
</div>
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// ── Pieces ───────────────────────────────────────────────────────────────────
|
|
232
|
+
|
|
233
|
+
function Section({
|
|
234
|
+
testId,
|
|
235
|
+
icon,
|
|
236
|
+
title,
|
|
237
|
+
help,
|
|
238
|
+
children,
|
|
239
|
+
}: {
|
|
240
|
+
testId: string;
|
|
241
|
+
icon: ReactNode;
|
|
242
|
+
title: string;
|
|
243
|
+
help?: ReactNode;
|
|
244
|
+
children: ReactNode;
|
|
245
|
+
}) {
|
|
246
|
+
const t = useThemeTokens();
|
|
247
|
+
return (
|
|
248
|
+
<section data-testid={testId} style={{ display: "flex", flexDirection: "column", gap: 8 }}>
|
|
249
|
+
<div style={{ display: "flex", alignItems: "center", gap: 6 }}>
|
|
250
|
+
<span style={{ color: t.primary, display: "inline-flex" }} aria-hidden>
|
|
251
|
+
{icon}
|
|
252
|
+
</span>
|
|
253
|
+
<h3 style={{ margin: 0, fontSize: 15, color: t.text }}>{title}</h3>
|
|
254
|
+
{help}
|
|
255
|
+
</div>
|
|
256
|
+
{children}
|
|
257
|
+
</section>
|
|
258
|
+
);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
function Empty({ children }: { children: ReactNode }) {
|
|
262
|
+
const t = useThemeTokens();
|
|
263
|
+
return (
|
|
264
|
+
<div
|
|
265
|
+
style={{
|
|
266
|
+
border: `1px solid ${t.border}`,
|
|
267
|
+
borderRadius: t.cornerRadius,
|
|
268
|
+
padding: 18,
|
|
269
|
+
textAlign: "center",
|
|
270
|
+
color: t.muted,
|
|
271
|
+
fontSize: 13,
|
|
272
|
+
}}
|
|
273
|
+
>
|
|
274
|
+
{children}
|
|
275
|
+
</div>
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
function useRowStyles() {
|
|
280
|
+
const t = useThemeTokens();
|
|
281
|
+
const card: CSSProperties = {
|
|
282
|
+
border: `1px solid ${t.border}`,
|
|
283
|
+
borderRadius: t.cornerRadius,
|
|
284
|
+
background: t.surface,
|
|
285
|
+
padding: "12px 14px",
|
|
286
|
+
display: "flex",
|
|
287
|
+
flexDirection: "column",
|
|
288
|
+
gap: 6,
|
|
289
|
+
};
|
|
290
|
+
const button = (busy: boolean, primary = false): CSSProperties => ({
|
|
291
|
+
background: primary ? t.primary : "transparent",
|
|
292
|
+
color: primary ? t.textPrimary : t.text,
|
|
293
|
+
border: primary ? "none" : `1px solid ${t.border}`,
|
|
294
|
+
borderRadius: t.cornerRadius,
|
|
295
|
+
padding: "5px 12px",
|
|
296
|
+
fontSize: 12,
|
|
297
|
+
fontWeight: 600,
|
|
298
|
+
cursor: busy ? "default" : "pointer",
|
|
299
|
+
opacity: busy ? 0.6 : 1,
|
|
300
|
+
fontFamily: "inherit",
|
|
301
|
+
});
|
|
302
|
+
const meta: CSSProperties = { fontSize: 12, color: t.muted };
|
|
303
|
+
const quote: CSSProperties = {
|
|
304
|
+
margin: 0,
|
|
305
|
+
fontSize: 13,
|
|
306
|
+
color: t.text,
|
|
307
|
+
whiteSpace: "pre-wrap",
|
|
308
|
+
wordBreak: "break-word",
|
|
309
|
+
borderLeft: `2px solid ${t.border}`,
|
|
310
|
+
paddingLeft: 10,
|
|
311
|
+
};
|
|
312
|
+
return { t, card, button, meta, quote };
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
function ReportRow({
|
|
316
|
+
report,
|
|
317
|
+
busy,
|
|
318
|
+
onOpenPost,
|
|
319
|
+
onResolve,
|
|
320
|
+
error,
|
|
321
|
+
}: {
|
|
322
|
+
report: CommunityModerationReport;
|
|
323
|
+
busy: boolean;
|
|
324
|
+
onOpenPost?: (postId: string) => void;
|
|
325
|
+
onResolve: (resolution: CommunityReportResolution) => void;
|
|
326
|
+
error: ReactNode;
|
|
327
|
+
}) {
|
|
328
|
+
const tr = useForgeT();
|
|
329
|
+
const { t, card, button, meta, quote } = useRowStyles();
|
|
330
|
+
const isPost = report.entityType === "community_post";
|
|
331
|
+
// The post to open: the reported post, or the reported reply's post. A hidden
|
|
332
|
+
// post cannot be opened; a hidden reply's post still can. Older servers send
|
|
333
|
+
// no `postId`, so a post report falls back to its own id.
|
|
334
|
+
const postId = report.postId ?? (isPost ? report.entityId : null);
|
|
335
|
+
const openPostId = isPost && report.contentHidden ? null : postId;
|
|
336
|
+
const reporter =
|
|
337
|
+
`${report.reporterFirstName ?? ""} ${report.reporterLastName ?? ""}`.trim() ||
|
|
338
|
+
tr("forge.community_moderation.unknown_member");
|
|
339
|
+
|
|
340
|
+
return (
|
|
341
|
+
<div data-testid="community-moderation-report" style={card}>
|
|
342
|
+
<div style={{ display: "flex", alignItems: "center", gap: 8, flexWrap: "wrap" }}>
|
|
343
|
+
<span style={{ fontSize: 12, fontWeight: 700, color: t.text }}>
|
|
344
|
+
{tr(isPost ? "forge.community_moderation.report_kind_post" : "forge.community_moderation.report_kind_reply")}
|
|
345
|
+
</span>
|
|
346
|
+
<span style={meta}>{tr("forge.community_moderation.reported_by", { name: reporter })}</span>
|
|
347
|
+
<span style={meta}>{timeAgo(report.createdAt)}</span>
|
|
348
|
+
{report.contentHidden && (
|
|
349
|
+
<span style={{ ...meta, fontWeight: 600 }}>{tr("forge.community_moderation.content_hidden")}</span>
|
|
350
|
+
)}
|
|
351
|
+
</div>
|
|
352
|
+
{report.contentPreview && <p style={quote}>{report.contentPreview}</p>}
|
|
353
|
+
{report.reason && (
|
|
354
|
+
<p style={{ margin: 0, fontSize: 13 }}>
|
|
355
|
+
{tr("forge.community_moderation.report_reason", { reason: report.reason })}
|
|
356
|
+
</p>
|
|
357
|
+
)}
|
|
358
|
+
<div className="fg:flex fg:flex-wrap fg:items-center fg:gap-2">
|
|
359
|
+
<button type="button" disabled={busy} style={button(busy, true)} onClick={() => onResolve("resolve")}>
|
|
360
|
+
{tr("forge.community_moderation.resolve")}
|
|
361
|
+
</button>
|
|
362
|
+
{!report.contentHidden && (
|
|
363
|
+
<button type="button" disabled={busy} style={button(busy)} onClick={() => onResolve("resolve_and_hide")}>
|
|
364
|
+
{tr("forge.community_moderation.resolve_hide")}
|
|
365
|
+
</button>
|
|
366
|
+
)}
|
|
367
|
+
<button type="button" disabled={busy} style={button(busy)} onClick={() => onResolve("dismiss")}>
|
|
368
|
+
{tr("forge.community_moderation.dismiss")}
|
|
369
|
+
</button>
|
|
370
|
+
{openPostId && onOpenPost && (
|
|
371
|
+
<button
|
|
372
|
+
type="button"
|
|
373
|
+
onClick={() => onOpenPost(openPostId)}
|
|
374
|
+
style={{ ...button(false), border: "none", color: t.primary }}
|
|
375
|
+
>
|
|
376
|
+
{tr("forge.community_moderation.open_post")}
|
|
377
|
+
</button>
|
|
378
|
+
)}
|
|
379
|
+
</div>
|
|
380
|
+
{error}
|
|
381
|
+
</div>
|
|
382
|
+
);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
function HeldRow({
|
|
386
|
+
kind,
|
|
387
|
+
item,
|
|
388
|
+
busy,
|
|
389
|
+
onOpen,
|
|
390
|
+
onApprove,
|
|
391
|
+
onReject,
|
|
392
|
+
error,
|
|
393
|
+
}: {
|
|
394
|
+
kind: string;
|
|
395
|
+
item: (CommunityPendingPost | CommunityPendingReply) & { title?: string | null };
|
|
396
|
+
busy: boolean;
|
|
397
|
+
onOpen?: () => void;
|
|
398
|
+
onApprove: () => void;
|
|
399
|
+
onReject: (reason: string) => Promise<boolean>;
|
|
400
|
+
error: ReactNode;
|
|
401
|
+
}) {
|
|
402
|
+
const tr = useForgeT();
|
|
403
|
+
const { t, card, button, meta, quote } = useRowStyles();
|
|
404
|
+
const [rejecting, setRejecting] = useState(false);
|
|
405
|
+
const [reason, setReason] = useState("");
|
|
406
|
+
const hold = describeHoldReason(item.moderationReason);
|
|
407
|
+
const holdLabel =
|
|
408
|
+
hold?.kind === "new_member"
|
|
409
|
+
? tr("forge.community_moderation.reason_new_member")
|
|
410
|
+
: hold?.kind === "all_posts"
|
|
411
|
+
? tr("forge.community_moderation.reason_all_posts")
|
|
412
|
+
: hold?.kind === "keyword"
|
|
413
|
+
? tr("forge.community_moderation.reason_keyword", { word: hold.word })
|
|
414
|
+
: hold?.kind === "other"
|
|
415
|
+
? hold.raw
|
|
416
|
+
: null;
|
|
417
|
+
|
|
418
|
+
return (
|
|
419
|
+
<div data-testid="community-moderation-held-item" style={card}>
|
|
420
|
+
<div style={{ display: "flex", alignItems: "center", gap: 8, flexWrap: "wrap" }}>
|
|
421
|
+
<span style={{ fontSize: 12, fontWeight: 700, color: t.text }}>{kind}</span>
|
|
422
|
+
<span style={meta}>
|
|
423
|
+
{tr("forge.community_moderation.by_author", {
|
|
424
|
+
name: item.authorName || tr("forge.community_moderation.unknown_member"),
|
|
425
|
+
})}
|
|
426
|
+
</span>
|
|
427
|
+
<span style={meta}>{timeAgo(item.createdAt)}</span>
|
|
428
|
+
{holdLabel && (
|
|
429
|
+
<span
|
|
430
|
+
data-testid="community-moderation-hold-reason"
|
|
431
|
+
style={{
|
|
432
|
+
padding: "1px 8px",
|
|
433
|
+
borderRadius: 999,
|
|
434
|
+
background: `${t.primary}1a`,
|
|
435
|
+
color: t.primary,
|
|
436
|
+
fontSize: 11,
|
|
437
|
+
fontWeight: 700,
|
|
438
|
+
}}
|
|
439
|
+
>
|
|
440
|
+
{holdLabel}
|
|
441
|
+
</span>
|
|
442
|
+
)}
|
|
443
|
+
</div>
|
|
444
|
+
{item.title && <div style={{ fontWeight: 700, fontSize: 14 }}>{item.title}</div>}
|
|
445
|
+
{item.bodyText && <p style={quote}>{item.bodyText}</p>}
|
|
446
|
+
|
|
447
|
+
{rejecting ? (
|
|
448
|
+
<form
|
|
449
|
+
style={{ display: "flex", flexDirection: "column", gap: 6 }}
|
|
450
|
+
onSubmit={async (e) => {
|
|
451
|
+
e.preventDefault();
|
|
452
|
+
if (busy) return;
|
|
453
|
+
if (await onReject(reason)) {
|
|
454
|
+
setRejecting(false);
|
|
455
|
+
setReason("");
|
|
456
|
+
}
|
|
457
|
+
}}
|
|
458
|
+
>
|
|
459
|
+
<label style={{ fontSize: 12, fontWeight: 600 }}>
|
|
460
|
+
{tr("forge.community_moderation.reject_reason_label")}
|
|
461
|
+
<textarea
|
|
462
|
+
value={reason}
|
|
463
|
+
onChange={(e) => setReason(e.target.value)}
|
|
464
|
+
maxLength={500}
|
|
465
|
+
rows={2}
|
|
466
|
+
autoFocus
|
|
467
|
+
style={{
|
|
468
|
+
display: "block",
|
|
469
|
+
width: "100%",
|
|
470
|
+
marginTop: 4,
|
|
471
|
+
boxSizing: "border-box",
|
|
472
|
+
padding: "6px 8px",
|
|
473
|
+
borderRadius: t.cornerRadius,
|
|
474
|
+
border: `1px solid ${t.border}`,
|
|
475
|
+
background: t.background,
|
|
476
|
+
color: t.text,
|
|
477
|
+
fontFamily: "inherit",
|
|
478
|
+
fontSize: 13,
|
|
479
|
+
fontWeight: 400,
|
|
480
|
+
resize: "vertical",
|
|
481
|
+
}}
|
|
482
|
+
/>
|
|
483
|
+
</label>
|
|
484
|
+
<div className="fg:flex fg:flex-wrap fg:items-center fg:gap-2">
|
|
485
|
+
<button type="submit" disabled={busy} style={button(busy, true)}>
|
|
486
|
+
{tr("forge.community_moderation.reject_confirm")}
|
|
487
|
+
</button>
|
|
488
|
+
<button type="button" style={button(false)} onClick={() => setRejecting(false)}>
|
|
489
|
+
{tr("forge.community_moderation.cancel")}
|
|
490
|
+
</button>
|
|
491
|
+
</div>
|
|
492
|
+
</form>
|
|
493
|
+
) : (
|
|
494
|
+
<div className="fg:flex fg:flex-wrap fg:items-center fg:gap-2">
|
|
495
|
+
<button type="button" disabled={busy} style={button(busy, true)} onClick={onApprove}>
|
|
496
|
+
{tr("forge.community_moderation.approve")}
|
|
497
|
+
</button>
|
|
498
|
+
<button type="button" disabled={busy} style={button(busy)} onClick={() => setRejecting(true)}>
|
|
499
|
+
{tr("forge.community_moderation.reject")}
|
|
500
|
+
</button>
|
|
501
|
+
{onOpen && (
|
|
502
|
+
<button type="button" onClick={onOpen} style={{ ...button(false), border: "none", color: t.primary }}>
|
|
503
|
+
{tr("forge.community_moderation.open_post")}
|
|
504
|
+
</button>
|
|
505
|
+
)}
|
|
506
|
+
</div>
|
|
507
|
+
)}
|
|
508
|
+
{error}
|
|
509
|
+
</div>
|
|
510
|
+
);
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
function LogRow({
|
|
514
|
+
entry,
|
|
515
|
+
canRestore,
|
|
516
|
+
busy,
|
|
517
|
+
onRestore,
|
|
518
|
+
error,
|
|
519
|
+
}: {
|
|
520
|
+
entry: CommunityModerationLogEntry;
|
|
521
|
+
canRestore: boolean;
|
|
522
|
+
busy: boolean;
|
|
523
|
+
onRestore: () => void;
|
|
524
|
+
error: ReactNode;
|
|
525
|
+
}) {
|
|
526
|
+
const tr = useForgeT();
|
|
527
|
+
const { t, button, meta } = useRowStyles();
|
|
528
|
+
const actor = entry.actorAccountId
|
|
529
|
+
? entry.actorName || tr("forge.community_moderation.unknown_member")
|
|
530
|
+
: tr("forge.community_moderation.log_actor_system");
|
|
531
|
+
const subject =
|
|
532
|
+
entry.entityType === "community_post"
|
|
533
|
+
? tr("forge.community_moderation.log_kind_post")
|
|
534
|
+
: entry.entityType === "community_reply"
|
|
535
|
+
? tr("forge.community_moderation.log_kind_reply")
|
|
536
|
+
: null;
|
|
537
|
+
|
|
538
|
+
return (
|
|
539
|
+
<div
|
|
540
|
+
data-testid="community-moderation-log-entry"
|
|
541
|
+
style={{
|
|
542
|
+
display: "flex",
|
|
543
|
+
flexDirection: "column",
|
|
544
|
+
gap: 4,
|
|
545
|
+
padding: "8px 0",
|
|
546
|
+
borderBottom: `1px solid ${t.border}`,
|
|
547
|
+
}}
|
|
548
|
+
>
|
|
549
|
+
<div style={{ display: "flex", alignItems: "center", gap: 8, flexWrap: "wrap", fontSize: 13 }}>
|
|
550
|
+
<span style={{ fontWeight: 700 }}>{actor}</span>
|
|
551
|
+
<span>{tr(LOG_ACTION_KEYS[entry.action] ?? "forge.community_moderation.action_other")}</span>
|
|
552
|
+
{subject && <span style={meta}>{subject}</span>}
|
|
553
|
+
{entry.targetName && (
|
|
554
|
+
<span style={meta}>{tr("forge.community_moderation.log_target", { name: entry.targetName })}</span>
|
|
555
|
+
)}
|
|
556
|
+
<span style={{ ...meta, marginLeft: "auto" }}>{timeAgo(entry.createdAt)}</span>
|
|
557
|
+
</div>
|
|
558
|
+
{entry.reason && (
|
|
559
|
+
<div style={{ fontSize: 12, color: t.muted }}>
|
|
560
|
+
{tr("forge.community_moderation.log_reason", { reason: entry.reason })}
|
|
561
|
+
</div>
|
|
562
|
+
)}
|
|
563
|
+
{canRestore && (
|
|
564
|
+
<div>
|
|
565
|
+
<button type="button" disabled={busy} style={button(busy)} onClick={onRestore}>
|
|
566
|
+
{tr("forge.community_moderation.restore")}
|
|
567
|
+
</button>
|
|
568
|
+
</div>
|
|
569
|
+
)}
|
|
570
|
+
{error}
|
|
571
|
+
</div>
|
|
572
|
+
);
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
function PagerButton({ disabled, onClick, children }: { disabled: boolean; onClick: () => void; children: ReactNode }) {
|
|
576
|
+
const { button } = useRowStyles();
|
|
577
|
+
return (
|
|
578
|
+
<button
|
|
579
|
+
type="button"
|
|
580
|
+
disabled={disabled}
|
|
581
|
+
onClick={onClick}
|
|
582
|
+
style={{ ...button(disabled), opacity: disabled ? 0.4 : 1 }}
|
|
583
|
+
>
|
|
584
|
+
{children}
|
|
585
|
+
</button>
|
|
586
|
+
);
|
|
587
|
+
}
|