"use client"; /** * Settings (§10): the Coming soon line, search engine verification (live at once), and the menu's * order (a draft, published with the site). */ import Link from "next/link"; import { useState } from "react"; import { api, canEdit } from "@/admin/api"; import { Btn, Field, inputClass, Loading, Notice, Panel, Title, useAction, useAdmin } from "@/admin/ui"; import { AppWindow, Hourglass, ListOrdered, Search, Settings } from "lucide-react"; import { ImagePicker } from "@/admin/media"; type Settings = { comingSoonText: string; googleVerification: string | null; bingVerification: string | null; faviconId: string | null }; type PageRow = { id: string; kind: string; title: string; inNav: boolean }; export default function SettingsPage() { const me = useAdmin<{ user: { role: string } }>("/me"); const settings = useAdmin("/settings"); const pages = useAdmin("/pages"); const [form, setForm] = useState>({}); const { busy, message, fields, run } = useAction(); if (!settings.data || !pages.data || !me.data) return ; const editor = canEdit(me.data.user.role); const s = { ...settings.data, ...form }; const menu = pages.data.filter((p) => p.kind !== "home"); const move = (i: number, d: -1 | 1) => run(async () => { const list = [...menu]; [list[i], list[i + d]] = [list[i + d]!, list[i]!]; await api("/pages-order", { method: "PUT", body: { ids: list.map((p) => p.id) } }); await pages.reload(); }, "Saved as a draft: publish to change the menu."); return ( <> Settings {message &&
{message.text}
}

To see how people find your site, add it to Google Search Console and Bing Webmaster Tools. They give you a code to prove the site is yours: paste it here (the whole tag is fine), save, then press Verify there. This goes live straight away.

setForm({ ...form, googleVerification: e.target.value })} /> setForm({ ...form, bingVerification: e.target.value })} />

A Google Business Profile helps people find your church on Google Maps: set one up at business.google.com with the same address as your church details.

The little picture in the browser tab and bookmarks. Choose a square picture (512 × 512 pixels is best; a PNG can have a see-through background). Without one, your site uses your church's icon, or your church's initial on its colour. This goes live straight away.

setForm({ ...form, faviconId })} /> {/* What the site shows now (the default when none is chosen). */}
In use now
{fields.faviconId &&

{fields.faviconId}

}
setForm({ ...form, comingSoonText: e.target.value })} /> {editor && Object.keys(form).length > 0 && ( run(async () => { settings.setData(await api("/settings", { method: "PUT", body: form })); setForm({}); }, "Saved.")}>Save settings )}

Pages in the menu, in this order. Which pages show is set on each page (Pages).

    {menu.map((p, i) => (
  • {p.title}{!p.inNav && (not in the menu)} move(i, -1)} disabled={busy || i === 0} aria-label={`Move ${p.title} up`}>↑ move(i, 1)} disabled={busy || i === menu.length - 1} aria-label={`Move ${p.title} down`}>↓
  • ))}
); }