@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,88 @@
|
|
|
1
|
+
import type { CSSProperties } from "react";
|
|
2
|
+
import { Users } from "lucide-react";
|
|
3
|
+
import { useCommunities } from "../../headless/communities/useCommunity";
|
|
4
|
+
import { communityAboutPath } from "../../headless/communities/paths";
|
|
5
|
+
import type { PublicCommunity } from "../../../data/queries/useCommunities";
|
|
6
|
+
import { useForgeT } from "../../../i18n";
|
|
7
|
+
import { Loading } from "../Loading";
|
|
8
|
+
import { useCommunityStyles } from "./shared";
|
|
9
|
+
|
|
10
|
+
export interface CommunitiesListProps {
|
|
11
|
+
/** SPA navigation adapter. Defaults to a full-page visit. */
|
|
12
|
+
navigate?: (href: string) => void;
|
|
13
|
+
/** Where a community card leads. Default its About page, `/i/communities/<slug>`. */
|
|
14
|
+
getCommunityHref?: (community: PublicCommunity) => string;
|
|
15
|
+
/** Optional page heading. Pass `null` to omit. */
|
|
16
|
+
heading?: string | null;
|
|
17
|
+
className?: string;
|
|
18
|
+
style?: CSSProperties;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Every community on the profile, as cards. Built on `useCommunities()`. */
|
|
22
|
+
export function CommunitiesList({ navigate, getCommunityHref, heading, className, style }: CommunitiesListProps) {
|
|
23
|
+
const tr = useForgeT();
|
|
24
|
+
const { t, card } = useCommunityStyles();
|
|
25
|
+
const { communities, isLoading } = useCommunities();
|
|
26
|
+
const go = navigate ?? ((href: string) => window.location.assign(href));
|
|
27
|
+
const hrefOf = getCommunityHref ?? ((community: PublicCommunity) => communityAboutPath(community.slug));
|
|
28
|
+
const resolvedHeading = heading === null ? null : (heading ?? tr("forge.communities_list.heading"));
|
|
29
|
+
|
|
30
|
+
if (isLoading) return <Loading fullPage />;
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<div className={className} style={{ color: t.text, fontFamily: t.fontFamily, ...style }}>
|
|
34
|
+
{resolvedHeading && (
|
|
35
|
+
<h1 style={{ fontSize: 30, fontWeight: 800, marginBottom: 24, fontFamily: t.headingFontFamily }}>
|
|
36
|
+
{resolvedHeading}
|
|
37
|
+
</h1>
|
|
38
|
+
)}
|
|
39
|
+
{communities.length === 0 ? (
|
|
40
|
+
<p style={{ opacity: 0.8 }}>{tr("forge.communities_list.empty")}</p>
|
|
41
|
+
) : (
|
|
42
|
+
<div className="fg:grid fg:grid-cols-1 fg:gap-5 fg:sm:grid-cols-2 fg:lg:grid-cols-3">
|
|
43
|
+
{communities.map((community) => (
|
|
44
|
+
<button
|
|
45
|
+
key={community.id}
|
|
46
|
+
type="button"
|
|
47
|
+
data-testid="community-card"
|
|
48
|
+
onClick={() => go(hrefOf(community))}
|
|
49
|
+
className="fg:flex fg:flex-col fg:text-left"
|
|
50
|
+
style={{ ...card, padding: 0, overflow: "hidden", cursor: "pointer", font: "inherit" }}
|
|
51
|
+
>
|
|
52
|
+
<div
|
|
53
|
+
style={{
|
|
54
|
+
height: 140,
|
|
55
|
+
background: community.coverUrl ? `center / cover no-repeat url(${JSON.stringify(community.coverUrl)})` : `${t.primary}22`,
|
|
56
|
+
}}
|
|
57
|
+
/>
|
|
58
|
+
<div className="fg:flex fg:flex-col fg:gap-2" style={{ padding: 16 }}>
|
|
59
|
+
<div className="fg:flex fg:items-center fg:gap-3">
|
|
60
|
+
{community.logoUrl && (
|
|
61
|
+
<img
|
|
62
|
+
src={community.logoUrl}
|
|
63
|
+
alt=""
|
|
64
|
+
style={{ width: 36, height: 36, borderRadius: "50%", objectFit: "cover", flexShrink: 0 }}
|
|
65
|
+
/>
|
|
66
|
+
)}
|
|
67
|
+
<h2 style={{ fontSize: 18, fontWeight: 700, margin: 0, fontFamily: t.headingFontFamily }}>
|
|
68
|
+
{community.name}
|
|
69
|
+
</h2>
|
|
70
|
+
</div>
|
|
71
|
+
{community.category && <span style={{ fontSize: 12, color: t.muted }}>{community.category}</span>}
|
|
72
|
+
{community.description && (
|
|
73
|
+
<p style={{ fontSize: 14, opacity: 0.85, margin: 0 }} className="fg:line-clamp-3">
|
|
74
|
+
{community.description}
|
|
75
|
+
</p>
|
|
76
|
+
)}
|
|
77
|
+
<span className="fg:flex fg:items-center fg:gap-1" style={{ fontSize: 13, color: t.muted }}>
|
|
78
|
+
<Users size={14} />
|
|
79
|
+
{tr("forge.communities_list.member_count", { count: community.memberCount })}
|
|
80
|
+
</span>
|
|
81
|
+
</div>
|
|
82
|
+
</button>
|
|
83
|
+
))}
|
|
84
|
+
</div>
|
|
85
|
+
)}
|
|
86
|
+
</div>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import type { CSSProperties } from "react";
|
|
2
|
+
import { Users } from "lucide-react";
|
|
3
|
+
import { useCommunityAbout, type UseCommunityAboutOptions } from "../../headless/communities/useCommunityAbout";
|
|
4
|
+
import { useForgeT } from "../../../i18n";
|
|
5
|
+
import { useAmountFormatter } from "../../format/useFormatCurrency";
|
|
6
|
+
import { membershipPriceLabel } from "../../format/membershipPriceLabel";
|
|
7
|
+
import { Loading } from "../Loading";
|
|
8
|
+
import { CommunityJoinSheet } from "./CommunityJoinSheet";
|
|
9
|
+
import { CommunityPublicWiki } from "./CommunityPublicWiki";
|
|
10
|
+
import { useCommunityStyles } from "./shared";
|
|
11
|
+
|
|
12
|
+
export interface CommunityAboutProps extends UseCommunityAboutOptions {
|
|
13
|
+
/** Format a tier price for display. Defaults to the runtime currency formatter. */
|
|
14
|
+
formatAmount?: (amount: number) => string;
|
|
15
|
+
className?: string;
|
|
16
|
+
style?: CSSProperties;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A community's About page: cover, name, member count, description, what each
|
|
21
|
+
* tier gives, and one main button. For a visitor it is Join, which opens the
|
|
22
|
+
* join sheet IN PLACE; for a member it goes inside; for a pending applicant it
|
|
23
|
+
* goes to the pending screen. `?invite=` and `?join=` open the sheet straight
|
|
24
|
+
* away. The community's public wiki pages follow, readable in place. Must sit
|
|
25
|
+
* inside `<CommunityProvider>`. Built on `useCommunityAbout`.
|
|
26
|
+
*/
|
|
27
|
+
export function CommunityAbout({ formatAmount, className, style, ...options }: CommunityAboutProps) {
|
|
28
|
+
const tr = useForgeT();
|
|
29
|
+
const { t, card, button, ghostButton, muted } = useCommunityStyles();
|
|
30
|
+
const fmt = useAmountFormatter(formatAmount);
|
|
31
|
+
const about = useCommunityAbout(options);
|
|
32
|
+
|
|
33
|
+
if (about.isLoading && !about.community) return <Loading fullPage />;
|
|
34
|
+
if (about.notFound || !about.community) {
|
|
35
|
+
return <p style={{ color: t.text }}>{tr("forge.community_about.not_found")}</p>;
|
|
36
|
+
}
|
|
37
|
+
const community = about.community;
|
|
38
|
+
const offer = about.joinOffer;
|
|
39
|
+
const mainLabel =
|
|
40
|
+
about.action === "enter"
|
|
41
|
+
? tr("forge.community_about.go_inside")
|
|
42
|
+
: about.action === "pending"
|
|
43
|
+
? tr("forge.community_about.view_application")
|
|
44
|
+
: offer?.kind === "free"
|
|
45
|
+
? tr("forge.community_about.join_free")
|
|
46
|
+
: offer?.kind === "paid"
|
|
47
|
+
? tr(offer.cycle === "year" ? "forge.community_about.join_from_yearly" : "forge.community_about.join_from", { amount: fmt(offer.amount) })
|
|
48
|
+
: offer?.kind === "apply"
|
|
49
|
+
? tr("forge.community_about.apply")
|
|
50
|
+
: tr("forge.community_about.join");
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<div className={className} style={{ color: t.text, fontFamily: t.fontFamily, ...style }}>
|
|
54
|
+
<div
|
|
55
|
+
style={{
|
|
56
|
+
height: 220,
|
|
57
|
+
borderRadius: t.cornerRadius,
|
|
58
|
+
marginBottom: 24,
|
|
59
|
+
background: community.coverUrl ? `center / cover no-repeat url(${JSON.stringify(community.coverUrl)})` : `${t.primary}22`,
|
|
60
|
+
}}
|
|
61
|
+
/>
|
|
62
|
+
<div className="fg:flex fg:flex-col fg:gap-6 fg:md:flex-row fg:md:items-start">
|
|
63
|
+
<div className="fg:flex fg:min-w-0 fg:flex-1 fg:flex-col fg:gap-3">
|
|
64
|
+
<div className="fg:flex fg:items-center fg:gap-3">
|
|
65
|
+
{community.logoUrl && (
|
|
66
|
+
<img src={community.logoUrl} alt="" style={{ width: 56, height: 56, borderRadius: "50%", objectFit: "cover" }} />
|
|
67
|
+
)}
|
|
68
|
+
<div>
|
|
69
|
+
<h1 style={{ fontSize: 30, fontWeight: 800, margin: 0, fontFamily: t.headingFontFamily }}>{community.name}</h1>
|
|
70
|
+
<p className="fg:flex fg:items-center fg:gap-1" style={muted}>
|
|
71
|
+
<Users size={14} />
|
|
72
|
+
{tr("forge.community_about.member_count", { count: community.memberCount })}
|
|
73
|
+
{community.category ? ` · ${community.category}` : ""}
|
|
74
|
+
</p>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
{community.description && <p style={{ whiteSpace: "pre-line", lineHeight: 1.6 }}>{community.description}</p>}
|
|
78
|
+
{about.isPending && (
|
|
79
|
+
<p role="status" data-testid="community-about-pending" style={{ fontWeight: 600 }}>
|
|
80
|
+
{tr("forge.community_about.pending")}
|
|
81
|
+
</p>
|
|
82
|
+
)}
|
|
83
|
+
</div>
|
|
84
|
+
<div className="fg:w-full fg:md:w-[320px]" style={{ ...card, flexShrink: 0 }}>
|
|
85
|
+
<button type="button" data-testid="community-about-primary" onClick={about.primary} style={{ ...button, width: "100%" }}>
|
|
86
|
+
{mainLabel}
|
|
87
|
+
</button>
|
|
88
|
+
</div>
|
|
89
|
+
</div>
|
|
90
|
+
|
|
91
|
+
{about.tiers.length > 0 && (
|
|
92
|
+
<section style={{ marginTop: 32 }}>
|
|
93
|
+
<h2 style={{ fontSize: 20, fontWeight: 700, marginBottom: 16, fontFamily: t.headingFontFamily }}>
|
|
94
|
+
{tr("forge.community_about.tiers_title")}
|
|
95
|
+
</h2>
|
|
96
|
+
<div className="fg:grid fg:grid-cols-1 fg:gap-4 fg:sm:grid-cols-2 fg:lg:grid-cols-3">
|
|
97
|
+
{about.tiers.map((tier) => {
|
|
98
|
+
const current = about.membership?.tierId === tier.id;
|
|
99
|
+
return (
|
|
100
|
+
<div key={tier.id} data-testid="community-about-tier" className="fg:flex fg:flex-col fg:gap-2" style={card}>
|
|
101
|
+
<h3 style={{ fontSize: 17, fontWeight: 700, margin: 0 }}>{tier.name}</h3>
|
|
102
|
+
<p style={{ fontWeight: 700, color: t.primary }}>{membershipPriceLabel(tier, tr, fmt)}</p>
|
|
103
|
+
{tier.description && <p style={{ fontSize: 14, opacity: 0.85 }}>{tier.description}</p>}
|
|
104
|
+
{!!tier.benefits?.length && (
|
|
105
|
+
<ul className="fg:flex fg:flex-col fg:gap-1" style={{ listStyle: "none", padding: 0, margin: 0, fontSize: 14 }}>
|
|
106
|
+
{tier.benefits.map((benefit) => (
|
|
107
|
+
<li key={benefit.id} className="fg:flex fg:gap-2">
|
|
108
|
+
<span style={{ color: t.primary }}>✓</span>
|
|
109
|
+
{benefit.title}
|
|
110
|
+
</li>
|
|
111
|
+
))}
|
|
112
|
+
</ul>
|
|
113
|
+
)}
|
|
114
|
+
<div style={{ marginTop: "auto" }}>
|
|
115
|
+
{current ? (
|
|
116
|
+
<p style={muted}>{tr("forge.community_about.current_tier")}</p>
|
|
117
|
+
) : about.action === "join" ? (
|
|
118
|
+
<button type="button" style={{ ...ghostButton, width: "100%" }} onClick={() => about.openJoin(tier.id)}>
|
|
119
|
+
{tier.joinMode === "application" ? tr("forge.community_about.apply") : tr("forge.community_about.join_tier")}
|
|
120
|
+
</button>
|
|
121
|
+
) : null}
|
|
122
|
+
</div>
|
|
123
|
+
</div>
|
|
124
|
+
);
|
|
125
|
+
})}
|
|
126
|
+
</div>
|
|
127
|
+
</section>
|
|
128
|
+
)}
|
|
129
|
+
|
|
130
|
+
{/* The public wiki pages (the guidelines, by default), readable before joining. */}
|
|
131
|
+
<CommunityPublicWiki />
|
|
132
|
+
|
|
133
|
+
{about.sheetOpen && (
|
|
134
|
+
<CommunityJoinSheet
|
|
135
|
+
open={about.sheetOpen}
|
|
136
|
+
onOpenChange={about.setSheetOpen}
|
|
137
|
+
tierId={about.sheetTierId}
|
|
138
|
+
invite={about.invite}
|
|
139
|
+
join={about.join}
|
|
140
|
+
navigate={options.navigate}
|
|
141
|
+
/>
|
|
142
|
+
)}
|
|
143
|
+
</div>
|
|
144
|
+
);
|
|
145
|
+
}
|