- Email buttons went to the link's label, not its URL (splitLinks took the label); they use the URL now, with or without mailto:. - Every website and email row is listed, each with its own label, instead of only the first. - The facts at the top of an organization page sit in a framed card: City, Part of <name> Region, Ministry, Meets, Since, and its tags. - Tags (070): Data -> Tags (Online, In-Person to start) replace the Online checkbox on organizations and events. Ticked records get the Online tag; v_events reads the "online" tag as is_online, so the calendar filter and place lines are unchanged. Tags show on the record's page and on group entries in the Community map list and grid. The map no longer keeps online groups off their state's tile. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
69 lines
2.9 KiB
TypeScript
69 lines
2.9 KiB
TypeScript
/* ═══════════════════════════════════════════════════════════════
|
|
ORG CONTACT
|
|
|
|
An organization's ways to reach it, as buttons: its action links
|
|
filled in its accent, then its website, email and socials
|
|
outlined. Nothing at all when it has none. Used on an
|
|
organization's page and on the Organization page (NGU's own).
|
|
A platform's icon has its name beside it for screen readers and
|
|
reading mode, unless the label already says it (PlatformName).
|
|
═══════════════════════════════════════════════════════════════ */
|
|
|
|
import PlatformIcon from './PlatformIcon.tsx'
|
|
import type { OrganizationRecord } from '../lib/useContent.ts'
|
|
import { accentText } from '../lib/color.ts'
|
|
import { PLATFORMS } from '../lib/platforms.ts'
|
|
|
|
function PlatformName({ platform, label }: { platform?: string | null; label?: string | null }) {
|
|
const name = PLATFORMS.find((p) => p.id === platform)?.label
|
|
if (!name || label?.toLowerCase().includes(name.toLowerCase())) return null
|
|
return <span className="sr-only">{label ? `${name}: ` : name}</span>
|
|
}
|
|
|
|
export default function OrgContact({ org, accent }: { org: OrganizationRecord; accent: string }) {
|
|
const hasAny =
|
|
org.links.length > 0 || org.socials.length > 0 || org.websites.length > 0 || org.emails.length > 0
|
|
|
|
if (!hasAny) return null
|
|
|
|
return (
|
|
<div className="flex flex-wrap gap-3">
|
|
{org.links.map((link) => (
|
|
<a
|
|
key={link.url}
|
|
href={link.url}
|
|
target="_blank"
|
|
rel="noreferrer"
|
|
className="inline-flex items-center gap-2 btn px-5 py-2 text-sm text-white transition-transform hover:scale-105"
|
|
style={{ background: accent }}
|
|
>
|
|
<PlatformIcon platform={link.platform} />
|
|
<PlatformName platform={link.platform} label={link.label} />
|
|
{link.label}
|
|
</a>
|
|
))}
|
|
|
|
{/* Every website and email row, each its own button with its
|
|
own label; an email's url is the bare address (splitLinks
|
|
in shape.js). */}
|
|
{[
|
|
...org.websites,
|
|
...org.emails.map((link) => ({ ...link, url: `mailto:${link.url}` })),
|
|
...org.socials,
|
|
].map((link) => (
|
|
<a
|
|
key={link.url}
|
|
href={link.url}
|
|
target="_blank"
|
|
rel="noreferrer"
|
|
className="inline-flex items-center gap-2 btn border px-4 py-1.5 text-sm transition-colors hover:bg-tint"
|
|
style={{ borderColor: accent, color: accentText(accent) }}
|
|
>
|
|
<PlatformIcon platform={link.platform} />
|
|
<PlatformName platform={link.platform} label={link.label} />
|
|
{link.label}
|
|
</a>
|
|
))}
|
|
</div>
|
|
)
|
|
}
|