Add a Request form, with files in Google Drive and email notices
One form at /request for blog posts, events, and new or updated chapters, regions (updates only), partners, teams, awards and people. ?type= opens it on one; buttons on the Community sections, blog posts, Retreats and the front page calendar do. Files (.docx, PDF, JPEG, PNG) go to a Google Drive folder through a service account. Requests are feedback rows of type 'content' (migration 046), in a third Forms queue: files download from Drive, a .docx can become a draft blog post, and deleting a request deletes its files. New content and data requests email the addresses in Site settings through Gmail. Setup: docs/google-drive-and-mail.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
0e582c236b
commit
dc53af238f
31 changed files with 1318 additions and 113 deletions
|
|
@ -122,6 +122,16 @@ export const siteSettings = {
|
|||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
legend: "Notices",
|
||||
fields: [
|
||||
{
|
||||
path: "notify_emails",
|
||||
label: "Email new requests to",
|
||||
help: "Who gets an email for each new content request (the Request form) and data request (the Privacy page), separated by commas, eg. web@nextgenerationofunity.org, board@nextgenerationofunity.org. Needs Gmail set up on the server (docs/google-drive-and-mail.md). Default: none, check Forms instead.",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
children: [
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
import { useState } from "react";
|
||||
|
||||
import RequestLink from "../components/RequestLink.tsx";
|
||||
|
||||
/* ═══════════════════════════════════════════════════════════════
|
||||
SECTION MANIFEST
|
||||
|
||||
|
|
@ -21,6 +23,10 @@ import { useState } from "react";
|
|||
default: "carousel",
|
||||
Toggle: EventCardsToggle,
|
||||
},
|
||||
request: { // optional button
|
||||
type: "chapter", // to the Request form
|
||||
label: "Add or update a chapter",
|
||||
},
|
||||
}
|
||||
|
||||
Sections fetch their own data. The page never does, which is why
|
||||
|
|
@ -50,20 +56,25 @@ export function useSectionManifest(manifest) {
|
|||
const setView = (id, value) => setViews(prev => ({ ...prev, [id]: value }));
|
||||
|
||||
return manifest.map(entry => {
|
||||
const { Component, props, views: spec, ...heading } = entry;
|
||||
const { Component, props, views: spec, request, ...heading } = entry;
|
||||
const view = views[entry.id];
|
||||
const Toggle = spec?.Toggle;
|
||||
|
||||
return {
|
||||
...heading,
|
||||
|
||||
actions: Toggle ? (
|
||||
<Toggle
|
||||
view={view}
|
||||
setView={value => setView(entry.id, value)}
|
||||
accent={entry.accent}
|
||||
options={spec.options}
|
||||
/>
|
||||
actions: Toggle || request ? (
|
||||
<div className="flex flex-wrap items-center gap-3">
|
||||
{request && <RequestLink type={request.type} label={request.label} />}
|
||||
{Toggle && (
|
||||
<Toggle
|
||||
view={view}
|
||||
setView={value => setView(entry.id, value)}
|
||||
accent={entry.accent}
|
||||
options={spec.options}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
) : undefined,
|
||||
|
||||
content: (
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import siteConfiguration from '../../site.json'
|
|||
|
||||
type PageText = { title: string; description: string }
|
||||
|
||||
type SiteText = { title?: string; pages?: Record<string, PageText>; privacyEmail?: string }
|
||||
type SiteText = { title?: string; pages?: Record<string, PageText>; privacyEmail?: string; requestFiles?: boolean }
|
||||
|
||||
/* What the server wrote into the page, if it did. */
|
||||
const fromServer: SiteText =
|
||||
|
|
@ -38,6 +38,11 @@ export const SITE_ORIGIN: string = siteConfiguration.url
|
|||
* settings, else site.json). Blank: the Privacy page's form only. */
|
||||
export const PRIVACY_EMAIL: string = fromServer.privacyEmail ?? siteConfiguration.privacyEmail
|
||||
|
||||
/** Whether the Request form takes files (Google Drive is set up on
|
||||
* the server). Unknown (the Vite dev server) offers them, and the
|
||||
* server says so if it can't. */
|
||||
export const REQUEST_FILES: boolean = fromServer.requestFiles ?? true
|
||||
|
||||
/** A site path as a full URL on the live site. */
|
||||
export const siteUrl = (path: string): string => new URL(path, SITE_ORIGIN).href
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue