forked from hiero-ledger/hiero-website
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpage.tsx
More file actions
458 lines (407 loc) · 17.1 KB
/
page.tsx
File metadata and controls
458 lines (407 loc) · 17.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
"use client";
import { useEffect, useRef, useState } from "react";
import Image from "next/image";
import tscMembers from "@/data/technical_steering_committee.json";
interface Member {
firstName: string;
lastName: string;
gitHubAccount?: string;
photo?: string;
bio?: string;
}
const TECHNICAL_CHARTER_URL =
"https://github.com/hiero-ledger/governance/blob/main/hiero-technical-charter.md";
const MEETING_CALENDAR_URL =
"https://zoom-lfx.platform.linuxfoundation.org/meetings/hiero?view=week";
const governanceResources = [
{
title: "Technical Charter",
description:
"Read the formal scope, decision model, and operating rules for the Technical Steering Committee.",
href: TECHNICAL_CHARTER_URL,
},
{
title: "Governance Repository",
description:
"Track governance documents, committee updates, and cross-project policy changes on GitHub.",
href: "https://github.com/hiero-ledger/governance",
},
];
export default function TSCSection() {
const [selectedMember, setSelectedMember] = useState<Member | null>(null);
const modalRef = useRef<HTMLDivElement | null>(null);
const closeButtonRef = useRef<HTMLButtonElement | null>(null);
const lastFocusedTriggerIdRef = useRef<string | null>(null);
const sorted = [...(tscMembers as Member[])].sort((a, b) =>
`${a.lastName} ${a.firstName}`.localeCompare(
`${b.lastName} ${b.firstName}`,
),
);
useEffect(() => {
if (!selectedMember) {
return;
}
const focusCloseButton = window.setTimeout(() => {
closeButtonRef.current?.focus();
}, 0);
const handleKeyboardInteraction = (event: KeyboardEvent) => {
if (event.key === "Escape") {
setSelectedMember(null);
return;
}
if (event.key !== "Tab") {
return;
}
const focusableElements = getFocusableElements(modalRef.current);
trapFocusInModal(event, focusableElements);
};
document.body.style.overflow = "hidden";
window.addEventListener("keydown", handleKeyboardInteraction);
return () => {
window.clearTimeout(focusCloseButton);
document.body.style.overflow = "";
window.removeEventListener("keydown", handleKeyboardInteraction);
if (lastFocusedTriggerIdRef.current) {
const triggerButton = document.getElementById(
lastFocusedTriggerIdRef.current,
);
triggerButton?.focus();
}
};
}, [selectedMember]);
return (
<main className="bg-white text-charcoal">
<section className="bg-linear-to-br from-red-dark via-red to-red text-white">
<div className="container py-14 sm:py-22.5 lg:py-27.5">
<div className="max-w-170 mx-auto text-center">
<h1 className="text-[42px] sm:text-[53px] leading-none mb-4 text-center text-white">
The Technical Steering Committee of Hiero
</h1>
<p className="text-base sm:text-lg max-w-150 mx-auto">
The Hiero Technical Steering Committee (TSC) is the committee
responsible for technical governance within the Hiero project.
</p>
<div className="mt-7 flex flex-wrap justify-center gap-3">
<a
href={TECHNICAL_CHARTER_URL}
target="_blank"
rel="noreferrer noopener"
className="inline-flex items-center justify-center rounded-full border-2 border-white bg-white px-5 py-2 text-sm font-medium text-red transition-colors hover:bg-gray-light focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-offset-2 focus-visible:ring-offset-red"
aria-label="View Technical Charter (opens in new tab)">
View Technical Charter
</a>
<a
href={MEETING_CALENDAR_URL}
target="_blank"
rel="noreferrer noopener"
className="inline-flex items-center justify-center rounded-full border-2 border-white px-5 py-2 text-sm font-medium text-white transition-colors hover:bg-white/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-offset-2 focus-visible:ring-offset-red"
aria-label="Open Meeting Calendar (opens in new tab)">
Open Meeting Calendar
</a>
</div>
</div>
</div>
</section>
<section
aria-labelledby="tsc-about-heading"
className="border-b border-white-dark bg-white">
<div className="container py-10 sm:py-15">
<div className="max-w-225">
<h2 id="tsc-about-heading" className="text-2xl sm:text-4xl mb-5">
About the TSC
</h2>
<div className="space-y-4 text-lg text-gray">
<p>
The Hiero Technical Steering Committee (TSC) is a committee of
members who serve the project's technical governance.
</p>
<p>
The duties, goals, and rights of the TSC are defined in the{" "}
<a
href={TECHNICAL_CHARTER_URL}
target="_blank"
rel="noreferrer noopener"
className="text-red underline hover:text-red-dark focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-red-light focus-visible:ring-offset-2"
aria-label="Read the technical charter (opens in new tab)">
technical charter
</a>{" "}
of the Hiero project.
</p>
<p>
This page provides an overview of the current committee members
and links to the core governance resources used by the project.
</p>
</div>
</div>
</div>
</section>
<section aria-labelledby="tsc-members-heading" className="bg-gray-light">
<div className="container py-10 sm:py-15 lg:py-20">
<div className="mb-10 sm:mb-12">
<h2 id="tsc-members-heading" className="text-2xl sm:text-4xl mb-5">
Committee Members
</h2>
<p className="text-lg max-w-205">
The committee is composed of contributors from across the Hiero
ecosystem. Member bios reflect their current roles and ongoing
work in open-source governance and technical delivery.
</p>
</div>
<div className="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-6 sm:gap-8">
{sorted.map((member, index) => {
const fullName = `${member.firstName} ${member.lastName}`.trim();
const hasBio = Boolean(member.bio?.trim());
const bioPreview = hasBio
? getBioPreview(member.bio ?? "")
: "Biography not available.";
const githubHandle = getGitHubHandle(member.gitHubAccount);
return (
<article
key={`${fullName}-${index}`}
className="flex flex-col h-full rounded-2xl border-2 border-white-dark bg-white p-6 sm:p-7">
{member.photo ? (
<Image
src={`/images/tsc/${member.photo}`}
alt={`${fullName} profile photo for the Hiero Technical Steering Committee`}
width={320}
height={320}
className="aspect-square w-full rounded-xl object-cover"
sizes="(min-width: 1280px) 25vw, (min-width: 768px) 40vw, 100vw"
/>
) : (
<div
className="aspect-square w-full rounded-xl bg-gray-light border border-white-dark"
aria-hidden="true"
/>
)}
<div className="flex flex-1 flex-col mt-5">
<h3 className="text-xl sm:text-2xl mb-2">{fullName}</h3>
{member.gitHubAccount ? (
<a
href={member.gitHubAccount}
target="_blank"
rel="noreferrer noopener"
className="inline-flex items-center gap-2 text-base text-red underline hover:text-red-dark focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-red-light focus-visible:ring-offset-2"
aria-label={`Visit ${fullName} on GitHub (opens in new tab)`}>
<Image
src="/images/Hiero-Icon-Github.svg"
alt="GitHub"
width={16}
height={16}
/>
{githubHandle ?? "GitHub profile"}
</a>
) : null}
<p className="grow mt-4 text-base text-gray">
{bioPreview}
</p>
{hasBio ? (
<button
id={`tsc-read-profile-${index}`}
type="button"
onClick={() => {
lastFocusedTriggerIdRef.current = `tsc-read-profile-${index}`;
setSelectedMember(member);
}}
className="mt-4 inline-flex items-center justify-center rounded-full border-2 border-white-dark px-4 py-1.5 text-sm font-medium text-charcoal transition-colors hover:border-red focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-red-light focus-visible:ring-offset-2"
aria-label={`Read full profile for ${fullName}`}>
Read full profile
</button>
) : null}
</div>
</article>
);
})}
</div>
</div>
</section>
<section aria-labelledby="tsc-resources-heading" className="bg-white">
<div className="container py-10 sm:py-15 lg:py-20">
<div className="mb-10 sm:mb-12 max-w-225">
<h2
id="tsc-resources-heading"
className="text-2xl sm:text-4xl mb-5">
Governance Resources
</h2>
<p className="text-lg">
Review the charter and follow governance activity through the
project's primary source materials.
</p>
</div>
<div className="grid grid-cols-1 md:grid-cols-2 gap-6 sm:gap-8">
{governanceResources.map(resource => (
<a
key={resource.title}
href={resource.href}
target="_blank"
rel="noreferrer noopener"
className="flex h-full flex-col rounded-2xl border-2 border-white-dark bg-white p-6 no-underline text-charcoal transition-colors hover:border-red focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-red-light focus-visible:ring-offset-2"
aria-label={`${resource.title} (opens in new tab)`}>
<h3 className="text-xl font-medium mb-3">{resource.title}</h3>
<p className="text-base text-gray grow">
{resource.description}
</p>
<span className="mt-5 text-base font-medium text-red underline">
Open resource
</span>
</a>
))}
</div>
</div>
</section>
{selectedMember ? (
<div
className="fixed inset-0 z-50 flex items-center justify-center bg-black/45 p-4 sm:p-8"
role="dialog"
aria-modal="true"
aria-labelledby="tsc-member-modal-title"
onClick={() => {
setSelectedMember(null);
}}>
<div
ref={modalRef}
className="relative max-h-[90vh] w-full max-w-220 overflow-y-auto rounded-2xl border-2 border-white-dark bg-white p-6 sm:p-8"
onClick={event => {
event.stopPropagation();
}}>
<button
ref={closeButtonRef}
type="button"
onClick={() => {
setSelectedMember(null);
}}
className="absolute right-4 top-4 z-10 inline-flex h-10 w-10 items-center justify-center rounded-full border-2 border-red bg-white text-red shadow-xs transition-colors hover:bg-red hover:text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-red-light focus-visible:ring-offset-2"
aria-label="Close profile dialog">
<span className="text-xl leading-none" aria-hidden="true">
×
</span>
</button>
<div className="grid grid-cols-1 gap-6 sm:gap-8 md:grid-cols-[220px_1fr] md:items-start">
{selectedMember.photo ? (
<Image
src={`/images/tsc/${selectedMember.photo}`}
alt={`${selectedMember.firstName} ${selectedMember.lastName} profile photo`}
width={220}
height={220}
className="aspect-square w-full rounded-xl object-cover"
/>
) : (
<div
className="aspect-square w-full rounded-xl bg-gray-light border border-white-dark"
aria-hidden="true"
/>
)}
<div>
<h3
id="tsc-member-modal-title"
className="text-2xl sm:text-3xl mb-3">
{selectedMember.firstName} {selectedMember.lastName}
</h3>
{selectedMember.gitHubAccount ? (
<a
href={selectedMember.gitHubAccount}
target="_blank"
rel="noreferrer noopener"
className="inline-flex items-center gap-2 text-base text-red underline hover:text-red-dark focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-red-light focus-visible:ring-offset-2"
aria-label={`Visit ${selectedMember.firstName} ${selectedMember.lastName} on GitHub (opens in new tab)`}>
<Image
src="/images/Hiero-Icon-Github.svg"
alt="GitHub"
width={16}
height={16}
/>
{getGitHubHandle(selectedMember.gitHubAccount) ??
"GitHub profile"}
</a>
) : null}
<div className="mt-5 space-y-4 text-base text-gray sm:text-lg sm:leading-relaxed">
{getBioParagraphs(
selectedMember.bio ?? "Biography not available.",
).map((paragraph, index) => (
<p key={`${selectedMember.lastName}-${index}`}>
{paragraph}
</p>
))}
</div>
</div>
</div>
</div>
</div>
) : null}
</main>
);
}
function getBioPreview(bio: string, maxLength = 170): string {
const trimmedBio = bio.trim();
if (trimmedBio.length <= maxLength) {
return trimmedBio;
}
return `${trimmedBio.slice(0, maxLength)}...`;
}
function getBioParagraphs(bio: string): string[] {
const trimmedBio = bio.trim();
if (!trimmedBio) {
return [];
}
const explicitParagraphs = trimmedBio
.split(/\n\s*\n/)
.map(paragraph => paragraph.trim())
.filter(Boolean);
if (explicitParagraphs.length > 1) {
return explicitParagraphs;
}
const sentences = trimmedBio.split(/(?<=[.!?])\s+/).filter(Boolean);
if (sentences.length <= 2) {
return [trimmedBio];
}
const paragraphs: string[] = [];
for (let index = 0; index < sentences.length; index += 2) {
paragraphs.push(sentences.slice(index, index + 2).join(" "));
}
return paragraphs;
}
function getFocusableElements(container: HTMLDivElement | null): HTMLElement[] {
if (!container) {
return [];
}
return Array.from(
container.querySelectorAll<HTMLElement>(
'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])',
),
).filter(
element =>
!element.hasAttribute("disabled") &&
element.getAttribute("aria-hidden") !== "true",
);
}
function trapFocusInModal(
event: KeyboardEvent,
focusableElements: HTMLElement[],
): void {
if (focusableElements.length === 0) {
event.preventDefault();
return;
}
const firstElement = focusableElements[0];
const lastElement = focusableElements[focusableElements.length - 1];
if (!event.shiftKey && document.activeElement === lastElement) {
event.preventDefault();
firstElement.focus();
}
if (event.shiftKey && document.activeElement === firstElement) {
event.preventDefault();
lastElement.focus();
}
}
function getGitHubHandle(gitHubAccount?: string): string | null {
if (!gitHubAccount) {
return null;
}
try {
const url = new URL(gitHubAccount);
const handle = url.pathname.split("/").filter(Boolean)[0];
return handle ? `@${handle}` : null;
} catch {
return null;
}
}