* replace country pages with region dashboards - move /countries to /regions, with 301 redirects from the old URLs in every locale - add a region dashboard: a map of the region's countries with pins coloured by prayer coverage, headline figures, and prayer, adoption and engagement progress against the DOXA goals, plus a per-country table - roll up progress stats per country and region in the shared summary and serve them from /api/regions - frame region maps with antimeridian-aware bounds - add Regions to the hamburger menu and translate the new strings in all eight locales * put each region on the regions index in a card with a header band The region name links to its dashboard with the site's chevron icon, and the people-group and country counts sit centred beside it on a brand-green header; the country list is the padded white card body.
18 lines
772 B
TypeScript
18 lines
772 B
TypeScript
/**
|
|
* GET /api/countries
|
|
* Returns one summary per country that has people groups (slug, code, localized
|
|
* name, WAGF region, progress stats, and a map center/zoom framed on the
|
|
* country). Supports translated names via ?lang=. The region pages read the
|
|
* same countries nested under /api/regions.
|
|
*/
|
|
import { getCountriesSummary, resolveLang } from '../utils/countries'
|
|
|
|
export default defineEventHandler(async (event) => {
|
|
const lang = resolveLang(getQuery(event).lang)
|
|
const countries = await getCountriesSummary(lang)
|
|
|
|
// Same edge-cache + stale-while-revalidate policy as the marketing HTML.
|
|
setResponseHeader(event, 'cache-control', 'public, max-age=0, s-maxage=86400, stale-while-revalidate=86400')
|
|
|
|
return { countries, total: countries.length }
|
|
})
|