@tribe-nest/forge 3.60.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/contexts/CartContext.tsx +34 -1
- 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 +10 -1
- package/src/data/queries/useCheckouts.ts +2 -1
- package/src/data/queries/useCoachingAvailability.ts +10 -1
- package/src/data/queries/useCommunities.ts +2 -0
- package/src/data/queries/useCommunity.ts +362 -18
- 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/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/useSiteApp.ts +130 -0
- package/src/data/queries/useSubscriptions.ts +6 -1
- package/src/i18n/de.json +746 -1
- package/src/i18n/en.json +746 -1
- package/src/index.ts +17 -0
- package/src/runtime/pages.spec.ts +5 -0
- package/src/runtime/pages.ts +32 -6
- 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/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/communityHarness.tsx +10 -3
- 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/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/useCommunityJoin.spec.tsx +228 -14
- package/src/ui/headless/_tests/useCommunityMembership.spec.tsx +29 -1
- package/src/ui/headless/_tests/useCommunityModeration.spec.tsx +420 -0
- package/src/ui/headless/_tests/useCommunityReads.spec.tsx +11 -2
- 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 +20 -1
- package/src/ui/headless/chat/useChatAttachmentUpload.ts +9 -6
- package/src/ui/headless/chat/useChatRoom.ts +35 -1
- package/src/ui/headless/communities/index.ts +41 -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 +3 -0
- package/src/ui/headless/communities/useCommunityJoin.ts +73 -23
- package/src/ui/headless/communities/useCommunityMembership.ts +48 -2
- package/src/ui/headless/communities/useCommunityWiki.ts +266 -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/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 +13 -0
- package/src/ui/headless/memberHome/index.ts +10 -0
- package/src/ui/headless/memberHome/memberHomeBar.ts +91 -0
- package/src/ui/headless/memberHome/useMemberHomeNav.ts +56 -18
- 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/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 +11 -0
- package/src/ui/styled/AccountDashboard.tsx +712 -352
- 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/MusicLinkPage.tsx +5 -5
- 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 +5 -5
- package/src/ui/styled/_tests/AccountNotifications.spec.tsx +135 -0
- package/src/ui/styled/_tests/DownloadPage.spec.tsx +68 -0
- 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/CommunityAbout.tsx +6 -1
- 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 +134 -11
- package/src/ui/styled/communities/CommunityJoinSheet.tsx +119 -19
- package/src/ui/styled/communities/CommunityMembershipMenu.tsx +168 -52
- package/src/ui/styled/communities/CommunityPublicWiki.tsx +75 -0
- package/src/ui/styled/communities/CommunityWiki.tsx +289 -0
- package/src/ui/styled/communities/MyMembershipsList.tsx +31 -5
- 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/CommunityWiki.spec.tsx +223 -0
- package/src/ui/styled/communities/index.ts +9 -0
- package/src/ui/styled/communities/shared.tsx +39 -11
- 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/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/index.ts +37 -2
- package/src/ui/styled/forge-utilities.css +234 -0
- package/src/ui/styled/members/CallRecordingActions.tsx +182 -0
- package/src/ui/styled/members/MemberCallsCalendar.tsx +13 -158
- package/src/ui/styled/members/MemberHomeLayout.tsx +295 -15
- package/src/ui/styled/members/MemberPostsFeed.tsx +3 -2
- 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/landing.ts +19 -6
- package/src/utils/metaEvents.ts +302 -0
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
import { useState, type CSSProperties, type MouseEvent } from "react";
|
|
2
|
+
import { Globe2, List, MapPin, Search, Users } from "lucide-react";
|
|
3
|
+
import { useThemeTokens } from "../../theme/ForgeThemeProvider";
|
|
4
|
+
import { useForgeLocale, useForgeT } from "../../../i18n";
|
|
5
|
+
import {
|
|
6
|
+
DIRECTORY_LEVELS,
|
|
7
|
+
DIRECTORY_SORTS,
|
|
8
|
+
memberLocationLabel,
|
|
9
|
+
useCommunityMemberDirectory,
|
|
10
|
+
type UseCommunityMemberDirectoryOptions,
|
|
11
|
+
} from "../../headless/community/useCommunityMembers";
|
|
12
|
+
import { countryName } from "../../headless/community/countries";
|
|
13
|
+
import { communityMemberName } from "../../../data/queries/useCommunity";
|
|
14
|
+
import type {
|
|
15
|
+
CommunityDirectoryMember,
|
|
16
|
+
CommunityDirectoryRole,
|
|
17
|
+
CommunityDirectorySort,
|
|
18
|
+
} from "../../../data/queries/useCommunityMembers";
|
|
19
|
+
import { CallHelpHint } from "../../media/CallHelpHint";
|
|
20
|
+
import { Loading } from "../Loading";
|
|
21
|
+
import { CommunityMemberGlobe } from "./CommunityMemberGlobe";
|
|
22
|
+
import { LevelBadge, MemberAvatar } from "./MemberAvatar";
|
|
23
|
+
|
|
24
|
+
export interface CommunityMembersProps extends UseCommunityMemberDirectoryOptions {
|
|
25
|
+
/** The address of a member's profile page, for the cards' links. */
|
|
26
|
+
getProfileHref: (accountId: string) => string;
|
|
27
|
+
/** SPA navigation adapter. Defaults to a plain link. */
|
|
28
|
+
navigate?: (href: string) => void;
|
|
29
|
+
className?: string;
|
|
30
|
+
style?: CSSProperties;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const SORT_KEYS: Record<CommunityDirectorySort, string> = {
|
|
34
|
+
active: "forge.community_members.sort_active",
|
|
35
|
+
points: "forge.community_members.sort_points",
|
|
36
|
+
newest: "forge.community_members.sort_newest",
|
|
37
|
+
name: "forge.community_members.sort_name",
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The Members tab of a community's member home: a searchable, filterable,
|
|
42
|
+
* paged directory of member cards, each opening the member's profile, and a
|
|
43
|
+
* Map view with a globe of the countries members chose to show. Members who
|
|
44
|
+
* opted out of the directory, or never opted in to the map, are left out by
|
|
45
|
+
* the server. Must sit inside `<CommunityProvider>`. Built on
|
|
46
|
+
* `useCommunityMemberDirectory`.
|
|
47
|
+
*/
|
|
48
|
+
export function CommunityMembers({ getProfileHref, navigate, className, style, ...options }: CommunityMembersProps) {
|
|
49
|
+
const t = useThemeTokens();
|
|
50
|
+
const tr = useForgeT();
|
|
51
|
+
const locale = useForgeLocale();
|
|
52
|
+
const dir = useCommunityMemberDirectory(options);
|
|
53
|
+
const border = `1px solid ${t.border}`;
|
|
54
|
+
|
|
55
|
+
const control: CSSProperties = {
|
|
56
|
+
height: 36,
|
|
57
|
+
padding: "0 10px",
|
|
58
|
+
borderRadius: t.cornerRadius,
|
|
59
|
+
border,
|
|
60
|
+
background: t.background,
|
|
61
|
+
color: t.text,
|
|
62
|
+
fontFamily: "inherit",
|
|
63
|
+
fontSize: 14,
|
|
64
|
+
};
|
|
65
|
+
const toggle = (active: boolean): CSSProperties => ({
|
|
66
|
+
display: "inline-flex",
|
|
67
|
+
alignItems: "center",
|
|
68
|
+
gap: 6,
|
|
69
|
+
padding: "6px 12px",
|
|
70
|
+
border: "none",
|
|
71
|
+
borderRadius: 999,
|
|
72
|
+
cursor: "pointer",
|
|
73
|
+
fontSize: 13,
|
|
74
|
+
fontWeight: 600,
|
|
75
|
+
fontFamily: "inherit",
|
|
76
|
+
background: active ? t.primary : "transparent",
|
|
77
|
+
color: active ? t.textPrimary : t.text,
|
|
78
|
+
});
|
|
79
|
+
const pager: CSSProperties = { ...control, height: 32, cursor: "pointer" };
|
|
80
|
+
|
|
81
|
+
if (dir.forbidden) {
|
|
82
|
+
return (
|
|
83
|
+
<div
|
|
84
|
+
className={className}
|
|
85
|
+
style={{ border, borderRadius: t.cornerRadius, padding: 28, textAlign: "center", color: t.muted, ...style }}
|
|
86
|
+
>
|
|
87
|
+
{tr("forge.community_members.forbidden")}
|
|
88
|
+
</div>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<div
|
|
94
|
+
data-testid="community-members"
|
|
95
|
+
className={className}
|
|
96
|
+
style={{ color: t.text, fontFamily: t.fontFamily, ...style }}
|
|
97
|
+
>
|
|
98
|
+
<div className="fg:flex fg:flex-col fg:gap-4">
|
|
99
|
+
<div className="fg:flex fg:flex-wrap fg:items-center fg:justify-between fg:gap-3">
|
|
100
|
+
<h2
|
|
101
|
+
className="fg:flex fg:items-center fg:gap-2"
|
|
102
|
+
style={{ margin: 0, fontSize: 18, fontFamily: t.headingFontFamily }}
|
|
103
|
+
>
|
|
104
|
+
<Users size={18} style={{ color: t.primary }} aria-hidden /> {tr("forge.community_members.title")}
|
|
105
|
+
</h2>
|
|
106
|
+
<div
|
|
107
|
+
role="group"
|
|
108
|
+
aria-label={tr("forge.community_members.view_label")}
|
|
109
|
+
style={{ display: "inline-flex", gap: 4, padding: 3, border, borderRadius: 999 }}
|
|
110
|
+
>
|
|
111
|
+
<button
|
|
112
|
+
type="button"
|
|
113
|
+
aria-pressed={dir.view === "list"}
|
|
114
|
+
style={toggle(dir.view === "list")}
|
|
115
|
+
onClick={() => dir.setView("list")}
|
|
116
|
+
>
|
|
117
|
+
<List size={14} aria-hidden /> {tr("forge.community_members.view_list")}
|
|
118
|
+
</button>
|
|
119
|
+
<button
|
|
120
|
+
type="button"
|
|
121
|
+
aria-pressed={dir.view === "map"}
|
|
122
|
+
style={toggle(dir.view === "map")}
|
|
123
|
+
onClick={() => dir.setView("map")}
|
|
124
|
+
>
|
|
125
|
+
<Globe2 size={14} aria-hidden /> {tr("forge.community_members.view_map")}
|
|
126
|
+
</button>
|
|
127
|
+
</div>
|
|
128
|
+
</div>
|
|
129
|
+
|
|
130
|
+
{dir.view === "map" ? (
|
|
131
|
+
<MemberMap dir={dir} />
|
|
132
|
+
) : (
|
|
133
|
+
<>
|
|
134
|
+
<div className="fg:flex fg:flex-col fg:gap-2 fg:sm:flex-row fg:sm:flex-wrap fg:sm:items-center">
|
|
135
|
+
<label
|
|
136
|
+
className="fg:flex fg:min-w-0 fg:flex-1 fg:items-center fg:gap-2"
|
|
137
|
+
style={{ ...control, minWidth: 180 }}
|
|
138
|
+
>
|
|
139
|
+
<Search size={15} style={{ color: t.muted, flexShrink: 0 }} aria-hidden />
|
|
140
|
+
<input
|
|
141
|
+
type="search"
|
|
142
|
+
value={dir.search}
|
|
143
|
+
onChange={(e) => dir.setSearch(e.target.value)}
|
|
144
|
+
placeholder={tr("forge.community_members.search_placeholder")}
|
|
145
|
+
aria-label={tr("forge.community_members.search_label")}
|
|
146
|
+
maxLength={80}
|
|
147
|
+
style={{
|
|
148
|
+
flex: 1,
|
|
149
|
+
minWidth: 0,
|
|
150
|
+
border: "none",
|
|
151
|
+
outline: "none",
|
|
152
|
+
background: "transparent",
|
|
153
|
+
color: t.text,
|
|
154
|
+
fontSize: 14,
|
|
155
|
+
fontFamily: "inherit",
|
|
156
|
+
}}
|
|
157
|
+
/>
|
|
158
|
+
</label>
|
|
159
|
+
<select
|
|
160
|
+
aria-label={tr("forge.community_members.role_label")}
|
|
161
|
+
value={dir.role ?? ""}
|
|
162
|
+
onChange={(e) => dir.setRole((e.target.value || null) as CommunityDirectoryRole | null)}
|
|
163
|
+
style={control}
|
|
164
|
+
>
|
|
165
|
+
<option value="">{tr("forge.community_members.role_any")}</option>
|
|
166
|
+
<option value="member">{tr("forge.community_members.role_member")}</option>
|
|
167
|
+
<option value="moderator">{tr("forge.community_members.role_moderator")}</option>
|
|
168
|
+
</select>
|
|
169
|
+
<select
|
|
170
|
+
aria-label={tr("forge.community_members.level_label")}
|
|
171
|
+
value={dir.minLevel ?? ""}
|
|
172
|
+
onChange={(e) => dir.setMinLevel(e.target.value ? Number(e.target.value) : null)}
|
|
173
|
+
style={control}
|
|
174
|
+
>
|
|
175
|
+
<option value="">{tr("forge.community_members.level_any")}</option>
|
|
176
|
+
{DIRECTORY_LEVELS.filter((level) => level > 1).map((level) => (
|
|
177
|
+
<option key={level} value={level}>
|
|
178
|
+
{tr("forge.community_members.level_min", { level })}
|
|
179
|
+
</option>
|
|
180
|
+
))}
|
|
181
|
+
</select>
|
|
182
|
+
<select
|
|
183
|
+
aria-label={tr("forge.community_members.sort_label")}
|
|
184
|
+
value={dir.sort}
|
|
185
|
+
onChange={(e) => dir.setSort(e.target.value as CommunityDirectorySort)}
|
|
186
|
+
style={control}
|
|
187
|
+
>
|
|
188
|
+
{DIRECTORY_SORTS.map((sort) => (
|
|
189
|
+
<option key={sort} value={sort}>
|
|
190
|
+
{tr(SORT_KEYS[sort])}
|
|
191
|
+
</option>
|
|
192
|
+
))}
|
|
193
|
+
</select>
|
|
194
|
+
</div>
|
|
195
|
+
|
|
196
|
+
{dir.isLoading ? (
|
|
197
|
+
<Loading />
|
|
198
|
+
) : dir.isError ? (
|
|
199
|
+
<p role="alert" style={{ margin: 0, fontWeight: 600 }}>
|
|
200
|
+
{tr("forge.community_members.error")}
|
|
201
|
+
</p>
|
|
202
|
+
) : dir.members.length === 0 ? (
|
|
203
|
+
<div style={{ border, borderRadius: t.cornerRadius, padding: 28, textAlign: "center", color: t.muted }}>
|
|
204
|
+
{tr(dir.filtered ? "forge.community_members.empty_filtered" : "forge.community_members.empty")}
|
|
205
|
+
</div>
|
|
206
|
+
) : (
|
|
207
|
+
<ul
|
|
208
|
+
className="fg:grid fg:grid-cols-1 fg:gap-3 fg:sm:grid-cols-2 fg:lg:grid-cols-3"
|
|
209
|
+
style={{ listStyle: "none", margin: 0, padding: 0, opacity: dir.isRefreshing ? 0.6 : 1 }}
|
|
210
|
+
>
|
|
211
|
+
{dir.members.map((member) => (
|
|
212
|
+
<MemberCard
|
|
213
|
+
key={member.accountId}
|
|
214
|
+
member={member}
|
|
215
|
+
href={getProfileHref(member.accountId)}
|
|
216
|
+
navigate={navigate}
|
|
217
|
+
locale={locale}
|
|
218
|
+
/>
|
|
219
|
+
))}
|
|
220
|
+
</ul>
|
|
221
|
+
)}
|
|
222
|
+
|
|
223
|
+
{(dir.hasPreviousPage || dir.hasNextPage) && (
|
|
224
|
+
<div className="fg:flex fg:items-center fg:justify-center fg:gap-3">
|
|
225
|
+
<button
|
|
226
|
+
type="button"
|
|
227
|
+
style={{ ...pager, opacity: dir.hasPreviousPage ? 1 : 0.4 }}
|
|
228
|
+
disabled={!dir.hasPreviousPage}
|
|
229
|
+
onClick={dir.previousPage}
|
|
230
|
+
>
|
|
231
|
+
{tr("forge.community_members.previous")}
|
|
232
|
+
</button>
|
|
233
|
+
<span style={{ fontSize: 12, color: t.muted }}>
|
|
234
|
+
{tr("forge.community_members.page", { page: dir.page })}
|
|
235
|
+
</span>
|
|
236
|
+
<button
|
|
237
|
+
type="button"
|
|
238
|
+
style={{ ...pager, opacity: dir.hasNextPage ? 1 : 0.4 }}
|
|
239
|
+
disabled={!dir.hasNextPage}
|
|
240
|
+
onClick={dir.nextPage}
|
|
241
|
+
>
|
|
242
|
+
{tr("forge.community_members.next")}
|
|
243
|
+
</button>
|
|
244
|
+
</div>
|
|
245
|
+
)}
|
|
246
|
+
</>
|
|
247
|
+
)}
|
|
248
|
+
</div>
|
|
249
|
+
</div>
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
function MemberCard({
|
|
254
|
+
member,
|
|
255
|
+
href,
|
|
256
|
+
navigate,
|
|
257
|
+
locale,
|
|
258
|
+
}: {
|
|
259
|
+
member: CommunityDirectoryMember;
|
|
260
|
+
href: string;
|
|
261
|
+
navigate?: (href: string) => void;
|
|
262
|
+
locale: string;
|
|
263
|
+
}) {
|
|
264
|
+
const t = useThemeTokens();
|
|
265
|
+
const tr = useForgeT();
|
|
266
|
+
const location = memberLocationLabel(member, locale);
|
|
267
|
+
const open = (e: MouseEvent<HTMLAnchorElement>) => {
|
|
268
|
+
if (!navigate) return;
|
|
269
|
+
e.preventDefault();
|
|
270
|
+
navigate(href);
|
|
271
|
+
};
|
|
272
|
+
return (
|
|
273
|
+
<li data-testid="community-member-card">
|
|
274
|
+
<a
|
|
275
|
+
href={href}
|
|
276
|
+
onClick={open}
|
|
277
|
+
className="fg:flex fg:items-center fg:gap-3"
|
|
278
|
+
style={{
|
|
279
|
+
border: `1px solid ${t.border}`,
|
|
280
|
+
borderRadius: t.cornerRadius,
|
|
281
|
+
background: t.surface,
|
|
282
|
+
padding: "12px 14px",
|
|
283
|
+
textDecoration: "none",
|
|
284
|
+
color: t.text,
|
|
285
|
+
height: "100%",
|
|
286
|
+
boxSizing: "border-box",
|
|
287
|
+
}}
|
|
288
|
+
>
|
|
289
|
+
<MemberAvatar member={member} size={44} />
|
|
290
|
+
<span className="fg:flex fg:min-w-0 fg:flex-1 fg:flex-col" style={{ gap: 2 }}>
|
|
291
|
+
<span className="fg:flex fg:items-center fg:gap-2" style={{ minWidth: 0 }}>
|
|
292
|
+
<span
|
|
293
|
+
style={{
|
|
294
|
+
fontWeight: 700,
|
|
295
|
+
fontSize: 14,
|
|
296
|
+
overflow: "hidden",
|
|
297
|
+
textOverflow: "ellipsis",
|
|
298
|
+
whiteSpace: "nowrap",
|
|
299
|
+
}}
|
|
300
|
+
>
|
|
301
|
+
{communityMemberName(member)}
|
|
302
|
+
</span>
|
|
303
|
+
<LevelBadge level={member.level} />
|
|
304
|
+
</span>
|
|
305
|
+
{member.role === "moderator" && (
|
|
306
|
+
<span style={{ fontSize: 10, fontWeight: 700, color: t.primary, textTransform: "uppercase" }}>
|
|
307
|
+
{tr("forge.community_members.role_badge_moderator")}
|
|
308
|
+
</span>
|
|
309
|
+
)}
|
|
310
|
+
{location && (
|
|
311
|
+
<span className="fg:flex fg:items-center fg:gap-1" style={{ fontSize: 12, color: t.muted, minWidth: 0 }}>
|
|
312
|
+
<MapPin size={12} aria-hidden style={{ flexShrink: 0 }} />
|
|
313
|
+
<span style={{ overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{location}</span>
|
|
314
|
+
</span>
|
|
315
|
+
)}
|
|
316
|
+
</span>
|
|
317
|
+
</a>
|
|
318
|
+
</li>
|
|
319
|
+
);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
function MemberMap({ dir }: { dir: ReturnType<typeof useCommunityMemberDirectory> }) {
|
|
323
|
+
const t = useThemeTokens();
|
|
324
|
+
const tr = useForgeT();
|
|
325
|
+
const locale = useForgeLocale();
|
|
326
|
+
const [unsupported, setUnsupported] = useState(false);
|
|
327
|
+
|
|
328
|
+
if (dir.mapLoading) return <Loading />;
|
|
329
|
+
if (dir.mapError) {
|
|
330
|
+
return (
|
|
331
|
+
<p role="alert" style={{ margin: 0, fontWeight: 600 }}>
|
|
332
|
+
{tr("forge.community_members.map_error")}
|
|
333
|
+
</p>
|
|
334
|
+
);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
return (
|
|
338
|
+
<section data-testid="community-member-map" className="fg:flex fg:flex-col fg:items-center fg:gap-4">
|
|
339
|
+
<div className="fg:flex fg:items-center fg:gap-2" style={{ fontSize: 13, color: t.muted }}>
|
|
340
|
+
{tr("forge.community_members.map_summary", { members: dir.mapMembers, countries: dir.mapCountries.length })}
|
|
341
|
+
<CallHelpHint label={tr("forge.community_members.map_help_label")}>
|
|
342
|
+
{tr("forge.community_members.map_help")}
|
|
343
|
+
</CallHelpHint>
|
|
344
|
+
</div>
|
|
345
|
+
{dir.mapCountries.length === 0 ? (
|
|
346
|
+
<div
|
|
347
|
+
style={{
|
|
348
|
+
border: `1px solid ${t.border}`,
|
|
349
|
+
borderRadius: t.cornerRadius,
|
|
350
|
+
padding: 28,
|
|
351
|
+
textAlign: "center",
|
|
352
|
+
color: t.muted,
|
|
353
|
+
width: "100%",
|
|
354
|
+
}}
|
|
355
|
+
>
|
|
356
|
+
{tr("forge.community_members.map_empty")}
|
|
357
|
+
</div>
|
|
358
|
+
) : (
|
|
359
|
+
<>
|
|
360
|
+
{!unsupported && dir.mapPoints.length > 0 && (
|
|
361
|
+
<CommunityMemberGlobe
|
|
362
|
+
points={dir.mapPoints}
|
|
363
|
+
label={tr("forge.community_members.globe_label")}
|
|
364
|
+
onUnsupported={() => setUnsupported(true)}
|
|
365
|
+
/>
|
|
366
|
+
)}
|
|
367
|
+
<ul
|
|
368
|
+
className="fg:grid fg:w-full fg:grid-cols-1 fg:gap-1 fg:sm:grid-cols-2"
|
|
369
|
+
style={{ listStyle: "none", margin: 0, padding: 0, fontSize: 14 }}
|
|
370
|
+
>
|
|
371
|
+
{dir.mapCountries.map((country) => (
|
|
372
|
+
<li
|
|
373
|
+
key={country.countryCode}
|
|
374
|
+
data-testid="community-member-map-country"
|
|
375
|
+
className="fg:flex fg:items-center fg:justify-between fg:gap-2"
|
|
376
|
+
style={{ padding: "6px 10px", borderBottom: `1px solid ${t.border}` }}
|
|
377
|
+
>
|
|
378
|
+
<span>{countryName(country.countryCode, locale)}</span>
|
|
379
|
+
<span style={{ fontWeight: 700, color: t.primary }}>{country.members}</span>
|
|
380
|
+
</li>
|
|
381
|
+
))}
|
|
382
|
+
</ul>
|
|
383
|
+
</>
|
|
384
|
+
)}
|
|
385
|
+
</section>
|
|
386
|
+
);
|
|
387
|
+
}
|