Add the Privacy and Terms pages, data requests and click-to-load embeds
- Privacy Policy (with cookies and storage) and Terms of Service, from what the code actually stores and loads; shared LegalText layout - Data requests: a 'privacy' feedback type sent from the Privacy page's form, email required, triaged in Admin -> Feedback - Migration 039: Panel -> Site settings -> Privacy contact email (over site.json's privacyEmail), shown on the Privacy page - The hero livestream, the hero featured video and schedule maps load only when pressed, so no third party sets anything before a click - A small dismissible privacy notice instead of a consent banner Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
bff082652a
commit
ee61568911
17 changed files with 507 additions and 81 deletions
|
|
@ -9,12 +9,16 @@
|
|||
|
||||
The page and section options come from navConfig, so adding a
|
||||
page to the nav adds it to this form too.
|
||||
|
||||
With fixedType the type is set and neither picker shows. The
|
||||
Privacy page uses it for data requests (DATA_REQUEST), which also
|
||||
need an email, since the answer has to go somewhere.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
import { useState } from "react";
|
||||
import { post, ApiError } from "../../lib/api.ts";
|
||||
import { PAGE_LINKS, PAGE_SECTIONS } from "../../navConfig.ts";
|
||||
import { FEEDBACK_TYPES } from "../../data/feedbackTypes.ts";
|
||||
import { DATA_REQUEST, FEEDBACK_TYPES } from "../../data/feedbackTypes.ts";
|
||||
|
||||
const ACCENT = "#0f7183";
|
||||
const MUTED = "#4a6b72";
|
||||
|
|
@ -216,8 +220,9 @@ function describeLocation(page, section) {
|
|||
|
||||
/* ── The form ────────────────────────────────────────────────── */
|
||||
|
||||
export default function FeedbackForm() {
|
||||
const [type, setType] = useState<any>(null);
|
||||
export default function FeedbackForm({ fixedType }: { fixedType?: string } = {}) {
|
||||
const request = fixedType === DATA_REQUEST.id;
|
||||
const [type, setType] = useState<any>(fixedType ?? null);
|
||||
const [page, setPage] = useState(SITE_WIDE);
|
||||
const [section, setSection] = useState(WHOLE_PAGE);
|
||||
const [message, setMessage] = useState("");
|
||||
|
|
@ -233,7 +238,8 @@ export default function FeedbackForm() {
|
|||
const [fieldErrors, setFieldErrors] = useState<any>({});
|
||||
|
||||
const sending = status === "sending";
|
||||
const ready = Boolean(type) && message.trim().length >= MIN_MESSAGE;
|
||||
const ready =
|
||||
Boolean(type) && message.trim().length >= MIN_MESSAGE && (!request || email.trim() !== "");
|
||||
|
||||
async function handleSubmit(event) {
|
||||
event.preventDefault();
|
||||
|
|
@ -271,7 +277,7 @@ export default function FeedbackForm() {
|
|||
}
|
||||
|
||||
function reset() {
|
||||
setType(null);
|
||||
setType(fixedType ?? null);
|
||||
setPage(SITE_WIDE);
|
||||
setSection(WHOLE_PAGE);
|
||||
setMessage("");
|
||||
|
|
@ -299,16 +305,18 @@ export default function FeedbackForm() {
|
|||
</p>
|
||||
)}
|
||||
<p className="mt-3 max-w-prose" style={{ color: MUTED }}>
|
||||
{email
|
||||
? `We'll follow up at ${email} if we have questions.`
|
||||
: "You sent this anonymously, so we won't be able to reply, but we read everything that comes in."}
|
||||
{request
|
||||
? `We'll reply to ${email}. We may ask you to confirm it's you before we change or delete anything.`
|
||||
: email
|
||||
? `We'll follow up at ${email} if we have questions.`
|
||||
: "You sent this anonymously, so we won't be able to reply, but we read everything that comes in."}
|
||||
</p>
|
||||
<button
|
||||
type="button"
|
||||
onClick={reset}
|
||||
className="mt-6 rounded-full border border-[#138ba0] px-5 py-2.5 font-semibold text-[#0f7183] transition-colors hover:bg-[#eef9fb] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#138ba0]/40"
|
||||
>
|
||||
Send more feedback
|
||||
{request ? "Send another request" : "Send more feedback"}
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
|
|
@ -320,28 +328,33 @@ export default function FeedbackForm() {
|
|||
noValidate
|
||||
className="rounded-2xl border border-[#138ba0]/20 bg-white p-6 sm:p-8"
|
||||
>
|
||||
<TypePicker value={type} onChange={setType} />
|
||||
{!fixedType && (
|
||||
<>
|
||||
<TypePicker value={type} onChange={setType} />
|
||||
|
||||
<div className="mt-10">
|
||||
<LocationPicker
|
||||
page={page}
|
||||
section={section}
|
||||
onPageChange={setPage}
|
||||
onSectionChange={setSection}
|
||||
/>
|
||||
</div>
|
||||
<div className="mt-10">
|
||||
<LocationPicker
|
||||
page={page}
|
||||
section={section}
|
||||
onPageChange={setPage}
|
||||
onSectionChange={setSection}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* Message */}
|
||||
<div className="mt-10">
|
||||
<div className={fixedType ? "" : "mt-10"}>
|
||||
<label
|
||||
htmlFor="feedback-message"
|
||||
className="text-base font-semibold text-[#26454c]"
|
||||
>
|
||||
Tell us more
|
||||
{request ? "Your request" : "Tell us more"}
|
||||
</label>
|
||||
<p className="mt-1 text-sm" style={{ color: MUTED }}>
|
||||
What you expected to happen, and what happened instead, is the most
|
||||
useful thing you can give us.
|
||||
{request
|
||||
? "Say what you'd like: to see the information we hold about you, to correct it, or to have it deleted. Tell us how you've been in touch with NGU (a retreat, a chapter, this site) so we can find it."
|
||||
: "What you expected to happen, and what happened instead, is the most useful thing you can give us."}
|
||||
</p>
|
||||
<textarea
|
||||
id="feedback-message"
|
||||
|
|
@ -349,7 +362,11 @@ export default function FeedbackForm() {
|
|||
maxLength={MAX_CHARS}
|
||||
value={message}
|
||||
onChange={(e) => setMessage(e.target.value)}
|
||||
placeholder="I was looking for the summer retreat dates and…"
|
||||
placeholder={
|
||||
request
|
||||
? "Please delete the details I gave when I registered for…"
|
||||
: "I was looking for the summer retreat dates and…"
|
||||
}
|
||||
aria-invalid={Boolean(fieldErrors.message)}
|
||||
aria-describedby={fieldErrors.message ? "feedback-message-error" : undefined}
|
||||
className={`mt-4 resize-y ${fieldClass} ${
|
||||
|
|
@ -370,12 +387,15 @@ export default function FeedbackForm() {
|
|||
{/* Optional contact details */}
|
||||
<div className="mt-8 rounded-xl border border-dashed border-[#4a6b72]/30 bg-[#eef9fb]/60 p-5 sm:p-6">
|
||||
<div className="flex flex-wrap items-center">
|
||||
<h3 className="text-base font-semibold text-[#26454c]">Your details</h3>
|
||||
<OptionalTag />
|
||||
<h3 className="text-base font-semibold text-[#26454c]">
|
||||
{request ? "How we reach you" : "Your details"}
|
||||
</h3>
|
||||
{!request && <OptionalTag />}
|
||||
</div>
|
||||
<p className="mt-1 max-w-prose text-sm" style={{ color: MUTED }}>
|
||||
Leave these blank and your feedback comes through anonymously. Fill
|
||||
them in only if you'd like a reply, we won't add you to any list.
|
||||
{request
|
||||
? "We use these only to answer this request, and we won't add you to any list."
|
||||
: "Leave these blank and your feedback comes through anonymously. Fill them in only if you'd like a reply, we won't add you to any list."}
|
||||
</p>
|
||||
|
||||
<div className="mt-5 grid gap-4 sm:grid-cols-2">
|
||||
|
|
@ -400,12 +420,14 @@ export default function FeedbackForm() {
|
|||
htmlFor="feedback-email"
|
||||
className="block text-sm font-medium text-[#26454c]"
|
||||
>
|
||||
Email <span className="font-normal text-[#4a6b72]">(optional)</span>
|
||||
Email{" "}
|
||||
<span className="font-normal text-[#4a6b72]">{request ? "(required)" : "(optional)"}</span>
|
||||
</label>
|
||||
<input
|
||||
id="feedback-email"
|
||||
type="email"
|
||||
autoComplete="email"
|
||||
required={request}
|
||||
value={email}
|
||||
onChange={(e) => setEmail(e.target.value)}
|
||||
aria-invalid={Boolean(fieldErrors.email)}
|
||||
|
|
@ -449,11 +471,13 @@ export default function FeedbackForm() {
|
|||
disabled={!ready || sending}
|
||||
className="rounded-full bg-[#0f7183] px-7 py-3 font-semibold text-white transition-colors hover:bg-[#0b5c6a] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#138ba0]/40 disabled:cursor-not-allowed disabled:bg-[#4a6b72]/25 disabled:text-white/80"
|
||||
>
|
||||
{sending ? "Sending…" : "Send feedback"}
|
||||
{sending ? "Sending…" : request ? "Send request" : "Send feedback"}
|
||||
</button>
|
||||
{!ready && !sending && (
|
||||
<p className="text-sm" style={{ color: MUTED }}>
|
||||
Choose a type and write at least a sentence to send.
|
||||
{request
|
||||
? "Write at least a sentence and give an email address to send."
|
||||
: "Choose a type and write at least a sentence to send."}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ import { useEffect, useState, type CSSProperties } from 'react'
|
|||
import { Link } from 'react-router-dom'
|
||||
|
||||
import HomeLink from './HomeLink.tsx'
|
||||
import VideoPlayer from '../../../components/VideoPlayer.tsx'
|
||||
import DoveMark from '../../../components/DoveMark.tsx'
|
||||
import PlatformIcon from '../../../components/PlatformIcon.tsx'
|
||||
import { livestreamEmbedUrl, videoSource, type VideoSource } from '../../../lib/embeds.ts'
|
||||
|
|
@ -352,14 +353,17 @@ function PhotoBackdrop({ slides, seconds }: { slides: HeroSlide[]; seconds: numb
|
|||
|
||||
/* ── Livestream ──────────────────────────────────────────────── */
|
||||
|
||||
/* The player loads when pressed, not with the page, so YouTube or
|
||||
Facebook set nothing until someone asks to watch (Privacy page). */
|
||||
function LiveFrame({ src, url, title }: { src: string | null; url: string; title?: string | null }) {
|
||||
const [watching, setWatching] = useState(false)
|
||||
return (
|
||||
<div
|
||||
className="relative overflow-hidden rounded-3xl border border-white/15 bg-black shadow-2xl"
|
||||
style={{ boxShadow: '0 30px 80px -20px rgba(16, 212, 138, 0.35)' }}
|
||||
>
|
||||
<div className="aspect-video w-full">
|
||||
{src ? (
|
||||
{src && watching ? (
|
||||
<iframe
|
||||
src={src}
|
||||
title={title || 'Livestream'}
|
||||
|
|
@ -367,6 +371,17 @@ function LiveFrame({ src, url, title }: { src: string | null; url: string; title
|
|||
allow="autoplay; encrypted-media; picture-in-picture; fullscreen"
|
||||
allowFullScreen
|
||||
/>
|
||||
) : src ? (
|
||||
<div className="flex h-full w-full flex-col items-center justify-center gap-4 text-white">
|
||||
<span className="hp-live-dot h-4 w-4 rounded-full bg-[#ff4d4d]" aria-hidden="true" />
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setWatching(true)}
|
||||
className="rounded-full bg-white px-6 py-3 font-semibold text-[#04262e] hover:scale-105"
|
||||
>
|
||||
Watch live
|
||||
</button>
|
||||
</div>
|
||||
) : (
|
||||
<div className="flex h-full w-full flex-col items-center justify-center gap-4 text-white">
|
||||
<span className="hp-live-dot h-4 w-4 rounded-full bg-[#ff4d4d]" aria-hidden="true" />
|
||||
|
|
@ -387,8 +402,9 @@ function LiveFrame({ src, url, title }: { src: string | null; url: string; title
|
|||
|
||||
/* A file plays in <video> with the browser's controls; preload
|
||||
"metadata" fetches enough for the first frame and the length,
|
||||
not the whole file. An embed waits for play. A link that is
|
||||
neither still gets a button out to it. */
|
||||
not the whole file. An embed is a VideoPlayer: a still until
|
||||
pressed, so the video's host sets nothing before then. A link
|
||||
that is neither still gets a button out to it. */
|
||||
function VideoFrame({
|
||||
source,
|
||||
url,
|
||||
|
|
@ -414,13 +430,7 @@ function VideoFrame({
|
|||
preload="metadata"
|
||||
/>
|
||||
) : source?.kind === 'embed' ? (
|
||||
<iframe
|
||||
src={source.src}
|
||||
title={title || 'Featured video'}
|
||||
className="h-full w-full"
|
||||
allow="encrypted-media; picture-in-picture; fullscreen"
|
||||
allowFullScreen
|
||||
/>
|
||||
<VideoPlayer url={url} title={title || 'Featured video'} className="h-full" />
|
||||
) : (
|
||||
<div className="flex h-full w-full items-center justify-center">
|
||||
<HomeLink
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue