@tribe-nest/forge 1.13.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 +42 -0
- package/src/client/createForgeClient.ts +54 -0
- package/src/content/ForgeContentProvider.tsx +118 -0
- package/src/content/ForgeEditBridge.tsx +134 -0
- package/src/content/editFlag.ts +23 -0
- package/src/content/index.ts +28 -0
- package/src/content/resolve.ts +67 -0
- package/src/content/types.ts +97 -0
- package/src/content/useField.ts +64 -0
- package/src/contexts/AppAuthContext.tsx +185 -0
- package/src/contexts/AudioPlayerContext.tsx +389 -0
- package/src/contexts/CartContext.tsx +131 -0
- package/src/contexts/PublicAuthContext.tsx +333 -0
- package/src/contexts/useAppAdminGuard.ts +56 -0
- package/src/css.d.ts +5 -0
- package/src/data/collectionParams.ts +57 -0
- package/src/data/queries/useAccount.ts +71 -0
- package/src/data/queries/useAccountSettings.ts +82 -0
- package/src/data/queries/useAnalytics.ts +86 -0
- package/src/data/queries/useAuthActions.ts +28 -0
- package/src/data/queries/useBlog.ts +103 -0
- package/src/data/queries/useBlogComments.ts +96 -0
- package/src/data/queries/useBroadcasts.ts +31 -0
- package/src/data/queries/useCertificates.ts +58 -0
- package/src/data/queries/useChat.ts +267 -0
- package/src/data/queries/useCoachingAvailability.ts +69 -0
- package/src/data/queries/useCoachingProducts.ts +67 -0
- package/src/data/queries/useCohortPage.ts +17 -0
- package/src/data/queries/useCollections.ts +211 -0
- package/src/data/queries/useCommunity.ts +794 -0
- package/src/data/queries/useCoupons.ts +20 -0
- package/src/data/queries/useCourseAccess.ts +50 -0
- package/src/data/queries/useCourses.ts +91 -0
- package/src/data/queries/useCurrencies.ts +33 -0
- package/src/data/queries/useDocuments.ts +208 -0
- package/src/data/queries/useDonations.ts +29 -0
- package/src/data/queries/useEngagement.ts +115 -0
- package/src/data/queries/useEvents.ts +69 -0
- package/src/data/queries/useFinalize.ts +109 -0
- package/src/data/queries/useForms.ts +31 -0
- package/src/data/queries/useInvoice.ts +65 -0
- package/src/data/queries/useLeadMagnet.ts +96 -0
- package/src/data/queries/useMembership.ts +20 -0
- package/src/data/queries/useNotifications.ts +267 -0
- package/src/data/queries/useOffers.ts +56 -0
- package/src/data/queries/useOrders.ts +71 -0
- package/src/data/queries/usePWA.ts +101 -0
- package/src/data/queries/usePageActions.ts +36 -0
- package/src/data/queries/usePaymentFlow.ts +80 -0
- package/src/data/queries/usePaymentLink.ts +47 -0
- package/src/data/queries/usePodcast.ts +85 -0
- package/src/data/queries/usePostCollections.ts +48 -0
- package/src/data/queries/usePosts.ts +94 -0
- package/src/data/queries/useProducts.ts +108 -0
- package/src/data/queries/useReplay.ts +19 -0
- package/src/data/queries/useReviews.ts +122 -0
- package/src/data/queries/useShipping.ts +109 -0
- package/src/data/queries/useSubscriptions.ts +66 -0
- package/src/data/queries/useWebsite.ts +128 -0
- package/src/data/queries/useWebsiteAgent.ts +100 -0
- package/src/index.ts +98 -0
- package/src/provider/ForgeAppProvider.tsx +149 -0
- package/src/provider/ForgeProvider.tsx +91 -0
- package/src/provider/SiteConfigProvider.tsx +27 -0
- package/src/server/_tests/buildPwaHead.spec.ts +182 -0
- package/src/server/_tests/buildWebManifest.spec.ts +313 -0
- package/src/server/_tests/forgeServiceWorkerScript.spec.ts +251 -0
- package/src/server/index.ts +260 -0
- package/src/server/jobs.ts +104 -0
- package/src/server/pwa.ts +332 -0
- package/src/types/index.ts +74 -0
- package/src/types/models.ts +1313 -0
- package/src/ui/analytics/ForgeAnalytics.tsx +208 -0
- package/src/ui/analytics/PageMetaPixel.tsx +92 -0
- package/src/ui/content/Editable.tsx +90 -0
- package/src/ui/format/PriceDisplay.tsx +142 -0
- package/src/ui/format/useFormatCurrency.ts +92 -0
- package/src/ui/headless/agent/useAiAgent.ts +106 -0
- package/src/ui/headless/auth/useLoginFlow.ts +72 -0
- package/src/ui/headless/auth/useSignupForm.ts +85 -0
- package/src/ui/headless/broadcast/useBroadcastWatch.ts +59 -0
- package/src/ui/headless/chat/attachmentKind.ts +27 -0
- package/src/ui/headless/chat/useChatAttachmentUpload.ts +132 -0
- package/src/ui/headless/chat/useChatRoom.ts +223 -0
- package/src/ui/headless/chat/useMessageThread.ts +60 -0
- package/src/ui/headless/checkout/useCheckout.ts +438 -0
- package/src/ui/headless/coaching/useCoachingBooking.ts +223 -0
- package/src/ui/headless/community/index.ts +20 -0
- package/src/ui/headless/community/lexical.ts +131 -0
- package/src/ui/headless/community/replyTree.ts +51 -0
- package/src/ui/headless/community/richLexical.ts +314 -0
- package/src/ui/headless/community/useCommunityAttachmentUpload.ts +137 -0
- package/src/ui/headless/community/useCommunitySpaceFeed.ts +122 -0
- package/src/ui/headless/community/useCommunityThread.ts +95 -0
- package/src/ui/headless/community/useMentionComposer.ts +105 -0
- package/src/ui/headless/community/useRichMentionComposer.ts +193 -0
- package/src/ui/headless/consent/useCookieConsent.ts +81 -0
- package/src/ui/headless/course/useCourseCheckout.ts +99 -0
- package/src/ui/headless/dialog.tsx +14 -0
- package/src/ui/headless/document/index.ts +7 -0
- package/src/ui/headless/document/useContractSignature.ts +68 -0
- package/src/ui/headless/document/useDocumentSigningFlow.ts +92 -0
- package/src/ui/headless/document/useOtpCodeInput.ts +86 -0
- package/src/ui/headless/document/useSignaturePad.ts +180 -0
- package/src/ui/headless/donation/Donation.tsx +115 -0
- package/src/ui/headless/donation/DonationContext.tsx +223 -0
- package/src/ui/headless/donation/fees.ts +15 -0
- package/src/ui/headless/donation/index.ts +10 -0
- package/src/ui/headless/engagement/usePostEngagement.ts +119 -0
- package/src/ui/headless/event/useEventCheckout.ts +141 -0
- package/src/ui/headless/forms/useContactForm.ts +58 -0
- package/src/ui/headless/forms/useEmailListForm.ts +75 -0
- package/src/ui/headless/forms/useSectionedForm.ts +256 -0
- package/src/ui/headless/index.ts +60 -0
- package/src/ui/headless/invoice/useInvoicePayment.ts +48 -0
- package/src/ui/headless/memberHome/index.ts +7 -0
- package/src/ui/headless/memberHome/useMemberHomeNav.ts +82 -0
- package/src/ui/headless/membership/MembershipGate.tsx +39 -0
- package/src/ui/headless/membership/useMembershipCheckout.ts +121 -0
- package/src/ui/headless/offer/Offer.tsx +88 -0
- package/src/ui/headless/offer/OfferContext.tsx +162 -0
- package/src/ui/headless/offer/index.ts +8 -0
- package/src/ui/headless/paymentLink/usePaymentLinkPayment.ts +46 -0
- package/src/ui/headless/podcast/usePodcastPlayer.ts +96 -0
- package/src/ui/headless/posts/index.ts +13 -0
- package/src/ui/headless/posts/upsell.ts +41 -0
- package/src/ui/headless/posts/useMemberPostsFeed.ts +110 -0
- package/src/ui/headless/posts/usePostCollectionDetail.ts +56 -0
- package/src/ui/headless/posts/usePostCollectionsList.ts +90 -0
- package/src/ui/headless/posts/usePostItem.ts +81 -0
- package/src/ui/headless/reviews/index.ts +6 -0
- package/src/ui/headless/reviews/useHelpfulVote.ts +45 -0
- package/src/ui/headless/reviews/useReviewForm.ts +108 -0
- package/src/ui/headless/reviews/useReviewsList.ts +79 -0
- package/src/ui/headless/work/index.ts +25 -0
- package/src/ui/headless/work/useWorkPortal.ts +349 -0
- package/src/ui/index.ts +144 -0
- package/src/ui/payment/ForgePaymentProvider.tsx +45 -0
- package/src/ui/payment/ForgeStripePayment.tsx +171 -0
- package/src/ui/shell/TribeNestApp.tsx +121 -0
- package/src/ui/shell/shellGating.spec.ts +28 -0
- package/src/ui/shell/shellGating.ts +11 -0
- package/src/ui/styled/AccountDashboard.tsx +575 -0
- package/src/ui/styled/AiAgentWidget.tsx +152 -0
- package/src/ui/styled/AudioPlayer.tsx +123 -0
- package/src/ui/styled/BlogCategory.tsx +79 -0
- package/src/ui/styled/BlogComments.tsx +236 -0
- package/src/ui/styled/BlogList.tsx +101 -0
- package/src/ui/styled/BlogPost.tsx +160 -0
- package/src/ui/styled/BlogPostFooter.tsx +33 -0
- package/src/ui/styled/BotProtection.tsx +101 -0
- package/src/ui/styled/Button.tsx +88 -0
- package/src/ui/styled/Cart.tsx +276 -0
- package/src/ui/styled/ChatRoom.tsx +252 -0
- package/src/ui/styled/Checkout.tsx +988 -0
- package/src/ui/styled/CheckoutConfirmation.tsx +452 -0
- package/src/ui/styled/CoachingBooking.tsx +605 -0
- package/src/ui/styled/CoachingConfirmation.tsx +151 -0
- package/src/ui/styled/CoachingDetail.tsx +99 -0
- package/src/ui/styled/CohortPage.tsx +82 -0
- package/src/ui/styled/ConfirmSubscription.tsx +134 -0
- package/src/ui/styled/Confirmation.tsx +171 -0
- package/src/ui/styled/ContactForm.tsx +81 -0
- package/src/ui/styled/CookieConsent.tsx +239 -0
- package/src/ui/styled/CourseAccess.tsx +169 -0
- package/src/ui/styled/CourseCheckout.tsx +425 -0
- package/src/ui/styled/CourseConfirmation.tsx +191 -0
- package/src/ui/styled/CourseDetail.tsx +140 -0
- package/src/ui/styled/CoursesGrid.tsx +85 -0
- package/src/ui/styled/CurrencySwitcher.tsx +51 -0
- package/src/ui/styled/DonationButton.tsx +247 -0
- package/src/ui/styled/DonationPage.tsx +29 -0
- package/src/ui/styled/EmailListForm.tsx +88 -0
- package/src/ui/styled/EventConfirmation.tsx +228 -0
- package/src/ui/styled/EventCountdown.tsx +98 -0
- package/src/ui/styled/EventDetail.tsx +141 -0
- package/src/ui/styled/EventTickets.tsx +548 -0
- package/src/ui/styled/EventsList.tsx +83 -0
- package/src/ui/styled/ForgotPasswordForm.tsx +105 -0
- package/src/ui/styled/FormRenderer.tsx +249 -0
- package/src/ui/styled/InstallBanner.tsx +114 -0
- package/src/ui/styled/InvoiceConfirmation.tsx +50 -0
- package/src/ui/styled/InvoicePayment.tsx +141 -0
- package/src/ui/styled/LeadMagnet.tsx +93 -0
- package/src/ui/styled/Loading.tsx +56 -0
- package/src/ui/styled/LoginForm.tsx +134 -0
- package/src/ui/styled/Markdown.tsx +103 -0
- package/src/ui/styled/MembershipCheckout.tsx +197 -0
- package/src/ui/styled/MembershipTiers.tsx +115 -0
- package/src/ui/styled/OfferButton.tsx +181 -0
- package/src/ui/styled/PageActions.tsx +124 -0
- package/src/ui/styled/PaymentLinkConfirmation.tsx +50 -0
- package/src/ui/styled/PaymentLinkPayment.tsx +85 -0
- package/src/ui/styled/Paywall.tsx +54 -0
- package/src/ui/styled/PlayButton.tsx +48 -0
- package/src/ui/styled/PodcastEpisode.tsx +137 -0
- package/src/ui/styled/PodcastList.tsx +58 -0
- package/src/ui/styled/PodcastShow.tsx +164 -0
- package/src/ui/styled/PostsFeed.tsx +63 -0
- package/src/ui/styled/ProductDetail.tsx +616 -0
- package/src/ui/styled/ProductGrid.tsx +82 -0
- package/src/ui/styled/PushOptIn.tsx +65 -0
- package/src/ui/styled/PwaRegistration.tsx +58 -0
- package/src/ui/styled/ReactionBar.tsx +93 -0
- package/src/ui/styled/ReplayList.tsx +134 -0
- package/src/ui/styled/ResetPasswordForm.tsx +127 -0
- package/src/ui/styled/ReviewForm.tsx +292 -0
- package/src/ui/styled/ReviewsSection.tsx +260 -0
- package/src/ui/styled/SectionedFormRenderer.tsx +146 -0
- package/src/ui/styled/SignupForm.tsx +109 -0
- package/src/ui/styled/UserMenu.tsx +166 -0
- package/src/ui/styled/chat/ChatAttachments.tsx +172 -0
- package/src/ui/styled/chat/ChatComposer.tsx +153 -0
- package/src/ui/styled/chat/ChatThreadPanel.tsx +94 -0
- package/src/ui/styled/chat/MessageBubble.tsx +66 -0
- package/src/ui/styled/chat/NewDmDialog.tsx +78 -0
- package/src/ui/styled/community/CommunityComposer.tsx +358 -0
- package/src/ui/styled/community/CommunityFeed.tsx +483 -0
- package/src/ui/styled/community/CommunityLeaderboard.tsx +109 -0
- package/src/ui/styled/community/CommunityMediaGallery.tsx +116 -0
- package/src/ui/styled/community/CommunityMemberProfile.tsx +285 -0
- package/src/ui/styled/community/CommunityNotifications.tsx +222 -0
- package/src/ui/styled/community/CommunityPostCard.tsx +165 -0
- package/src/ui/styled/community/CommunityPostDetail.tsx +337 -0
- package/src/ui/styled/community/CommunityReactionBar.tsx +107 -0
- package/src/ui/styled/community/CommunityRichText.tsx +157 -0
- package/src/ui/styled/community/CommunitySpaces.tsx +174 -0
- package/src/ui/styled/community/MemberAvatar.tsx +74 -0
- package/src/ui/styled/community/index.ts +23 -0
- package/src/ui/styled/community/util.ts +15 -0
- package/src/ui/styled/members/MemberHomeLayout.tsx +98 -0
- package/src/ui/styled/members/MemberPostCard.tsx +392 -0
- package/src/ui/styled/members/MemberPostsFeed.tsx +219 -0
- package/src/ui/styled/members/PostCollectionDetail.tsx +227 -0
- package/src/ui/styled/members/PostCollectionsGrid.tsx +287 -0
- package/src/ui/styled/members/index.ts +7 -0
- package/src/ui/styled/rich-text.css +150 -0
- package/src/ui/styled/work/WorkInviteAccept.tsx +222 -0
- package/src/ui/styled/work/WorkPortalProjects.tsx +163 -0
- package/src/ui/styled/work/WorkProjectInvoices.tsx +113 -0
- package/src/ui/styled/work/WorkProjectReport.tsx +66 -0
- package/src/ui/styled/work/WorkReportBody.tsx +327 -0
- package/src/ui/styled/work/WorkTaskAttachments.tsx +67 -0
- package/src/ui/styled/work/WorkTaskComments.tsx +151 -0
- package/src/ui/styled/work/WorkTaskDetail.tsx +92 -0
- package/src/ui/styled/work/WorkTokenReport.tsx +49 -0
- package/src/ui/styled/work/index.ts +10 -0
- package/src/ui/theme/ForgeThemeProvider.tsx +121 -0
- package/src/ui/theme/contrast.ts +22 -0
- package/src/utils/analyticsBus.ts +31 -0
- package/src/utils/attribution.ts +68 -0
- package/src/utils/cookieConsent.ts +83 -0
- package/src/utils/landing.ts +153 -0
- package/src/utils/metaPixel.ts +122 -0
- package/src/utils/structuredData.ts +126 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { Lock, MessageCircle, Pin } from "lucide-react";
|
|
2
|
+
import { useThemeTokens } from "../../theme/ForgeThemeProvider";
|
|
3
|
+
import { communityMemberName, type CommunityPost } from "../../../data/queries/useCommunity";
|
|
4
|
+
import { CommunityRichText } from "./CommunityRichText";
|
|
5
|
+
import { CommunityMediaGallery } from "./CommunityMediaGallery";
|
|
6
|
+
import { CommunityReactionBar } from "./CommunityReactionBar";
|
|
7
|
+
import { LevelBadge, MemberAvatar } from "./MemberAvatar";
|
|
8
|
+
import { timeAgo } from "./util";
|
|
9
|
+
|
|
10
|
+
export interface CommunityPostCardProps {
|
|
11
|
+
post: CommunityPost;
|
|
12
|
+
/** "feed" renders the full body inline; "forum" renders a compact title row. */
|
|
13
|
+
variant: "feed" | "forum";
|
|
14
|
+
onOpen?: (post: CommunityPost) => void;
|
|
15
|
+
onOpenProfile?: (accountId: string) => void;
|
|
16
|
+
onReact?: (emoji: string) => void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** One post in a space — card (feed spaces) or compact row (forum spaces). */
|
|
20
|
+
export function CommunityPostCard({ post, variant, onOpen, onOpenProfile, onReact }: CommunityPostCardProps) {
|
|
21
|
+
const t = useThemeTokens();
|
|
22
|
+
const border = `1px solid ${t.border}`;
|
|
23
|
+
const author = post.author;
|
|
24
|
+
|
|
25
|
+
const meta = (
|
|
26
|
+
<div style={{ display: "flex", alignItems: "center", gap: 8, minWidth: 0 }}>
|
|
27
|
+
<MemberAvatar member={author} size={variant === "feed" ? 36 : 28} onClick={() => author && onOpenProfile?.(author.accountId)} />
|
|
28
|
+
<div style={{ minWidth: 0 }}>
|
|
29
|
+
<div style={{ display: "flex", alignItems: "center", gap: 6 }}>
|
|
30
|
+
<button
|
|
31
|
+
onClick={() => author && onOpenProfile?.(author.accountId)}
|
|
32
|
+
style={{
|
|
33
|
+
background: "none",
|
|
34
|
+
border: "none",
|
|
35
|
+
padding: 0,
|
|
36
|
+
cursor: "pointer",
|
|
37
|
+
color: t.text,
|
|
38
|
+
fontWeight: 600,
|
|
39
|
+
fontSize: 14,
|
|
40
|
+
whiteSpace: "nowrap",
|
|
41
|
+
overflow: "hidden",
|
|
42
|
+
textOverflow: "ellipsis",
|
|
43
|
+
}}
|
|
44
|
+
>
|
|
45
|
+
{communityMemberName(author)}
|
|
46
|
+
</button>
|
|
47
|
+
<LevelBadge level={author?.level} />
|
|
48
|
+
{author?.role === "moderator" && (
|
|
49
|
+
<span style={{ fontSize: 10, fontWeight: 700, color: t.muted, textTransform: "uppercase" }}>Mod</span>
|
|
50
|
+
)}
|
|
51
|
+
</div>
|
|
52
|
+
<div style={{ fontSize: 12, color: t.muted }}>{timeAgo(post.createdAt)}</div>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
const badges = (
|
|
58
|
+
<span style={{ display: "inline-flex", gap: 6, alignItems: "center" }}>
|
|
59
|
+
{post.isPinned && <Pin size={14} style={{ color: t.primary }} aria-label="Pinned" />}
|
|
60
|
+
{post.isLocked && <Lock size={14} style={{ color: t.muted }} aria-label="Locked" />}
|
|
61
|
+
</span>
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
if (variant === "forum") {
|
|
65
|
+
return (
|
|
66
|
+
<div
|
|
67
|
+
style={{
|
|
68
|
+
border,
|
|
69
|
+
borderRadius: t.cornerRadius,
|
|
70
|
+
background: t.surface,
|
|
71
|
+
padding: "10px 14px",
|
|
72
|
+
display: "flex",
|
|
73
|
+
alignItems: "center",
|
|
74
|
+
gap: 12,
|
|
75
|
+
}}
|
|
76
|
+
>
|
|
77
|
+
<div style={{ flex: 1, minWidth: 0 }}>
|
|
78
|
+
<button
|
|
79
|
+
onClick={() => onOpen?.(post)}
|
|
80
|
+
style={{
|
|
81
|
+
background: "none",
|
|
82
|
+
border: "none",
|
|
83
|
+
padding: 0,
|
|
84
|
+
cursor: "pointer",
|
|
85
|
+
color: t.text,
|
|
86
|
+
fontWeight: 700,
|
|
87
|
+
fontSize: 15,
|
|
88
|
+
textAlign: "left",
|
|
89
|
+
display: "flex",
|
|
90
|
+
alignItems: "center",
|
|
91
|
+
gap: 6,
|
|
92
|
+
}}
|
|
93
|
+
>
|
|
94
|
+
{badges}
|
|
95
|
+
<span style={{ overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>
|
|
96
|
+
{post.title || post.bodyText?.slice(0, 80) || "Untitled"}
|
|
97
|
+
</span>
|
|
98
|
+
</button>
|
|
99
|
+
<div style={{ display: "flex", alignItems: "center", gap: 8, marginTop: 4, fontSize: 12, color: t.muted }}>
|
|
100
|
+
<span>{communityMemberName(author)}</span>
|
|
101
|
+
<span>·</span>
|
|
102
|
+
<span>{timeAgo(post.lastActivityAt ?? post.createdAt)}</span>
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
<div style={{ display: "flex", alignItems: "center", gap: 12, fontSize: 13, color: t.muted, flexShrink: 0 }}>
|
|
106
|
+
<span style={{ display: "inline-flex", alignItems: "center", gap: 4 }}>
|
|
107
|
+
<MessageCircle size={14} /> {post.replyCount}
|
|
108
|
+
</span>
|
|
109
|
+
<span>{post.reactionCount > 0 ? `${post.reactionCount} 👍` : ""}</span>
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return (
|
|
116
|
+
<article style={{ border, borderRadius: t.cornerRadius, background: t.surface, padding: 16 }}>
|
|
117
|
+
<header style={{ display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8 }}>
|
|
118
|
+
{meta}
|
|
119
|
+
{badges}
|
|
120
|
+
</header>
|
|
121
|
+
|
|
122
|
+
{post.title && (
|
|
123
|
+
<h3
|
|
124
|
+
onClick={() => onOpen?.(post)}
|
|
125
|
+
style={{
|
|
126
|
+
margin: "10px 0 4px",
|
|
127
|
+
fontSize: 17,
|
|
128
|
+
fontFamily: t.headingFontFamily,
|
|
129
|
+
color: t.text,
|
|
130
|
+
cursor: onOpen ? "pointer" : undefined,
|
|
131
|
+
}}
|
|
132
|
+
>
|
|
133
|
+
{post.title}
|
|
134
|
+
</h3>
|
|
135
|
+
)}
|
|
136
|
+
|
|
137
|
+
<div style={{ marginTop: post.title ? 0 : 10 }}>
|
|
138
|
+
<CommunityRichText body={post.body} clampLines={8} />
|
|
139
|
+
</div>
|
|
140
|
+
<CommunityMediaGallery media={post.media ?? []} />
|
|
141
|
+
|
|
142
|
+
<footer style={{ marginTop: 12 }}>
|
|
143
|
+
<CommunityReactionBar reactions={post.reactions ?? []} onToggle={(emoji) => onReact?.(emoji)}>
|
|
144
|
+
<button
|
|
145
|
+
onClick={() => onOpen?.(post)}
|
|
146
|
+
style={{
|
|
147
|
+
display: "inline-flex",
|
|
148
|
+
alignItems: "center",
|
|
149
|
+
gap: 4,
|
|
150
|
+
background: "none",
|
|
151
|
+
border: "none",
|
|
152
|
+
cursor: "pointer",
|
|
153
|
+
color: t.muted,
|
|
154
|
+
fontSize: 13,
|
|
155
|
+
padding: "2px 4px",
|
|
156
|
+
}}
|
|
157
|
+
>
|
|
158
|
+
<MessageCircle size={14} />
|
|
159
|
+
{post.replyCount > 0 ? `${post.replyCount} ${post.replyCount === 1 ? "reply" : "replies"}` : "Reply"}
|
|
160
|
+
</button>
|
|
161
|
+
</CommunityReactionBar>
|
|
162
|
+
</footer>
|
|
163
|
+
</article>
|
|
164
|
+
);
|
|
165
|
+
}
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
import { useMemo, useState } from "react";
|
|
2
|
+
import { Flag, Lock } from "lucide-react";
|
|
3
|
+
import { useThemeTokens } from "../../theme/ForgeThemeProvider";
|
|
4
|
+
import { useCommunityThread } from "../../headless/community/useCommunityThread";
|
|
5
|
+
import { findReplyNode, type ReplyNode } from "../../headless/community/replyTree";
|
|
6
|
+
import {
|
|
7
|
+
communityMemberName,
|
|
8
|
+
useReportCommunityContent,
|
|
9
|
+
type CommunityReply,
|
|
10
|
+
} from "../../../data/queries/useCommunity";
|
|
11
|
+
import { Loading } from "../Loading";
|
|
12
|
+
import { CommunityComposer } from "./CommunityComposer";
|
|
13
|
+
import { CommunityMediaGallery } from "./CommunityMediaGallery";
|
|
14
|
+
import { CommunityReactionBar } from "./CommunityReactionBar";
|
|
15
|
+
import { CommunityRichText } from "./CommunityRichText";
|
|
16
|
+
import { LevelBadge, MemberAvatar } from "./MemberAvatar";
|
|
17
|
+
import { timeAgo } from "./util";
|
|
18
|
+
|
|
19
|
+
/** How many nesting levels are RENDERED before "Continue this thread". The
|
|
20
|
+
* data model nests without limit; this is purely a display cap. */
|
|
21
|
+
export const REPLY_DISPLAY_DEPTH = 3;
|
|
22
|
+
|
|
23
|
+
export interface CommunityPostDetailProps {
|
|
24
|
+
postId: string;
|
|
25
|
+
onOpenProfile?: (accountId: string) => void;
|
|
26
|
+
/** Receives the post's spaceId so "back" returns to that space's feed
|
|
27
|
+
* (not the spaces list). May be undefined before the post loads. */
|
|
28
|
+
onBack?: (spaceId?: string) => void;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Full post view: rich body + media, reactions, and the nested reply thread. */
|
|
32
|
+
export function CommunityPostDetail({ postId, onOpenProfile, onBack }: CommunityPostDetailProps) {
|
|
33
|
+
const t = useThemeTokens();
|
|
34
|
+
const thread = useCommunityThread(postId);
|
|
35
|
+
const report = useReportCommunityContent();
|
|
36
|
+
const border = `1px solid ${t.border}`;
|
|
37
|
+
|
|
38
|
+
// "Continue thread" re-roots the rendered tree on a deep reply (Reddit-style).
|
|
39
|
+
const [threadRootId, setThreadRootId] = useState<string | null>(null);
|
|
40
|
+
const [replyingTo, setReplyingTo] = useState<string | null>(null);
|
|
41
|
+
const [reported, setReported] = useState<Set<string>>(new Set());
|
|
42
|
+
|
|
43
|
+
const visibleTree = useMemo(() => {
|
|
44
|
+
if (!threadRootId) return thread.replyTree;
|
|
45
|
+
const node = findReplyNode(thread.replyTree, threadRootId);
|
|
46
|
+
return node ? [node] : thread.replyTree;
|
|
47
|
+
}, [thread.replyTree, threadRootId]);
|
|
48
|
+
|
|
49
|
+
if (thread.postLoading) return <Loading />;
|
|
50
|
+
|
|
51
|
+
if (!thread.post) {
|
|
52
|
+
return (
|
|
53
|
+
<div style={{ border, borderRadius: t.cornerRadius, padding: 32, textAlign: "center", color: t.muted }}>
|
|
54
|
+
This post is unavailable.
|
|
55
|
+
</div>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const post = thread.post;
|
|
60
|
+
const locked = post.isLocked;
|
|
61
|
+
|
|
62
|
+
const doReport = (entityId: string, entityType: "community_post" | "community_reply") => {
|
|
63
|
+
if (reported.has(entityId)) return;
|
|
64
|
+
report.mutate(
|
|
65
|
+
{ entityId, entityType },
|
|
66
|
+
{ onSuccess: () => setReported((prev) => new Set(prev).add(entityId)) },
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const reportButton = (entityId: string, entityType: "community_post" | "community_reply") => (
|
|
71
|
+
<button
|
|
72
|
+
onClick={() => doReport(entityId, entityType)}
|
|
73
|
+
title={reported.has(entityId) ? "Reported" : "Report to moderators"}
|
|
74
|
+
style={{
|
|
75
|
+
display: "inline-flex",
|
|
76
|
+
alignItems: "center",
|
|
77
|
+
gap: 4,
|
|
78
|
+
background: "none",
|
|
79
|
+
border: "none",
|
|
80
|
+
cursor: reported.has(entityId) ? "default" : "pointer",
|
|
81
|
+
color: t.muted,
|
|
82
|
+
fontSize: 12,
|
|
83
|
+
padding: "2px 4px",
|
|
84
|
+
opacity: reported.has(entityId) ? 0.6 : 1,
|
|
85
|
+
}}
|
|
86
|
+
>
|
|
87
|
+
<Flag size={12} />
|
|
88
|
+
{reported.has(entityId) ? "Reported" : "Report"}
|
|
89
|
+
</button>
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
const submitReply = async (input: {
|
|
93
|
+
body: unknown;
|
|
94
|
+
attachments: { url: string; type: "image" | "video" | "audio" | "document" | "other"; size: number; name?: string }[];
|
|
95
|
+
mentionedAccountIds: string[];
|
|
96
|
+
}) => {
|
|
97
|
+
await thread.createReply.mutateAsync({
|
|
98
|
+
body: input.body,
|
|
99
|
+
attachments: input.attachments,
|
|
100
|
+
mentionedAccountIds: input.mentionedAccountIds,
|
|
101
|
+
parentReplyId: replyingTo ?? undefined,
|
|
102
|
+
});
|
|
103
|
+
setReplyingTo(null);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const renderNode = (node: ReplyNode, renderedDepth: number): React.ReactNode => {
|
|
107
|
+
const reply = node.reply;
|
|
108
|
+
const capped = renderedDepth >= REPLY_DISPLAY_DEPTH - 1 && node.children.length > 0;
|
|
109
|
+
|
|
110
|
+
return (
|
|
111
|
+
<div key={reply.id} style={{ display: "flex", flexDirection: "column", gap: 8 }}>
|
|
112
|
+
<ReplyItem
|
|
113
|
+
reply={reply}
|
|
114
|
+
onOpenProfile={onOpenProfile}
|
|
115
|
+
onReact={(emoji) => thread.react("community_reply", reply.id, emoji)}
|
|
116
|
+
extraActions={
|
|
117
|
+
<>
|
|
118
|
+
{!locked && (
|
|
119
|
+
<button
|
|
120
|
+
onClick={() => setReplyingTo((prev) => (prev === reply.id ? null : reply.id))}
|
|
121
|
+
style={{
|
|
122
|
+
background: "none",
|
|
123
|
+
border: "none",
|
|
124
|
+
cursor: "pointer",
|
|
125
|
+
color: t.muted,
|
|
126
|
+
fontSize: 12,
|
|
127
|
+
padding: "2px 4px",
|
|
128
|
+
}}
|
|
129
|
+
>
|
|
130
|
+
Reply
|
|
131
|
+
</button>
|
|
132
|
+
)}
|
|
133
|
+
{reportButton(reply.id, "community_reply")}
|
|
134
|
+
</>
|
|
135
|
+
}
|
|
136
|
+
/>
|
|
137
|
+
|
|
138
|
+
{replyingTo === reply.id && (
|
|
139
|
+
<div style={{ marginLeft: 44 }}>
|
|
140
|
+
<CommunityComposer
|
|
141
|
+
compact
|
|
142
|
+
autoFocus
|
|
143
|
+
placeholder={`Reply to ${communityMemberName(reply.author)}…`}
|
|
144
|
+
submitLabel="Reply"
|
|
145
|
+
onSubmit={submitReply}
|
|
146
|
+
onCancel={() => setReplyingTo(null)}
|
|
147
|
+
/>
|
|
148
|
+
</div>
|
|
149
|
+
)}
|
|
150
|
+
|
|
151
|
+
{node.children.length > 0 && !capped && (
|
|
152
|
+
<div style={{ marginLeft: 20, paddingLeft: 16, borderLeft: `2px solid ${t.border}`, display: "flex", flexDirection: "column", gap: 8 }}>
|
|
153
|
+
{node.children.map((child) => renderNode(child, renderedDepth + 1))}
|
|
154
|
+
</div>
|
|
155
|
+
)}
|
|
156
|
+
|
|
157
|
+
{capped && (
|
|
158
|
+
<button
|
|
159
|
+
onClick={() => setThreadRootId(reply.id)}
|
|
160
|
+
style={{
|
|
161
|
+
alignSelf: "flex-start",
|
|
162
|
+
marginLeft: 44,
|
|
163
|
+
background: "none",
|
|
164
|
+
border: "none",
|
|
165
|
+
cursor: "pointer",
|
|
166
|
+
color: t.primary,
|
|
167
|
+
fontSize: 13,
|
|
168
|
+
fontWeight: 600,
|
|
169
|
+
padding: 0,
|
|
170
|
+
}}
|
|
171
|
+
>
|
|
172
|
+
Continue this thread ({countDescendants(node)} more) →
|
|
173
|
+
</button>
|
|
174
|
+
)}
|
|
175
|
+
</div>
|
|
176
|
+
);
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
return (
|
|
180
|
+
<div style={{ display: "flex", flexDirection: "column", gap: 16 }}>
|
|
181
|
+
{onBack && (
|
|
182
|
+
<button
|
|
183
|
+
onClick={() => onBack(thread.post?.spaceId)}
|
|
184
|
+
style={{
|
|
185
|
+
alignSelf: "flex-start",
|
|
186
|
+
background: "none",
|
|
187
|
+
border: "none",
|
|
188
|
+
cursor: "pointer",
|
|
189
|
+
color: t.text,
|
|
190
|
+
fontSize: 14,
|
|
191
|
+
padding: 0,
|
|
192
|
+
}}
|
|
193
|
+
>
|
|
194
|
+
← Back
|
|
195
|
+
</button>
|
|
196
|
+
)}
|
|
197
|
+
|
|
198
|
+
{/* Post */}
|
|
199
|
+
<article style={{ border, borderRadius: t.cornerRadius, background: t.surface, padding: 18 }}>
|
|
200
|
+
<header style={{ display: "flex", alignItems: "center", gap: 10 }}>
|
|
201
|
+
<MemberAvatar member={post.author} size={40} onClick={() => post.author && onOpenProfile?.(post.author.accountId)} />
|
|
202
|
+
<div style={{ minWidth: 0, flex: 1 }}>
|
|
203
|
+
<div style={{ display: "flex", alignItems: "center", gap: 6 }}>
|
|
204
|
+
<button
|
|
205
|
+
onClick={() => post.author && onOpenProfile?.(post.author.accountId)}
|
|
206
|
+
style={{ background: "none", border: "none", padding: 0, cursor: "pointer", color: t.text, fontWeight: 700, fontSize: 15 }}
|
|
207
|
+
>
|
|
208
|
+
{communityMemberName(post.author)}
|
|
209
|
+
</button>
|
|
210
|
+
<LevelBadge level={post.author?.level} />
|
|
211
|
+
</div>
|
|
212
|
+
<div style={{ fontSize: 12, color: t.muted }}>{timeAgo(post.createdAt)}</div>
|
|
213
|
+
</div>
|
|
214
|
+
{locked && (
|
|
215
|
+
<span style={{ display: "inline-flex", alignItems: "center", gap: 4, fontSize: 12, color: t.muted }}>
|
|
216
|
+
<Lock size={12} /> Locked
|
|
217
|
+
</span>
|
|
218
|
+
)}
|
|
219
|
+
</header>
|
|
220
|
+
|
|
221
|
+
{post.title && (
|
|
222
|
+
<h2 style={{ margin: "12px 0 6px", fontSize: 20, fontFamily: t.headingFontFamily, color: t.text }}>{post.title}</h2>
|
|
223
|
+
)}
|
|
224
|
+
<div style={{ marginTop: post.title ? 0 : 12 }}>
|
|
225
|
+
<CommunityRichText body={post.body} />
|
|
226
|
+
</div>
|
|
227
|
+
<CommunityMediaGallery media={post.media ?? []} />
|
|
228
|
+
|
|
229
|
+
<footer style={{ marginTop: 14 }}>
|
|
230
|
+
<CommunityReactionBar reactions={post.reactions ?? []} onToggle={(emoji) => thread.react("community_post", post.id, emoji)}>
|
|
231
|
+
{reportButton(post.id, "community_post")}
|
|
232
|
+
</CommunityReactionBar>
|
|
233
|
+
</footer>
|
|
234
|
+
</article>
|
|
235
|
+
|
|
236
|
+
{/* Top-level composer */}
|
|
237
|
+
{locked ? (
|
|
238
|
+
<div style={{ border, borderRadius: t.cornerRadius, padding: 14, textAlign: "center", color: t.muted, fontSize: 14 }}>
|
|
239
|
+
<Lock size={13} style={{ verticalAlign: -2, marginRight: 6 }} />
|
|
240
|
+
This post is locked — replies are closed.
|
|
241
|
+
</div>
|
|
242
|
+
) : (
|
|
243
|
+
!replyingTo && <CommunityComposer compact placeholder="Write a reply…" submitLabel="Reply" onSubmit={submitReply} />
|
|
244
|
+
)}
|
|
245
|
+
|
|
246
|
+
{/* Thread */}
|
|
247
|
+
<section style={{ display: "flex", flexDirection: "column", gap: 10 }}>
|
|
248
|
+
<div style={{ display: "flex", alignItems: "center", gap: 8 }}>
|
|
249
|
+
<h3 style={{ margin: 0, fontSize: 15, color: t.text }}>
|
|
250
|
+
{post.replyCount} {post.replyCount === 1 ? "reply" : "replies"}
|
|
251
|
+
</h3>
|
|
252
|
+
{threadRootId && (
|
|
253
|
+
<button
|
|
254
|
+
onClick={() => setThreadRootId(null)}
|
|
255
|
+
style={{ background: "none", border: "none", cursor: "pointer", color: t.primary, fontSize: 13, fontWeight: 600 }}
|
|
256
|
+
>
|
|
257
|
+
← View full thread
|
|
258
|
+
</button>
|
|
259
|
+
)}
|
|
260
|
+
</div>
|
|
261
|
+
|
|
262
|
+
{thread.repliesLoading && !thread.replies.length ? (
|
|
263
|
+
<Loading />
|
|
264
|
+
) : (
|
|
265
|
+
<div style={{ display: "flex", flexDirection: "column", gap: 10 }}>
|
|
266
|
+
{visibleTree.map((node) => renderNode(node, threadRootId ? 0 : node.depth))}
|
|
267
|
+
</div>
|
|
268
|
+
)}
|
|
269
|
+
|
|
270
|
+
{thread.hasMore && (
|
|
271
|
+
<button
|
|
272
|
+
onClick={() => thread.fetchNextPage()}
|
|
273
|
+
style={{
|
|
274
|
+
alignSelf: "center",
|
|
275
|
+
background: "none",
|
|
276
|
+
border,
|
|
277
|
+
borderRadius: t.cornerRadius,
|
|
278
|
+
padding: "6px 14px",
|
|
279
|
+
cursor: "pointer",
|
|
280
|
+
color: t.text,
|
|
281
|
+
fontSize: 13,
|
|
282
|
+
}}
|
|
283
|
+
>
|
|
284
|
+
Load more replies
|
|
285
|
+
</button>
|
|
286
|
+
)}
|
|
287
|
+
</section>
|
|
288
|
+
</div>
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
function countDescendants(node: ReplyNode): number {
|
|
293
|
+
return node.children.reduce((n, child) => n + 1 + countDescendants(child), 0);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
function ReplyItem({
|
|
297
|
+
reply,
|
|
298
|
+
onOpenProfile,
|
|
299
|
+
onReact,
|
|
300
|
+
extraActions,
|
|
301
|
+
}: {
|
|
302
|
+
reply: CommunityReply;
|
|
303
|
+
onOpenProfile?: (accountId: string) => void;
|
|
304
|
+
onReact: (emoji: string) => void;
|
|
305
|
+
extraActions?: React.ReactNode;
|
|
306
|
+
}) {
|
|
307
|
+
const t = useThemeTokens();
|
|
308
|
+
|
|
309
|
+
return (
|
|
310
|
+
<div style={{ display: "flex", gap: 10 }}>
|
|
311
|
+
<MemberAvatar member={reply.author} size={32} onClick={() => reply.author && onOpenProfile?.(reply.author.accountId)} />
|
|
312
|
+
<div style={{ flex: 1, minWidth: 0 }}>
|
|
313
|
+
<div style={{ display: "flex", alignItems: "center", gap: 6 }}>
|
|
314
|
+
<button
|
|
315
|
+
onClick={() => reply.author && onOpenProfile?.(reply.author.accountId)}
|
|
316
|
+
style={{ background: "none", border: "none", padding: 0, cursor: "pointer", color: t.text, fontWeight: 600, fontSize: 13 }}
|
|
317
|
+
>
|
|
318
|
+
{communityMemberName(reply.author)}
|
|
319
|
+
</button>
|
|
320
|
+
<LevelBadge level={reply.author?.level} />
|
|
321
|
+
<span style={{ fontSize: 11, color: t.muted }}>{timeAgo(reply.createdAt)}</span>
|
|
322
|
+
</div>
|
|
323
|
+
|
|
324
|
+
<div style={{ marginTop: 2 }}>
|
|
325
|
+
<CommunityRichText body={reply.body} />
|
|
326
|
+
</div>
|
|
327
|
+
<CommunityMediaGallery media={reply.media ?? []} />
|
|
328
|
+
|
|
329
|
+
<div style={{ marginTop: 6 }}>
|
|
330
|
+
<CommunityReactionBar reactions={reply.reactions ?? []} onToggle={onReact}>
|
|
331
|
+
{extraActions}
|
|
332
|
+
</CommunityReactionBar>
|
|
333
|
+
</div>
|
|
334
|
+
</div>
|
|
335
|
+
</div>
|
|
336
|
+
);
|
|
337
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { useThemeTokens } from "../../theme/ForgeThemeProvider";
|
|
3
|
+
import type { ReactionSummary } from "../../../data/queries/useCommunity";
|
|
4
|
+
|
|
5
|
+
/** The default quick-reaction set (👍 doubles as the legacy "like"). */
|
|
6
|
+
export const COMMUNITY_REACTION_EMOJIS = ["👍", "❤️", "🎉", "😂", "😮"] as const;
|
|
7
|
+
|
|
8
|
+
export interface CommunityReactionBarProps {
|
|
9
|
+
/** Per-emoji summary rows for THIS entity. */
|
|
10
|
+
reactions: ReactionSummary[];
|
|
11
|
+
/** Toggle handler — the backend flips the (member, entity, emoji) reaction. */
|
|
12
|
+
onToggle: (emoji: string) => void;
|
|
13
|
+
/** Extra inline actions rendered after the reactions (e.g. reply/report). */
|
|
14
|
+
children?: React.ReactNode;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Emoji reactions: existing reactions render as count chips (highlighted when
|
|
20
|
+
* you reacted); the "+" opens the default picker 👍❤️🎉😂😮. Toggle semantics
|
|
21
|
+
* match POST /public/community/:entityType/:id/react.
|
|
22
|
+
*/
|
|
23
|
+
export function CommunityReactionBar({ reactions, onToggle, children, disabled }: CommunityReactionBarProps) {
|
|
24
|
+
const t = useThemeTokens();
|
|
25
|
+
const [pickerOpen, setPickerOpen] = useState(false);
|
|
26
|
+
|
|
27
|
+
const chip = (active: boolean): React.CSSProperties => ({
|
|
28
|
+
display: "inline-flex",
|
|
29
|
+
alignItems: "center",
|
|
30
|
+
gap: 4,
|
|
31
|
+
border: `1px solid ${active ? t.primary : t.border}`,
|
|
32
|
+
background: active ? `${t.primary}1a` : "transparent",
|
|
33
|
+
color: active ? t.primary : t.text,
|
|
34
|
+
borderRadius: 999,
|
|
35
|
+
padding: "2px 8px",
|
|
36
|
+
fontSize: 13,
|
|
37
|
+
cursor: disabled ? "default" : "pointer",
|
|
38
|
+
lineHeight: 1.5,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const shown = reactions.filter((r) => r.count > 0);
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<div style={{ position: "relative", display: "flex", alignItems: "center", flexWrap: "wrap", gap: 6 }}>
|
|
45
|
+
{shown.map((r) => (
|
|
46
|
+
<button
|
|
47
|
+
key={r.emoji}
|
|
48
|
+
onClick={() => !disabled && onToggle(r.emoji)}
|
|
49
|
+
aria-pressed={r.reactedByMe}
|
|
50
|
+
style={chip(r.reactedByMe)}
|
|
51
|
+
>
|
|
52
|
+
<span aria-hidden>{r.emoji}</span>
|
|
53
|
+
<span style={{ fontWeight: 600 }}>{r.count}</span>
|
|
54
|
+
</button>
|
|
55
|
+
))}
|
|
56
|
+
|
|
57
|
+
<button
|
|
58
|
+
onClick={() => !disabled && setPickerOpen((v) => !v)}
|
|
59
|
+
aria-label="Add reaction"
|
|
60
|
+
style={{ ...chip(false), color: t.muted }}
|
|
61
|
+
>
|
|
62
|
+
{shown.length ? "+" : "🙂 React"}
|
|
63
|
+
</button>
|
|
64
|
+
|
|
65
|
+
{pickerOpen && (
|
|
66
|
+
<div
|
|
67
|
+
style={{
|
|
68
|
+
position: "absolute",
|
|
69
|
+
bottom: "calc(100% + 6px)",
|
|
70
|
+
left: 0,
|
|
71
|
+
display: "flex",
|
|
72
|
+
gap: 2,
|
|
73
|
+
background: t.surface,
|
|
74
|
+
border: `1px solid ${t.border}`,
|
|
75
|
+
borderRadius: 999,
|
|
76
|
+
padding: "4px 6px",
|
|
77
|
+
boxShadow: "0 4px 16px rgba(0,0,0,0.12)",
|
|
78
|
+
zIndex: 20,
|
|
79
|
+
}}
|
|
80
|
+
>
|
|
81
|
+
{COMMUNITY_REACTION_EMOJIS.map((emoji) => (
|
|
82
|
+
<button
|
|
83
|
+
key={emoji}
|
|
84
|
+
onClick={() => {
|
|
85
|
+
onToggle(emoji);
|
|
86
|
+
setPickerOpen(false);
|
|
87
|
+
}}
|
|
88
|
+
aria-label={`React ${emoji}`}
|
|
89
|
+
style={{
|
|
90
|
+
background: "transparent",
|
|
91
|
+
border: "none",
|
|
92
|
+
fontSize: 18,
|
|
93
|
+
cursor: "pointer",
|
|
94
|
+
padding: "2px 4px",
|
|
95
|
+
borderRadius: 8,
|
|
96
|
+
}}
|
|
97
|
+
>
|
|
98
|
+
{emoji}
|
|
99
|
+
</button>
|
|
100
|
+
))}
|
|
101
|
+
</div>
|
|
102
|
+
)}
|
|
103
|
+
|
|
104
|
+
{children}
|
|
105
|
+
</div>
|
|
106
|
+
);
|
|
107
|
+
}
|