diff --git a/docs/associations.md b/docs/associations.md new file mode 100644 index 00000000..80c49bbe --- /dev/null +++ b/docs/associations.md @@ -0,0 +1,9 @@ +# Published association registry + +The association listing accepts the optional `extraLinks` field from the reviewed backend registry. It validates the additive payload and keeps the existing `links` fallback for older backend deployments. Visible labels are shown only for repeated platforms and for Twitch/other links (single links keep the icon-only look); an invalid `extraLinks` payload falls back to the legacy `links` for that association instead of emptying the list. Multiple entries for the same platform have their own visible labels, including unsupported platforms with a generic web icon. Public email remains a mail link. + +The public page links representatives to `/dashboard/associations` on `ADMIN_URL` (default `https://admin.polinetwork.org`). Registration, representative approvals, private evidence and draft content belong to the backend/admin portal; this website receives only the approved public version. + +Reviewed external logo URLs are rendered without Next's server-side image optimization, avoiding arbitrary remote fetches through the image optimizer. Bundled static images retain optimization. + +This PR can deploy before the coordinated backend/admin release. Run `pnpm check`, `pnpm build`, and `pnpm typecheck`. The backend tests cover publication gating, preservation of existing associations and numeric IDs. In staging, confirm existing associations, repeated platform links and labels, and logo display after content approval. diff --git a/src/app/associations/page.tsx b/src/app/associations/page.tsx index 8a8d2426..dbc710ce 100644 --- a/src/app/associations/page.tsx +++ b/src/app/associations/page.tsx @@ -2,6 +2,7 @@ import type { Metadata } from "next" import { AssociationsList } from "@/components/associations/associations-list" import { CONTAINER, PAGE_HERO, PAGE_MAIN } from "@/components/layout/page" import { Hero } from "@/components/ui/hero" +import { env } from "@/env" import { getAllAssociations } from "@/queries/associations" export const metadata: Metadata = { @@ -24,6 +25,16 @@ export default async function AssociationsPage() {
+

+ Rappresenti un’associazione?{" "} + + Registrala o richiedi accesso alla sua scheda + + . +

diff --git a/src/components/accordion-association/index.tsx b/src/components/accordion-association/index.tsx index ff257a04..ad978726 100644 --- a/src/components/accordion-association/index.tsx +++ b/src/components/accordion-association/index.tsx @@ -1,4 +1,5 @@ import Image from "next/image" +import { isHttpUrl, isOptimizableImageHost } from "@/lib/association-links" import { GradientIcon } from "../gradient-icon" import { Accordion } from "./accordion" import { AccordionContent } from "./accordion-content" @@ -21,7 +22,8 @@ function initials(name: string) { function AssociationLogo({ name, logo }: Pick) { // The name sits right next to the logo, so both are decorative for screen readers - if (!logo) { + // Reviewed logos must be http(s); anything else falls back to the initials + if (!logo || (typeof logo === "string" && !isHttpUrl(logo))) { return ( ) } - return + return ( + + ) } export default function AccordionAssociation({ accordionItems, defaultValue }: AccordionAssociationProps) { @@ -53,20 +64,23 @@ export default function AccordionAssociation({ accordionItems, defaultValue }: A Segui l'associazione