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
|
|
@ -34,16 +34,16 @@ const WHOLE_PAGE = "";
|
|||
|
||||
/* ── Shared field chrome ─────────────────────────────────────── */
|
||||
|
||||
const fieldClass =
|
||||
export const fieldClass =
|
||||
"w-full rounded-xl border border-muted/50 bg-surface px-4 py-3 text-body " +
|
||||
"placeholder:text-muted outline-none transition-colors " +
|
||||
"focus:border-brand focus:ring-2 focus:ring-brand/25";
|
||||
|
||||
const errorFieldClass = "border-danger focus:border-danger focus:ring-danger/20";
|
||||
export const errorFieldClass = "border-danger focus:border-danger focus:ring-danger/20";
|
||||
|
||||
const selectClass = `${fieldClass} appearance-none pr-10`;
|
||||
|
||||
function OptionalTag() {
|
||||
export function OptionalTag() {
|
||||
return (
|
||||
<span className="ml-2 rounded-full bg-tint px-2 py-0.5 text-xs font-medium text-link">
|
||||
Optional
|
||||
|
|
@ -51,7 +51,7 @@ function OptionalTag() {
|
|||
);
|
||||
}
|
||||
|
||||
function FieldError({ id, children }) {
|
||||
export function FieldError({ id, children }) {
|
||||
if (!children) return null;
|
||||
return (
|
||||
<p id={id} className="mt-2 text-sm text-danger">
|
||||
|
|
@ -82,26 +82,38 @@ function Select({ id, label, value, onChange, children }) {
|
|||
);
|
||||
}
|
||||
|
||||
/* ── Type picker ─────────────────────────────────────────────── */
|
||||
/* ── Type picker: a tile per option (the Request form's too) ─── */
|
||||
|
||||
function TypePicker({ value, onChange }) {
|
||||
export function TilePicker({
|
||||
legend,
|
||||
blurb,
|
||||
name,
|
||||
options,
|
||||
value,
|
||||
onChange,
|
||||
}: {
|
||||
legend: string;
|
||||
blurb: string;
|
||||
name: string;
|
||||
options: { id: string; label: string; hint: string }[];
|
||||
value: string | null;
|
||||
onChange: (id: string) => void;
|
||||
}) {
|
||||
return (
|
||||
<fieldset>
|
||||
<legend className="text-base font-semibold text-body">
|
||||
What kind of feedback is this?
|
||||
</legend>
|
||||
<legend className="text-base font-semibold text-body">{legend}</legend>
|
||||
<p className="mt-1 text-sm" style={{ color: MUTED }}>
|
||||
Pick the closest fit. It helps us route it to the right person.
|
||||
{blurb}
|
||||
</p>
|
||||
|
||||
<div className="mt-4 grid gap-3 sm:grid-cols-2 lg:grid-cols-3">
|
||||
{FEEDBACK_TYPES.map((type) => {
|
||||
{options.map((type) => {
|
||||
const selected = value === type.id;
|
||||
return (
|
||||
<label key={type.id} className="cursor-pointer">
|
||||
<input
|
||||
type="radio"
|
||||
name="feedbackType"
|
||||
name={name}
|
||||
value={type.id}
|
||||
checked={selected}
|
||||
onChange={() => onChange(type.id)}
|
||||
|
|
@ -317,7 +329,14 @@ export default function FeedbackForm({ fixedType }: { fixedType?: string } = {})
|
|||
>
|
||||
{!fixedType && (
|
||||
<>
|
||||
<TypePicker value={type} onChange={setType} />
|
||||
<TilePicker
|
||||
legend="What kind of feedback is this?"
|
||||
blurb="Pick the closest fit. It helps us route it to the right person."
|
||||
name="feedbackType"
|
||||
options={FEEDBACK_TYPES}
|
||||
value={type}
|
||||
onChange={setType}
|
||||
/>
|
||||
|
||||
<div className="mt-10">
|
||||
<LocationPicker
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue