Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
801d99b745
|
||
|
|
70f6f92f00
|
||
|
|
2e920a96e7
|
||
|
|
2ed3a17914
|
||
|
|
e27e31bfa5
|
||
|
|
2c51c35fe8
|
||
|
|
19fab4a783
|
+6
-4
@@ -14,10 +14,12 @@ apps/cms/.strapi
|
||||
apps/cms/.tmp
|
||||
apps/cms/.cache
|
||||
|
||||
# Secrets. The containers receive their environment from docker compose.
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
# Secrets. The containers receive their environment from docker compose, so no
|
||||
# .env belongs in an image - including the per-application ones (apps/web/.env,
|
||||
# apps/cms/.env), which COPY apps/web / COPY apps/cms would otherwise pick up.
|
||||
**/.env
|
||||
**/.env.*
|
||||
!**/.env.example
|
||||
|
||||
# Licensed fonts are mounted or copied in at deploy time, never baked into a
|
||||
# published image. See the FONTS section of README.md.
|
||||
|
||||
+17
-13
@@ -7,12 +7,13 @@
|
||||
# WHO READS THIS FILE
|
||||
# * docker compose - every ${VARIABLE} in docker-compose.yml is read from
|
||||
# the .env file sitting next to it (this one).
|
||||
# * apps/web - the React Router server reads STRAPI_URL / STRAPI_TOKEN
|
||||
# / SITE_URL from its process environment. In manual mode
|
||||
# nothing loads this file for you, so export it first:
|
||||
# set -a; . ./.env; set +a
|
||||
# The defaults below are also the code defaults, so a
|
||||
# plain `pnpm dev` works without exporting anything.
|
||||
# * apps/web - NOT this file. In manual mode the web app reads
|
||||
# apps/web/.env (cp apps/web/.env.example apps/web/.env),
|
||||
# which is where PORT, HOST, SITE_URL, STRAPI_URL and
|
||||
# STRAPI_TOKEN belong. Under Docker the values below are
|
||||
# injected into the container instead. The defaults are
|
||||
# also the code defaults, so a plain `pnpm dev` works
|
||||
# with no .env at all.
|
||||
# * apps/cms - Strapi does NOT read this file. In manual mode it reads
|
||||
# apps/cms/.env (cp apps/cms/.env.example apps/cms/.env).
|
||||
# Under Docker the values below are injected into the
|
||||
@@ -63,12 +64,18 @@ ENCRYPTION_KEY=
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# PORTS
|
||||
# Host ports the two applications are published on in Docker mode, and the
|
||||
# ports they listen on in manual mode.
|
||||
# Host ports the two applications are published on in Docker mode. The ports
|
||||
# they LISTEN on in manual mode live in each application's own .env
|
||||
# (apps/web/.env, apps/cms/.env), because both servers read a bare PORT.
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# React Router server (production build / Docker). `pnpm dev:web` uses 5173.
|
||||
# Docker mode - host port the web container is published on; inside the
|
||||
# container it always listens on 3000, so WEB_PORT=8080 means 8080:3000.
|
||||
# Manual mode has its own PORT in apps/web/.env - never put a bare PORT in
|
||||
# THIS file: both servers would read it and Strapi would land on the website's
|
||||
# port. `pnpm dev:web` uses 5173 either way.
|
||||
WEB_PORT=3000
|
||||
|
||||
# Strapi API + admin panel.
|
||||
CMS_PORT=1337
|
||||
|
||||
@@ -79,7 +86,7 @@ CMS_PUBLIC_URL=http://localhost:1337
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# WEB APP
|
||||
# WEB APP - Docker mode. In manual mode these live in apps/web/.env.
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# Public origin of the site. Used for canonical URLs, hreflang alternates and
|
||||
@@ -87,9 +94,6 @@ CMS_PUBLIC_URL=http://localhost:1337
|
||||
# Leave it unset in local development and the request's own host is used.
|
||||
SITE_URL=http://localhost:3000
|
||||
|
||||
# Where the server-side loaders fetch content from, MANUAL MODE.
|
||||
STRAPI_URL=http://localhost:1337
|
||||
|
||||
# Where they fetch from inside Docker, where "cms" is the compose service name.
|
||||
# NOTE: this origin is also prefixed onto uploaded media URLs, which the
|
||||
# browser has to be able to resolve too - see "Images from the CMS" in the
|
||||
|
||||
@@ -61,6 +61,8 @@ unreachable — the site must never 500 because Strapi is down.
|
||||
`skillNames: "resource:figma-design-to-code"`. File key `yvKHp3Ha2rQmv9kt9tCC7j`.
|
||||
5. **Never invent statistics, dates, names or quotes.** If a number is not in `docs/` or in
|
||||
the CMS, it does not go on the page. Leave the slot empty or omit the component.
|
||||
The same rule governs the seed: anything invented belongs in `src/seed/demo.ts`, never
|
||||
in `approved.ts`, and `pnpm seed` without `--demo` must stay publishable.
|
||||
6. **`docs/` is read-only source material.** Never edit, move or "clean up" those files.
|
||||
7. **Both locales, always.** New UI text goes into `app/i18n/messages/en.json` *and*
|
||||
`ar.json` with identical keys (the `Messages` type enforces it). A component that hard-codes
|
||||
@@ -86,6 +88,7 @@ unreachable — the site must never 500 because Strapi is down.
|
||||
| HTML shell, canonical, hreflang | `apps/web/app/root.tsx` |
|
||||
| Content types | `apps/cms/src/api/<name>/content-types/<name>/schema.json` |
|
||||
| Boot-time locale + permission setup | `apps/cms/src/bootstrap/` |
|
||||
| CMS seed content (`pnpm seed`) | `apps/cms/src/seed/` — `approved.ts` is from `docs/`; `demo.ts` is invented, opt-in behind `--demo`, every slug prefixed `demo-` |
|
||||
| CORS, upload rules, i18n locales | `apps/cms/config/{middlewares.ts,plugins.ts}` |
|
||||
|
||||
## Conventions that bite
|
||||
|
||||
@@ -26,6 +26,7 @@ publications — all of it in English and Arabic, with the Arabic side laid out
|
||||
- [Path A — manual setup](#path-a--manual-setup)
|
||||
- [Path B — Docker](#path-b--docker)
|
||||
- [Available scripts](#available-scripts)
|
||||
- [Seeding content](#seeding-content)
|
||||
- [Design tokens](#design-tokens)
|
||||
- [Bilingual EN / AR](#bilingual-en--ar)
|
||||
- [Adding a content type, end to end](#adding-a-content-type-end-to-end)
|
||||
@@ -195,12 +196,17 @@ sudo -u postgres psql -c "CREATE ROLE sharper WITH LOGIN PASSWORD 'a-strong-pass
|
||||
|
||||
### 4. Environment files
|
||||
|
||||
Two files, with different jobs:
|
||||
Three files, with different jobs:
|
||||
|
||||
| File | Read by | Required in manual mode |
|
||||
| --- | --- | --- |
|
||||
| `apps/cms/.env` | Strapi (it loads its own `.env`) | **yes** |
|
||||
| `.env` (root) | `docker compose`, and optionally the web server | no — the code defaults already point at `localhost` |
|
||||
| `apps/web/.env` | `pnpm --filter web start` (it loads its own `.env`) | no — but it is where `PORT` goes |
|
||||
| `.env` (root) | `docker compose` only | no |
|
||||
|
||||
Each application reads its **own** `.env`, and the root one belongs to `docker compose`.
|
||||
That split is not cosmetic: `PORT` and `HOST` mean something different to each server, and a
|
||||
single shared value would put Strapi on the website's port.
|
||||
|
||||
```bash
|
||||
# CMS: copy the fully documented template, then fill in the six secrets
|
||||
@@ -222,17 +228,19 @@ overwrites a value that is already set unless you pass `--force`, so it is safe
|
||||
Without `--write` it just prints a block you can paste. By hand:
|
||||
`openssl rand -base64 32`, once per key (`APP_KEYS` takes at least two, comma separated).
|
||||
|
||||
The web application reads `STRAPI_URL`, `STRAPI_TOKEN` and `SITE_URL` from its **process
|
||||
environment**. Nothing loads the root `.env` for you in manual mode, and you do not need it:
|
||||
`STRAPI_URL` already defaults to `http://localhost:1337`, and with `SITE_URL` unset the
|
||||
canonical URL is derived from the incoming request. To override them anyway:
|
||||
The web application needs nothing to start: `STRAPI_URL` already defaults to
|
||||
`http://localhost:1337`, and with `SITE_URL` unset the canonical URL is derived from the
|
||||
incoming request. Copy its template when you want to override those, or to pin the
|
||||
production port:
|
||||
|
||||
```bash
|
||||
cp .env.example .env
|
||||
set -a; . ./.env; set +a # export it into the current shell
|
||||
pnpm dev
|
||||
cp apps/web/.env.example apps/web/.env # PORT, HOST, SITE_URL, STRAPI_URL, STRAPI_TOKEN
|
||||
```
|
||||
|
||||
`pnpm --filter web start` loads that file. `pnpm dev:web` does not — the dev server is Vite
|
||||
on 5173 — so export anything you need for development, or put it in the file for the
|
||||
production server and pass it inline while developing.
|
||||
|
||||
### 5. Run both applications
|
||||
|
||||
```bash
|
||||
@@ -461,7 +469,8 @@ docker run --rm -v sharper_cms-uploads:/data -v "$PWD":/backup alpine \
|
||||
| `pnpm dev:cms` | `strapi develop` (auto-reloads on schema changes) → `http://localhost:1337` |
|
||||
| `pnpm build` | builds the CMS, then the web app (that order: the web build has no CMS dependency, but a broken CMS build should fail first) |
|
||||
| `pnpm start` | runs both production builds |
|
||||
| `pnpm typecheck` | the web app's `react-router typegen && tsc` (the CMS has no `typecheck` script — its TypeScript is checked by `strapi build`) |
|
||||
| `pnpm seed` | writes the approved content into the CMS — see [Seeding content](#seeding-content) |
|
||||
| `pnpm typecheck` | `tsc` in both applications, preceded in the web app by `react-router typegen` |
|
||||
|
||||
**`apps/web`** — run with `pnpm --filter web <script>`:
|
||||
|
||||
@@ -469,7 +478,7 @@ docker run --rm -v sharper_cms-uploads:/data -v "$PWD":/backup alpine \
|
||||
| --- | --- |
|
||||
| `dev` | `react-router dev` — SSR dev server with HMR |
|
||||
| `build` | `react-router build` → `build/client` (static assets) + `build/server` (SSR bundle) |
|
||||
| `start` | `react-router-serve ./build/server/index.js` — the production server, port 3000 |
|
||||
| `start` | the production server — `react-router-serve ./build/server/index.js`, started with `node --env-file-if-exists=.env` so `apps/web/.env` can set `PORT` |
|
||||
| `typecheck` | regenerates `+types/*` route types, then `tsc` |
|
||||
|
||||
**`apps/cms`** — run with `pnpm --filter cms <script>`:
|
||||
@@ -479,6 +488,7 @@ docker run --rm -v sharper_cms-uploads:/data -v "$PWD":/backup alpine \
|
||||
| `develop` / `dev` | `strapi develop` — the only mode in which the Content-Type Builder can write schemas |
|
||||
| `build` | builds the admin panel and compiles the TypeScript server into `dist/` |
|
||||
| `start` | `strapi start` — production mode; the Content-Type Builder is disabled |
|
||||
| `seed` | writes the CMS content — `pnpm --filter cms seed -- --demo` to include the fixtures |
|
||||
| `console` | a REPL with `strapi` in scope, for one-off data fixes |
|
||||
| `strapi` | the CLI itself, e.g. `pnpm --filter cms exec strapi admin:create-user` |
|
||||
| `upgrade` / `upgrade:dry` | `@strapi/upgrade` codemods for a minor/major version bump |
|
||||
@@ -493,6 +503,73 @@ docker run --rm -v sharper_cms-uploads:/data -v "$PWD":/backup alpine \
|
||||
|
||||
---
|
||||
|
||||
## Seeding content
|
||||
|
||||
A fresh database has an empty CMS, so every page renders its fallback copy and
|
||||
every listing renders its empty state. `pnpm seed` fills it in. Both
|
||||
applications can stay running while it does — it talks to PostgreSQL directly
|
||||
and never opens a port of its own.
|
||||
|
||||
```bash
|
||||
pnpm seed # the approved content
|
||||
pnpm seed -- --demo # the same, plus fixtures to look at
|
||||
pnpm seed -- --demo --clean # remove those fixtures again
|
||||
```
|
||||
|
||||
> The `--` is pnpm's, not the seed's. Running it from `apps/cms` (`pnpm seed
|
||||
> --demo`) needs no separator.
|
||||
|
||||
**It is safe to run twice.** Every write is matched on a slug and written over
|
||||
the same document, so a second run changes nothing but the fields the seed
|
||||
owns — your own edits to other fields survive. It deletes nothing except on
|
||||
`--demo --clean`. It uploads nothing: where a page already has a picture, the
|
||||
existing file is read back and written out again with the new copy.
|
||||
|
||||
### The approved set — `apps/cms/src/seed/approved.ts`
|
||||
|
||||
Transcribed from `docs/`, in both languages, and safe to publish: the site
|
||||
settings, the three consortium members, the topic taxonomy, the five activity
|
||||
streams, the launch article, and the About, What We Do, Contact and Home
|
||||
pages.
|
||||
|
||||
What `docs/` does not supply is not written. There are no statistics anywhere
|
||||
(the source marks every number "TBD — must not be published until confirmed"),
|
||||
no project email, no Facebook URL and no consortium addresses, because the
|
||||
source writes all of those as bracketed placeholders. Two fields are judgement
|
||||
calls and say so at the line: every activity's `activityStatus`, which the
|
||||
schema requires and the source never states, and the launch article's year,
|
||||
which is derived — the source says "Tuesday, June 30", and within the project's
|
||||
own December 2025 – December 2027 window that is 2026 and no other year.
|
||||
|
||||
### The demo set — `apps/cms/src/seed/demo.ts`
|
||||
|
||||
Invented content: twelve network organisations, six articles, six events, four
|
||||
opportunities, six resources, six knowledge items, eight questions and five
|
||||
regions, across the calendar and across every enum value, so the listings,
|
||||
filters, detail pages and the home page's logo marquee have something in them.
|
||||
|
||||
It is kept apart from real content three ways:
|
||||
|
||||
1. **Opt-in.** `pnpm seed` never writes it.
|
||||
2. **Refused in production.** With `NODE_ENV=production` the seed exits with an
|
||||
error rather than writing a fixture, whatever flags it is given.
|
||||
3. **Tagged in the data.** Every demo slug starts `demo-`, so it is visible in
|
||||
every URL — `/en/news-and-updates/demo-…` — and `--demo --clean` finds them
|
||||
again by that prefix alone, with nothing remembered between runs.
|
||||
|
||||
### After seeding
|
||||
|
||||
```bash
|
||||
curl -s "http://localhost:1337/api/news-articles?locale=ar" | head -c 200
|
||||
```
|
||||
|
||||
Then the home page at `http://localhost:5173/en` and `/ar`: the hero carries the
|
||||
CMS headline, the newsroom band has cards, and — with `--demo` — the network
|
||||
logo wall becomes the marquee, which needs at least eight partners before it
|
||||
stops being a grid.
|
||||
|
||||
---
|
||||
|
||||
## Design tokens
|
||||
|
||||
Two tiers, so re-branding is a one-line edit in one file.
|
||||
@@ -766,18 +843,50 @@ pnpm install --frozen-lockfile
|
||||
pnpm build # cms (admin panel + dist/) then web (build/client + build/server)
|
||||
|
||||
pnpm --filter cms start # strapi start :1337
|
||||
pnpm --filter web start # react-router-serve :3000
|
||||
pnpm --filter web start # react-router-serve :$PORT (see below)
|
||||
```
|
||||
|
||||
Both are ordinary long-running Node processes. Run them under systemd, PM2 or the
|
||||
containers in `docker-compose.yml`, behind a reverse proxy (nginx, Caddy) that terminates
|
||||
TLS and forwards to 3000 and 1337.
|
||||
|
||||
#### Choosing the web server's port
|
||||
|
||||
`react-router-serve` binds `PORT` when it is set, and otherwise takes the first **free** port
|
||||
from 3000 upwards — so a busy 3000 moves the site to 3001, 3002, … with no error, and the
|
||||
proxy's upstream stops matching. Nothing in the repository defaults it for you.
|
||||
|
||||
`pnpm --filter web start` runs under `node --env-file-if-exists=.env`, so `apps/web/.env` is
|
||||
enough:
|
||||
|
||||
```bash
|
||||
echo 'PORT=8080' >> apps/web/.env
|
||||
pnpm --filter web start # :8080
|
||||
```
|
||||
|
||||
It has to be that file and not the root `.env`: Strapi reads a bare `PORT` too, so a shared
|
||||
one would move the CMS onto the website's port. `apps/web/.env` is read by the web server
|
||||
alone, exactly as `apps/cms/.env` is read by Strapi alone.
|
||||
|
||||
A real environment variable wins over the file, so `PORT=9090 pnpm --filter web start` and a
|
||||
systemd unit's `Environment=PORT=8080` both override it. `HOST` works the same way — unset it
|
||||
listens on every interface, `HOST=127.0.0.1` only accepts the reverse proxy on the same host.
|
||||
|
||||
Under Docker none of this applies: `PORT=3000` is set in the image and in
|
||||
`docker-compose.yml`, `WEB_PORT` in the root `.env` is the **host** port the container is
|
||||
published on (`WEB_PORT=8080` gives `8080:3000`), and `.dockerignore` keeps every `.env` out
|
||||
of the build context.
|
||||
|
||||
Whichever port you pick, `SITE_URL` stays the public origin (`https://sharper.ly`), not
|
||||
`http://127.0.0.1:8080` — canonical URLs, `hreflang` and JSON-LD are built from it.
|
||||
|
||||
### Production environment
|
||||
|
||||
| Variable | Where | Value |
|
||||
| --- | --- | --- |
|
||||
| `NODE_ENV` | both | `production` |
|
||||
| `PORT` | web | the port `react-router-serve` binds, e.g. `8080`. Unset, it takes the first free port from 3000 upwards |
|
||||
| `HOST` | web | optional; `127.0.0.1` to accept only the local reverse proxy, unset to listen on every interface |
|
||||
| `SITE_URL` | web | `https://sharper.ly` — canonical URLs, `hreflang`, JSON-LD are built from it |
|
||||
| `STRAPI_URL` | web | the CMS origin, e.g. `https://cms.sharper.ly`. It is also prefixed onto media URLs, so it must be resolvable **by the browser**, not only from the server |
|
||||
| `STRAPI_TOKEN` | web | only needed for draft/protected content; published content is public |
|
||||
|
||||
@@ -143,6 +143,13 @@ UPLOAD_MAX_FILE_SIZE=52428800
|
||||
# Cache-Control max-age (ms) for files served by the local upload provider.
|
||||
UPLOAD_LOCAL_MAX_AGE=300000
|
||||
|
||||
SMTP_HOST=smtp.example.com
|
||||
SMTP_PORT=587
|
||||
SMTP_USERNAME=your-username
|
||||
SMTP_PASSWORD=your-password
|
||||
DEFAULT_FROM=no-reply@yourdomain.com
|
||||
DEFAULT_REPLY_TO=support@yourdomain.com
|
||||
|
||||
# Production only - switching the upload provider to S3. Uncomment these after
|
||||
# adding @strapi/provider-upload-aws-s3 and editing the upload block in
|
||||
# config/plugins.ts (the switch is documented there step by step).
|
||||
|
||||
@@ -138,6 +138,24 @@ const config = ({ env }: Core.Config.Shared.ConfigParams): Core.Config.Plugin =>
|
||||
},
|
||||
},
|
||||
},
|
||||
email: {
|
||||
config: {
|
||||
provider: "@strapi/provider-email-nodemailer",
|
||||
providerOptions: {
|
||||
host: env("SMTP_HOST", "mail.sharper.ly"),
|
||||
port: env("SMTP_PORT", 587),
|
||||
secure: true,
|
||||
auth: {
|
||||
user: env("SMTP_USERNAME"),
|
||||
pass: env("SMTP_PASSWORD"),
|
||||
},
|
||||
},
|
||||
settings: {
|
||||
defaultFrom: "SHARP-ER <noreply@sharper.ly>",
|
||||
defaultReplyTo: "United Efforts <info@unitedefforts.ngo>"
|
||||
}
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
export default config;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"console": "strapi console",
|
||||
"deploy": "strapi deploy",
|
||||
"dev": "strapi develop",
|
||||
"seed": "node --env-file-if-exists=.env ./scripts/seed.js",
|
||||
"develop": "strapi develop",
|
||||
"start": "strapi start",
|
||||
"strapi": "strapi",
|
||||
@@ -19,6 +20,7 @@
|
||||
"@strapi/database": "5.53.0",
|
||||
"@strapi/plugin-cloud": "5.53.0",
|
||||
"@strapi/plugin-users-permissions": "5.53.0",
|
||||
"@strapi/provider-email-nodemailer": "^5.54.0",
|
||||
"@strapi/strapi": "5.53.0",
|
||||
"pg": "^8.23.0",
|
||||
"react": "^18.0.0",
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
/* ============================================================================
|
||||
SEED RUNNER
|
||||
----------------------------------------------------------------------------
|
||||
Boots Strapi far enough to use the document service, runs src/seed, and
|
||||
shuts it down again. It does NOT start a server: nothing listens on a port,
|
||||
so it is safe to run while `pnpm dev:cms` is up - both talk to the same
|
||||
PostgreSQL database.
|
||||
|
||||
`compileStrapi()` is Strapi's own TypeScript build step. It compiles
|
||||
src/** (the seed included) into dist/, which is why this file is plain
|
||||
CommonJS JavaScript and everything it calls is TypeScript.
|
||||
|
||||
Usage:
|
||||
pnpm seed
|
||||
pnpm seed --demo
|
||||
pnpm seed --demo --clean
|
||||
========================================================================= */
|
||||
|
||||
'use strict';
|
||||
|
||||
const { compileStrapi, createStrapi } = require('@strapi/strapi');
|
||||
|
||||
async function main() {
|
||||
const appContext = await compileStrapi();
|
||||
const app = await createStrapi(appContext).load();
|
||||
|
||||
/* Required from dist, not from src: the file below is TypeScript, and what
|
||||
`compileStrapi()` just produced is the JavaScript for it. */
|
||||
const { runSeed, parseSeedOptions } = require('../dist/src/seed');
|
||||
|
||||
try {
|
||||
await runSeed(app, parseSeedOptions(process.argv.slice(2)));
|
||||
} finally {
|
||||
await shutdown(app);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shut Strapi down without letting the shutdown fail the run.
|
||||
*
|
||||
* Knex tears its connection pool down by aborting every acquisition still
|
||||
* pending on it, and each abort rejects a promise that nothing is waiting on -
|
||||
* so it arrives as an unhandled rejection reading "aborted" rather than as an
|
||||
* error this function could simply catch. Everything the seed wrote is
|
||||
* committed long before this point, so those are absorbed for the length of
|
||||
* the shutdown and nothing else is: a seed that worked must not report itself
|
||||
* as a seed that failed, and a real error must still say so.
|
||||
*/
|
||||
async function shutdown(app) {
|
||||
const absorbAbort = (reason) => {
|
||||
const message = reason instanceof Error ? reason.message : String(reason);
|
||||
if (message !== 'aborted') {
|
||||
console.warn(`[seed] while shutting down: ${message}`);
|
||||
}
|
||||
};
|
||||
|
||||
process.on('unhandledRejection', absorbAbort);
|
||||
|
||||
try {
|
||||
await app.destroy();
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
console.warn(`[seed] Strapi did not shut down cleanly (${message}). The data is written.`);
|
||||
} finally {
|
||||
process.off('unhandledRejection', absorbAbort);
|
||||
}
|
||||
}
|
||||
|
||||
main()
|
||||
.then(() => process.exit(0))
|
||||
.catch((error) => {
|
||||
console.error(error instanceof Error ? error.message : error);
|
||||
if (error instanceof Error && error.stack) console.error(error.stack);
|
||||
process.exit(1);
|
||||
});
|
||||
@@ -39,7 +39,6 @@
|
||||
"components": [
|
||||
"blocks.rich-text",
|
||||
"blocks.image-gallery",
|
||||
"blocks.stats-grid",
|
||||
"blocks.cta-banner",
|
||||
"blocks.card-grid",
|
||||
"blocks.quote",
|
||||
|
||||
@@ -58,7 +58,6 @@
|
||||
"components": [
|
||||
"blocks.rich-text",
|
||||
"blocks.image-gallery",
|
||||
"blocks.stats-grid",
|
||||
"blocks.cta-banner",
|
||||
"blocks.card-grid",
|
||||
"blocks.quote",
|
||||
|
||||
@@ -26,10 +26,10 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"stats": {
|
||||
"approach": {
|
||||
"type": "component",
|
||||
"repeatable": true,
|
||||
"component": "shared.stat",
|
||||
"repeatable": false,
|
||||
"component": "page.band-intro",
|
||||
"pluginOptions": {
|
||||
"i18n": {
|
||||
"localized": true
|
||||
@@ -41,7 +41,6 @@
|
||||
"components": [
|
||||
"blocks.rich-text",
|
||||
"blocks.image-gallery",
|
||||
"blocks.stats-grid",
|
||||
"blocks.cta-banner",
|
||||
"blocks.card-grid",
|
||||
"blocks.quote",
|
||||
|
||||
@@ -58,7 +58,6 @@
|
||||
"components": [
|
||||
"blocks.rich-text",
|
||||
"blocks.image-gallery",
|
||||
"blocks.stats-grid",
|
||||
"blocks.cta-banner",
|
||||
"blocks.card-grid",
|
||||
"blocks.quote",
|
||||
|
||||
@@ -58,7 +58,6 @@
|
||||
"components": [
|
||||
"blocks.rich-text",
|
||||
"blocks.image-gallery",
|
||||
"blocks.stats-grid",
|
||||
"blocks.cta-banner",
|
||||
"blocks.card-grid",
|
||||
"blocks.quote",
|
||||
|
||||
@@ -67,7 +67,6 @@
|
||||
"components": [
|
||||
"blocks.rich-text",
|
||||
"blocks.image-gallery",
|
||||
"blocks.stats-grid",
|
||||
"blocks.cta-banner",
|
||||
"blocks.card-grid",
|
||||
"blocks.quote",
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"collectionName": "components_blocks_stats_grids",
|
||||
"info": {
|
||||
"displayName": "Stats Grid",
|
||||
"icon": "chartBubble",
|
||||
"description": "A grid of headline figures."
|
||||
},
|
||||
"options": {},
|
||||
"attributes": {
|
||||
"stats": {
|
||||
"type": "component",
|
||||
"repeatable": true,
|
||||
"component": "shared.stat"
|
||||
},
|
||||
"note": {
|
||||
"type": "text"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"collectionName": "components_page_band_intros",
|
||||
"info": {
|
||||
"displayName": "Band intro",
|
||||
"icon": "layer",
|
||||
"description": "The heading, lead and pictures of a page band, in one place so an editor is not hunting for half of it in the Blocks zone."
|
||||
},
|
||||
"options": {},
|
||||
"attributes": {
|
||||
"eyebrow": {
|
||||
"type": "string"
|
||||
},
|
||||
"heading": {
|
||||
"type": "string"
|
||||
},
|
||||
"lead": {
|
||||
"type": "text"
|
||||
},
|
||||
"images": {
|
||||
"type": "media",
|
||||
"multiple": true,
|
||||
"required": false,
|
||||
"allowedTypes": [
|
||||
"images"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"collectionName": "components_shared_stats",
|
||||
"info": {
|
||||
"displayName": "Stat",
|
||||
"icon": "chartBubble",
|
||||
"description": "A single headline figure, e.g. 64 / CSO Partners."
|
||||
},
|
||||
"options": {},
|
||||
"attributes": {
|
||||
"value": {
|
||||
"type": "string",
|
||||
"required": true
|
||||
},
|
||||
"label": {
|
||||
"type": "string",
|
||||
"required": true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,706 @@
|
||||
/* ============================================================================
|
||||
SEED - APPROVED CONTENT
|
||||
----------------------------------------------------------------------------
|
||||
Everything in this file is transcribed from docs/, in both languages, and
|
||||
nothing in it is invented. That is the whole point of keeping it apart from
|
||||
demo.ts: this content is safe to publish.
|
||||
|
||||
SOURCES
|
||||
docs/SHARPER_Website_Draft_Section_EN_AR.docx sections 1-9, EN and AR
|
||||
columns, which is why no
|
||||
Arabic string here is a
|
||||
machine translation
|
||||
docs/SHARPER Home Page .docx the launch article, EN/AR
|
||||
docs/UEC_SHARPER_Website_TOR V3.docx the consortium and the
|
||||
project's purpose
|
||||
|
||||
WHAT docs/ DOES NOT SUPPLY, AND IS THEREFORE NOT HERE
|
||||
* Figures. Every number in the draft is bracketed and marked "TBD ... must
|
||||
not be published until confirmed". There is no figures band on the site
|
||||
and no `stats` component in the CMS - both were removed rather than left
|
||||
as an empty invitation to fill one in.
|
||||
* The project email. The draft writes it "[project email - e.g.
|
||||
info@sharper.ly]", an example rather than an address, so
|
||||
`contact-page.generalEmail` is left empty.
|
||||
* The Facebook URL and the SHARP-legacy link. Both are bracketed
|
||||
placeholders, and `shared.link` requires an href, so neither link is
|
||||
written at all rather than written to nowhere.
|
||||
* Consortium postal addresses - "[addresses/contacts TBD]".
|
||||
* Any CSO partner, event, resource or question. The draft's examples are
|
||||
all written "[CSO Name]", "[Date]", "[Report title]". Those live in
|
||||
demo.ts and are opt-in.
|
||||
|
||||
THE TWO JUDGEMENT CALLS, BOTH FLAGGED AT THEIR FIELD
|
||||
* `activityStatus` is required by the schema and the draft states no
|
||||
status per activity stream.
|
||||
* The launch article's year is derived, not given.
|
||||
========================================================================= */
|
||||
|
||||
import type { Localised, SeedData } from './upsert';
|
||||
|
||||
/** Slug -> content, for the collection types the approved set writes. */
|
||||
export type SeedEntries = ReadonlyArray<{
|
||||
readonly slug: string;
|
||||
readonly data: Localised<SeedData>;
|
||||
}>;
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
SITE SETTINGS
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
export const SITE_SETTINGS: Localised<SeedData> = {
|
||||
en: {
|
||||
siteName: 'SHARP-ER',
|
||||
tagline: 'Shared Action on Rule of Law Progress – Exit Route',
|
||||
euFundingStatement: 'Funded by the European Union',
|
||||
implementedByLabel: 'Implemented by',
|
||||
},
|
||||
ar: {
|
||||
siteName: 'SHARP-ER',
|
||||
tagline: 'العمل المشترك لتعزيز سيادة القانون – مسار الخروج',
|
||||
euFundingStatement: 'بتمويل من الاتحاد الأوروبي',
|
||||
implementedByLabel: 'ينفّذه',
|
||||
},
|
||||
};
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
THE CONSORTIUM
|
||||
----------------------------------------------------------------------------
|
||||
Draft section 1 writes each member as "<name> - <role> - <deliverable>".
|
||||
The Latin names are kept in the Arabic column exactly as the draft keeps
|
||||
them. No website is seeded: the draft names none.
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
export const CONSORTIUM: SeedEntries = [
|
||||
{
|
||||
slug: 'acted',
|
||||
data: {
|
||||
en: {
|
||||
name: 'Acted',
|
||||
slug: 'acted',
|
||||
partnerRole: 'consortium-lead',
|
||||
description:
|
||||
'Lead implementing partner — overall project management and civil society sub-projects.',
|
||||
},
|
||||
ar: {
|
||||
name: 'Acted',
|
||||
slug: 'acted',
|
||||
partnerRole: 'consortium-lead',
|
||||
description: 'الشريك المنفّذ الرئيسي — الإدارة العامة للمشروع والمشاريع الفرعية لمنظمات المجتمع المدني.',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
slug: 'united-efforts-consultancy',
|
||||
data: {
|
||||
en: {
|
||||
name: 'United Efforts Consultancy (UEC)',
|
||||
slug: 'united-efforts-consultancy',
|
||||
partnerRole: 'consortium-partner',
|
||||
description: 'Network strengthening, dialogue, and peer-learning.',
|
||||
},
|
||||
ar: {
|
||||
name: 'United Efforts Consultancy (UEC)',
|
||||
slug: 'united-efforts-consultancy',
|
||||
partnerRole: 'consortium-partner',
|
||||
description: 'تعزيز الشبكة، والحوار، والتعلّم بين الأقران.',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
slug: 'stichting-bureau-ensemble',
|
||||
data: {
|
||||
en: {
|
||||
name: 'Stichting Bureau Ensemble (SBE)',
|
||||
slug: 'stichting-bureau-ensemble',
|
||||
partnerRole: 'consortium-partner',
|
||||
description: 'Research, perception data, and knowledge publications.',
|
||||
},
|
||||
ar: {
|
||||
name: 'Stichting Bureau Ensemble (SBE)',
|
||||
slug: 'stichting-bureau-ensemble',
|
||||
partnerRole: 'consortium-partner',
|
||||
description: 'البحث، وبيانات الاستطلاع، والمنشورات المعرفية.',
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
/** Slugs, so later steps can wire relations without repeating the strings. */
|
||||
export const PARTNER_SLUGS = {
|
||||
acted: 'acted',
|
||||
uec: 'united-efforts-consultancy',
|
||||
sbe: 'stichting-bureau-ensemble',
|
||||
} as const;
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
TOPICS
|
||||
----------------------------------------------------------------------------
|
||||
The taxonomy the site filters by. Each name and description is one of the
|
||||
draft's own area headings - the three pillars of section 1 and two of the
|
||||
five activity streams of section 3 - so the vocabulary is the project's,
|
||||
not one this seed made up.
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
export const TOPICS: SeedEntries = [
|
||||
{
|
||||
slug: 'rule-of-law',
|
||||
data: {
|
||||
en: {
|
||||
name: 'Rule of Law',
|
||||
slug: 'rule-of-law',
|
||||
description:
|
||||
'Supporting local institutions to improve access to justice and transparency.',
|
||||
},
|
||||
ar: {
|
||||
name: 'سيادة القانون',
|
||||
slug: 'rule-of-law',
|
||||
description: 'دعم المؤسسات المحلية لتحسين الوصول إلى العدالة وتعزيز الشفافية.',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
slug: 'civil-society',
|
||||
data: {
|
||||
en: {
|
||||
name: 'Civil Society',
|
||||
slug: 'civil-society',
|
||||
description:
|
||||
'Building the capacity of CSOs to strengthen their role in oversight and accountability.',
|
||||
},
|
||||
ar: {
|
||||
name: 'المجتمع المدني',
|
||||
slug: 'civil-society',
|
||||
description: 'بناء قدرات منظمات المجتمع المدني لتعزيز دورها في الرقابة والمساءلة.',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
slug: 'local-governance',
|
||||
data: {
|
||||
en: {
|
||||
name: 'Local Governance',
|
||||
slug: 'local-governance',
|
||||
description:
|
||||
'Enhancing collaboration between municipalities and local actors to improve service delivery.',
|
||||
},
|
||||
ar: {
|
||||
name: 'الحوكمة المحلية',
|
||||
slug: 'local-governance',
|
||||
description: 'تعزيز التعاون بين البلديات والجهات الفاعلة المحلية لتحسين تقديم الخدمات.',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
slug: 'dialogue',
|
||||
data: {
|
||||
en: {
|
||||
name: 'Dialogue',
|
||||
slug: 'dialogue',
|
||||
description:
|
||||
'SUQ dialogues and Civil Society Law Sessions that bring civic and government actors to the same table.',
|
||||
},
|
||||
ar: {
|
||||
name: 'الحوار',
|
||||
slug: 'dialogue',
|
||||
description: 'حوارات SUQ وجلسات قانون المجتمع المدني التي تجمع الفاعلين المدنيين والحكوميين حول طاولة واحدة.',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
slug: 'human-security',
|
||||
data: {
|
||||
en: {
|
||||
name: 'Human Security',
|
||||
slug: 'human-security',
|
||||
description: 'Sub-projects designed to foster human security at the community level.',
|
||||
},
|
||||
ar: {
|
||||
name: 'الأمن البشري',
|
||||
slug: 'human-security',
|
||||
description: 'مشاريع فرعية مصمَّمة لتعزيز الأمن البشري على المستوى المجتمعي.',
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
export const TOPIC_SLUGS = {
|
||||
ruleOfLaw: 'rule-of-law',
|
||||
civilSociety: 'civil-society',
|
||||
localGovernance: 'local-governance',
|
||||
dialogue: 'dialogue',
|
||||
humanSecurity: 'human-security',
|
||||
} as const;
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
ACTIVITIES - draft section 3
|
||||
----------------------------------------------------------------------------
|
||||
Five streams, and the draft names all five along with the partner that
|
||||
implements each. They map one-to-one onto the `activityStream` enum, which
|
||||
is where that enum came from.
|
||||
|
||||
`activityStatus` is the one field with no source. The schema requires it and
|
||||
the draft states no status per stream, so every activity is seeded
|
||||
`ongoing`: the draft heads the section "here's where the project stands
|
||||
today" and describes all five in the present tense. It is a default for
|
||||
editors to correct, not a claim from docs/.
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
const activity = (
|
||||
slug: string,
|
||||
stream: string,
|
||||
partners: readonly string[],
|
||||
topics: readonly string[],
|
||||
en: { title: string; summary: string },
|
||||
ar: { title: string; summary: string }
|
||||
) => ({
|
||||
slug,
|
||||
partners,
|
||||
topics,
|
||||
data: {
|
||||
en: {
|
||||
title: en.title,
|
||||
slug,
|
||||
summary: en.summary,
|
||||
activityStream: stream,
|
||||
activityStatus: 'ongoing',
|
||||
},
|
||||
ar: {
|
||||
title: ar.title,
|
||||
slug,
|
||||
summary: ar.summary,
|
||||
activityStream: stream,
|
||||
activityStatus: 'ongoing',
|
||||
},
|
||||
} satisfies Localised<SeedData>,
|
||||
});
|
||||
|
||||
export const ACTIVITIES = [
|
||||
activity(
|
||||
'the-sharp-network',
|
||||
'sharp-network',
|
||||
[PARTNER_SLUGS.uec],
|
||||
[TOPIC_SLUGS.civilSociety],
|
||||
{
|
||||
title: 'The SHARP Network',
|
||||
summary:
|
||||
'Regional meetings, international events, and peer-to-peer learning that keep the civil society network connected.',
|
||||
},
|
||||
{
|
||||
title: 'شبكة SHARP',
|
||||
summary: 'اجتماعات إقليمية وفعاليات دولية وتعلّم بين الأقران تُبقي شبكة المجتمع المدني على تواصل.',
|
||||
}
|
||||
),
|
||||
activity(
|
||||
'cso-sub-projects-and-policy-to-rights',
|
||||
'cso-subprojects-p2r',
|
||||
[PARTNER_SLUGS.acted],
|
||||
[TOPIC_SLUGS.civilSociety, TOPIC_SLUGS.ruleOfLaw],
|
||||
{
|
||||
title: 'CSO Sub-Projects & Policy-to-Rights',
|
||||
summary:
|
||||
'Collective sub-projects selected through open Calls for Expression of Interest, fostering cross-country cooperation, plus Policy-to-Rights (P2R) projects.',
|
||||
},
|
||||
{
|
||||
title: 'المشاريع الفرعية لمنظمات المجتمع المدني ومشاريع P2R',
|
||||
summary:
|
||||
'مشاريع فرعية جماعية تُختار عبر دعوات مفتوحة للتعبير عن الاهتمام لتعزيز التعاون العابر للمناطق، إضافة إلى مشاريع “من السياسة إلى الحقوق”.',
|
||||
}
|
||||
),
|
||||
activity(
|
||||
'suq-dialogues-and-civil-society-law-sessions',
|
||||
'suq-dialogues',
|
||||
[PARTNER_SLUGS.uec, PARTNER_SLUGS.acted],
|
||||
[TOPIC_SLUGS.dialogue, TOPIC_SLUGS.ruleOfLaw],
|
||||
{
|
||||
title: 'SUQ Dialogues & Civil Society Law Sessions',
|
||||
summary:
|
||||
'Search, Understand, Question (SUQ) dialogues driven by local needs, dialogue-facilitation training, and joint sessions with the Commission on Civil Society (CCS).',
|
||||
},
|
||||
{
|
||||
title: 'حوارات SUQ وجلسات قانون المجتمع المدني',
|
||||
summary:
|
||||
'حوارات “ابحث، افهم، اسأل” (SUQ) مدفوعة باحتياجات محلية، وتدريب على تيسير الحوار، وجلسات مشتركة مع لجنة المجتمع المدني (CCS).',
|
||||
}
|
||||
),
|
||||
activity(
|
||||
'human-security-initiatives',
|
||||
'human-security',
|
||||
[PARTNER_SLUGS.uec],
|
||||
[TOPIC_SLUGS.humanSecurity],
|
||||
{
|
||||
title: 'Human Security Initiatives',
|
||||
summary:
|
||||
'16 individual sub-projects designed to foster human security at the community level.',
|
||||
},
|
||||
{
|
||||
title: 'مبادرات الأمن البشري',
|
||||
summary: '16 مشروعًا فرديًا فرعيًا مصمَّمًا لتعزيز الأمن البشري على المستوى المجتمعي.',
|
||||
}
|
||||
),
|
||||
activity(
|
||||
'research-and-perception-data',
|
||||
'research',
|
||||
[PARTNER_SLUGS.sbe],
|
||||
[TOPIC_SLUGS.localGovernance],
|
||||
{
|
||||
title: 'Research & Perception Data',
|
||||
summary: 'Nationwide perception-based data collection, analysis, and dissemination.',
|
||||
},
|
||||
{
|
||||
title: 'البحث وبيانات الاستطلاع',
|
||||
summary: 'جمع بيانات استطلاعية على المستوى الوطني وتحليلها ونشرها.',
|
||||
}
|
||||
),
|
||||
] as const;
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
THE LAUNCH ARTICLE - docs/SHARPER Home Page .docx
|
||||
----------------------------------------------------------------------------
|
||||
The one piece of real news the project has handed over, written out in full
|
||||
in both languages.
|
||||
|
||||
THE DATE: the document says "Tuesday, June 30" and gives no year. Within the
|
||||
project's own window - December 2025 to December 2027 - 30 June falls on a
|
||||
Tuesday in 2026 and in no other year, so 2026-06-30 is derived from the
|
||||
source rather than chosen.
|
||||
|
||||
The source's closing line ("Visit the SHARP-ER website and follow our social
|
||||
media channels...") is left out: it addresses a reader on social media and
|
||||
asks them to come to this site, which is not something to print on it.
|
||||
|
||||
No `authorOrganisation`: the document attributes the article to no one, and
|
||||
a byline is not a thing to guess at.
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
const LAUNCH_SLUG = 'sharp-er-project-officially-launches-in-libya';
|
||||
|
||||
export const LAUNCH_ARTICLE = {
|
||||
slug: LAUNCH_SLUG,
|
||||
topics: [TOPIC_SLUGS.civilSociety, TOPIC_SLUGS.ruleOfLaw],
|
||||
data: {
|
||||
en: {
|
||||
title: 'SHARP-ER Project Officially Launches in Libya',
|
||||
slug: LAUNCH_SLUG,
|
||||
category: 'sharper-news',
|
||||
publishDate: '2026-06-30',
|
||||
featured: true,
|
||||
excerpt:
|
||||
'The launch brought together the European Union Delegation, three ministries, civil society organisations, partners and stakeholders from across Libya, and opened the Expression of Interest.',
|
||||
body: [
|
||||
'On Tuesday, June 30, the SHARP-ER project officially launched, bringing together representatives from the European Union Delegation, the Ministry of Youth, the Ministry of Local Governance, the Ministry of Women’s Affairs, civil society organizations, partners, and stakeholders from across Libya.',
|
||||
'The event marked an important start for the project, including the launch of the SHARP-ER website and the opening of the Expression of Interest (EOI). Participants also learned more about the project’s objectives, upcoming opportunities, and activities focused on strengthening collaboration, partnerships, and local capacities.',
|
||||
'Thank you to everyone who joined us and contributed to this milestone. We look forward to working together to support locally driven initiatives and create meaningful, lasting impact across Libya.',
|
||||
'This project is funded by the European Union in Libya.',
|
||||
].join('\n\n'),
|
||||
},
|
||||
ar: {
|
||||
title: 'انطلاق مشروع SHARP-ER رسميًا في ليبيا',
|
||||
slug: LAUNCH_SLUG,
|
||||
category: 'sharper-news',
|
||||
publishDate: '2026-06-30',
|
||||
featured: true,
|
||||
excerpt:
|
||||
'جمعت فعالية الإطلاق بعثة الاتحاد الأوروبي وثلاث وزارات ومنظمات المجتمع المدني والشركاء وأصحاب المصلحة من مختلف أنحاء ليبيا، وشهدت فتح باب التعبير عن الاهتمام.',
|
||||
body: [
|
||||
'انطلقت يوم الثلاثاء 30 يونيو رسميًا فعاليات مشروع SHARP-ER خلال حدث الإطلاق الذي جمع ممثلين عن بعثة الاتحاد الأوروبي، ووزارة الشباب، ووزارة الحكم المحلي، ووزارة شؤون المرأة، إلى جانب منظمات المجتمع المدني والشركاء والجهات الفاعلة من مختلف أنحاء ليبيا.',
|
||||
'وشكّل الحدث بداية مهمة للمشروع، حيث تم إطلاق الموقع الإلكتروني الرسمي، والإعلان عن فتح باب التعبير عن الاهتمام (EOI)، إلى جانب استعراض أهداف المشروع والفرص والأنشطة القادمة. وتركّز هذه الأنشطة على تعزيز التعاون والشراكات وبناء القدرات على المستوى المحلي.',
|
||||
'نتوجه بالشكر إلى جميع المشاركين على حضورهم ومساهماتهم القيّمة. ونتطلع إلى العمل معًا خلال المرحلة المقبلة لدعم المبادرات المحلية وتحقيق أثر مستدام في مختلف أنحاء ليبيا.',
|
||||
'المشروع ممول من الاتحاد الأوروبي في ليبيا.',
|
||||
].join('\n\n'),
|
||||
},
|
||||
} satisfies Localised<SeedData>,
|
||||
};
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
PAGES
|
||||
----------------------------------------------------------------------------
|
||||
The single types. Each hero, body and component list below is the draft's
|
||||
own wording for that section; the home page's hero is the Claude Design
|
||||
draft's, which is the same content the web app bundles as its fallback, so
|
||||
the CMS and the fallback say the same thing rather than drifting apart.
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
export const HOME_PAGE: Localised<SeedData> = {
|
||||
en: {
|
||||
hero: {
|
||||
/* No `eyebrow`. The design draws a status pill reading "Now open -
|
||||
Funding calls for Libyan organisations"; whether a call is open on any
|
||||
given day is a fact about the project, not about the design, so the
|
||||
pill stays unwritten until an editor writes it. */
|
||||
headline: 'Advancing Justice and Accountability, Led by Libyan Communities',
|
||||
subheading:
|
||||
'SHARP-ER — Shared Action on Rule of Law Progress, Exit Route — works with civil society organisations, municipalities, and community leaders across Libya to strengthen access to justice, accountability, and local governance. Funded by the European Union, running to December 2027.',
|
||||
},
|
||||
/* The band under the hero. Seeded so an editor opening Home Page finds the
|
||||
words already in a field they can change, rather than wondering where
|
||||
the page is getting them from - the web app still falls back to the
|
||||
bundled draft copy if this is ever emptied. `images` is left alone: the
|
||||
seed uploads nothing. */
|
||||
approach: {
|
||||
eyebrow: 'Nationwide, Libya',
|
||||
heading: 'A nationwide project, delivered locally',
|
||||
lead: 'Local organisations lead the design and delivery of the work. SHARP-ER partners with Libyan civil society, municipalities, and community leaders — through funded sub-projects, training, and open dialogue between communities and the institutions that serve them.',
|
||||
},
|
||||
partnersHeadline: 'The consortium',
|
||||
seo: {
|
||||
metaTitle: 'SHARP-ER — Shared Action on Rule of Law Progress, Exit Route',
|
||||
metaDescription:
|
||||
'A nationwide initiative supporting Libya’s civil society, local institutions, and communities in advancing justice, accountability, and good governance.',
|
||||
},
|
||||
},
|
||||
ar: {
|
||||
hero: {
|
||||
headline: 'تعزيز العدالة والمساءلة بقيادة المجتمعات الليبية',
|
||||
subheading:
|
||||
'يعمل SHARP-ER — العمل المشترك لتعزيز سيادة القانون، مسار الخروج — مع منظمات المجتمع المدني والبلديات وقادة المجتمعات في مختلف أنحاء ليبيا على تعزيز الوصول إلى العدالة والمساءلة والحوكمة المحلية. بتمويل من الاتحاد الأوروبي، ويستمر حتى ديسمبر 2027.',
|
||||
},
|
||||
approach: {
|
||||
eyebrow: 'على مستوى ليبيا بأكملها',
|
||||
heading: 'مشروع وطني يُنفَّذ محليًا',
|
||||
lead: 'تتولّى المنظمات المحلية تصميم العمل وتنفيذه. ويعمل SHARP-ER بالشراكة مع المجتمع المدني الليبي والبلديات وقادة المجتمعات، من خلال المشاريع الفرعية المموَّلة، والتدريب، والحوار المفتوح بين المجتمعات والمؤسسات التي تخدمها.',
|
||||
},
|
||||
partnersHeadline: 'الائتلاف المنفّذ',
|
||||
seo: {
|
||||
metaTitle: 'SHARP-ER — العمل المشترك لتعزيز سيادة القانون، مسار الخروج',
|
||||
metaDescription:
|
||||
'مبادرة وطنية تدعم المجتمع المدني والمؤسسات المحلية والمجتمعات في ليبيا في تعزيز العدالة والمساءلة والحوكمة الرشيدة.',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* The About page. `consortium` is built in index.ts, where the partner
|
||||
* documentIds are known; everything else is here.
|
||||
*/
|
||||
export const ABOUT_PAGE: Localised<SeedData> = {
|
||||
en: {
|
||||
hero: {
|
||||
eyebrow: 'About the project',
|
||||
headline: 'Strengthening the Rule of Law, Together',
|
||||
subheading:
|
||||
'SHARP-ER (Shared Action on Rule of Law Progress – Exit Route) is a nationwide initiative supporting Libya’s civil society, local institutions, and communities in advancing justice, accountability, and good governance.',
|
||||
},
|
||||
body: [
|
||||
'Running from December 2025 to December 2027, SHARP-ER is implemented by Acted, in consortium with United Efforts Consultancy (UEC) and Stichting Bureau Ensemble (SBE), and funded by the European Union. The project works nationwide across Libya, partnering with civil society organisations, municipalities, and community leaders to strengthen access to justice, build the capacity of civil society to hold institutions accountable, and improve local governance and service delivery.',
|
||||
].join('\n\n'),
|
||||
pillars: [
|
||||
{
|
||||
title: 'Strengthening Rule of Law',
|
||||
description:
|
||||
'Supporting local institutions to improve access to justice and transparency.',
|
||||
},
|
||||
{
|
||||
title: 'Empowering Civil Society',
|
||||
description:
|
||||
'Building the capacity of CSOs to strengthen their role in oversight and accountability.',
|
||||
},
|
||||
{
|
||||
title: 'Supporting Local Governance',
|
||||
description:
|
||||
'Enhancing collaboration between municipalities and local actors to improve service delivery.',
|
||||
},
|
||||
],
|
||||
legacyHeadline: 'SHARP I and II (2019–2024)',
|
||||
legacyBody:
|
||||
'SHARP-ER builds on the foundation of SHARP I and II (2019–2024), carrying its network of civil society partners and its dialogue practice into a new phase focused on sustainability and exit.',
|
||||
/* No `legacyLink`: the draft marks the target "[link: read about the SHARP
|
||||
legacy]" and gives no URL, and `shared.link` requires an href. */
|
||||
seo: {
|
||||
metaTitle: 'About SHARP-ER',
|
||||
metaDescription:
|
||||
'SHARP-ER is implemented by Acted with United Efforts Consultancy and Stichting Bureau Ensemble, and funded by the European Union, from December 2025 to December 2027.',
|
||||
},
|
||||
},
|
||||
ar: {
|
||||
hero: {
|
||||
eyebrow: 'عن المشروع',
|
||||
headline: 'نحو تعزيز سيادة القانون، معًا',
|
||||
subheading:
|
||||
'SHARP-ER (العمل المشترك لتعزيز سيادة القانون – مسار الخروج) هو مبادرة وطنية تدعم المجتمع المدني والمؤسسات المحلية والمجتمعات الليبية في تعزيز العدالة والمساءلة والحوكمة الرشيدة.',
|
||||
},
|
||||
body: [
|
||||
'يمتد المشروع من ديسمبر 2025 إلى ديسمبر 2027، ويُنفَّذ من قِبل منظمة Acted بالشراكة مع United Efforts Consultancy (UEC) وStichting Bureau Ensemble (SBE)، وبتمويل من الاتحاد الأوروبي. يعمل المشروع على مستوى ليبيا بأكملها، بالتعاون مع منظمات المجتمع المدني والبلديات والقيادات المجتمعية، من أجل تحسين الوصول إلى العدالة، وبناء قدرات المجتمع المدني على مساءلة المؤسسات، وتحسين الحوكمة المحلية وتقديم الخدمات.',
|
||||
].join('\n\n'),
|
||||
pillars: [
|
||||
{
|
||||
title: 'تعزيز سيادة القانون',
|
||||
description: 'دعم المؤسسات المحلية لتحسين الوصول إلى العدالة وتعزيز الشفافية.',
|
||||
},
|
||||
{
|
||||
title: 'تمكين المجتمع المدني',
|
||||
description: 'بناء قدرات منظمات المجتمع المدني لتعزيز دورها في الرقابة والمساءلة.',
|
||||
},
|
||||
{
|
||||
title: 'دعم الحوكمة المحلية',
|
||||
description: 'تعزيز التعاون بين البلديات والجهات الفاعلة المحلية لتحسين تقديم الخدمات.',
|
||||
},
|
||||
],
|
||||
legacyHeadline: 'مشروعا SHARP الأول والثاني (2019–2024)',
|
||||
legacyBody:
|
||||
'يبني SHARP-ER على الأساس الذي أرساه مشروعا SHARP الأول والثاني (2019–2024)، حاملًا معه شبكة الشركاء من المجتمع المدني وممارسة الحوار إلى مرحلة جديدة تركّز على الاستدامة ومسار الخروج.',
|
||||
seo: {
|
||||
metaTitle: 'عن مشروع SHARP-ER',
|
||||
metaDescription:
|
||||
'يُنفَّذ SHARP-ER من قِبل Acted بالشراكة مع United Efforts Consultancy وStichting Bureau Ensemble، وبتمويل من الاتحاد الأوروبي، من ديسمبر 2025 إلى ديسمبر 2027.',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
/** The role chip and its line on the About page's consortium cards. */
|
||||
export const CONSORTIUM_ROLES: Readonly<
|
||||
Record<string, Localised<{ role: string; roleDescription: string }>>
|
||||
> = {
|
||||
[PARTNER_SLUGS.acted]: {
|
||||
en: {
|
||||
role: 'Lead implementing partner',
|
||||
roleDescription: 'Overall project management and civil society sub-projects.',
|
||||
},
|
||||
ar: {
|
||||
role: 'الشريك المنفّذ الرئيسي',
|
||||
roleDescription: 'الإدارة العامة للمشروع والمشاريع الفرعية لمنظمات المجتمع المدني.',
|
||||
},
|
||||
},
|
||||
[PARTNER_SLUGS.uec]: {
|
||||
en: {
|
||||
role: 'Consortium partner',
|
||||
roleDescription: 'Network strengthening, dialogue, and peer-learning.',
|
||||
},
|
||||
ar: {
|
||||
role: 'شريك في الائتلاف',
|
||||
roleDescription: 'تعزيز الشبكة، والحوار، والتعلّم بين الأقران.',
|
||||
},
|
||||
},
|
||||
[PARTNER_SLUGS.sbe]: {
|
||||
en: {
|
||||
role: 'Consortium partner',
|
||||
roleDescription: 'Research, perception data, and knowledge publications.',
|
||||
},
|
||||
ar: {
|
||||
role: 'شريك في الائتلاف',
|
||||
roleDescription: 'البحث، وبيانات الاستطلاع، والمنشورات المعرفية.',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const WHAT_WE_DO_PAGE: Localised<SeedData> = {
|
||||
en: {
|
||||
hero: {
|
||||
headline: 'A Participatory Approach to Justice and Governance',
|
||||
subheading: 'We work directly with civil society, municipalities, and communities — not around them.',
|
||||
},
|
||||
intro: 'SHARP-ER is organised around four connected areas of work.',
|
||||
workstreams: [
|
||||
{
|
||||
title: 'Capacity Building',
|
||||
description:
|
||||
'Training civil society organisations and local actors on governance, justice, and management, and equipping the SHARP network with peer-to-peer learning.',
|
||||
},
|
||||
{
|
||||
title: 'Institutional Support',
|
||||
description:
|
||||
'Strengthening the systems, procedures, and dialogue channels that connect local institutions with the people they serve.',
|
||||
},
|
||||
{
|
||||
title: 'Community Initiatives',
|
||||
description:
|
||||
'Funding and supporting CSO-led sub-projects, Policy-to-Rights (P2R) projects, and human-security initiatives designed and driven by local actors.',
|
||||
},
|
||||
{
|
||||
title: 'Dialogue and Coordination',
|
||||
description:
|
||||
'Running SUQ (Search, Understand, Question) dialogues and Civil Society Law Sessions that bring civic and government actors to the same table.',
|
||||
},
|
||||
],
|
||||
/* The four clauses of the draft's "Our approach rests on four
|
||||
principles..." sentence, and nothing else: the design gives each tile an
|
||||
explanatory line that appears in no approved document. */
|
||||
principles: [
|
||||
{ title: 'Working with local actors' },
|
||||
{ title: 'Promoting sustainable — not one-off — solutions' },
|
||||
{ title: 'Connecting civil society with institutions' },
|
||||
{ title: 'Supporting gradual, realistic institutional reform' },
|
||||
],
|
||||
guidingValues: [
|
||||
'Dialogue',
|
||||
'Community Leadership',
|
||||
'Learning',
|
||||
'Inclusion',
|
||||
'Responsibility & Accountability',
|
||||
],
|
||||
seo: {
|
||||
metaTitle: 'What We Do — SHARP-ER',
|
||||
metaDescription:
|
||||
'Capacity building, institutional support, community initiatives, and dialogue and coordination: the four connected areas of work behind SHARP-ER.',
|
||||
},
|
||||
},
|
||||
ar: {
|
||||
hero: {
|
||||
headline: 'نهج تشاركي في العدالة والحوكمة',
|
||||
subheading: 'نعمل مباشرة مع المجتمع المدني والبلديات والمجتمعات المحلية، لا من حولها.',
|
||||
},
|
||||
intro: 'يقوم عمل SHARP-ER على أربعة محاور مترابطة.',
|
||||
workstreams: [
|
||||
{
|
||||
title: 'بناء القدرات',
|
||||
description:
|
||||
'تدريب منظمات المجتمع المدني والجهات المحلية على الحوكمة والعدالة والإدارة، وتزويد شبكة SHARP بالتعلّم بين الأقران.',
|
||||
},
|
||||
{
|
||||
title: 'الدعم المؤسسي',
|
||||
description: 'تعزيز الأنظمة والإجراءات وقنوات الحوار التي تربط المؤسسات المحلية بالمجتمعات التي تخدمها.',
|
||||
},
|
||||
{
|
||||
title: 'المبادرات المجتمعية',
|
||||
description:
|
||||
'تمويل ودعم مشاريع فرعية تقودها منظمات المجتمع المدني، ومشاريع “من السياسة إلى الحقوق” (P2R)، ومبادرات الأمن البشري التي يصممها الفاعلون المحليون ويقودونها.',
|
||||
},
|
||||
{
|
||||
title: 'الحوار والتنسيق',
|
||||
description:
|
||||
'تنظيم حوارات SUQ (ابحث، افهم، اسأل) وجلسات قانون المجتمع المدني التي تجمع الفاعلين المدنيين والحكوميين حول طاولة واحدة.',
|
||||
},
|
||||
],
|
||||
principles: [
|
||||
{ title: 'العمل مع الفاعلين المحليين' },
|
||||
{ title: 'تعزيز الحلول المستدامة لا الآنية' },
|
||||
{ title: 'الربط بين المجتمع المدني والمؤسسات' },
|
||||
{ title: 'دعم إصلاح مؤسسي تدريجي وواقعي' },
|
||||
],
|
||||
guidingValues: ['الحوار', 'القيادة المجتمعية', 'التعلّم', 'الشمول', 'المساءلة والمسؤولية'],
|
||||
seo: {
|
||||
metaTitle: 'ماذا نفعل — SHARP-ER',
|
||||
metaDescription:
|
||||
'بناء القدرات، والدعم المؤسسي، والمبادرات المجتمعية، والحوار والتنسيق: المحاور الأربعة المترابطة التي يقوم عليها عمل SHARP-ER.',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const CONTACT_PAGE: Localised<SeedData> = {
|
||||
en: {
|
||||
hero: {
|
||||
headline: 'Get in Touch',
|
||||
subheading: 'Questions about SHARP-ER, a partnership, or a specific activity? Reach out.',
|
||||
},
|
||||
intro: 'Questions about SHARP-ER, a partnership, or a specific activity? Reach out.',
|
||||
websiteLabel: 'sharper.ly',
|
||||
/* No `generalEmail`, no `socialLinks`, no `consortiumContacts`: the draft
|
||||
writes all three as bracketed placeholders. */
|
||||
seo: {
|
||||
metaTitle: 'Contact SHARP-ER',
|
||||
metaDescription: 'Get in touch with the SHARP-ER consortium about the project, a partnership, or a specific activity.',
|
||||
},
|
||||
},
|
||||
ar: {
|
||||
hero: {
|
||||
headline: 'تواصل معنا',
|
||||
subheading: 'لديك استفسار حول SHARP-ER، أو شراكة محتملة، أو نشاط معيّن؟ راسلنا.',
|
||||
},
|
||||
intro: 'لديك استفسار حول SHARP-ER، أو شراكة محتملة، أو نشاط معيّن؟ راسلنا.',
|
||||
websiteLabel: 'sharper.ly',
|
||||
seo: {
|
||||
metaTitle: 'تواصل مع SHARP-ER',
|
||||
metaDescription: 'تواصل مع ائتلاف SHARP-ER بشأن المشروع، أو شراكة محتملة، أو نشاط معيّن.',
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,925 @@
|
||||
/* ============================================================================
|
||||
SEED - DEMO FIXTURES
|
||||
----------------------------------------------------------------------------
|
||||
INVENTED CONTENT. Nothing in this file comes from docs/ and nothing in it is
|
||||
true. It exists so the listings, filters, cards, empty states and the logo
|
||||
marquee can be looked at with something in them, on a development machine.
|
||||
|
||||
HOW IT IS KEPT APART FROM REAL CONTENT
|
||||
1. Opt-in. `pnpm seed` never writes it; only `pnpm seed --demo` does.
|
||||
2. Refused in production. The seed will not write demo content when
|
||||
NODE_ENV is production (see index.ts), whatever flags it is given.
|
||||
3. Tagged in the data itself. Every slug starts `demo-`, so every demo
|
||||
URL says so - /en/news-and-updates/demo-... - and `--demo --clean`
|
||||
finds them again by that prefix alone, with nothing remembered between
|
||||
runs. The FAQ type has no slug, so its demo entries are matched by
|
||||
their exact questions instead.
|
||||
|
||||
The names are deliberately generic ("Coastal Justice Forum") rather than
|
||||
plausible-sounding Libyan organisations: an invented name that could be
|
||||
mistaken for a real partner is the thing to avoid. Cities are real places,
|
||||
used only as locations.
|
||||
|
||||
DATES are computed from the moment the seed runs, so a freshly seeded site
|
||||
always has events in the past, in progress and still to come.
|
||||
========================================================================= */
|
||||
|
||||
import type { Localised, SeedData } from './upsert';
|
||||
|
||||
/** Every demo slug starts with this, and that is how `--clean` finds them. */
|
||||
export const DEMO_PREFIX = 'demo-';
|
||||
|
||||
export interface DemoEntry {
|
||||
readonly slug: string;
|
||||
readonly topics?: readonly string[];
|
||||
readonly regions?: readonly string[];
|
||||
readonly partners?: readonly string[];
|
||||
readonly data: Localised<SeedData>;
|
||||
}
|
||||
|
||||
const DAY = 24 * 60 * 60 * 1000;
|
||||
|
||||
/** An ISO date `days` from the reference point, date only. */
|
||||
const onDay = (from: Date, days: number): string =>
|
||||
new Date(from.getTime() + days * DAY).toISOString().slice(0, 10);
|
||||
|
||||
/** The same, with a time of day, for the datetime fields. */
|
||||
const atHour = (from: Date, days: number, hour: number): string => {
|
||||
const when = new Date(from.getTime() + days * DAY);
|
||||
when.setUTCHours(hour, 0, 0, 0);
|
||||
return when.toISOString();
|
||||
};
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
REGIONS
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
export const DEMO_REGIONS: readonly DemoEntry[] = [
|
||||
['tripoli', 'Tripoli', 'طرابلس'],
|
||||
['benghazi', 'Benghazi', 'بنغازي'],
|
||||
['misrata', 'Misrata', 'مصراتة'],
|
||||
['sebha', 'Sebha', 'سبها'],
|
||||
['zawiya', 'Zawiya', 'الزاوية'],
|
||||
].map(([key, en, ar]) => {
|
||||
const slug = `${DEMO_PREFIX}${key}`;
|
||||
return {
|
||||
slug,
|
||||
data: {
|
||||
en: { name: en as string, slug },
|
||||
ar: { name: ar as string, slug },
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
export const DEMO_REGION_SLUGS = DEMO_REGIONS.map((region) => region.slug);
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
THE CIVIL SOCIETY NETWORK
|
||||
----------------------------------------------------------------------------
|
||||
Twelve organisations, which is what the home page's logo wall needs to
|
||||
become a marquee rather than a grid (it wants at least eight). None of them
|
||||
has a logo: an invented organisation with an invented mark would be a step
|
||||
too far, and the tile's no-logo state - its name set as text - is a state
|
||||
the design draws anyway.
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
const csoPartner = (
|
||||
key: string,
|
||||
en: { name: string; description: string },
|
||||
ar: { name: string; description: string },
|
||||
role: 'cso-partner' | 'institution' = 'cso-partner'
|
||||
): DemoEntry => {
|
||||
const slug = `${DEMO_PREFIX}${key}`;
|
||||
return {
|
||||
slug,
|
||||
data: {
|
||||
en: { name: en.name, slug, description: en.description, partnerRole: role, country: 'Libya' },
|
||||
ar: { name: ar.name, slug, description: ar.description, partnerRole: role, country: 'ليبيا' },
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export const DEMO_PARTNERS: readonly DemoEntry[] = [
|
||||
csoPartner(
|
||||
'coastal-justice-forum',
|
||||
{ name: 'Coastal Justice Forum', description: 'Legal awareness sessions for residents of the coastal municipalities.' },
|
||||
{ name: 'منتدى العدالة الساحلي', description: 'جلسات توعية قانونية لسكان البلديات الساحلية.' }
|
||||
),
|
||||
csoPartner(
|
||||
'southern-governance-network',
|
||||
{ name: 'Southern Governance Network', description: 'Bringing municipal councils and residents together in the south.' },
|
||||
{ name: 'شبكة الحوكمة الجنوبية', description: 'تقريب المجالس البلدية من السكان في الجنوب.' }
|
||||
),
|
||||
csoPartner(
|
||||
'open-municipality-initiative',
|
||||
{ name: 'Open Municipality Initiative', description: 'Publishing municipal budgets and service plans in plain language.' },
|
||||
{ name: 'مبادرة البلدية المفتوحة', description: 'نشر ميزانيات البلديات وخطط الخدمات بلغة مبسّطة.' }
|
||||
),
|
||||
csoPartner(
|
||||
'womens-participation-centre',
|
||||
{ name: 'Women’s Participation Centre', description: 'Supporting women’s participation in local decision-making.' },
|
||||
{ name: 'مركز المشاركة النسائية', description: 'دعم مشاركة النساء في صنع القرار المحلي.' }
|
||||
),
|
||||
csoPartner(
|
||||
'youth-civic-lab',
|
||||
{ name: 'Youth Civic Lab', description: 'Civic education and volunteering programmes for young people.' },
|
||||
{ name: 'مختبر الشباب المدني', description: 'برامج تربية مدنية وتطوّع للشباب.' }
|
||||
),
|
||||
csoPartner(
|
||||
'community-mediation-group',
|
||||
{ name: 'Community Mediation Group', description: 'Mediation between neighbourhoods and local service providers.' },
|
||||
{ name: 'مجموعة الوساطة المجتمعية', description: 'الوساطة بين الأحياء ومقدّمي الخدمات المحليين.' }
|
||||
),
|
||||
csoPartner(
|
||||
'legal-aid-collective',
|
||||
{ name: 'Legal Aid Collective', description: 'Free first-line legal advice and referral.' },
|
||||
{ name: 'تجمّع المساعدة القانونية', description: 'استشارات قانونية أولية مجانية وإحالة.' }
|
||||
),
|
||||
csoPartner(
|
||||
'transparency-watch-libya',
|
||||
{ name: 'Transparency Watch', description: 'Monitoring public procurement at municipal level.' },
|
||||
{ name: 'مرصد الشفافية', description: 'مراقبة المشتريات العامة على مستوى البلديات.' }
|
||||
),
|
||||
csoPartner(
|
||||
'desert-communities-association',
|
||||
{ name: 'Desert Communities Association', description: 'Human-security initiatives in remote communities.' },
|
||||
{ name: 'جمعية مجتمعات الصحراء', description: 'مبادرات الأمن البشري في المجتمعات النائية.' }
|
||||
),
|
||||
csoPartner(
|
||||
'civic-media-workshop',
|
||||
{ name: 'Civic Media Workshop', description: 'Training citizen reporters to cover local governance.' },
|
||||
{ name: 'ورشة الإعلام المدني', description: 'تدريب المراسلين المواطنين على تغطية الحوكمة المحلية.' }
|
||||
),
|
||||
csoPartner(
|
||||
'municipal-council-of-tripoli-centre',
|
||||
{ name: 'Municipal Council — Tripoli Centre', description: 'Local institution partnering on service-delivery dialogue.' },
|
||||
{ name: 'المجلس البلدي — وسط طرابلس', description: 'مؤسسة محلية شريكة في حوار تقديم الخدمات.' },
|
||||
'institution'
|
||||
),
|
||||
csoPartner(
|
||||
'municipal-council-of-benghazi',
|
||||
{ name: 'Municipal Council — Benghazi', description: 'Local institution partnering on transparency and planning.' },
|
||||
{ name: 'المجلس البلدي — بنغازي', description: 'مؤسسة محلية شريكة في الشفافية والتخطيط.' },
|
||||
'institution'
|
||||
),
|
||||
];
|
||||
|
||||
export const DEMO_PARTNER_SLUGS = DEMO_PARTNERS.map((partner) => partner.slug);
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
FAQs
|
||||
----------------------------------------------------------------------------
|
||||
No slug on this content type, so `--clean` matches these questions exactly.
|
||||
Change a question here and the old one stops being cleanable - which is the
|
||||
point: an edited question is an editor's question, not the seed's.
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
const faq = (order: number, en: [string, string], ar: [string, string]): Localised<SeedData> => ({
|
||||
en: { question: en[0], answer: en[1], order },
|
||||
ar: { question: ar[0], answer: ar[1], order },
|
||||
});
|
||||
|
||||
export const DEMO_FAQS: readonly Localised<SeedData>[] = [
|
||||
faq(
|
||||
1,
|
||||
['Who can apply to a SHARP-ER call?', 'Calls are open to civil society organisations registered in Libya. Each call lists its own eligibility criteria on its page.'],
|
||||
['من يمكنه التقديم على دعوات SHARP-ER؟', 'الدعوات مفتوحة لمنظمات المجتمع المدني المسجّلة في ليبيا. وتُدرج كل دعوة شروط الأهلية الخاصة بها على صفحتها.']
|
||||
),
|
||||
faq(
|
||||
2,
|
||||
['In which languages can I apply?', 'Applications are accepted in Arabic and in English. Neither is preferred over the other.'],
|
||||
['بأي لغة يمكنني التقديم؟', 'تُقبل الطلبات باللغتين العربية والإنجليزية، ولا تُفضَّل إحداهما على الأخرى.']
|
||||
),
|
||||
faq(
|
||||
3,
|
||||
['What is a SUQ dialogue?', 'SUQ stands for Search, Understand, Question. It is a facilitated session that brings residents together with the institutions that serve them.'],
|
||||
['ما هو حوار SUQ؟', '«SUQ» اختصار لـ «ابحث، افهم، اسأل». وهي جلسة ميسَّرة تجمع السكان بالمؤسسات التي تخدمهم.']
|
||||
),
|
||||
faq(
|
||||
4,
|
||||
['Do I need to be a member of the SHARP network to take part?', 'No. Events and calls are open beyond the network, though some opportunities are reserved for member organisations and say so.'],
|
||||
['هل يجب أن أكون عضوًا في شبكة SHARP للمشاركة؟', 'لا. الفعاليات والدعوات مفتوحة خارج الشبكة، وإن كانت بعض الفرص مخصّصة للمنظمات الأعضاء وتوضّح ذلك.']
|
||||
),
|
||||
faq(
|
||||
5,
|
||||
['Is there a cost to attend an event?', 'No. Every SHARP-ER event is free to attend.'],
|
||||
['هل هناك رسوم لحضور الفعاليات؟', 'لا. حضور جميع فعاليات SHARP-ER مجاني.']
|
||||
),
|
||||
faq(
|
||||
6,
|
||||
['How is SHARP-ER funded?', 'SHARP-ER is funded by the European Union and implemented by a consortium of Acted, United Efforts Consultancy and Stichting Bureau Ensemble.'],
|
||||
['كيف يُموَّل مشروع SHARP-ER؟', 'يُموَّل SHARP-ER من الاتحاد الأوروبي، وينفّذه ائتلاف يضم Acted وUnited Efforts Consultancy وStichting Bureau Ensemble.']
|
||||
),
|
||||
faq(
|
||||
7,
|
||||
['Can my organisation publish an update on this site?', 'Partner organisations in the network can submit updates, which appear in the newsroom under "From the Network" with the organisation credited.'],
|
||||
['هل يمكن لمنظمتي نشر مستجدات على هذا الموقع؟', 'يمكن للمنظمات الشريكة في الشبكة إرسال مستجداتها، فتظهر في غرفة الأخبار ضمن «من الشبكة» منسوبة إلى المنظمة.']
|
||||
),
|
||||
faq(
|
||||
8,
|
||||
['Where can I find the project’s publications?', 'Research, policy articles, project reports and fact sheets are all in Resources and Publications, filterable by type, topic and year.'],
|
||||
['أين أجد منشورات المشروع؟', 'تجد الأبحاث والمقالات السياساتية وتقارير المشروع وأوراق الحقائق في قسم الموارد والمنشورات، مع إمكانية التصفية حسب النوع والموضوع والسنة.']
|
||||
),
|
||||
];
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
NEWSROOM
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
export const demoNews = (now: Date): readonly DemoEntry[] => {
|
||||
const article = (
|
||||
key: string,
|
||||
days: number,
|
||||
category: 'sharper-news' | 'from-the-network',
|
||||
authorSlug: string | undefined,
|
||||
topics: readonly string[],
|
||||
regions: readonly string[],
|
||||
en: { title: string; excerpt: string; body: string },
|
||||
ar: { title: string; excerpt: string; body: string }
|
||||
): DemoEntry => {
|
||||
const slug = `${DEMO_PREFIX}${key}`;
|
||||
const shared = { slug, category, publishDate: onDay(now, days), featured: false };
|
||||
return {
|
||||
slug,
|
||||
topics,
|
||||
regions,
|
||||
...(authorSlug ? { partners: [authorSlug] } : {}),
|
||||
data: {
|
||||
en: { ...shared, title: en.title, excerpt: en.excerpt, body: en.body },
|
||||
ar: { ...shared, title: ar.title, excerpt: ar.excerpt, body: ar.body },
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
return [
|
||||
article(
|
||||
'first-round-of-sub-projects-selected',
|
||||
-7,
|
||||
'sharper-news',
|
||||
undefined,
|
||||
['civil-society'],
|
||||
[`${DEMO_PREFIX}tripoli`],
|
||||
{
|
||||
title: 'First round of community sub-projects selected',
|
||||
excerpt: 'The selection panel has finished its review of the first Call for Expression of Interest.',
|
||||
body: 'The selection panel has finished its review of the first Call for Expression of Interest. Successful organisations will be contacted directly, and a summary of the themes the round attracted will be published alongside the next call.\n\nThis is demo content and describes nothing that has happened.',
|
||||
},
|
||||
{
|
||||
title: 'اختيار الجولة الأولى من المشاريع المجتمعية الفرعية',
|
||||
excerpt: 'أنهت لجنة الاختيار مراجعتها لأول دعوة للتعبير عن الاهتمام.',
|
||||
body: 'أنهت لجنة الاختيار مراجعتها لأول دعوة للتعبير عن الاهتمام. وسيتم التواصل مباشرة مع المنظمات المختارة، وسيُنشر ملخّص للمحاور التي استقطبتها الجولة مع الدعوة التالية.\n\nهذا محتوى تجريبي ولا يصف أي حدث وقع فعلًا.',
|
||||
}
|
||||
),
|
||||
article(
|
||||
'dialogue-facilitation-training-concludes',
|
||||
-21,
|
||||
'sharper-news',
|
||||
undefined,
|
||||
['dialogue'],
|
||||
[`${DEMO_PREFIX}benghazi`],
|
||||
{
|
||||
title: 'Dialogue facilitation training concludes in Benghazi',
|
||||
excerpt: 'Participants from eleven organisations completed the three-day facilitation course.',
|
||||
body: 'Participants from eleven organisations completed the three-day facilitation course, which covers preparing a session, handling disagreement in the room, and following up on what was agreed.\n\nThis is demo content and describes nothing that has happened.',
|
||||
},
|
||||
{
|
||||
title: 'اختتام التدريب على تيسير الحوار في بنغازي',
|
||||
excerpt: 'أتمّ مشاركون من إحدى عشرة منظمة دورة التيسير التي استمرت ثلاثة أيام.',
|
||||
body: 'أتمّ مشاركون من إحدى عشرة منظمة دورة التيسير التي استمرت ثلاثة أيام، والتي تتناول الإعداد للجلسة، وإدارة الاختلاف داخل القاعة، ومتابعة ما جرى الاتفاق عليه.\n\nهذا محتوى تجريبي ولا يصف أي حدث وقع فعلًا.',
|
||||
}
|
||||
),
|
||||
article(
|
||||
'perception-survey-fieldwork-begins',
|
||||
-35,
|
||||
'sharper-news',
|
||||
undefined,
|
||||
['local-governance'],
|
||||
[],
|
||||
{
|
||||
title: 'Nationwide perception survey enters fieldwork',
|
||||
excerpt: 'Data collection has begun for the project’s first nationwide perception study.',
|
||||
body: 'Data collection has begun for the project’s first nationwide perception study. Findings will be published in Resources and Publications once analysis is complete.\n\nThis is demo content and describes nothing that has happened.',
|
||||
},
|
||||
{
|
||||
title: 'بدء العمل الميداني للدراسة الاستطلاعية الوطنية',
|
||||
excerpt: 'انطلق جمع البيانات لأول دراسة استطلاعية وطنية ينفّذها المشروع.',
|
||||
body: 'انطلق جمع البيانات لأول دراسة استطلاعية وطنية ينفّذها المشروع. وستُنشر النتائج في قسم الموارد والمنشورات فور اكتمال التحليل.\n\nهذا محتوى تجريبي ولا يصف أي حدث وقع فعلًا.',
|
||||
}
|
||||
),
|
||||
article(
|
||||
'coastal-justice-forum-completes-sub-project',
|
||||
-14,
|
||||
'from-the-network',
|
||||
`${DEMO_PREFIX}coastal-justice-forum`,
|
||||
['rule-of-law'],
|
||||
[`${DEMO_PREFIX}zawiya`],
|
||||
{
|
||||
title: 'Coastal Justice Forum completes its first community sub-project',
|
||||
excerpt: 'Six legal awareness sessions reached residents across four neighbourhoods.',
|
||||
body: 'Six legal awareness sessions reached residents across four neighbourhoods, focusing on civil documentation and how to raise a complaint with the municipality.\n\nThis is demo content and describes nothing that has happened.',
|
||||
},
|
||||
{
|
||||
title: 'منتدى العدالة الساحلي يُنجز أول مشروع مجتمعي فرعي',
|
||||
excerpt: 'ست جلسات توعية قانونية وصلت إلى سكان أربعة أحياء.',
|
||||
body: 'ست جلسات توعية قانونية وصلت إلى سكان أربعة أحياء، وركّزت على الوثائق المدنية وكيفية تقديم شكوى إلى البلدية.\n\nهذا محتوى تجريبي ولا يصف أي حدث وقع فعلًا.',
|
||||
}
|
||||
),
|
||||
article(
|
||||
'open-municipality-publishes-budget-guide',
|
||||
-28,
|
||||
'from-the-network',
|
||||
`${DEMO_PREFIX}open-municipality-initiative`,
|
||||
['local-governance'],
|
||||
[`${DEMO_PREFIX}misrata`],
|
||||
{
|
||||
title: 'Open Municipality Initiative publishes a plain-language budget guide',
|
||||
excerpt: 'The guide explains how a municipal budget is drawn up and where residents can comment on it.',
|
||||
body: 'The guide explains how a municipal budget is drawn up, which decisions are taken when, and where residents can comment on it.\n\nThis is demo content and describes nothing that has happened.',
|
||||
},
|
||||
{
|
||||
title: 'مبادرة البلدية المفتوحة تنشر دليلًا مبسّطًا للميزانية',
|
||||
excerpt: 'يشرح الدليل كيفية إعداد ميزانية البلدية وأين يمكن للسكان إبداء الرأي فيها.',
|
||||
body: 'يشرح الدليل كيفية إعداد ميزانية البلدية، وأي القرارات تُتّخذ ومتى، وأين يمكن للسكان إبداء الرأي فيها.\n\nهذا محتوى تجريبي ولا يصف أي حدث وقع فعلًا.',
|
||||
}
|
||||
),
|
||||
article(
|
||||
'youth-civic-lab-opens-volunteer-round',
|
||||
-3,
|
||||
'from-the-network',
|
||||
`${DEMO_PREFIX}youth-civic-lab`,
|
||||
['civil-society'],
|
||||
[`${DEMO_PREFIX}sebha`],
|
||||
{
|
||||
title: 'Youth Civic Lab opens its next volunteering round',
|
||||
excerpt: 'Applications are open to anyone aged 18 to 30 living in the south.',
|
||||
body: 'Applications are open to anyone aged 18 to 30 living in the south. Volunteers are matched with a local organisation for three months.\n\nThis is demo content and describes nothing that has happened.',
|
||||
},
|
||||
{
|
||||
title: 'مختبر الشباب المدني يفتح جولة التطوّع التالية',
|
||||
excerpt: 'التقديم مفتوح لمن تتراوح أعمارهم بين 18 و30 عامًا من سكان الجنوب.',
|
||||
body: 'التقديم مفتوح لمن تتراوح أعمارهم بين 18 و30 عامًا من سكان الجنوب. ويُربط كل متطوّع بمنظمة محلية لمدة ثلاثة أشهر.\n\nهذا محتوى تجريبي ولا يصف أي حدث وقع فعلًا.',
|
||||
}
|
||||
),
|
||||
];
|
||||
};
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
EVENTS
|
||||
----------------------------------------------------------------------------
|
||||
Spread across the calendar on purpose: two already over, one running, three
|
||||
still to come, so the listing's filters and every registration state have
|
||||
something to show.
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
export const demoEvents = (now: Date): readonly DemoEntry[] => {
|
||||
const event = (
|
||||
key: string,
|
||||
days: number,
|
||||
options: {
|
||||
eventType: string;
|
||||
format: 'in-person' | 'online' | 'hybrid';
|
||||
registrationStatus: 'open' | 'closed' | 'full' | 'waitlist' | 'not-required';
|
||||
capacity?: number;
|
||||
region?: string;
|
||||
topics?: readonly string[];
|
||||
partners?: readonly string[];
|
||||
},
|
||||
en: { title: string; description: string; venue?: string },
|
||||
ar: { title: string; description: string; venue?: string }
|
||||
): DemoEntry => {
|
||||
const slug = `${DEMO_PREFIX}${key}`;
|
||||
const shared = {
|
||||
slug,
|
||||
eventType: options.eventType,
|
||||
format: options.format,
|
||||
registrationStatus: options.registrationStatus,
|
||||
startDateTime: atHour(now, days, 9),
|
||||
endDateTime: atHour(now, days, 14),
|
||||
timezone: 'Africa/Tripoli',
|
||||
...(options.capacity ? { capacity: options.capacity } : {}),
|
||||
...(options.registrationStatus === 'open'
|
||||
? { registrationDeadline: atHour(now, days - 2, 23) }
|
||||
: {}),
|
||||
waitlistEnabled: options.registrationStatus === 'waitlist',
|
||||
};
|
||||
|
||||
return {
|
||||
slug,
|
||||
...(options.topics ? { topics: options.topics } : {}),
|
||||
...(options.region ? { regions: [options.region] } : {}),
|
||||
...(options.partners ? { partners: options.partners } : {}),
|
||||
data: {
|
||||
en: { ...shared, title: en.title, description: en.description, ...(en.venue ? { venue: en.venue } : {}) },
|
||||
ar: { ...shared, title: ar.title, description: ar.description, ...(ar.venue ? { venue: ar.venue } : {}) },
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
return [
|
||||
event(
|
||||
'suq-dialogue-tripoli',
|
||||
21,
|
||||
{
|
||||
eventType: 'suq-dialogue',
|
||||
format: 'in-person',
|
||||
registrationStatus: 'open',
|
||||
capacity: 60,
|
||||
region: `${DEMO_PREFIX}tripoli`,
|
||||
topics: ['dialogue', 'local-governance'],
|
||||
},
|
||||
{
|
||||
title: 'SUQ Dialogue — water and sanitation services',
|
||||
description: 'Residents and the municipal services department sit down together over the winter service plan.',
|
||||
venue: 'Tripoli',
|
||||
},
|
||||
{
|
||||
title: 'حوار SUQ — خدمات المياه والصرف الصحي',
|
||||
description: 'يجلس السكان وإدارة الخدمات البلدية معًا لمناقشة خطة الخدمات الشتوية.',
|
||||
venue: 'طرابلس',
|
||||
}
|
||||
),
|
||||
event(
|
||||
'facilitation-training-online',
|
||||
35,
|
||||
{
|
||||
eventType: 'training',
|
||||
format: 'online',
|
||||
registrationStatus: 'open',
|
||||
capacity: 25,
|
||||
topics: ['dialogue'],
|
||||
},
|
||||
{
|
||||
title: 'Dialogue facilitation training',
|
||||
description: 'A three-session online course on preparing, running and following up a community dialogue.',
|
||||
},
|
||||
{
|
||||
title: 'تدريب على تيسير الحوار',
|
||||
description: 'دورة عبر الإنترنت من ثلاث جلسات حول الإعداد للحوار المجتمعي وإدارته ومتابعته.',
|
||||
}
|
||||
),
|
||||
event(
|
||||
'network-meeting-south',
|
||||
49,
|
||||
{
|
||||
eventType: 'network-meeting',
|
||||
format: 'hybrid',
|
||||
registrationStatus: 'waitlist',
|
||||
capacity: 40,
|
||||
region: `${DEMO_PREFIX}sebha`,
|
||||
topics: ['civil-society'],
|
||||
},
|
||||
{
|
||||
title: 'SHARP Network regional meeting — South',
|
||||
description: 'Member organisations in the south meet to plan the next six months of joint work.',
|
||||
venue: 'Sebha',
|
||||
},
|
||||
{
|
||||
title: 'اجتماع شبكة SHARP الإقليمي — الجنوب',
|
||||
description: 'تجتمع المنظمات الأعضاء في الجنوب للتخطيط للأشهر الستة المقبلة من العمل المشترك.',
|
||||
venue: 'سبها',
|
||||
}
|
||||
),
|
||||
event(
|
||||
'law-session-with-the-ccs',
|
||||
-5,
|
||||
{
|
||||
eventType: 'law-session',
|
||||
format: 'in-person',
|
||||
registrationStatus: 'closed',
|
||||
region: `${DEMO_PREFIX}benghazi`,
|
||||
topics: ['rule-of-law', 'civil-society'],
|
||||
},
|
||||
{
|
||||
title: 'Civil Society Law Session with the CCS',
|
||||
description: 'A joint session on registration procedures and reporting obligations for civil society organisations.',
|
||||
venue: 'Benghazi',
|
||||
},
|
||||
{
|
||||
title: 'جلسة قانون المجتمع المدني مع لجنة المجتمع المدني',
|
||||
description: 'جلسة مشتركة حول إجراءات التسجيل والتزامات التقارير لمنظمات المجتمع المدني.',
|
||||
venue: 'بنغازي',
|
||||
}
|
||||
),
|
||||
event(
|
||||
'suq-dialogue-misrata',
|
||||
-30,
|
||||
{
|
||||
eventType: 'suq-dialogue',
|
||||
format: 'in-person',
|
||||
registrationStatus: 'closed',
|
||||
region: `${DEMO_PREFIX}misrata`,
|
||||
topics: ['dialogue'],
|
||||
},
|
||||
{
|
||||
title: 'SUQ Dialogue — street lighting and public safety',
|
||||
description: 'A dialogue between neighbourhood representatives and the municipality on night-time safety.',
|
||||
venue: 'Misrata',
|
||||
},
|
||||
{
|
||||
title: 'حوار SUQ — الإنارة العامة والسلامة',
|
||||
description: 'حوار بين ممثلي الأحياء والبلدية حول السلامة الليلية.',
|
||||
venue: 'مصراتة',
|
||||
}
|
||||
),
|
||||
event(
|
||||
'project-open-day',
|
||||
7,
|
||||
{
|
||||
eventType: 'other',
|
||||
format: 'online',
|
||||
registrationStatus: 'not-required',
|
||||
topics: ['civil-society'],
|
||||
},
|
||||
{
|
||||
title: 'SHARP-ER open session — how to apply',
|
||||
description: 'An open walk-through of the application form and the selection criteria. No registration needed.',
|
||||
},
|
||||
{
|
||||
title: 'جلسة SHARP-ER المفتوحة — كيف تتقدّم بطلب',
|
||||
description: 'شرح مفتوح لنموذج التقديم ومعايير الاختيار. لا يلزم التسجيل.',
|
||||
}
|
||||
),
|
||||
];
|
||||
};
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
OPPORTUNITIES
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
export const demoOpportunities = (now: Date): readonly DemoEntry[] => {
|
||||
const opportunity = (
|
||||
key: string,
|
||||
options: {
|
||||
opportunityType: string;
|
||||
opportunityStatus: 'upcoming' | 'open' | 'closed';
|
||||
openDays: number;
|
||||
deadlineDays: number;
|
||||
topics?: readonly string[];
|
||||
partners?: readonly string[];
|
||||
},
|
||||
en: { title: string; summary: string; eligibility: string; howToApply: string },
|
||||
ar: { title: string; summary: string; eligibility: string; howToApply: string }
|
||||
): DemoEntry => {
|
||||
const slug = `${DEMO_PREFIX}${key}`;
|
||||
const shared = {
|
||||
slug,
|
||||
opportunityType: options.opportunityType,
|
||||
opportunityStatus: options.opportunityStatus,
|
||||
openDate: onDay(now, options.openDays),
|
||||
deadline: atHour(now, options.deadlineDays, 23),
|
||||
};
|
||||
return {
|
||||
slug,
|
||||
...(options.topics ? { topics: options.topics } : {}),
|
||||
...(options.partners ? { partners: options.partners } : {}),
|
||||
data: {
|
||||
en: { ...shared, ...en },
|
||||
ar: { ...shared, ...ar },
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
return [
|
||||
opportunity(
|
||||
'call-for-expression-of-interest-round-two',
|
||||
{
|
||||
opportunityType: 'call-eoi',
|
||||
opportunityStatus: 'open',
|
||||
openDays: -10,
|
||||
deadlineDays: 25,
|
||||
topics: ['civil-society', 'rule-of-law'],
|
||||
partners: ['acted'],
|
||||
},
|
||||
{
|
||||
title: 'Call for Expression of Interest — community sub-projects, round two',
|
||||
summary: 'Funding for civil society organisations to design and run a community sub-project over nine months.',
|
||||
eligibility: 'Open to civil society organisations registered in Libya with at least one year of operations. Consortia of two or more organisations are welcome.',
|
||||
howToApply: 'Complete the application form on this page. Applications may be submitted in Arabic or English. Late submissions are not considered.',
|
||||
},
|
||||
{
|
||||
title: 'دعوة للتعبير عن الاهتمام — المشاريع المجتمعية الفرعية، الجولة الثانية',
|
||||
summary: 'تمويل لمنظمات المجتمع المدني لتصميم وتنفيذ مشروع مجتمعي فرعي على مدى تسعة أشهر.',
|
||||
eligibility: 'الدعوة مفتوحة لمنظمات المجتمع المدني المسجّلة في ليبيا ولديها سنة عمل واحدة على الأقل. ويُرحَّب بالتحالفات بين منظمتين أو أكثر.',
|
||||
howToApply: 'يُرجى تعبئة نموذج التقديم في هذه الصفحة. ويمكن التقديم بالعربية أو الإنجليزية. ولا يُنظر في الطلبات المتأخرة.',
|
||||
}
|
||||
),
|
||||
opportunity(
|
||||
'join-the-sharp-network',
|
||||
{
|
||||
opportunityType: 'network-membership',
|
||||
opportunityStatus: 'open',
|
||||
openDays: -60,
|
||||
deadlineDays: 90,
|
||||
topics: ['civil-society'],
|
||||
partners: ['united-efforts-consultancy'],
|
||||
},
|
||||
{
|
||||
title: 'Join the SHARP network',
|
||||
summary: 'Become part of the civil society network behind SHARP-ER: regional meetings, peer learning, and joint events.',
|
||||
eligibility: 'Open to civil society organisations working anywhere in Libya. There is no fee and no minimum size.',
|
||||
howToApply: 'Send the membership form together with your registration certificate. Applications are reviewed on a rolling basis.',
|
||||
},
|
||||
{
|
||||
title: 'انضم إلى شبكة SHARP',
|
||||
summary: 'كن جزءًا من شبكة المجتمع المدني وراء SHARP-ER: اجتماعات إقليمية، وتعلّم بين الأقران، وفعاليات مشتركة.',
|
||||
eligibility: 'مفتوح لمنظمات المجتمع المدني العاملة في أي مكان في ليبيا. لا توجد رسوم ولا حد أدنى للحجم.',
|
||||
howToApply: 'أرسل نموذج العضوية مرفقًا بشهادة التسجيل. وتُراجَع الطلبات أولًا بأول.',
|
||||
}
|
||||
),
|
||||
opportunity(
|
||||
'training-monitoring-and-reporting',
|
||||
{
|
||||
opportunityType: 'training',
|
||||
opportunityStatus: 'upcoming',
|
||||
openDays: 20,
|
||||
deadlineDays: 45,
|
||||
topics: ['local-governance'],
|
||||
},
|
||||
{
|
||||
title: 'Training — monitoring and reporting for small grants',
|
||||
summary: 'A short course for organisations managing a grant for the first time.',
|
||||
eligibility: 'Reserved for organisations that hold, or have applied for, a SHARP-ER sub-project grant.',
|
||||
howToApply: 'Applications open on the date shown above. Places are limited and allocated in order of application.',
|
||||
},
|
||||
{
|
||||
title: 'تدريب — المتابعة وإعداد التقارير للمنح الصغيرة',
|
||||
summary: 'دورة قصيرة للمنظمات التي تدير منحة للمرة الأولى.',
|
||||
eligibility: 'مخصّص للمنظمات الحاصلة على منحة مشروع فرعي من SHARP-ER أو المتقدّمة للحصول عليها.',
|
||||
howToApply: 'يُفتح التقديم في التاريخ الموضّح أعلاه. المقاعد محدودة وتُخصَّص حسب أسبقية التقديم.',
|
||||
}
|
||||
),
|
||||
opportunity(
|
||||
'policy-to-rights-first-call',
|
||||
{
|
||||
opportunityType: 'grant',
|
||||
opportunityStatus: 'closed',
|
||||
openDays: -120,
|
||||
deadlineDays: -40,
|
||||
topics: ['rule-of-law'],
|
||||
partners: ['acted'],
|
||||
},
|
||||
{
|
||||
title: 'Policy-to-Rights (P2R) — first call',
|
||||
summary: 'Support for organisations turning a policy commitment into a concrete change residents can see.',
|
||||
eligibility: 'This call is closed. It was open to organisations with previous experience of policy advocacy.',
|
||||
howToApply: 'This call is closed. The next round will be announced on this page.',
|
||||
},
|
||||
{
|
||||
title: '«من السياسة إلى الحقوق» (P2R) — الدعوة الأولى',
|
||||
summary: 'دعم للمنظمات التي تحوّل التزامًا سياساتيًا إلى تغيير ملموس يلمسه السكان.',
|
||||
eligibility: 'هذه الدعوة مغلقة. وكانت مفتوحة للمنظمات ذات الخبرة السابقة في المناصرة السياساتية.',
|
||||
howToApply: 'هذه الدعوة مغلقة. وسيُعلن عن الجولة التالية في هذه الصفحة.',
|
||||
}
|
||||
),
|
||||
];
|
||||
};
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
RESOURCES
|
||||
----------------------------------------------------------------------------
|
||||
No files are attached: the seed uploads nothing, so each entry is a record
|
||||
with its metadata and the listing draws its format chip from that. The
|
||||
detail page shows the entry without a download, which is the state an
|
||||
editor sees before they attach the PDF.
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
export const demoResources = (now: Date): readonly DemoEntry[] => {
|
||||
const resource = (
|
||||
key: string,
|
||||
options: {
|
||||
resourceType: string;
|
||||
resourceLanguage: 'en' | 'ar' | 'bilingual';
|
||||
days: number;
|
||||
pageCount?: number;
|
||||
topics?: readonly string[];
|
||||
partners?: readonly string[];
|
||||
featured?: boolean;
|
||||
authors?: string;
|
||||
},
|
||||
en: { title: string; description: string },
|
||||
ar: { title: string; description: string }
|
||||
): DemoEntry => {
|
||||
const slug = `${DEMO_PREFIX}${key}`;
|
||||
const shared = {
|
||||
slug,
|
||||
resourceType: options.resourceType,
|
||||
resourceLanguage: options.resourceLanguage,
|
||||
publicationDate: onDay(now, options.days),
|
||||
featured: options.featured ?? false,
|
||||
...(options.pageCount ? { pageCount: options.pageCount } : {}),
|
||||
...(options.authors ? { authors: options.authors } : {}),
|
||||
};
|
||||
return {
|
||||
slug,
|
||||
...(options.topics ? { topics: options.topics } : {}),
|
||||
...(options.partners ? { partners: options.partners } : {}),
|
||||
data: {
|
||||
en: { ...shared, ...en },
|
||||
ar: { ...shared, ...ar },
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
return [
|
||||
resource(
|
||||
'nationwide-perception-study',
|
||||
{
|
||||
resourceType: 'research-perception',
|
||||
resourceLanguage: 'bilingual',
|
||||
days: -45,
|
||||
pageCount: 64,
|
||||
featured: true,
|
||||
authors: 'Stichting Bureau Ensemble',
|
||||
topics: ['local-governance', 'rule-of-law'],
|
||||
partners: ['stichting-bureau-ensemble'],
|
||||
},
|
||||
{
|
||||
title: 'Nationwide perception study — baseline',
|
||||
description: 'How residents across Libya describe their access to justice and their local services.',
|
||||
},
|
||||
{
|
||||
title: 'الدراسة الاستطلاعية الوطنية — خط الأساس',
|
||||
description: 'كيف يصف السكان في مختلف أنحاء ليبيا وصولهم إلى العدالة وخدماتهم المحلية.',
|
||||
}
|
||||
),
|
||||
resource(
|
||||
'sharp-er-fact-sheet',
|
||||
{
|
||||
resourceType: 'visibility-factsheet',
|
||||
resourceLanguage: 'bilingual',
|
||||
days: -90,
|
||||
pageCount: 2,
|
||||
topics: ['civil-society'],
|
||||
},
|
||||
{ title: 'SHARP-ER fact sheet', description: 'A two-page summary of the project, its partners and its areas of work.' },
|
||||
{ title: 'ورقة حقائق SHARP-ER', description: 'ملخّص من صفحتين عن المشروع وشركائه ومجالات عمله.' }
|
||||
),
|
||||
resource(
|
||||
'policy-article-municipal-transparency',
|
||||
{
|
||||
resourceType: 'policy-article',
|
||||
resourceLanguage: 'en',
|
||||
days: -20,
|
||||
pageCount: 12,
|
||||
authors: 'Transparency Watch',
|
||||
topics: ['local-governance'],
|
||||
partners: [`${DEMO_PREFIX}transparency-watch-libya`],
|
||||
},
|
||||
{
|
||||
title: 'What municipal transparency costs, and what it saves',
|
||||
description: 'A Policy-to-Rights article on publishing procurement decisions at municipal level.',
|
||||
},
|
||||
{
|
||||
title: 'ما تكلفة الشفافية البلدية وما الذي توفّره',
|
||||
description: 'مقال ضمن سلسلة «من السياسة إلى الحقوق» حول نشر قرارات المشتريات على مستوى البلديات.',
|
||||
}
|
||||
),
|
||||
resource(
|
||||
'policy-article-legal-aid-access',
|
||||
{
|
||||
resourceType: 'policy-article',
|
||||
resourceLanguage: 'ar',
|
||||
days: -55,
|
||||
pageCount: 9,
|
||||
authors: 'Legal Aid Collective',
|
||||
topics: ['rule-of-law'],
|
||||
partners: [`${DEMO_PREFIX}legal-aid-collective`],
|
||||
},
|
||||
{
|
||||
title: 'First-line legal advice: who asks, and for what',
|
||||
description: 'What a year of free legal advice sessions says about the questions residents bring.',
|
||||
},
|
||||
{
|
||||
title: 'الاستشارة القانونية الأولية: من يسأل، وعن ماذا',
|
||||
description: 'ما الذي تكشفه سنة من جلسات الاستشارة القانونية المجانية عن أسئلة السكان.',
|
||||
}
|
||||
),
|
||||
resource(
|
||||
'project-report-first-half',
|
||||
{
|
||||
resourceType: 'project-report',
|
||||
resourceLanguage: 'en',
|
||||
days: -10,
|
||||
pageCount: 28,
|
||||
topics: ['civil-society'],
|
||||
partners: ['acted'],
|
||||
},
|
||||
{
|
||||
title: 'Project report — first reporting period',
|
||||
description: 'Activities, participation and lessons from the project’s first reporting period.',
|
||||
},
|
||||
{
|
||||
title: 'تقرير المشروع — فترة التقرير الأولى',
|
||||
description: 'الأنشطة والمشاركة والدروس المستفادة من فترة التقرير الأولى للمشروع.',
|
||||
}
|
||||
),
|
||||
resource(
|
||||
'dialogue-practice-note',
|
||||
{
|
||||
resourceType: 'project-report',
|
||||
resourceLanguage: 'bilingual',
|
||||
days: -70,
|
||||
pageCount: 16,
|
||||
topics: ['dialogue'],
|
||||
partners: ['united-efforts-consultancy'],
|
||||
},
|
||||
{
|
||||
title: 'Practice note — running a SUQ dialogue',
|
||||
description: 'What has worked, and what has not, across the first rounds of community dialogue.',
|
||||
},
|
||||
{
|
||||
title: 'مذكّرة عملية — كيف يُدار حوار SUQ',
|
||||
description: 'ما الذي نجح وما الذي لم ينجح عبر الجولات الأولى من الحوار المجتمعي.',
|
||||
}
|
||||
),
|
||||
];
|
||||
};
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
KNOWLEDGE HUB
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
export const demoKnowledge = (now: Date): readonly DemoEntry[] => {
|
||||
const item = (
|
||||
key: string,
|
||||
itemType: string,
|
||||
days: number,
|
||||
topics: readonly string[],
|
||||
en: { title: string; summary: string },
|
||||
ar: { title: string; summary: string }
|
||||
): DemoEntry => {
|
||||
const slug = `${DEMO_PREFIX}${key}`;
|
||||
const shared = { slug, itemType, publicationDate: onDay(now, days) };
|
||||
return {
|
||||
slug,
|
||||
topics,
|
||||
data: {
|
||||
en: { ...shared, ...en },
|
||||
ar: { ...shared, ...ar },
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
return [
|
||||
item(
|
||||
'module-governance-basics',
|
||||
'training-module',
|
||||
-80,
|
||||
['local-governance'],
|
||||
{ title: 'Training module — governance basics', summary: 'What a municipality does, who decides what, and where a resident fits in.' },
|
||||
{ title: 'وحدة تدريبية — أساسيات الحوكمة', summary: 'ماذا تفعل البلدية، ومن يقرّر ماذا، وأين يقع دور الساكن.' }
|
||||
),
|
||||
item(
|
||||
'module-facilitation-skills',
|
||||
'training-module',
|
||||
-60,
|
||||
['dialogue'],
|
||||
{ title: 'Training module — facilitation skills', summary: 'Preparing a session, keeping a room together, and closing on something concrete.' },
|
||||
{ title: 'وحدة تدريبية — مهارات التيسير', summary: 'الإعداد للجلسة، وإبقاء القاعة متماسكة، والختام بنتيجة ملموسة.' }
|
||||
),
|
||||
item(
|
||||
'toolkit-community-needs',
|
||||
'toolkit',
|
||||
-40,
|
||||
['civil-society'],
|
||||
{ title: 'Toolkit — identifying community needs', summary: 'A short set of tools for finding out what a neighbourhood actually wants changed.' },
|
||||
{ title: 'دليل عملي — تحديد احتياجات المجتمع', summary: 'مجموعة أدوات موجزة لمعرفة ما يريد الحي تغييره فعلًا.' }
|
||||
),
|
||||
item(
|
||||
'guide-law-session-registration',
|
||||
'law-session-guide',
|
||||
-30,
|
||||
['rule-of-law'],
|
||||
{ title: 'Law Session guide — registration and reporting', summary: 'Plain-language notes from the joint session with the Commission on Civil Society.' },
|
||||
{ title: 'دليل جلسة قانونية — التسجيل وإعداد التقارير', summary: 'ملاحظات بلغة مبسّطة من الجلسة المشتركة مع لجنة المجتمع المدني.' }
|
||||
),
|
||||
item(
|
||||
'case-study-water-dialogue',
|
||||
'case-study',
|
||||
-15,
|
||||
['dialogue', 'local-governance'],
|
||||
{ title: 'Case study — a dialogue that changed a service plan', summary: 'How one SUQ dialogue ended with a revised winter maintenance schedule.' },
|
||||
{ title: 'دراسة حالة — حوار غيّر خطة خدمات', summary: 'كيف انتهى أحد حوارات SUQ بجدول صيانة شتوي معدَّل.' }
|
||||
),
|
||||
item(
|
||||
'case-study-first-grant',
|
||||
'case-study',
|
||||
-5,
|
||||
['civil-society'],
|
||||
{ title: 'Case study — managing a first grant', summary: 'What a small organisation learned in its first nine months of grant management.' },
|
||||
{ title: 'دراسة حالة — إدارة أول منحة', summary: 'ما تعلّمته منظمة صغيرة في أول تسعة أشهر من إدارة منحة.' }
|
||||
),
|
||||
];
|
||||
};
|
||||
|
||||
/**
|
||||
* The home page fields the demo set overrides.
|
||||
*
|
||||
* The status pill is the one piece of approved-looking copy the demo writes,
|
||||
* and it is true of the demo data: `demo-call-for-expression-of-interest-
|
||||
* round-two` really is open on a demo-seeded site.
|
||||
*/
|
||||
export const DEMO_HOME_PAGE: Localised<SeedData> = {
|
||||
en: { hero: { eyebrow: 'Now open · Funding calls for Libyan organisations' } },
|
||||
ar: { hero: { eyebrow: 'مفتوح الآن · دعوات تمويل للمنظمات الليبية' } },
|
||||
};
|
||||
@@ -0,0 +1,441 @@
|
||||
/* ============================================================================
|
||||
SEED - orchestration
|
||||
----------------------------------------------------------------------------
|
||||
Run it with `pnpm seed` from the repository root, or from apps/cms:
|
||||
|
||||
pnpm seed the approved content only (approved.ts)
|
||||
pnpm seed --demo the same, plus the invented fixtures (demo.ts)
|
||||
pnpm seed --demo --clean remove the invented fixtures, leave the rest
|
||||
|
||||
IDEMPOTENT. Every write goes through `upsert`, matched on a slug (or, for
|
||||
the single types, on there being only one document), so a second run writes
|
||||
the same fields over the same documents. It never deletes anything except on
|
||||
`--demo --clean`, and then only what carries the demo slug prefix.
|
||||
|
||||
ORDER MATTERS. Partners and topics are written first because the activities,
|
||||
the articles and the About page's consortium cards all point at them by
|
||||
documentId, and a relation can only be set once its target exists.
|
||||
|
||||
WHAT IT DOES NOT TOUCH
|
||||
* Media. The seed uploads nothing. Where a page already has a picture -
|
||||
the home hero, most of all - the existing file is read back and written
|
||||
out again with the new copy, because a component is replaced wholesale
|
||||
on write and anything left out of the payload is gone.
|
||||
* Submissions. `application`, `event-registration` and `contact-submission`
|
||||
hold personal data. Nothing writes to them here, not even in demo mode.
|
||||
* Locales and permissions. Those are reconciled at boot by src/bootstrap.
|
||||
========================================================================= */
|
||||
|
||||
import type { Core } from '@strapi/strapi';
|
||||
|
||||
import {
|
||||
ABOUT_PAGE,
|
||||
ACTIVITIES,
|
||||
CONSORTIUM,
|
||||
CONSORTIUM_ROLES,
|
||||
CONTACT_PAGE,
|
||||
HOME_PAGE,
|
||||
LAUNCH_ARTICLE,
|
||||
SITE_SETTINGS,
|
||||
TOPICS,
|
||||
WHAT_WE_DO_PAGE,
|
||||
type SeedEntries,
|
||||
} from './approved';
|
||||
import {
|
||||
DEMO_FAQS,
|
||||
DEMO_HOME_PAGE,
|
||||
DEMO_PARTNERS,
|
||||
DEMO_PARTNER_SLUGS,
|
||||
DEMO_PREFIX,
|
||||
DEMO_REGIONS,
|
||||
demoEvents,
|
||||
demoKnowledge,
|
||||
demoNews,
|
||||
demoOpportunities,
|
||||
demoResources,
|
||||
type DemoEntry,
|
||||
} from './demo';
|
||||
import {
|
||||
deleteBySlugPrefix,
|
||||
deleteWhere,
|
||||
mediaId,
|
||||
readExisting,
|
||||
upsert,
|
||||
type Localised,
|
||||
type SeedData,
|
||||
type SeedUid,
|
||||
} from './upsert';
|
||||
|
||||
export interface SeedOptions {
|
||||
/** Write the invented fixtures as well as the approved content. */
|
||||
readonly demo: boolean;
|
||||
/** With `demo`, remove those fixtures instead of writing them. */
|
||||
readonly clean: boolean;
|
||||
}
|
||||
|
||||
const UID = {
|
||||
siteSettings: 'api::site-settings.site-settings',
|
||||
homePage: 'api::home-page.home-page',
|
||||
aboutPage: 'api::about-page.about-page',
|
||||
whatWeDoPage: 'api::what-we-do-page.what-we-do-page',
|
||||
contactPage: 'api::contact-page.contact-page',
|
||||
partner: 'api::partner.partner',
|
||||
topic: 'api::topic.topic',
|
||||
region: 'api::region.region',
|
||||
activity: 'api::activity.activity',
|
||||
news: 'api::news-article.news-article',
|
||||
event: 'api::event.event',
|
||||
opportunity: 'api::opportunity.opportunity',
|
||||
resource: 'api::resource.resource',
|
||||
knowledge: 'api::knowledge-item.knowledge-item',
|
||||
faq: 'api::faq.faq',
|
||||
} as const satisfies Record<string, SeedUid>;
|
||||
|
||||
/** Every slugged type the demo set writes to, in the order `--clean` sweeps. */
|
||||
const DEMO_SLUGGED_TYPES: readonly SeedUid[] = [
|
||||
UID.knowledge,
|
||||
UID.resource,
|
||||
UID.opportunity,
|
||||
UID.event,
|
||||
UID.news,
|
||||
UID.partner,
|
||||
UID.region,
|
||||
];
|
||||
|
||||
/** slug -> documentId, built as each type is written. */
|
||||
type SlugIndex = Map<string, string>;
|
||||
|
||||
const log = (strapi: Core.Strapi, message: string): void => {
|
||||
strapi.log.info(`[seed] ${message}`);
|
||||
};
|
||||
|
||||
/** Write a list of slugged entries and return the slug -> documentId index. */
|
||||
async function upsertAll(
|
||||
strapi: Core.Strapi,
|
||||
uid: SeedUid,
|
||||
entries: ReadonlyArray<{ slug: string; data: Localised<SeedData> }>,
|
||||
into: SlugIndex = new Map()
|
||||
): Promise<SlugIndex> {
|
||||
for (const entry of entries) {
|
||||
const { documentId } = await upsert(strapi, uid, entry.data, {
|
||||
slug: { $eq: entry.slug },
|
||||
});
|
||||
into.set(entry.slug, documentId);
|
||||
}
|
||||
return into;
|
||||
}
|
||||
|
||||
/** Turn a list of slugs into the documentIds a relation field wants. */
|
||||
const relate = (index: SlugIndex, slugs: readonly string[] | undefined): string[] =>
|
||||
(slugs ?? []).map((slug) => index.get(slug)).filter((id): id is string => Boolean(id));
|
||||
|
||||
/**
|
||||
* Add relation fields to both locales of an entry.
|
||||
*
|
||||
* Relations are held per locale in Strapi, so a translation that is written
|
||||
* without them comes back with an empty list - which is how a page ends up
|
||||
* with its topics in English and none in Arabic.
|
||||
*/
|
||||
function withRelations(
|
||||
data: Localised<SeedData>,
|
||||
relations: SeedData
|
||||
): Localised<SeedData> {
|
||||
return {
|
||||
en: { ...data.en, ...relations },
|
||||
ar: { ...data.ar, ...relations },
|
||||
};
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
THE APPROVED SET
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
async function seedApproved(strapi: Core.Strapi): Promise<{
|
||||
partners: SlugIndex;
|
||||
topics: SlugIndex;
|
||||
launchArticleId: string;
|
||||
}> {
|
||||
await upsert(strapi, UID.siteSettings, SITE_SETTINGS);
|
||||
log(strapi, 'site settings');
|
||||
|
||||
const partners = await upsertAll(strapi, UID.partner, CONSORTIUM);
|
||||
log(strapi, `${partners.size} consortium partners`);
|
||||
|
||||
const topics = await upsertAll(strapi, UID.topic, TOPICS as SeedEntries);
|
||||
log(strapi, `${topics.size} topics`);
|
||||
|
||||
for (const activity of ACTIVITIES) {
|
||||
await upsert(
|
||||
strapi,
|
||||
UID.activity,
|
||||
withRelations(activity.data, {
|
||||
implementingPartners: relate(partners, activity.partners),
|
||||
topics: relate(topics, activity.topics),
|
||||
}),
|
||||
{ slug: { $eq: activity.slug } }
|
||||
);
|
||||
}
|
||||
log(strapi, `${ACTIVITIES.length} activities`);
|
||||
|
||||
const launch = await upsert(
|
||||
strapi,
|
||||
UID.news,
|
||||
withRelations(LAUNCH_ARTICLE.data, { topics: relate(topics, LAUNCH_ARTICLE.topics) }),
|
||||
{ slug: { $eq: LAUNCH_ARTICLE.slug } }
|
||||
);
|
||||
log(strapi, 'the launch article');
|
||||
|
||||
/* The home hero already carries an uploaded picture on this database; read
|
||||
it back so writing the new copy does not drop it. */
|
||||
const existingHome = await readExisting(strapi, UID.homePage, ['hero.media']);
|
||||
const heroMedia = mediaId(existingHome?.hero, 'media');
|
||||
|
||||
await upsert(strapi, UID.homePage, {
|
||||
en: {
|
||||
...HOME_PAGE.en,
|
||||
hero: { ...(HOME_PAGE.en.hero as SeedData), ...(heroMedia ? { media: heroMedia } : {}) },
|
||||
featuredNews: [launch.documentId],
|
||||
},
|
||||
ar: {
|
||||
...HOME_PAGE.ar,
|
||||
hero: { ...(HOME_PAGE.ar.hero as SeedData), ...(heroMedia ? { media: heroMedia } : {}) },
|
||||
featuredNews: [launch.documentId],
|
||||
},
|
||||
});
|
||||
log(strapi, 'home page');
|
||||
|
||||
/* The About page's consortium cards are components that point at the partner
|
||||
documents, so they can only be built now that the partners exist. */
|
||||
const consortiumFor = (locale: 'en' | 'ar'): SeedData[] =>
|
||||
CONSORTIUM.map((member) => ({
|
||||
partner: partners.get(member.slug),
|
||||
...CONSORTIUM_ROLES[member.slug]![locale],
|
||||
}));
|
||||
|
||||
await upsert(strapi, UID.aboutPage, {
|
||||
en: { ...ABOUT_PAGE.en, consortium: consortiumFor('en') },
|
||||
ar: { ...ABOUT_PAGE.ar, consortium: consortiumFor('ar') },
|
||||
});
|
||||
log(strapi, 'about page');
|
||||
|
||||
await upsert(strapi, UID.whatWeDoPage, WHAT_WE_DO_PAGE);
|
||||
log(strapi, 'what we do page');
|
||||
|
||||
await upsert(strapi, UID.contactPage, CONTACT_PAGE);
|
||||
log(strapi, 'contact page');
|
||||
|
||||
return { partners, topics, launchArticleId: launch.documentId };
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
THE DEMO SET
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
async function seedDemo(
|
||||
strapi: Core.Strapi,
|
||||
context: { partners: SlugIndex; topics: SlugIndex; launchArticleId: string }
|
||||
): Promise<void> {
|
||||
const now = new Date();
|
||||
|
||||
const regions = await upsertAll(strapi, UID.region, DEMO_REGIONS);
|
||||
log(strapi, `${regions.size} demo regions`);
|
||||
|
||||
/* Written into the same index as the consortium: a resource or an article
|
||||
can credit either a consortium member or a network organisation, and the
|
||||
lookup should not have to know which. */
|
||||
const partners = await upsertAll(strapi, UID.partner, DEMO_PARTNERS, context.partners);
|
||||
log(strapi, `${DEMO_PARTNERS.length} demo network partners`);
|
||||
|
||||
for (const item of DEMO_FAQS) {
|
||||
await upsert(strapi, UID.faq, item, { question: { $eq: item.en.question } });
|
||||
}
|
||||
log(strapi, `${DEMO_FAQS.length} demo FAQs`);
|
||||
|
||||
/* `entry.partners` is the author on a news article (a single relation) and
|
||||
the implementing/publishing organisations everywhere else. */
|
||||
const news = demoNews(now);
|
||||
const newsIndex: SlugIndex = new Map();
|
||||
for (const entry of news) {
|
||||
const author = relate(partners, entry.partners)[0];
|
||||
const { documentId } = await upsert(
|
||||
strapi,
|
||||
UID.news,
|
||||
withRelations(entry.data, {
|
||||
topics: relate(context.topics, entry.topics),
|
||||
regions: relate(regions, entry.regions),
|
||||
...(author ? { authorOrganisation: author } : {}),
|
||||
}),
|
||||
{ slug: { $eq: entry.slug } }
|
||||
);
|
||||
newsIndex.set(entry.slug, documentId);
|
||||
}
|
||||
log(strapi, `${news.length} demo articles`);
|
||||
|
||||
const events = demoEvents(now);
|
||||
for (const entry of events) {
|
||||
await upsert(
|
||||
strapi,
|
||||
UID.event,
|
||||
withRelations(entry.data, {
|
||||
topics: relate(context.topics, entry.topics),
|
||||
/* `region` is a single relation on this type, not a list. */
|
||||
...(entry.regions?.length ? { region: relate(regions, entry.regions)[0] } : {}),
|
||||
implementingPartners: relate(partners, entry.partners),
|
||||
}),
|
||||
{ slug: { $eq: entry.slug } }
|
||||
);
|
||||
}
|
||||
log(strapi, `${events.length} demo events`);
|
||||
|
||||
const opportunities = demoOpportunities(now);
|
||||
for (const entry of opportunities) {
|
||||
await upsert(
|
||||
strapi,
|
||||
UID.opportunity,
|
||||
withRelations(entry.data, {
|
||||
topics: relate(context.topics, entry.topics),
|
||||
implementingPartners: relate(partners, entry.partners),
|
||||
}),
|
||||
{ slug: { $eq: entry.slug } }
|
||||
);
|
||||
}
|
||||
log(strapi, `${opportunities.length} demo opportunities`);
|
||||
|
||||
const resources = demoResources(now);
|
||||
for (const entry of resources) {
|
||||
await upsert(
|
||||
strapi,
|
||||
UID.resource,
|
||||
withRelations(entry.data, {
|
||||
topics: relate(context.topics, entry.topics),
|
||||
partnerOrganisations: relate(partners, entry.partners),
|
||||
}),
|
||||
{ slug: { $eq: entry.slug } }
|
||||
);
|
||||
}
|
||||
log(strapi, `${resources.length} demo resources`);
|
||||
|
||||
const knowledge = demoKnowledge(now);
|
||||
for (const entry of knowledge) {
|
||||
await upsert(
|
||||
strapi,
|
||||
UID.knowledge,
|
||||
withRelations(entry.data, { topics: relate(context.topics, entry.topics) }),
|
||||
{ slug: { $eq: entry.slug } }
|
||||
);
|
||||
}
|
||||
log(strapi, `${knowledge.length} demo knowledge items`);
|
||||
|
||||
/* Finally the home page, which the demo set only adds to: the status pill,
|
||||
the network logo wall (twelve organisations, which is what turns the wall
|
||||
into the design's marquee), and two network stories beside the real launch
|
||||
article. The hero is rewritten in full, media included, because writing a
|
||||
component replaces it. */
|
||||
const existingHome = await readExisting(strapi, UID.homePage, ['hero.media']);
|
||||
const heroMedia = mediaId(existingHome?.hero, 'media');
|
||||
|
||||
const featured = [
|
||||
context.launchArticleId,
|
||||
newsIndex.get(`${DEMO_PREFIX}first-round-of-sub-projects-selected`),
|
||||
newsIndex.get(`${DEMO_PREFIX}coastal-justice-forum-completes-sub-project`),
|
||||
].filter((id): id is string => Boolean(id));
|
||||
|
||||
const homeFor = (locale: 'en' | 'ar'): SeedData => ({
|
||||
...HOME_PAGE[locale],
|
||||
hero: {
|
||||
...(HOME_PAGE[locale].hero as SeedData),
|
||||
...(DEMO_HOME_PAGE[locale].hero as SeedData),
|
||||
...(heroMedia ? { media: heroMedia } : {}),
|
||||
},
|
||||
featuredNews: featured,
|
||||
partners: relate(partners, DEMO_PARTNER_SLUGS),
|
||||
});
|
||||
|
||||
await upsert(strapi, UID.homePage, { en: homeFor('en'), ar: homeFor('ar') });
|
||||
log(strapi, 'home page, with the demo network wall');
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
REMOVING THE DEMO SET
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
async function cleanDemo(strapi: Core.Strapi): Promise<void> {
|
||||
let removed = 0;
|
||||
|
||||
for (const uid of DEMO_SLUGGED_TYPES) {
|
||||
removed += await deleteBySlugPrefix(strapi, uid, DEMO_PREFIX);
|
||||
}
|
||||
|
||||
/* Both languages: the filter runs once per locale, and an Arabic question
|
||||
never matches an English one. */
|
||||
removed += await deleteWhere(strapi, UID.faq, {
|
||||
question: {
|
||||
$in: DEMO_FAQS.flatMap((item) => [item.en.question, item.ar.question]),
|
||||
},
|
||||
});
|
||||
|
||||
/* The home page is approved content with demo fields written onto it, so it
|
||||
is put back rather than deleted. Deleting the partners above already
|
||||
emptied the wall; this takes the status pill off again. */
|
||||
const existingHome = await readExisting(strapi, UID.homePage, ['hero.media']);
|
||||
const heroMedia = mediaId(existingHome?.hero, 'media');
|
||||
|
||||
await upsert(strapi, UID.homePage, {
|
||||
en: {
|
||||
...HOME_PAGE.en,
|
||||
hero: { ...(HOME_PAGE.en.hero as SeedData), ...(heroMedia ? { media: heroMedia } : {}) },
|
||||
},
|
||||
ar: {
|
||||
...HOME_PAGE.ar,
|
||||
hero: { ...(HOME_PAGE.ar.hero as SeedData), ...(heroMedia ? { media: heroMedia } : {}) },
|
||||
},
|
||||
});
|
||||
|
||||
log(strapi, `removed ${removed} demo entries and reset the home page`);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
ENTRY POINT
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
export async function runSeed(strapi: Core.Strapi, options: SeedOptions): Promise<void> {
|
||||
/* The guard that makes demo content safe to have in the repository at all:
|
||||
no flag combination writes invented entries to a production database. */
|
||||
if (options.demo && process.env.NODE_ENV === 'production') {
|
||||
throw new Error(
|
||||
'[seed] refusing to touch demo content with NODE_ENV=production. ' +
|
||||
'Run `pnpm seed` without --demo to write the approved content only.'
|
||||
);
|
||||
}
|
||||
|
||||
if (options.clean && !options.demo) {
|
||||
throw new Error(
|
||||
'[seed] --clean removes demo content and nothing else, so it needs --demo. ' +
|
||||
'Approved content is never deleted by the seed.'
|
||||
);
|
||||
}
|
||||
|
||||
if (options.clean) {
|
||||
await cleanDemo(strapi);
|
||||
return;
|
||||
}
|
||||
|
||||
const context = await seedApproved(strapi);
|
||||
|
||||
if (options.demo) {
|
||||
log(strapi, 'writing DEMO fixtures - invented content, every slug prefixed "demo-"');
|
||||
await seedDemo(strapi, context);
|
||||
}
|
||||
|
||||
log(strapi, 'done.');
|
||||
}
|
||||
|
||||
/** Read the options off a process argument list. */
|
||||
export function parseSeedOptions(argv: readonly string[]): SeedOptions {
|
||||
return {
|
||||
demo: argv.includes('--demo'),
|
||||
clean: argv.includes('--clean'),
|
||||
};
|
||||
}
|
||||
|
||||
export type { DemoEntry };
|
||||
@@ -0,0 +1,237 @@
|
||||
/* ============================================================================
|
||||
SEED - idempotent document helpers
|
||||
----------------------------------------------------------------------------
|
||||
Every write in the seed goes through here, so the whole seed can be run
|
||||
again over a database it has already written to and change nothing but the
|
||||
fields it owns. Nothing is ever deleted except demo entries, and only on an
|
||||
explicit `--demo --clean`.
|
||||
|
||||
THE SHAPE OF A WRITE
|
||||
A seed entry is always a pair - the English document and its Arabic
|
||||
translation - because every localised content type on this site ships in
|
||||
both languages (CLAUDE.md rule 7). `upsert` writes the English document
|
||||
first, because that is the one carrying the identity (the slug), then
|
||||
writes the Arabic locale onto the SAME document, which is how Strapi 5
|
||||
models a translation: one `documentId`, one row per locale.
|
||||
|
||||
DRAFT AND PUBLISH
|
||||
Content is written as a draft and then published explicitly. Publishing
|
||||
is a separate call rather than `status: 'published'` on the write, so a
|
||||
half-built entry is never live for the moment between the two locales.
|
||||
|
||||
Two content types - `topic` and `region` - are pure taxonomy and have
|
||||
draft & publish switched off, and a document service for such a type has
|
||||
no `publish` method and no `status` to filter on at all. `usesDraft`
|
||||
below reads that off the schema rather than keeping a list, so a type that
|
||||
gains or loses the setting needs no change here.
|
||||
|
||||
TYPES
|
||||
`strapi.documents(uid)` is generated per content type, so a helper that
|
||||
takes the uid as a parameter cannot be typed against one schema. The
|
||||
single cast below is the seam: past it, the seed's own data is checked by
|
||||
the content files' own types, and Strapi validates the payload at runtime
|
||||
against the real schema - a wrong field name fails the seed loudly.
|
||||
========================================================================= */
|
||||
|
||||
import type { Core } from '@strapi/strapi';
|
||||
|
||||
/** The two locales this site ships. */
|
||||
export const LOCALES = ['en', 'ar'] as const;
|
||||
|
||||
export type SeedLocale = (typeof LOCALES)[number];
|
||||
|
||||
/** One piece of content, written once per locale. */
|
||||
export type Localised<T> = Readonly<Record<SeedLocale, T>>;
|
||||
|
||||
/** A field payload - checked by Strapi against the real schema at runtime. */
|
||||
export type SeedData = Record<string, unknown>;
|
||||
|
||||
/** Any content type uid `strapi.documents()` accepts. */
|
||||
export type SeedUid = Parameters<Core.Strapi['documents']>[0];
|
||||
|
||||
interface SeedDocument {
|
||||
documentId: string;
|
||||
[field: string]: unknown;
|
||||
}
|
||||
|
||||
/**
|
||||
* The document service, minus the per-uid generics.
|
||||
*
|
||||
* See the TYPES note above: this is the one place the seed steps outside
|
||||
* Strapi's generated types, and it is deliberate.
|
||||
*/
|
||||
interface LooseDocumentService {
|
||||
findFirst(params: SeedData): Promise<SeedDocument | null>;
|
||||
findMany(params: SeedData): Promise<SeedDocument[]>;
|
||||
create(params: SeedData): Promise<SeedDocument>;
|
||||
update(params: SeedData): Promise<SeedDocument | null>;
|
||||
delete(params: SeedData): Promise<unknown>;
|
||||
publish(params: SeedData): Promise<unknown>;
|
||||
}
|
||||
|
||||
const documents = (strapi: Core.Strapi, uid: SeedUid): LooseDocumentService =>
|
||||
strapi.documents(uid) as unknown as LooseDocumentService;
|
||||
|
||||
/** Whether this content type has draft & publish, and so a `publish` call. */
|
||||
const usesDraft = (strapi: Core.Strapi, uid: SeedUid): boolean =>
|
||||
Boolean(strapi.contentType(uid).options?.draftAndPublish);
|
||||
|
||||
/** `status: 'draft'`, but only where a status exists to ask about. */
|
||||
const draftFilter = (strapi: Core.Strapi, uid: SeedUid): SeedData =>
|
||||
usesDraft(strapi, uid) ? { status: 'draft' } : {};
|
||||
|
||||
/** What a seed step did, for the run summary. */
|
||||
export interface SeedResult {
|
||||
documentId: string;
|
||||
created: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write both locales of a document and publish it.
|
||||
*
|
||||
* `find` identifies the entry across runs - a slug for a collection type,
|
||||
* nothing at all for a single type, which has only ever one document. When it
|
||||
* matches nothing the document is created; when it matches, the same fields
|
||||
* are written over the existing one, so an editor's OTHER changes survive a
|
||||
* re-run and the fields the seed owns go back to the seeded value.
|
||||
*/
|
||||
export async function upsert(
|
||||
strapi: Core.Strapi,
|
||||
uid: SeedUid,
|
||||
data: Localised<SeedData>,
|
||||
find?: SeedData
|
||||
): Promise<SeedResult> {
|
||||
const service = documents(strapi, uid);
|
||||
|
||||
/* Looked up as a draft: a document that exists but has never been published
|
||||
is still the same document, and creating a second one beside it is how a
|
||||
seed ends up with duplicates. */
|
||||
const existing = await service.findFirst({
|
||||
...(find ? { filters: find } : {}),
|
||||
locale: 'en',
|
||||
...draftFilter(strapi, uid),
|
||||
});
|
||||
|
||||
let documentId: string;
|
||||
let created = false;
|
||||
|
||||
if (existing) {
|
||||
documentId = existing.documentId;
|
||||
await service.update({ documentId, locale: 'en', data: data.en });
|
||||
} else {
|
||||
const document = await service.create({ locale: 'en', data: data.en });
|
||||
documentId = document.documentId;
|
||||
created = true;
|
||||
}
|
||||
|
||||
/* An update against a locale the document does not have yet creates that
|
||||
translation - there is no separate "add a locale" call. */
|
||||
await service.update({ documentId, locale: 'ar', data: data.ar });
|
||||
|
||||
if (usesDraft(strapi, uid)) {
|
||||
await service.publish({ documentId, locale: '*' });
|
||||
}
|
||||
|
||||
return { documentId, created };
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the documents a filter matches, in every locale.
|
||||
*
|
||||
* TWO THINGS THE DOCUMENT SERVICE DOES NOT DO BY ITSELF, both of which leave
|
||||
* Arabic rows behind that the next run then collides with on the unique slug:
|
||||
*
|
||||
* 1. `delete({ documentId })` with no locale removes the DEFAULT locale
|
||||
* only, not the document. It takes `locale: '*'` to remove the lot.
|
||||
* 2. `findMany({ locale })` answers for one locale, so a document whose
|
||||
* English half has already gone is invisible to a search in English.
|
||||
* Both locales are searched and the documentIds pooled, which also
|
||||
* sweeps up orphans an earlier, less careful run left.
|
||||
*/
|
||||
async function deleteMatching(
|
||||
strapi: Core.Strapi,
|
||||
uid: SeedUid,
|
||||
filters: SeedData
|
||||
): Promise<number> {
|
||||
const service = documents(strapi, uid);
|
||||
const documentIds = new Set<string>();
|
||||
|
||||
for (const locale of LOCALES) {
|
||||
const matches = await service.findMany({
|
||||
filters,
|
||||
locale,
|
||||
...draftFilter(strapi, uid),
|
||||
pagination: { limit: -1 },
|
||||
});
|
||||
for (const match of matches) documentIds.add(match.documentId);
|
||||
}
|
||||
|
||||
for (const documentId of documentIds) {
|
||||
await service.delete({ documentId, locale: '*' });
|
||||
}
|
||||
|
||||
return documentIds.size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete every document of a type whose slug starts with the given prefix.
|
||||
*
|
||||
* This is how `--demo --clean` finds what it planted: the prefix is on the
|
||||
* slug itself, so nothing has to be remembered between runs and an entry an
|
||||
* editor has since renamed out of the prefix is deliberately left alone.
|
||||
*/
|
||||
export async function deleteBySlugPrefix(
|
||||
strapi: Core.Strapi,
|
||||
uid: SeedUid,
|
||||
prefix: string
|
||||
): Promise<number> {
|
||||
return deleteMatching(strapi, uid, { slug: { $startsWith: prefix } });
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete documents matched by an arbitrary filter.
|
||||
*
|
||||
* The FAQ content type has no slug to prefix, so its demo entries are found by
|
||||
* their exact questions instead - in both languages, because the filter is
|
||||
* matched per locale. Anything the seed did not write is left untouched,
|
||||
* because the filter is the seeded list itself.
|
||||
*/
|
||||
export async function deleteWhere(
|
||||
strapi: Core.Strapi,
|
||||
uid: SeedUid,
|
||||
filters: SeedData
|
||||
): Promise<number> {
|
||||
return deleteMatching(strapi, uid, filters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read one field off a single type before overwriting it.
|
||||
*
|
||||
* Used for the media an editor has already uploaded: the seed owns the words
|
||||
* on a page, not the pictures, so it reads the current hero image back and
|
||||
* writes it out again with the new copy rather than dropping it. A component
|
||||
* is replaced wholesale on write, so anything inside it that is not in the
|
||||
* payload is gone.
|
||||
*/
|
||||
export async function readExisting(
|
||||
strapi: Core.Strapi,
|
||||
uid: SeedUid,
|
||||
populate: string[],
|
||||
find?: SeedData
|
||||
): Promise<SeedDocument | null> {
|
||||
return documents(strapi, uid).findFirst({
|
||||
...(find ? { filters: find } : {}),
|
||||
locale: 'en',
|
||||
...draftFilter(strapi, uid),
|
||||
populate,
|
||||
});
|
||||
}
|
||||
|
||||
/** The id of a media entry nested in a populated component, if there is one. */
|
||||
export function mediaId(component: unknown, field: string): number | undefined {
|
||||
if (!component || typeof component !== 'object') return undefined;
|
||||
const media = (component as Record<string, unknown>)[field];
|
||||
if (!media || typeof media !== 'object') return undefined;
|
||||
const id = (media as Record<string, unknown>).id;
|
||||
return typeof id === 'number' ? id : undefined;
|
||||
}
|
||||
+16
-28
@@ -96,19 +96,6 @@ export interface BlocksRichText extends Struct.ComponentSchema {
|
||||
};
|
||||
}
|
||||
|
||||
export interface BlocksStatsGrid extends Struct.ComponentSchema {
|
||||
collectionName: 'components_blocks_stats_grids';
|
||||
info: {
|
||||
description: 'A grid of headline figures.';
|
||||
displayName: 'Stats Grid';
|
||||
icon: 'chartBubble';
|
||||
};
|
||||
attributes: {
|
||||
note: Schema.Attribute.Text;
|
||||
stats: Schema.Attribute.Component<'shared.stat', true>;
|
||||
};
|
||||
}
|
||||
|
||||
export interface BlocksVideoEmbed extends Struct.ComponentSchema {
|
||||
collectionName: 'components_blocks_video_embeds';
|
||||
info: {
|
||||
@@ -150,6 +137,21 @@ export interface NavigationNavGroup extends Struct.ComponentSchema {
|
||||
};
|
||||
}
|
||||
|
||||
export interface PageBandIntro extends Struct.ComponentSchema {
|
||||
collectionName: 'components_page_band_intros';
|
||||
info: {
|
||||
description: 'The heading, lead and pictures of a page band, in one place so an editor is not hunting for half of it in the Blocks zone.';
|
||||
displayName: 'Band intro';
|
||||
icon: 'layer';
|
||||
};
|
||||
attributes: {
|
||||
eyebrow: Schema.Attribute.String;
|
||||
heading: Schema.Attribute.String;
|
||||
images: Schema.Attribute.Media<'images', true>;
|
||||
lead: Schema.Attribute.Text;
|
||||
};
|
||||
}
|
||||
|
||||
export interface PageConsortiumMember extends Struct.ComponentSchema {
|
||||
collectionName: 'components_page_consortium_members';
|
||||
info: {
|
||||
@@ -297,19 +299,6 @@ export interface SharedSeo extends Struct.ComponentSchema {
|
||||
};
|
||||
}
|
||||
|
||||
export interface SharedStat extends Struct.ComponentSchema {
|
||||
collectionName: 'components_shared_stats';
|
||||
info: {
|
||||
description: 'A single headline figure, e.g. 64 / CSO Partners.';
|
||||
displayName: 'Stat';
|
||||
icon: 'chartBubble';
|
||||
};
|
||||
attributes: {
|
||||
label: Schema.Attribute.String & Schema.Attribute.Required;
|
||||
value: Schema.Attribute.String & Schema.Attribute.Required;
|
||||
};
|
||||
}
|
||||
|
||||
export interface SharedTitledText extends Struct.ComponentSchema {
|
||||
collectionName: 'components_shared_titled_texts';
|
||||
info: {
|
||||
@@ -333,10 +322,10 @@ declare module '@strapi/strapi' {
|
||||
'blocks.partner-logos': BlocksPartnerLogos;
|
||||
'blocks.quote': BlocksQuote;
|
||||
'blocks.rich-text': BlocksRichText;
|
||||
'blocks.stats-grid': BlocksStatsGrid;
|
||||
'blocks.video-embed': BlocksVideoEmbed;
|
||||
'navigation.footer-column': NavigationFooterColumn;
|
||||
'navigation.nav-group': NavigationNavGroup;
|
||||
'page.band-intro': PageBandIntro;
|
||||
'page.consortium-member': PageConsortiumMember;
|
||||
'page.workstream': PageWorkstream;
|
||||
'shared.accordion-item': SharedAccordionItem;
|
||||
@@ -346,7 +335,6 @@ declare module '@strapi/strapi' {
|
||||
'shared.hero': SharedHero;
|
||||
'shared.link': SharedLink;
|
||||
'shared.seo': SharedSeo;
|
||||
'shared.stat': SharedStat;
|
||||
'shared.titled-text': SharedTitledText;
|
||||
}
|
||||
}
|
||||
|
||||
+6
-12
@@ -464,7 +464,6 @@ export interface ApiAboutPageAboutPage extends Struct.SingleTypeSchema {
|
||||
[
|
||||
'blocks.rich-text',
|
||||
'blocks.image-gallery',
|
||||
'blocks.stats-grid',
|
||||
'blocks.cta-banner',
|
||||
'blocks.card-grid',
|
||||
'blocks.quote',
|
||||
@@ -588,7 +587,6 @@ export interface ApiActivityActivity extends Struct.CollectionTypeSchema {
|
||||
[
|
||||
'blocks.rich-text',
|
||||
'blocks.image-gallery',
|
||||
'blocks.stats-grid',
|
||||
'blocks.cta-banner',
|
||||
'blocks.card-grid',
|
||||
'blocks.quote',
|
||||
@@ -1165,11 +1163,16 @@ export interface ApiHomePageHomePage extends Struct.SingleTypeSchema {
|
||||
};
|
||||
};
|
||||
attributes: {
|
||||
approach: Schema.Attribute.Component<'page.band-intro', false> &
|
||||
Schema.Attribute.SetPluginOptions<{
|
||||
i18n: {
|
||||
localized: true;
|
||||
};
|
||||
}>;
|
||||
blocks: Schema.Attribute.DynamicZone<
|
||||
[
|
||||
'blocks.rich-text',
|
||||
'blocks.image-gallery',
|
||||
'blocks.stats-grid',
|
||||
'blocks.cta-banner',
|
||||
'blocks.card-grid',
|
||||
'blocks.quote',
|
||||
@@ -1216,12 +1219,6 @@ export interface ApiHomePageHomePage extends Struct.SingleTypeSchema {
|
||||
localized: true;
|
||||
};
|
||||
}>;
|
||||
stats: Schema.Attribute.Component<'shared.stat', true> &
|
||||
Schema.Attribute.SetPluginOptions<{
|
||||
i18n: {
|
||||
localized: true;
|
||||
};
|
||||
}>;
|
||||
updatedAt: Schema.Attribute.DateTime;
|
||||
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> &
|
||||
Schema.Attribute.Private;
|
||||
@@ -1256,7 +1253,6 @@ export interface ApiKnowledgeItemKnowledgeItem
|
||||
[
|
||||
'blocks.rich-text',
|
||||
'blocks.image-gallery',
|
||||
'blocks.stats-grid',
|
||||
'blocks.cta-banner',
|
||||
'blocks.card-grid',
|
||||
'blocks.quote',
|
||||
@@ -1389,7 +1385,6 @@ export interface ApiNewsArticleNewsArticle extends Struct.CollectionTypeSchema {
|
||||
[
|
||||
'blocks.rich-text',
|
||||
'blocks.image-gallery',
|
||||
'blocks.stats-grid',
|
||||
'blocks.cta-banner',
|
||||
'blocks.card-grid',
|
||||
'blocks.quote',
|
||||
@@ -2134,7 +2129,6 @@ export interface ApiWhatWeDoPageWhatWeDoPage extends Struct.SingleTypeSchema {
|
||||
[
|
||||
'blocks.rich-text',
|
||||
'blocks.image-gallery',
|
||||
'blocks.stats-grid',
|
||||
'blocks.cta-banner',
|
||||
'blocks.card-grid',
|
||||
'blocks.quote',
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
# ---------------------------------------------------------------------------
|
||||
# SHARP-ER web (React Router 8) - environment template
|
||||
#
|
||||
# Copy to .env and fill in real values: cp .env.example .env
|
||||
# Never commit .env.
|
||||
#
|
||||
# `pnpm --filter web start` loads THIS file (apps/web/.env), the same way the
|
||||
# CMS loads apps/cms/.env. It is per-application on purpose: PORT and HOST mean
|
||||
# something different to each server, and a single shared value would move
|
||||
# Strapi onto the website's port. The repository-root .env is docker compose's
|
||||
# file and is not read here.
|
||||
#
|
||||
# A real environment variable always wins over this file, so a systemd unit,
|
||||
# a container or `PORT=9090 pnpm --filter web start` overrides any line below.
|
||||
#
|
||||
# `pnpm dev:web` does NOT read this file - the dev server is Vite on 5173, and
|
||||
# it only exposes variables prefixed VITE_, by inlining them into the CLIENT
|
||||
# bundle. Never use that prefix here: STRAPI_TOKEN below is a server secret.
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# --- Server ----------------------------------------------------------------
|
||||
|
||||
# Port react-router-serve binds. Leave it unset and the server takes the first
|
||||
# FREE port from 3000 upwards - 3001, 3002, ... once 3000 is busy - which a
|
||||
# reverse proxy cannot be pointed at. `pnpm dev:web` ignores this and uses 5173.
|
||||
PORT=3000
|
||||
|
||||
# Interface to bind. Unset means every interface. Set it to 127.0.0.1 when a
|
||||
# reverse proxy on the same host should be the only way in.
|
||||
# HOST=127.0.0.1
|
||||
|
||||
# --- Content ---------------------------------------------------------------
|
||||
|
||||
# Public origin of the site. Canonical URLs, hreflang alternates and JSON-LD
|
||||
# are built from it, so it must match how visitors actually reach the site -
|
||||
# https://sharper.ly in production, never the internal http://127.0.0.1:3000.
|
||||
# Leave it unset in local development and the request's own host is used.
|
||||
SITE_URL=http://localhost:3000
|
||||
|
||||
# Where the server-side loaders fetch content from. This origin is also
|
||||
# prefixed onto uploaded media URLs, which the browser has to resolve too -
|
||||
# see "Images from the CMS" in README.md.
|
||||
STRAPI_URL=http://localhost:1337
|
||||
|
||||
# Optional Strapi API token. Only needed to read draft or otherwise protected
|
||||
# content; published content is public. Settings -> API Tokens in the admin.
|
||||
STRAPI_TOKEN=
|
||||
@@ -26,6 +26,9 @@
|
||||
* "Ghost / Large / Default" is the one cell in the matrix with no padding
|
||||
while its own Hover and Disabled cells have it - an authoring slip that
|
||||
would make the button jump on hover. Padding is kept on all ghost states.
|
||||
* Ghost is repainted to the Claude Design drafts rather than to the Figma
|
||||
frame: text-only throughout, no hover fill, no lift, widening gap. See
|
||||
the block below and the ghost tokens in semantic.css.
|
||||
* Disabled uses the opaque `-bg-disabled` / `-fg-disabled` tokens rather than
|
||||
Figma's 40% opacity, so the page never shows through a disabled control.
|
||||
`--control-opacity-disabled` still holds the 0.4 if that is ever wanted.
|
||||
@@ -190,11 +193,28 @@
|
||||
--sh-btn-border-disabled: var(--interactive-ghost-border-disabled);
|
||||
}
|
||||
|
||||
/* Figma gives the ghost md/lg cells radius.md while every other cell uses
|
||||
radius.sm - reproduced rather than normalised. */
|
||||
.sh-btn[data-variant="ghost"][data-size="md"],
|
||||
.sh-btn[data-variant="ghost"][data-size="lg"] {
|
||||
border-radius: var(--radius-control-lg);
|
||||
/* GHOST IS A TEXT LINK, NOT A BUTTON.
|
||||
The drafts draw "All updates ->" and "What we do ->" as plain text that
|
||||
turns accent green while the label-to-arrow gap opens from 8px to 12px.
|
||||
So the ghost variant opts out of the 3px lift the filled controls take -
|
||||
nothing that has no box should appear to rise off the page - and animates
|
||||
its gap instead. (The old Figma-quirk override that gave ghost md/lg
|
||||
radius.md is gone with --radius-control-lg; every control is 4px.) */
|
||||
.sh-btn[data-variant="ghost"] .sh-btn__content {
|
||||
transition:
|
||||
opacity var(--motion-duration-fast) var(--motion-ease-standard),
|
||||
gap var(--motion-duration-base) var(--motion-ease-standard);
|
||||
}
|
||||
|
||||
@media (hover: hover) {
|
||||
.sh-btn[data-variant="ghost"]:hover:not(:disabled):not([aria-disabled="true"]):not([data-loading]) {
|
||||
transform: none;
|
||||
}
|
||||
|
||||
.sh-btn[data-variant="ghost"]:hover:not(:disabled):not([aria-disabled="true"]):not([data-loading])
|
||||
.sh-btn__content {
|
||||
gap: var(--spacing-sm);
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
|
||||
@@ -65,7 +65,10 @@ export function CardCTA({
|
||||
data-surface="dark"
|
||||
className={cx(
|
||||
"sh-card relative flex flex-col gap-lg rounded-surface p-10",
|
||||
"bg-surface-accent text-text-on-accent shadow-[var(--elevation-popover)]",
|
||||
/* The drafts rest nothing on a shadow - a panel is a fill and an edge,
|
||||
and the black is spent on what floats. --elevation-card is that
|
||||
resting step: none on the dark surface, soft on the light one. */
|
||||
"bg-surface-accent text-text-on-accent shadow-[var(--elevation-card)]",
|
||||
"sm:flex-row sm:items-center",
|
||||
className,
|
||||
)}
|
||||
|
||||
@@ -85,7 +85,7 @@ export function CardContent({
|
||||
light on both surfaces - text-on-accent is the only always-white
|
||||
role, text-primary would go dark on the light surface. */}
|
||||
{badge ? (
|
||||
<span className="absolute start-md top-md rounded-control-lg bg-overlay-scrim px-xs py-2xs label-md text-text-on-accent backdrop-blur-[4px]">
|
||||
<span className="absolute start-md top-md rounded-chip bg-overlay-scrim px-xs py-2xs label-md text-text-on-accent backdrop-blur-[4px]">
|
||||
{badge}
|
||||
</span>
|
||||
) : null}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
STYLING RULE for this whole directory:
|
||||
* colour and radius come from the tier-2 Tailwind bridge
|
||||
(bg-surface-raised, text-text-accent, border-border-subtle,
|
||||
rounded-surface, ...) - never a hex, never a tier-1 primitive;
|
||||
rounded-card, ...) - never a hex, never a tier-1 primitive;
|
||||
* tokens without a bridge utility are spent as arbitrary values,
|
||||
e.g. shadow-[var(--elevation-card)];
|
||||
* spacing uses the named scale (p-lg = 24, gap-md = 16) so the Figma
|
||||
@@ -143,8 +143,10 @@ export interface CardShellProps {
|
||||
}
|
||||
|
||||
/**
|
||||
* The surface every card shares: raised fill, hairline border, 12px corner
|
||||
* (Figma radius/lg) and the card elevation.
|
||||
* The surface every card shares: raised fill, hairline border and the 4px
|
||||
* corner the design drafts draw. `--elevation-card` is the drafts' resting
|
||||
* shadow, which on the dark surface is none at all - the hairline does the
|
||||
* separating, and the black is kept for the hover state in card.css.
|
||||
*/
|
||||
export function CardShell({
|
||||
as = "article",
|
||||
@@ -160,7 +162,7 @@ export function CardShell({
|
||||
"sh-card",
|
||||
linked && "sh-card--linked",
|
||||
"relative flex bg-[var(--surface-card)] text-text-primary",
|
||||
"rounded-surface border border-border-subtle shadow-[var(--elevation-card)]",
|
||||
"rounded-card border border-border-subtle shadow-[var(--elevation-card)]",
|
||||
className,
|
||||
)}
|
||||
>
|
||||
|
||||
@@ -1,106 +0,0 @@
|
||||
/* ============================================================================
|
||||
Card.Stat - Figma 25:792 (260 x 166)
|
||||
----------------------------------------------------------------------------
|
||||
The figure card used by the home page stats strip: a large accent number,
|
||||
an optional trend chip, the label it counts, a rule and a caption. Never a
|
||||
link - a number is not a destination.
|
||||
|
||||
USAGE
|
||||
-----
|
||||
<ul className="grid gap-lg sm:grid-cols-2 lg:grid-cols-4">
|
||||
<Card.Stat
|
||||
as="li"
|
||||
value="2,450"
|
||||
label="Participants reached"
|
||||
caption="Cumulative regional outreach, updated each quarter."
|
||||
trend={{ label: "12%", direction: "up", description: "up 12% on last quarter" }}
|
||||
/>
|
||||
<Card.Stat as="li" value="18" label="Municipalities engaged" />
|
||||
</ul>
|
||||
|
||||
// Arabic - Eastern Arabic numerals belong in the value string itself.
|
||||
<Card.Stat value="٢٬٤٥٠" label="عدد المشاركين" />
|
||||
========================================================================= */
|
||||
|
||||
import { CardIcon, CardShell, cx } from "./CardShell";
|
||||
import type { CardElement } from "./types";
|
||||
|
||||
export interface CardStatTrend {
|
||||
/** Visible text, e.g. "12%". */
|
||||
label: string;
|
||||
/** Up is the accent fill, down the danger fill. Defaults to up. */
|
||||
direction?: "up" | "down";
|
||||
/**
|
||||
* Spoken instead of the bare figure, e.g. "up 12% on last quarter". The
|
||||
* arrow is decorative, so without this a screen reader hears only "12%".
|
||||
*/
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export interface CardStatProps {
|
||||
/** Pre-formatted for the locale - the card never formats a number itself. */
|
||||
value: string;
|
||||
label: string;
|
||||
caption?: string;
|
||||
trend?: CardStatTrend;
|
||||
as?: CardElement;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export function CardStat({
|
||||
value,
|
||||
label,
|
||||
caption,
|
||||
trend,
|
||||
as = "article",
|
||||
className,
|
||||
}: CardStatProps) {
|
||||
const isDown = trend?.direction === "down";
|
||||
|
||||
return (
|
||||
<CardShell
|
||||
as={as}
|
||||
className={cx("flex-col items-start gap-md p-lg", className)}
|
||||
>
|
||||
<div className="flex w-full items-center justify-between gap-sm">
|
||||
<p className="display-sm tabular-nums text-text-accent">{value}</p>
|
||||
|
||||
{trend ? (
|
||||
/* Figma paints the chip label in text/accent on a background/accent
|
||||
fill - green on green, invisible. Kept as the accent fill with the
|
||||
always-white on-accent label, and the danger fill when the figure
|
||||
is falling. */
|
||||
<span
|
||||
className={cx(
|
||||
"inline-flex shrink-0 items-center gap-2xs rounded-control-lg px-xs py-2xs",
|
||||
"label-md text-text-on-accent",
|
||||
isDown ? "bg-surface-danger" : "bg-surface-accent",
|
||||
)}
|
||||
>
|
||||
<CardIcon
|
||||
name="arrow-up"
|
||||
size={10}
|
||||
className={isDown ? "rotate-180" : undefined}
|
||||
/>
|
||||
{trend.description ? (
|
||||
<>
|
||||
<span aria-hidden="true">{trend.label}</span>
|
||||
<span className="sr-only">{trend.description}</span>
|
||||
</>
|
||||
) : (
|
||||
trend.label
|
||||
)}
|
||||
</span>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
<p className="body-md-bold text-text-primary">{label}</p>
|
||||
|
||||
<div aria-hidden="true" className="w-full border-t border-border-subtle" />
|
||||
|
||||
{caption ? (
|
||||
<p className="body-sm text-text-secondary">{caption}</p>
|
||||
) : null}
|
||||
</CardShell>
|
||||
);
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
CARD - mechanics that cannot be expressed as a utility
|
||||
----------------------------------------------------------------------------
|
||||
Everything token-driven lives in the TSX as a tier-2 utility
|
||||
(bg-surface-raised, text-text-accent, rounded-surface, ...). This file only
|
||||
(bg-surface-raised, text-text-accent, rounded-card, ...). This file only
|
||||
holds the three things a utility cannot do:
|
||||
|
||||
1. paint an exported SVG asset in the current token colour (mask),
|
||||
@@ -13,7 +13,7 @@
|
||||
component rather than by app/app.css, so it is not scoped by anything else.
|
||||
|
||||
Everything lives in @layer components so a Tailwind utility passed through
|
||||
`className` (`rounded-surface`, `text-text-secondary`, ...) still wins.
|
||||
`className` (`rounded-card`, `text-text-secondary`, ...) still wins.
|
||||
The layer statement is a defensive no-op when app.css has already declared
|
||||
the same order, and makes this file correct on its own if it ever loads first.
|
||||
========================================================================= */
|
||||
@@ -88,17 +88,29 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
HOVER / FOCUS AFFORDANCES
|
||||
------------------------------------------------------------------------ */
|
||||
/* The drafts hover a card three ways at once: the hairline turns accent
|
||||
green, the card rises, and a deep black lands under it. The lift is
|
||||
pointer-only - a touch "hover" would leave the card raised after the tap -
|
||||
and it is dropped entirely under prefers-reduced-motion below, because a
|
||||
transform still lands instantly once app.css has flattened the duration. */
|
||||
.sh-card--linked {
|
||||
transition:
|
||||
box-shadow var(--motion-duration-base) var(--motion-ease-standard),
|
||||
border-color var(--motion-duration-base) var(--motion-ease-standard);
|
||||
border-color var(--motion-duration-base) var(--motion-ease-standard),
|
||||
transform var(--motion-duration-base) var(--motion-ease-standard);
|
||||
}
|
||||
|
||||
.sh-card--linked:hover {
|
||||
border-color: var(--border-default);
|
||||
border-color: var(--border-accent);
|
||||
box-shadow: var(--elevation-popover);
|
||||
}
|
||||
|
||||
@media (hover: hover) {
|
||||
.sh-card--linked:hover {
|
||||
transform: translateY(-6px);
|
||||
}
|
||||
}
|
||||
|
||||
.sh-card--linked:hover .sh-card-title,
|
||||
.sh-card--linked:has(.sh-card-link:focus-visible) .sh-card-title {
|
||||
text-decoration: underline;
|
||||
@@ -116,6 +128,7 @@
|
||||
/* app.css already neutralises transition durations under reduced motion, but a
|
||||
transform still lands instantly - drop it entirely. */
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.sh-card--linked:hover,
|
||||
.sh-card--linked:hover .sh-card-media img {
|
||||
transform: none;
|
||||
}
|
||||
|
||||
@@ -1,16 +1,19 @@
|
||||
/* ============================================================================
|
||||
CARD - Figma frame 25:809
|
||||
----------------------------------------------------------------------------
|
||||
Five card types that share one surface, one link mechanism and one icon
|
||||
Four card types that share one surface, one link mechanism and one icon
|
||||
strategy. Import the namespace for readable markup:
|
||||
|
||||
import { Card } from "~/components/ui/Card";
|
||||
<Card.Content … /> <Card.Team … /> <Card.Horizontal … />
|
||||
<Card.Stat … /> <Card.CTA … />
|
||||
<Card.Content … /> <Card.Team … />
|
||||
<Card.Horizontal … /> <Card.CTA … />
|
||||
|
||||
or the components directly when you want the narrowest import:
|
||||
|
||||
import { CardStat } from "~/components/ui/Card";
|
||||
import { CardTeam } from "~/components/ui/Card";
|
||||
|
||||
The fifth, Card.Stat, is gone along with the rest of the project's figures
|
||||
machinery: no approved document carries a number, so nothing drew it.
|
||||
|
||||
Every card is correct on both surfaces without a prop: colour comes only
|
||||
from tier-2 roles, which [data-surface="dark"] and [data-surface="light"]
|
||||
@@ -20,7 +23,6 @@
|
||||
export { CardContent } from "./CardContent";
|
||||
export { CardTeam } from "./CardTeam";
|
||||
export { CardHorizontal } from "./CardHorizontal";
|
||||
export { CardStat } from "./CardStat";
|
||||
export { CardCTA } from "./CardCTA";
|
||||
|
||||
export {
|
||||
@@ -39,7 +41,6 @@ export type {
|
||||
CardTeamSocialKind,
|
||||
} from "./CardTeam";
|
||||
export type { CardHorizontalProps } from "./CardHorizontal";
|
||||
export type { CardStatProps, CardStatTrend } from "./CardStat";
|
||||
export type { CardCTAProps, CardCTAAction } from "./CardCTA";
|
||||
export type {
|
||||
CardShellProps,
|
||||
@@ -58,14 +59,12 @@ export type {
|
||||
import { CardContent } from "./CardContent";
|
||||
import { CardTeam } from "./CardTeam";
|
||||
import { CardHorizontal } from "./CardHorizontal";
|
||||
import { CardStat } from "./CardStat";
|
||||
import { CardCTA } from "./CardCTA";
|
||||
|
||||
/** The card family, namespaced: Card.Content, Card.Team, Card.Horizontal, Card.Stat, Card.CTA. */
|
||||
/** The card family, namespaced: Card.Content, Card.Team, Card.Horizontal, Card.CTA. */
|
||||
export const Card = {
|
||||
Content: CardContent,
|
||||
Team: CardTeam,
|
||||
Horizontal: CardHorizontal,
|
||||
Stat: CardStat,
|
||||
CTA: CardCTA,
|
||||
} as const;
|
||||
|
||||
@@ -287,7 +287,9 @@ function SocialButton({ link }: { link: FooterSocialLink }) {
|
||||
)}
|
||||
>
|
||||
<FooterSocialIcon platform={link.platform} className="h-[17px] w-[17px]" />
|
||||
<span className="body-sm-bold">{link.label}</span>
|
||||
{/* The label never wraps under its own icon: "Follow us on Facebook" is
|
||||
one line at every width, as the draft has it. */}
|
||||
<span className="body-sm-bold whitespace-nowrap">{link.label}</span>
|
||||
</a>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
background-color: var(--field-bg);
|
||||
color: var(--field-fg);
|
||||
border: var(--control-border-width) solid var(--field-border);
|
||||
border-radius: var(--radius-control-lg);
|
||||
border-radius: var(--radius-control);
|
||||
padding-inline: calc(var(--control-padding-inline-md) - var(--control-border-width));
|
||||
padding-block: calc(var(--control-padding-block-md) - var(--control-border-width));
|
||||
text-align: start;
|
||||
|
||||
@@ -436,10 +436,14 @@ export function DesktopNav({
|
||||
className={cx(
|
||||
"body-sm-bold flex cursor-pointer items-center gap-2xs",
|
||||
"whitespace-nowrap pb-[2px] text-start",
|
||||
"text-[var(--text-primary)]",
|
||||
"hover:text-[var(--text-accent)]",
|
||||
"aria-expanded:text-[var(--text-accent)]",
|
||||
"data-[current=true]:text-[var(--text-accent)]",
|
||||
/* The drafts rest a nav label in text/secondary and
|
||||
brighten it to primary under the pointer; the section
|
||||
the reader is in stays primary and is marked by the
|
||||
accent rule below, not by green text. */
|
||||
"text-[var(--text-secondary)]",
|
||||
"hover:text-[var(--text-primary)]",
|
||||
"aria-expanded:text-[var(--text-primary)]",
|
||||
"data-[current=true]:text-[var(--text-primary)]",
|
||||
HOVER_TRANSITION,
|
||||
FOCUS_RING,
|
||||
)}
|
||||
@@ -512,9 +516,10 @@ export function DesktopNav({
|
||||
onFocus={closeGroup}
|
||||
className={cx(
|
||||
"body-sm-bold whitespace-nowrap pb-[2px] no-underline",
|
||||
"text-[var(--text-primary)]",
|
||||
"hover:text-[var(--text-accent)]",
|
||||
"aria-[current=page]:text-[var(--text-accent)]",
|
||||
/* Same rest/hover/current treatment as a group trigger. */
|
||||
"text-[var(--text-secondary)]",
|
||||
"hover:text-[var(--text-primary)]",
|
||||
"aria-[current=page]:text-[var(--text-primary)]",
|
||||
HOVER_TRANSITION,
|
||||
FOCUS_RING,
|
||||
)}
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
useState,
|
||||
type KeyboardEvent as ReactKeyboardEvent,
|
||||
} from "react";
|
||||
import { createPortal } from "react-dom";
|
||||
import { Link } from "react-router";
|
||||
|
||||
import { EuBadge } from "../EuBadge";
|
||||
@@ -28,6 +29,18 @@ const FOCUSABLE_SELECTOR = [
|
||||
'[tabindex]:not([tabindex="-1"])',
|
||||
].join(", ");
|
||||
|
||||
/**
|
||||
* The hamburger and its close twin. The glyph is the drafts' 24px box, which is
|
||||
* well under the 44x44 WCAG 2.5.5 target size, so the control is a 44px square
|
||||
* around it. The negative inline-end margin gives back the 10px of padding that
|
||||
* would otherwise push the glyph off the page gutter the wordmark opposite it
|
||||
* lines up with - logical, so it mirrors in Arabic.
|
||||
*/
|
||||
const TAP_TARGET = cx(
|
||||
"-me-[0.625rem] inline-flex size-11 shrink-0 cursor-pointer",
|
||||
"items-center justify-center rounded-control",
|
||||
);
|
||||
|
||||
function focusablesIn(root: HTMLElement): HTMLElement[] {
|
||||
return Array.from(root.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR)).filter(
|
||||
(element) => !element.hasAttribute("hidden") && element.getClientRects().length > 0,
|
||||
@@ -55,6 +68,23 @@ export interface MobileNavProps {
|
||||
* `inert` (so assistive technology cannot browse the page under an aria-modal
|
||||
* dialog either), the page behind cannot scroll, Escape closes it, and focus
|
||||
* returns to the hamburger on close.
|
||||
*
|
||||
* THE DRAWER IS PORTALLED TO <body>, AND HAS TO BE.
|
||||
* The bar it hangs off paints the drafts' translucent ground with
|
||||
* `backdrop-filter: blur(14px)`, and a filtered element becomes the containing
|
||||
* block for every `position: fixed` descendant (CSS Filter Effects 1 s.6.1).
|
||||
* Rendered in place, `fixed inset-0` therefore resolved against the 64px bar
|
||||
* rather than the viewport: the panel painted a 64px strip and its menu spilled
|
||||
* over the page with no background behind it. The header also carries
|
||||
* `z-index: var(--layer-header)`, which is a stacking context, so an
|
||||
* `aria-modal` dialog nested inside it could never rise above anything painted
|
||||
* above the bar either. A portal fixes both at once, and it is where a modal
|
||||
* dialog belongs regardless.
|
||||
*
|
||||
* The portal is client-only, so the panel joins the DOM on mount. Nothing is
|
||||
* lost: the trigger is a button with an onClick, so without JavaScript the
|
||||
* drawer could not be opened anyway, and every link in it is already in the
|
||||
* server-rendered DesktopNav markup.
|
||||
*/
|
||||
export function MobileNav({
|
||||
items,
|
||||
@@ -69,6 +99,9 @@ export function MobileNav({
|
||||
className,
|
||||
}: MobileNavProps) {
|
||||
const [open, setOpen] = useState(false);
|
||||
/* The portal target only exists in a browser, and the first client render has
|
||||
to match the server's, so the panel is mounted one commit later. */
|
||||
const [mounted, setMounted] = useState(false);
|
||||
const triggerRef = useRef<HTMLButtonElement>(null);
|
||||
const closeRef = useRef<HTMLButtonElement>(null);
|
||||
const drawerRef = useRef<HTMLDivElement>(null);
|
||||
@@ -81,6 +114,8 @@ export function MobileNav({
|
||||
|
||||
const close = useCallback(() => setOpen(false), []);
|
||||
|
||||
useEffect(() => setMounted(true), []);
|
||||
|
||||
/* Focus in on open, and back to the hamburger on close. */
|
||||
useEffect(() => {
|
||||
if (open) {
|
||||
@@ -94,11 +129,11 @@ export function MobileNav({
|
||||
|
||||
/* The drawer is aria-modal, so the rest of the page has to be inert as well -
|
||||
otherwise a screen reader still browses the header, main and footer behind
|
||||
it. Rather than naming those landmarks (the drawer is itself rendered
|
||||
inside the header, so inerting the header would inert the drawer), every
|
||||
ancestor up to <body> has its OTHER children inerted. `inert` is set as an
|
||||
attribute so no DOM-lib typing is needed, and an element that was already
|
||||
inert is skipped so the restore never clears someone else's flag.
|
||||
it. Rather than naming those landmarks, every ancestor up to <body> has its
|
||||
OTHER children inerted; from the portal that is simply body's other
|
||||
children, which is exactly the header, main and footer. `inert` is set as
|
||||
an attribute so no DOM-lib typing is needed, and an element that was
|
||||
already inert is skipped so the restore never clears someone else's flag.
|
||||
|
||||
This runs after the focus effect above on purpose: focus is already inside
|
||||
the drawer by the time the element it came from goes inert. */
|
||||
@@ -215,24 +250,7 @@ export function MobileNav({
|
||||
FOCUS_RING,
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<button
|
||||
ref={triggerRef}
|
||||
type="button"
|
||||
aria-expanded={open}
|
||||
aria-controls={drawerId}
|
||||
aria-label={open ? strings.closeMenu : strings.openMenu}
|
||||
onClick={() => setOpen((value) => !value)}
|
||||
className={cx(
|
||||
"inline-flex shrink-0 cursor-pointer items-center justify-center rounded-control xl:hidden",
|
||||
FOCUS_RING,
|
||||
className,
|
||||
)}
|
||||
>
|
||||
<MenuBars />
|
||||
</button>
|
||||
|
||||
const panel = (
|
||||
<div
|
||||
id={drawerId}
|
||||
ref={drawerRef}
|
||||
@@ -256,10 +274,7 @@ export function MobileNav({
|
||||
type="button"
|
||||
aria-label={strings.closeMenu}
|
||||
onClick={close}
|
||||
className={cx(
|
||||
"inline-flex shrink-0 cursor-pointer items-center justify-center rounded-control",
|
||||
FOCUS_RING,
|
||||
)}
|
||||
className={cx(TAP_TARGET, FOCUS_RING)}
|
||||
>
|
||||
<MenuBars open />
|
||||
</button>
|
||||
@@ -341,6 +356,23 @@ export function MobileNav({
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<button
|
||||
ref={triggerRef}
|
||||
type="button"
|
||||
aria-expanded={open}
|
||||
aria-controls={drawerId}
|
||||
aria-label={open ? strings.closeMenu : strings.openMenu}
|
||||
onClick={() => setOpen((value) => !value)}
|
||||
className={cx(TAP_TARGET, "xl:hidden", FOCUS_RING, className)}
|
||||
>
|
||||
<MenuBars />
|
||||
</button>
|
||||
|
||||
{mounted ? createPortal(panel, document.body) : null}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -409,7 +409,7 @@ export function ConsentCheckbox({
|
||||
required
|
||||
aria-invalid={error ? true : undefined}
|
||||
aria-describedby={describedBy}
|
||||
className="mt-2xs size-md shrink-0 rounded-[var(--radius-control)] border border-border-strong accent-[var(--interactive-primary-bg)]"
|
||||
className="mt-2xs size-md shrink-0 rounded-chip border border-border-strong accent-[var(--interactive-primary-bg)]"
|
||||
/>
|
||||
<label htmlFor={name} className="body-sm text-text-primary">
|
||||
{label}
|
||||
|
||||
@@ -42,7 +42,11 @@ export interface AccordionProps {
|
||||
className?: string;
|
||||
}
|
||||
|
||||
/** The +/- mark. The upright bar collapses as the question opens. */
|
||||
/**
|
||||
* The +/- mark. The upright bar collapses as the question opens, and the whole
|
||||
* mark turns half a revolution with it - the design draft's own gesture, which
|
||||
* carries the change of state even where the thin bar is hard to follow.
|
||||
*/
|
||||
function ToggleMark({ open }: { open: boolean }) {
|
||||
return (
|
||||
<span
|
||||
@@ -50,8 +54,8 @@ function ToggleMark({ open }: { open: boolean }) {
|
||||
className={cx(
|
||||
"flex size-8 shrink-0 items-center justify-center rounded-pill",
|
||||
"border border-[var(--border-default)] text-[var(--text-accent)]",
|
||||
"transition-colors duration-[var(--motion-duration-base)]",
|
||||
open && "border-[var(--border-accent)] bg-[var(--surface-accent-subtle)]",
|
||||
"transition duration-[var(--motion-duration-base)]",
|
||||
open && "rotate-180 border-[var(--border-accent)] bg-[var(--surface-accent-subtle)]",
|
||||
)}
|
||||
>
|
||||
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" aria-hidden="true">
|
||||
|
||||
@@ -38,11 +38,19 @@ export interface CmsHero {
|
||||
readonly ctas?: readonly CmsCta[] | null;
|
||||
}
|
||||
|
||||
/** shared.stat - `value` is authored as a string so "48%" and "1,583" survive. */
|
||||
export interface CmsStat {
|
||||
/**
|
||||
* page.band-intro - a page band's own heading, lead and pictures.
|
||||
*
|
||||
* It exists so a band is edited in one place. The alternative - a headline in
|
||||
* one field and its pictures somewhere down the Blocks zone - is how an editor
|
||||
* ends up unable to find half of a section.
|
||||
*/
|
||||
export interface CmsBandIntro {
|
||||
readonly id?: number;
|
||||
readonly value: string;
|
||||
readonly label: string;
|
||||
readonly eyebrow?: string | null;
|
||||
readonly heading?: string | null;
|
||||
readonly lead?: string | null;
|
||||
readonly images?: readonly StrapiMedia[] | null;
|
||||
}
|
||||
|
||||
/** shared.titled-text - pillars and principles. */
|
||||
@@ -175,7 +183,8 @@ export interface CmsFaq extends StrapiEntity {
|
||||
/** api::home-page.home-page */
|
||||
export interface CmsHomePage extends StrapiEntity {
|
||||
readonly hero?: CmsHero | null;
|
||||
readonly stats?: readonly CmsStat[] | null;
|
||||
/** The band under the hero - "A nationwide project, delivered locally". */
|
||||
readonly approach?: CmsBandIntro | null;
|
||||
readonly blocks?: readonly CmsBlock[] | null;
|
||||
/** Curated newsroom picks; the page falls back to the latest articles. */
|
||||
readonly featuredNews?: readonly CmsNewsArticle[] | null;
|
||||
|
||||
@@ -2,14 +2,17 @@
|
||||
PAGE COPY - EN / AR
|
||||
----------------------------------------------------------------------------
|
||||
SOURCE
|
||||
Home page Figma frame 253:4799 "Home-en" is the source of truth.
|
||||
The headline (I253:4800;228:2609), the launch heading
|
||||
(I361:10853;361:11147), the one-paragraph launch lead
|
||||
with its four bold runs (I361:10853;349:8838) and the
|
||||
three captions are transcribed from that frame, NOT
|
||||
from docs/SHARPER Home Page .docx - the design condenses
|
||||
the draft, and the draft itself is headed "Placeholder
|
||||
text for design purposes - not final copy".
|
||||
Home page The Claude Design draft "Home page redesign with news
|
||||
and FAQs" (third drop) is the source of truth. Its
|
||||
headline, lead, primary call to action and the
|
||||
"nationwide project, delivered locally" band are
|
||||
transcribed from that draft, NOT from docs/SHARPER Home
|
||||
Page .docx - the design condenses the draft, and the
|
||||
draft itself is headed "Placeholder text for design
|
||||
purposes - not final copy". Every claim in it is
|
||||
nonetheless in docs/: the consortium, the partner
|
||||
groups it works with, the EU funding and the December
|
||||
2027 end date.
|
||||
Everything else docs/SHARPER_Website_Draft_Section_EN_AR.docx
|
||||
(sections 1, 2 and 9), which carries both columns, so
|
||||
no string below is a machine translation of the other
|
||||
@@ -32,8 +35,9 @@
|
||||
Figures. The draft marks every number "TBD" and says they must not be
|
||||
published until confirmed, so there is no statistic anywhere in this file.
|
||||
Figma hides the home page's figures band outright (frame 253:4835 is
|
||||
hidden="true"), so the band renders only once the CMS `stats` component
|
||||
supplies real numbers, and nothing stands in for it until then.
|
||||
hidden="true") and the third design drop deletes it, so the band is gone
|
||||
from the page and the `stats` component is gone from the CMS. There is
|
||||
nowhere left for a figure to be typed in, which is the point.
|
||||
========================================================================= */
|
||||
|
||||
import type { Locale } from "~/i18n";
|
||||
@@ -69,17 +73,13 @@ export interface HomeCopy {
|
||||
readonly heroCtaPrimary: string;
|
||||
readonly heroCtaSecondary: string;
|
||||
/**
|
||||
* The figures band. Bundled so the band is never empty, and overridden by
|
||||
* `home-page.stats` the moment an editor writes one. Every figure here is
|
||||
* verifiable: three consortium members and the Dec 2025 - Dec 2027 run come
|
||||
* from the project brief, the four areas of work are the What We Do
|
||||
* workstreams, and the sixteen human security sub-projects are the approved
|
||||
* EN/AR draft's own wording.
|
||||
* The band under the hero picture: what the project is and who delivers it.
|
||||
* It replaces the launch-event band of the previous drop, which had dated
|
||||
* the whole home page to a single day in June.
|
||||
*/
|
||||
readonly stats: readonly { readonly value: string; readonly label: string }[];
|
||||
readonly launchEyebrow: string;
|
||||
readonly launchHeading: string;
|
||||
readonly launchLead: string;
|
||||
readonly approachEyebrow: string;
|
||||
readonly approachHeading: string;
|
||||
readonly approachLead: string;
|
||||
readonly workHeading: string;
|
||||
readonly workLinkLabel: string;
|
||||
readonly newsEyebrow: string;
|
||||
@@ -194,21 +194,17 @@ export interface PageCopy {
|
||||
|
||||
const EN: PageCopy = {
|
||||
home: {
|
||||
heroHeadline: "SHARP-ER Project Officially Launches in Libya",
|
||||
heroHeadline: "Advancing Justice and Accountability, Led by Libyan Communities",
|
||||
heroLead:
|
||||
"Shared Action on Rule of Law Progress — Exit Route: a nationwide initiative supporting Libya’s civil society, local institutions, and communities in advancing justice, accountability, and good governance.",
|
||||
heroCtaPrimary: "Expression of Interest",
|
||||
"SHARP-ER — Shared Action on Rule of Law Progress, Exit Route — works with civil society organisations, municipalities, and community leaders across Libya to strengthen access to justice, accountability, and local governance. Funded by the European Union, running to December 2027.",
|
||||
heroCtaPrimary: "See open calls",
|
||||
heroCtaSecondary: "About the project",
|
||||
stats: [
|
||||
{ value: "3", label: "Consortium partners" },
|
||||
{ value: "4", label: "Areas of work" },
|
||||
{ value: "16", label: "Human security sub-projects" },
|
||||
{ value: "25 mo", label: "Dec 2025 – Dec 2027" },
|
||||
],
|
||||
launchEyebrow: "30 June · Launch event",
|
||||
launchHeading: "An important start for the project",
|
||||
launchLead:
|
||||
"The launch brought together representatives from the European Union Delegation, the Ministry of Youth, the Ministry of Local Governance, the Ministry of Women’s Affairs, civil society organisations, partners, and stakeholders from across Libya. The event marked the opening of the Expression of Interest and the launch of this website.",
|
||||
approachEyebrow: "Nationwide, Libya",
|
||||
/* The same sentence the About page heads its body with - one project, one
|
||||
description of it. */
|
||||
approachHeading: "A nationwide project, delivered locally",
|
||||
approachLead:
|
||||
"Local organisations lead the design and delivery of the work. SHARP-ER partners with Libyan civil society, municipalities, and community leaders — through funded sub-projects, training, and open dialogue between communities and the institutions that serve them.",
|
||||
workHeading: "Three areas of change",
|
||||
workLinkLabel: "What we do",
|
||||
newsEyebrow: "Newsroom",
|
||||
@@ -383,23 +379,17 @@ const EN: PageCopy = {
|
||||
|
||||
const AR: PageCopy = {
|
||||
home: {
|
||||
heroHeadline: "انطلاق مشروع SHARP-ER رسميًا في ليبيا",
|
||||
heroHeadline: "تعزيز العدالة والمساءلة بقيادة المجتمعات الليبية",
|
||||
heroLead:
|
||||
"العمل المشترك لتعزيز سيادة القانون – مسار الخروج: مبادرة وطنية تدعم المجتمع المدني والمؤسسات المحلية والمجتمعات في ليبيا في تعزيز العدالة والمساءلة والحوكمة الرشيدة.",
|
||||
heroCtaPrimary: "الدعوة للتعبير عن الاهتمام",
|
||||
"يعمل SHARP-ER — العمل المشترك لتعزيز سيادة القانون، مسار الخروج — مع منظمات المجتمع المدني والبلديات وقادة المجتمعات في مختلف أنحاء ليبيا على تعزيز الوصول إلى العدالة والمساءلة والحوكمة المحلية. بتمويل من الاتحاد الأوروبي، ويستمر حتى ديسمبر 2027.",
|
||||
heroCtaPrimary: "اطّلع على الدعوات المفتوحة",
|
||||
heroCtaSecondary: "عن المشروع",
|
||||
/* Western digits, as the rest of the Arabic draft writes its numbers
|
||||
("ديسمبر 2025", "SHARP I and II (2019–2024)"). */
|
||||
stats: [
|
||||
{ value: "3", label: "شركاء الائتلاف" },
|
||||
{ value: "4", label: "مجالات العمل" },
|
||||
{ value: "16", label: "مشروعًا فرعيًا للأمن الإنساني" },
|
||||
{ value: "25 شهرًا", label: "ديسمبر 2025 – ديسمبر 2027" },
|
||||
],
|
||||
launchEyebrow: "30 يونيو · فعالية الإطلاق",
|
||||
launchHeading: "بداية مهمة للمشروع",
|
||||
launchLead:
|
||||
"جمعت فعالية الإطلاق ممثلين عن بعثة الاتحاد الأوروبي، ووزارة الشباب، ووزارة الحكم المحلي، ووزارة شؤون المرأة، ومنظمات المجتمع المدني، والشركاء، وأصحاب المصلحة من مختلف أنحاء ليبيا. وشهد الحدث افتتاح الدعوة للتعبير عن الاهتمام وإطلاق هذا الموقع الإلكتروني.",
|
||||
/* The same two lines the About page uses for its coverage fact and its
|
||||
body heading, so the Arabic reads identically on both pages. */
|
||||
approachEyebrow: "على مستوى ليبيا بأكملها",
|
||||
approachHeading: "مشروع وطني يُنفَّذ محليًا",
|
||||
approachLead:
|
||||
"تتولّى المنظمات المحلية تصميم العمل وتنفيذه. ويعمل SHARP-ER بالشراكة مع المجتمع المدني الليبي والبلديات وقادة المجتمعات، من خلال المشاريع الفرعية المموَّلة، والتدريب، والحوار المفتوح بين المجتمعات والمؤسسات التي تخدمها.",
|
||||
workHeading: "ثلاثة مجالات للتغيير",
|
||||
workLinkLabel: "ماذا نفعل",
|
||||
newsEyebrow: "غرفة الأخبار",
|
||||
|
||||
@@ -23,11 +23,12 @@
|
||||
scroll block is additionally gated on `prefers-reduced-motion: no-preference`
|
||||
so a reduced-motion visitor never gets a timeline-driven opacity ramp at all.
|
||||
|
||||
DIRECTION: `transform-origin` and `linear-gradient()` have no logical
|
||||
keywords, so the progress bar and the brand stripe carry an explicit RTL
|
||||
override. These are the only physical directions in the file, and they exist
|
||||
because the property itself has no logical form - every box edge elsewhere is
|
||||
still ps-/pe-/start-/end-.
|
||||
DIRECTION: `transform-origin`, `linear-gradient()`, `clip-path: inset()` and
|
||||
`translateX()` have no logical keywords, so the progress bar, the brand
|
||||
stripe, the headline wipe, the hover rule and the logo marquee each carry an
|
||||
explicit RTL override. These are the only physical directions in the file,
|
||||
and they exist because the property itself has no logical form - every box
|
||||
edge elsewhere is still ps-/pe-/start-/end-.
|
||||
========================================================================= */
|
||||
|
||||
@layer theme, base, components, utilities;
|
||||
@@ -59,6 +60,33 @@
|
||||
--sh-rise-delay: calc(var(--motion-duration-fast) * 3);
|
||||
}
|
||||
|
||||
/* The home headline. The third design drop stops lifting it and uncovers it
|
||||
instead, from the inline start, so the words are read into place rather
|
||||
than slid in. It reads the SAME `--sh-rise-delay` as the cascade above, so
|
||||
`.sh-rise--3` &c. stagger the wipe alongside everything else. */
|
||||
.sh-wipe {
|
||||
animation: sh-wipe var(--motion-duration-reveal) var(--motion-ease-entrance)
|
||||
var(--sh-rise-delay, 0ms) backwards;
|
||||
}
|
||||
|
||||
[dir="rtl"] .sh-wipe {
|
||||
animation-name: sh-wipe-rtl;
|
||||
}
|
||||
|
||||
/* `backwards`, not `both`: the clip has to be GONE once the wipe is over.
|
||||
`inset(0)` at rest would keep clipping to the border box, which shaves a
|
||||
descender or an Arabic mark off a tight heading line. */
|
||||
|
||||
/* app.css shortens every animation but leaves its delay alone, which for a
|
||||
clip means the headline is not merely faded but absent until the delay has
|
||||
passed. Removing the animation outright puts the words on screen from the
|
||||
first paint, which is what a reduced-motion reader asked for. */
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.sh-wipe {
|
||||
animation: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* The brand stripe under the hero picture, drawn on from the inline start. */
|
||||
.sh-bar-grow {
|
||||
transform-origin: left center;
|
||||
@@ -93,6 +121,69 @@
|
||||
infinite;
|
||||
}
|
||||
|
||||
/* The network logo wall, drifting past. The track carries the tiles TWICE,
|
||||
so moving it exactly half its own width lands on an identical frame and
|
||||
the loop never shows a seam; 42.5x the reveal duration is the draft's 34s
|
||||
at the shipped token.
|
||||
|
||||
`width` is set here rather than with a `w-max` utility on purpose: the
|
||||
reduced-motion block below has to be able to take it back, and a utility
|
||||
sits in a later layer than this one.
|
||||
|
||||
It stops under the pointer and whenever anything inside it takes focus, so
|
||||
a reader can hold the movement still to look at - or tab to - a logo
|
||||
(WCAG 2.2.2). Under reduced motion it stops being a track at all: the row
|
||||
simply wraps and the duplicate half is removed, so nothing moves and no
|
||||
logo is shown twice. */
|
||||
.sh-marquee {
|
||||
width: max-content;
|
||||
animation: sh-marquee calc(var(--motion-duration-reveal) * 42.5) linear
|
||||
infinite;
|
||||
}
|
||||
|
||||
/* RTL reads the other way, so the drift does too. */
|
||||
[dir="rtl"] .sh-marquee {
|
||||
animation-name: sh-marquee-rtl;
|
||||
}
|
||||
|
||||
.sh-marquee:hover,
|
||||
.sh-marquee:focus-within {
|
||||
animation-play-state: paused;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.sh-marquee {
|
||||
width: auto;
|
||||
flex-wrap: wrap;
|
||||
animation: none;
|
||||
}
|
||||
|
||||
.sh-marquee__clone {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* The wall fades out at both ends instead of being cut off mid-tile. `black`
|
||||
and `transparent` here are alpha, not colour - a mask reads the channel
|
||||
only - which is why this is not a surface token. The ramp is symmetric, so
|
||||
it needs no RTL form. */
|
||||
.sh-marquee-mask {
|
||||
-webkit-mask-image: linear-gradient(
|
||||
to right,
|
||||
transparent,
|
||||
black 8%,
|
||||
black 92%,
|
||||
transparent
|
||||
);
|
||||
mask-image: linear-gradient(
|
||||
to right,
|
||||
transparent,
|
||||
black 8%,
|
||||
black 92%,
|
||||
transparent
|
||||
);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------
|
||||
INTERACTION
|
||||
---------------------------------------------------------------------- */
|
||||
@@ -112,6 +203,56 @@
|
||||
}
|
||||
}
|
||||
|
||||
/* A picture pushing in a little while the frame around it is hovered. The
|
||||
frame clips, so the picture grows into its own box and not over the page.
|
||||
Paired with .sh-lift the tile rises and its picture closes in, which is
|
||||
how the draft hovers the gallery. */
|
||||
.sh-zoom {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.sh-zoom img {
|
||||
transition: transform var(--motion-duration-slow)
|
||||
var(--motion-ease-standard);
|
||||
}
|
||||
|
||||
@media (hover: hover) {
|
||||
.sh-zoom:hover img {
|
||||
transform: scale(1.09);
|
||||
}
|
||||
}
|
||||
|
||||
/* An accent rule drawn across the top of a tile under the pointer, growing
|
||||
from the inline start. It is a pseudo-element so the tile's own markup
|
||||
stays a heading and a paragraph. */
|
||||
.sh-rule-top {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.sh-rule-top::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset-block-start: 0;
|
||||
inset-inline: 0;
|
||||
block-size: 3px;
|
||||
background: var(--surface-accent);
|
||||
transform: scaleX(0);
|
||||
transform-origin: left center;
|
||||
transition: transform var(--motion-duration-slow)
|
||||
var(--motion-ease-entrance);
|
||||
}
|
||||
|
||||
[dir="rtl"] .sh-rule-top::before {
|
||||
transform-origin: right center;
|
||||
}
|
||||
|
||||
@media (hover: hover) {
|
||||
.sh-rule-top:hover::before {
|
||||
transform: scaleX(1);
|
||||
}
|
||||
}
|
||||
|
||||
/* An FAQ answer opening under its question. */
|
||||
.sh-answer {
|
||||
animation: sh-answer var(--motion-duration-base) var(--motion-ease-entrance)
|
||||
@@ -134,6 +275,16 @@
|
||||
animation-name: sh-reveal-in;
|
||||
animation-range: entry 0% entry 80%;
|
||||
}
|
||||
|
||||
/* The hero picture drifting as the page scrolls past it. It is scaled up
|
||||
before it travels, so the drift can never uncover an edge of the
|
||||
frame. Chromium-only, like every timeline here: elsewhere the picture
|
||||
simply sits still, which is the state the design falls back to. */
|
||||
.sh-pan {
|
||||
animation: sh-pan linear both;
|
||||
animation-timeline: view();
|
||||
animation-range: entry 100% exit 0%;
|
||||
}
|
||||
}
|
||||
|
||||
@supports (animation-timeline: scroll()) {
|
||||
@@ -236,6 +387,60 @@
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes sh-wipe {
|
||||
from {
|
||||
opacity: 0.4;
|
||||
clip-path: inset(0 100% 0 0);
|
||||
}
|
||||
|
||||
to {
|
||||
opacity: 1;
|
||||
clip-path: inset(0 0 0 0);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes sh-wipe-rtl {
|
||||
from {
|
||||
opacity: 0.4;
|
||||
clip-path: inset(0 0 0 100%);
|
||||
}
|
||||
|
||||
to {
|
||||
opacity: 1;
|
||||
clip-path: inset(0 0 0 0);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes sh-marquee {
|
||||
from {
|
||||
transform: translateX(0);
|
||||
}
|
||||
|
||||
to {
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes sh-marquee-rtl {
|
||||
from {
|
||||
transform: translateX(0);
|
||||
}
|
||||
|
||||
to {
|
||||
transform: translateX(50%);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes sh-pan {
|
||||
from {
|
||||
transform: translateY(-5%) scale(1.14);
|
||||
}
|
||||
|
||||
to {
|
||||
transform: translateY(5%) scale(1.14);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes sh-answer {
|
||||
from {
|
||||
opacity: 0;
|
||||
|
||||
@@ -393,6 +393,12 @@ export function PageHero({
|
||||
const rise = (step?: 2 | 3 | 4 | 5) =>
|
||||
reveal ? cx("sh-rise", step && `sh-rise--${step}`) : undefined;
|
||||
|
||||
/* The same cascade, uncovering the words instead of lifting them - the
|
||||
headline treatment of the home draft. `.sh-wipe` reads the very step
|
||||
classes `rise` sets, so both share one stagger. */
|
||||
const wipe = (step?: 2 | 3 | 4 | 5) =>
|
||||
reveal ? cx("sh-wipe", step && `sh-rise--${step}`) : undefined;
|
||||
|
||||
const washes = ambient ?? [];
|
||||
|
||||
return (
|
||||
@@ -452,12 +458,27 @@ export function PageHero({
|
||||
{leadWithActions ? (
|
||||
<>
|
||||
{/* Headline across the top ... */}
|
||||
<div className={cx("flex max-w-[43.75rem] flex-col gap-sm", rise(3))}>
|
||||
<div className="flex max-w-[43.75rem] flex-col gap-sm">
|
||||
{eyebrow ? (
|
||||
<p className="label-md uppercase text-[var(--text-accent)]">{eyebrow}</p>
|
||||
<p
|
||||
className={cx(
|
||||
"label-md uppercase text-[var(--text-accent)]",
|
||||
rise(3),
|
||||
)}
|
||||
>
|
||||
{eyebrow}
|
||||
</p>
|
||||
) : null}
|
||||
|
||||
<h1 className="heading-h1 text-[var(--text-primary)] md:display-sm">
|
||||
{/* The wipe is on the heading itself, not on the column, so the
|
||||
eyebrow above it still arrives with the rest of the cascade
|
||||
rather than being uncovered along with the words. */}
|
||||
<h1
|
||||
className={cx(
|
||||
"heading-h1 text-[var(--text-primary)] md:display-sm",
|
||||
wipe(3),
|
||||
)}
|
||||
>
|
||||
{title}
|
||||
</h1>
|
||||
</div>
|
||||
@@ -539,13 +560,18 @@ export function PageHero({
|
||||
mint tint over a shade, both painted on the photograph. */
|
||||
<div className={cx("w-full", rise(5))}>
|
||||
<div className="relative w-full overflow-hidden">
|
||||
{/* `sh-pan` drifts the picture inside the band as the page
|
||||
scrolls past it. It is scaled up inside the frame first,
|
||||
so the drift never uncovers an edge; the washes above are
|
||||
positioned against the frame, not the picture, so they do
|
||||
not travel with it. */}
|
||||
<img
|
||||
src={media.src}
|
||||
alt={media.alt}
|
||||
{...(media.width ? { width: media.width } : {})}
|
||||
{...(media.height ? { height: media.height } : {})}
|
||||
fetchPriority="high"
|
||||
className="aspect-[16/9] w-full object-cover md:aspect-[1244/415]"
|
||||
className="sh-pan aspect-[16/9] w-full object-cover md:aspect-[1244/415]"
|
||||
/>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
@@ -563,27 +589,24 @@ export function PageHero({
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* The colour band (478:16360): three blocks flush under the
|
||||
picture, 6px tall. Figma lays out 390 / 495 / 363 inside a
|
||||
1244-wide clipping frame, so the last block loses 4px and the
|
||||
split that is actually drawn is 390 : 495 : 359 - carried here
|
||||
as flex-grow ratios so it holds at every width instead of only
|
||||
at 1244. The three fills are `background/accent`,
|
||||
`background/inverse` and `background/danger`, which is why the
|
||||
middle block reads white on the dark hero and near-black on a
|
||||
light surface.
|
||||
{/* The colour band (478:16360, redrawn in the drafts' home
|
||||
hero): three blocks flush under the picture, 6px tall, split
|
||||
390 : 495 : 363 and carried as flex-grow ratios so the split
|
||||
holds at every width instead of only at the drafts' 1244.
|
||||
|
||||
The fills are `background/accent`, `background/inverse` and
|
||||
`background/danger` - the drafts paint the middle block
|
||||
#F8F9FA, so the stripe reads green / white / red on the dark
|
||||
hero and flips to green / near-black / red on a light
|
||||
surface.
|
||||
|
||||
Purely decorative, so it is hidden from assistive technology;
|
||||
as an ordinary flex row it mirrors in Arabic along with the
|
||||
rest of the page. */}
|
||||
<div aria-hidden="true" className="sh-bar-grow flex h-[6px] w-full">
|
||||
<span className="basis-0 grow-[390] bg-[var(--surface-accent)]" />
|
||||
{/* The middle block is the raised dark, not the inverse:
|
||||
the redesign drops pure white from the page entirely, so
|
||||
the stripe reads green / dark / red on the near-black
|
||||
band instead of green / white / red. */}
|
||||
<span className="basis-0 grow-[495] bg-[var(--surface-raised)]" />
|
||||
<span className="basis-0 grow-[359] bg-[var(--surface-danger)]" />
|
||||
<span className="basis-0 grow-[495] bg-[var(--surface-inverse)]" />
|
||||
<span className="basis-0 grow-[363] bg-[var(--surface-danger)]" />
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
@@ -750,39 +773,3 @@ export function ValueChips({
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export interface StatStripProps {
|
||||
stats: readonly { value: string; label: string }[];
|
||||
className?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* The figures band. `value` is authored in the CMS as a string, already
|
||||
* formatted for its locale, because the site must never invent or re-derive a
|
||||
* project figure - see the note the pages render when this list is empty.
|
||||
*/
|
||||
export function StatStrip({ stats, className }: StatStripProps) {
|
||||
if (stats.length === 0) return null;
|
||||
|
||||
return (
|
||||
<dl
|
||||
className={cx(
|
||||
"grid grid-cols-2 gap-lg border-y border-[var(--border-subtle)] py-xl md:grid-cols-4",
|
||||
className,
|
||||
)}
|
||||
>
|
||||
{stats.map((stat) => (
|
||||
/* Source order is term-then-description, as the spec requires; the
|
||||
reversed column paints the figure above its label without repeating
|
||||
the label for a screen reader. */
|
||||
<div
|
||||
key={`${stat.value}-${stat.label}`}
|
||||
className="flex flex-col-reverse gap-2xs text-start"
|
||||
>
|
||||
<dt className="body-sm text-[var(--text-secondary)]">{stat.label}</dt>
|
||||
<dd className="heading-h1 text-[var(--text-accent)]">{stat.value}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -792,7 +792,7 @@ export function FacetGroup({
|
||||
aria-hidden="true"
|
||||
className={cx(
|
||||
"mt-2xs flex size-[0.875rem] shrink-0 items-center justify-center",
|
||||
"rounded-[var(--radius-control)] border",
|
||||
"rounded-chip border",
|
||||
option.isCurrent
|
||||
? "border-border-accent"
|
||||
: "border-border-default",
|
||||
|
||||
@@ -466,7 +466,7 @@ function StreamDisclosure({
|
||||
|
||||
<h3 className="flex-1 heading-h3">{copy.title}</h3>
|
||||
|
||||
<span className="hidden shrink-0 rounded-[var(--radius-control)] bg-surface-accent-subtle px-xs py-2xs label-md uppercase text-text-accent sm:inline-block">
|
||||
<span className="hidden shrink-0 rounded-chip bg-surface-accent-subtle px-xs py-2xs label-md uppercase text-text-accent sm:inline-block">
|
||||
{copy.partners}
|
||||
</span>
|
||||
|
||||
|
||||
@@ -638,7 +638,7 @@ function MonthCell({ day, locale }: { day: CalendarDay; locale: Locale }) {
|
||||
to={entry.href}
|
||||
prefetch="intent"
|
||||
className={[
|
||||
"rounded-[var(--radius-control)] border-s-2 border-s-[var(--border-accent)]",
|
||||
"rounded-chip border-s-2 border-s-[var(--border-accent)]",
|
||||
"bg-surface-accent-subtle px-2xs py-2xs body-sm-bold text-text-primary",
|
||||
"transition-colors duration-[var(--motion-duration-fast)]",
|
||||
"ease-[var(--motion-ease-standard)] hover:text-text-accent",
|
||||
|
||||
+166
-174
@@ -1,15 +1,18 @@
|
||||
/* ============================================================================
|
||||
HOME - /en and /ar
|
||||
----------------------------------------------------------------------------
|
||||
The redesigned home page (Claude Design "Home", second drop), carried onto
|
||||
the project's own design system. Six bands, alternating the two dark
|
||||
surfaces the way the draft alternates #0B0B0A and #1D1D1B:
|
||||
The redesigned home page (Claude Design "Home page redesign with news and
|
||||
FAQs", third drop), carried onto the project's own design system. Six bands,
|
||||
alternating the two dark surfaces the way the draft alternates #0B0B0A and
|
||||
#1D1D1B:
|
||||
|
||||
Hero EU badge, an optional status pill, the headline, the lead,
|
||||
the CTA pair, the wide picture, the brand stripe and the
|
||||
figures row. Two slow washes drift behind it.
|
||||
Launch "An important start for the project": the launch lead and
|
||||
three pictures from the CMS gallery.
|
||||
the CTA pair, the wide picture and the brand stripe. Two
|
||||
slow washes drift behind it.
|
||||
Approach "A nationwide project, delivered locally": what the project
|
||||
does, and up to three pictures. Heading, lead and pictures
|
||||
are all `home-page.approach`, so the band is edited in one
|
||||
place rather than half in a field and half in Blocks.
|
||||
Work "Three areas of change" - the three approved pillars, with
|
||||
a link through to What We Do.
|
||||
Newsroom three cards from the newsroom, newest first.
|
||||
@@ -20,25 +23,26 @@
|
||||
--------------------------------------------
|
||||
* The draft's FAQ column promises a reply "within five working days". That
|
||||
commitment appears in no approved document, so it is not published
|
||||
(CLAUDE.md rule 5). Everything else in the draft is verifiable: the four
|
||||
figures, the ministries at the launch and the three pillars are all in
|
||||
docs/ or in the bundled draft copy.
|
||||
* Every list - news, questions, partner logos, launch pictures - is CMS
|
||||
(CLAUDE.md rule 5). Everything else in the draft is verifiable against
|
||||
docs/ or the bundled draft copy.
|
||||
* The figures band the second drop carried is gone, as it is from the third
|
||||
draft, and so is the `home-page.stats` component behind it: no approved
|
||||
document carries a number, so there was never anything to put in it.
|
||||
* Every list - news, questions, partner logos, band pictures - is CMS
|
||||
data, never the draft's sample entries. Each band shows its localised
|
||||
empty state instead of inventing content.
|
||||
* The draft's own navigation and footer are ignored: the site ships
|
||||
<Navigation /> and <Footer /> from the app shell.
|
||||
|
||||
MOTION: every animation in the draft is here, as classes from
|
||||
_page-kit/motion.css, plus the figures counting up on arrival. The one
|
||||
effect deliberately dropped is the coloured glow behind a hovered button or
|
||||
card.
|
||||
_page-kit/motion.css - the headline wipe, the hero picture's scroll-driven
|
||||
drift, the gallery and card hovers, the logo marquee. The one effect
|
||||
deliberately dropped is the coloured glow behind a hovered button or card.
|
||||
|
||||
There is no Arabic frame, so /ar is this same DOM under `dir="rtl"`, which
|
||||
is why every inline edge below is logical (ps-/pe-/start-/end-).
|
||||
========================================================================= */
|
||||
|
||||
import { useEffect, useLayoutEffect, useState } from "react";
|
||||
import { Link } from "react-router";
|
||||
|
||||
import { ArrowIcon, Button } from "~/components/ui/Button";
|
||||
@@ -74,6 +78,7 @@ import {
|
||||
toImage,
|
||||
toPartner,
|
||||
type ResolvedImage,
|
||||
type ResolvedPartner,
|
||||
} from "./_page-kit/cms.server";
|
||||
import { pageCopy } from "./_page-kit/copy";
|
||||
import { routeLocale } from "./_page-kit/locale";
|
||||
@@ -90,12 +95,21 @@ import "./_page-kit/motion.css";
|
||||
|
||||
/** The network logo wall - a wide but finite grid. */
|
||||
const PARTNER_PAGE_SIZE = 36;
|
||||
/**
|
||||
* Below this many partners the wall stays a grid.
|
||||
*
|
||||
* The marquee loops by carrying the tiles twice and sliding exactly half the
|
||||
* track, which only reads as a loop while the half is wider than the frame it
|
||||
* slides through. Eight 178px tiles clear a desktop container; fewer would
|
||||
* drift a short row across an empty band, so the grid keeps them still.
|
||||
*/
|
||||
const PARTNER_MARQUEE_MIN = 8;
|
||||
/** The draft's newsroom band is a straight three-up row. */
|
||||
const NEWS_PAGE_SIZE = 3;
|
||||
/** More than a dozen questions is a page of its own, not a home page band. */
|
||||
const FAQ_PAGE_SIZE = 12;
|
||||
/** The draft's launch band shows three pictures. */
|
||||
const LAUNCH_SHOTS = 3;
|
||||
/** The draft's approach band shows three pictures. */
|
||||
const GALLERY_SHOTS = 3;
|
||||
|
||||
/** A newsroom card, already localised and safe to serialise to the client. */
|
||||
interface NewsCard {
|
||||
@@ -131,7 +145,7 @@ export async function loader({ params }: Route.LoaderArgs) {
|
||||
locale,
|
||||
populate: {
|
||||
hero: { populate: { media: true, ctas: true } },
|
||||
stats: true,
|
||||
approach: { populate: { images: true } },
|
||||
// Strapi 5 populates a dynamic zone per component with `on`.
|
||||
blocks: { on: { "blocks.image-gallery": { populate: { images: true } } } },
|
||||
featuredNews: { populate: { coverImage: true, authorOrganisation: true } },
|
||||
@@ -174,9 +188,15 @@ export async function loader({ params }: Route.LoaderArgs) {
|
||||
pagination: { pageSize: FAQ_PAGE_SIZE },
|
||||
});
|
||||
|
||||
const gallery = list(page?.blocks)
|
||||
/* The band's own pictures come first. An `image-gallery` block is still
|
||||
read after them, so a gallery an editor built in the Blocks zone before
|
||||
the band had a media field of its own keeps rendering. */
|
||||
const gallery = [
|
||||
...list(page?.approach?.images),
|
||||
...list(page?.blocks)
|
||||
.filter(isImageGalleryBlock)
|
||||
.flatMap((block) => list(block.images))
|
||||
.flatMap((block) => list(block.images)),
|
||||
]
|
||||
.map((image) => toImage(image, "medium"))
|
||||
.filter((image): image is ResolvedImage => image !== undefined);
|
||||
|
||||
@@ -193,12 +213,12 @@ export async function loader({ params }: Route.LoaderArgs) {
|
||||
variant: cta.variant ?? "primary",
|
||||
})),
|
||||
},
|
||||
/* Editor-owned figures win; the bundled four stand in until then. */
|
||||
stats: list(page?.stats).map((stat) => ({
|
||||
value: stat.value,
|
||||
label: stat.label,
|
||||
})),
|
||||
gallery: gallery.slice(0, LAUNCH_SHOTS),
|
||||
approach: {
|
||||
eyebrow: page?.approach?.eyebrow ?? null,
|
||||
heading: page?.approach?.heading ?? null,
|
||||
lead: page?.approach?.lead ?? null,
|
||||
},
|
||||
gallery: gallery.slice(0, GALLERY_SHOTS),
|
||||
partnersHeadline: page?.partnersHeadline ?? null,
|
||||
partners: partners.map(toPartner),
|
||||
news: news.slice(0, NEWS_PAGE_SIZE).map((article) => toNewsCard(article, locale)),
|
||||
@@ -291,93 +311,17 @@ function StatusPill({ label }: { label: string }) {
|
||||
);
|
||||
}
|
||||
|
||||
/* `useLayoutEffect` would warn during SSR, and the count only exists in a
|
||||
browser, so the effect is picked per environment. */
|
||||
const useBrowserLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
|
||||
|
||||
/**
|
||||
* A figure that counts up to its value on arrival, as the draft does.
|
||||
*
|
||||
* The server renders the FINAL value, so a reader without JavaScript - and a
|
||||
* search engine - sees the real figure. In a browser the count is reset before
|
||||
* the first paint (layout effect, not a plain effect), so the number never
|
||||
* flashes its end state first. A value the CMS wrote as words rather than
|
||||
* digits is simply printed.
|
||||
*/
|
||||
function CountUpValue({ value }: { value: string }) {
|
||||
const parsed = /^(\d[\d,]*)([\s\S]*)$/.exec(value);
|
||||
const target = parsed ? Number(parsed[1]!.replace(/,/g, "")) : null;
|
||||
const suffix = parsed ? parsed[2]! : "";
|
||||
const [shown, setShown] = useState<number | null>(target);
|
||||
|
||||
useBrowserLayoutEffect(() => {
|
||||
if (target === null) return;
|
||||
/* app.css collapses animation, but this one is script-driven, so the
|
||||
preference has to be honoured here as well. */
|
||||
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) return;
|
||||
|
||||
let frame = 0;
|
||||
const started = performance.now();
|
||||
const duration = 1500;
|
||||
|
||||
setShown(0);
|
||||
|
||||
const tick = (now: number) => {
|
||||
const progress = Math.min(1, (now - started) / duration);
|
||||
/* Ease out cubic - the draft's own curve. */
|
||||
setShown(Math.round(target * (1 - Math.pow(1 - progress, 3))));
|
||||
if (progress < 1) frame = requestAnimationFrame(tick);
|
||||
};
|
||||
|
||||
frame = requestAnimationFrame(tick);
|
||||
return () => cancelAnimationFrame(frame);
|
||||
}, [target]);
|
||||
|
||||
if (target === null) return <>{value}</>;
|
||||
|
||||
return (
|
||||
<>
|
||||
{shown}
|
||||
{suffix}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* The figures row that closes the hero: four cells divided by hairlines. The
|
||||
* grid's own background paints the 1px gaps, which is how the draft draws the
|
||||
* dividers without a border on each cell.
|
||||
*/
|
||||
function StatsRow({ stats }: { stats: readonly { value: string; label: string }[] }) {
|
||||
if (stats.length === 0) return null;
|
||||
|
||||
return (
|
||||
<dl className="grid grid-cols-1 gap-px border-y border-[var(--border-subtle)] bg-[var(--border-subtle)] sm:grid-cols-2 lg:grid-cols-4">
|
||||
{stats.map((stat) => (
|
||||
/* Source order is term-then-description, as the spec requires; the
|
||||
reversed column paints the figure above its label without repeating
|
||||
the label for a screen reader. */
|
||||
<div
|
||||
key={`${stat.value}-${stat.label}`}
|
||||
className="flex flex-col-reverse gap-2xs bg-[var(--surface-sunken)] px-lg py-xl text-start transition-colors duration-[var(--motion-duration-base)] hover:bg-[var(--surface-raised)]"
|
||||
>
|
||||
<dt className="label-md uppercase text-[var(--text-tertiary)]">{stat.label}</dt>
|
||||
<dd className="heading-h1 tabular-nums text-[var(--text-primary)]">
|
||||
<CountUpValue value={stat.value} />
|
||||
</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* The launch band's three pictures. The CMS alt text doubles as the visible
|
||||
* The approach band's three pictures. The CMS alt text doubles as the visible
|
||||
* caption - so the picture is described once, in the caption, and the <img>
|
||||
* itself is marked decorative rather than having a screen reader read the same
|
||||
* sentence twice.
|
||||
*
|
||||
* The frame and the picture hover apart, as the third draft has them: the
|
||||
* frame lifts and takes the accent hairline (`sh-lift`) while the picture
|
||||
* closes in inside it (`sh-zoom`, which also does the clipping).
|
||||
*/
|
||||
function LaunchShots({ images }: { images: readonly ResolvedImage[] }) {
|
||||
function GalleryShots({ images }: { images: readonly ResolvedImage[] }) {
|
||||
if (images.length === 0) return null;
|
||||
|
||||
return (
|
||||
@@ -385,12 +329,14 @@ function LaunchShots({ images }: { images: readonly ResolvedImage[] }) {
|
||||
{images.map((image) => (
|
||||
<li key={image.src} className="sh-reveal">
|
||||
<figure className="flex flex-col gap-xs">
|
||||
<div className="sh-lift sh-zoom rounded-control border border-[var(--border-subtle)] hover:border-[var(--border-accent)]">
|
||||
<img
|
||||
src={image.src}
|
||||
alt=""
|
||||
loading="lazy"
|
||||
className="sh-lift h-[15rem] w-full rounded-control border border-[var(--border-subtle)] object-cover hover:border-[var(--border-accent)]"
|
||||
className="h-[15rem] w-full object-cover"
|
||||
/>
|
||||
</div>
|
||||
{image.alt ? (
|
||||
<figcaption className="body-sm-bold text-[var(--text-secondary)]">
|
||||
{image.alt}
|
||||
@@ -403,6 +349,74 @@ function LaunchShots({ images }: { images: readonly ResolvedImage[] }) {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* One tile on the civil society logo wall.
|
||||
*
|
||||
* `decorative` renders the second half of the marquee track: the same tile,
|
||||
* hidden from assistive technology, with no link and no alt text, so the loop
|
||||
* repeats visually without repeating the wall for a screen reader or adding a
|
||||
* second tab stop per partner.
|
||||
*/
|
||||
function PartnerTile({
|
||||
partner,
|
||||
fixedWidth = false,
|
||||
decorative = false,
|
||||
}: {
|
||||
partner: ResolvedPartner;
|
||||
fixedWidth?: boolean;
|
||||
decorative?: boolean;
|
||||
}) {
|
||||
const href = decorative ? undefined : safeHref(partner.website);
|
||||
|
||||
/* The logo wall is a wall of equal tiles; the name is the tile's text when
|
||||
there is no logo to draw, and always its accessible name. */
|
||||
const inner = partner.logo ? (
|
||||
<img
|
||||
src={partner.logo.src}
|
||||
alt={decorative ? "" : partner.name}
|
||||
loading="lazy"
|
||||
className="max-h-[3.5rem] w-auto max-w-full object-contain"
|
||||
/>
|
||||
) : (
|
||||
<span className="body-sm-bold text-center text-[var(--text-secondary)]">
|
||||
{partner.name}
|
||||
</span>
|
||||
);
|
||||
|
||||
return (
|
||||
<li
|
||||
{...(decorative ? { "aria-hidden": true } : {})}
|
||||
className={cx(
|
||||
"flex h-[5.5rem] items-center justify-center",
|
||||
"rounded-control border border-[var(--border-subtle)] bg-[var(--surface-card)] p-md",
|
||||
"transition-colors duration-[var(--motion-duration-base)]",
|
||||
"hover:border-[var(--border-accent)]",
|
||||
/* A still grid reveals tile by tile; a travelling track must not, or
|
||||
each tile would ramp its own opacity while it moves.
|
||||
|
||||
The track's spacing is a margin on the tile rather than a `gap` on
|
||||
the row: the loop slides exactly half the track, so each half has to
|
||||
carry its own trailing space or the seam lands half a gap short. */
|
||||
fixedWidth ? "me-md w-[11.125rem] shrink-0" : "sh-reveal sh-reveal--in",
|
||||
decorative && "sh-marquee__clone",
|
||||
)}
|
||||
>
|
||||
{href ? (
|
||||
<a
|
||||
href={href}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="flex h-full w-full items-center justify-center"
|
||||
>
|
||||
{inner}
|
||||
</a>
|
||||
) : (
|
||||
inner
|
||||
)}
|
||||
</li>
|
||||
);
|
||||
}
|
||||
|
||||
/** The "see the whole section" link the draft puts opposite a band heading. */
|
||||
function BandLink({ to, label }: { to: string; label: string }) {
|
||||
return (
|
||||
@@ -417,7 +431,7 @@ function BandLink({ to, label }: { to: string; label: string }) {
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
export default function Home({ loaderData }: Route.ComponentProps) {
|
||||
const { locale, hero, stats, gallery, partners, news, faqs } = loaderData;
|
||||
const { locale, hero, approach, gallery, partners, news, faqs } = loaderData;
|
||||
const t = createTranslator(locale);
|
||||
const copy = pageCopy(locale).home;
|
||||
/* The three pillars are the About page's approved copy - one source, so the
|
||||
@@ -426,7 +440,6 @@ export default function Home({ loaderData }: Route.ComponentProps) {
|
||||
|
||||
const headline = hero.headline ?? copy.heroHeadline;
|
||||
const lead = hero.subheading ?? copy.heroLead;
|
||||
const figures = stats.length > 0 ? stats : copy.stats;
|
||||
const consortiumHeading = loaderData.partnersHeadline ?? copy.consortiumHeading;
|
||||
|
||||
/* The frame draws one accent CTA and one white one. Editor-supplied CTAs go
|
||||
@@ -462,7 +475,7 @@ export default function Home({ loaderData }: Route.ComponentProps) {
|
||||
/>
|
||||
|
||||
<PageHero
|
||||
className="bg-[var(--surface-sunken)] [--layout-hero-top:clamp(2.5rem,6vw,4.5rem)] [--layout-hero-bottom:var(--spacing-2xl)]"
|
||||
className="bg-[var(--surface-sunken)] [--layout-hero-top:clamp(2.5rem,6vw,4.5rem)] [--layout-hero-bottom:var(--spacing-md)]"
|
||||
title={headline}
|
||||
lead={lead}
|
||||
leadWithActions
|
||||
@@ -500,28 +513,29 @@ export default function Home({ loaderData }: Route.ComponentProps) {
|
||||
actions={heroCtas.map((cta) => (
|
||||
<HeroCta key={`${cta.href}-${cta.label}`} {...cta} />
|
||||
))}
|
||||
below={<StatsRow stats={figures} />}
|
||||
/>
|
||||
|
||||
{/* THE LAUNCH */}
|
||||
{/* WHAT THE PROJECT IS, AND WHO DELIVERS IT */}
|
||||
<PageSection
|
||||
aria-labelledby="home-launch-heading"
|
||||
aria-labelledby="home-approach-heading"
|
||||
band
|
||||
>
|
||||
<div className="flex flex-col gap-3xl">
|
||||
<div className="sh-reveal mx-auto flex max-w-[55rem] flex-col items-center gap-lg text-center">
|
||||
<SectionHeader
|
||||
id="home-launch-heading"
|
||||
eyebrow={copy.launchEyebrow}
|
||||
title={copy.launchHeading}
|
||||
id="home-approach-heading"
|
||||
eyebrow={approach.eyebrow ?? copy.approachEyebrow}
|
||||
title={approach.heading ?? copy.approachHeading}
|
||||
size="display"
|
||||
align="center"
|
||||
/>
|
||||
|
||||
<p className="body-lg text-[var(--text-secondary)]">{copy.launchLead}</p>
|
||||
<p className="body-lg text-[var(--text-secondary)]">
|
||||
{approach.lead ?? copy.approachLead}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<LaunchShots images={gallery} />
|
||||
<GalleryShots images={gallery} />
|
||||
</div>
|
||||
</PageSection>
|
||||
|
||||
@@ -545,7 +559,9 @@ export default function Home({ loaderData }: Route.ComponentProps) {
|
||||
{pillars.map((pillar) => (
|
||||
<li
|
||||
key={pillar.title}
|
||||
className="sh-lift sh-reveal sh-reveal--in flex h-full flex-col gap-sm rounded-card border border-[var(--border-subtle)] bg-[var(--surface-card)] p-xl hover:border-[var(--border-accent)]"
|
||||
/* `sh-rule-top` draws the draft's accent rule across the top
|
||||
of the tile as the pointer arrives. */
|
||||
className="sh-lift sh-reveal sh-reveal--in sh-rule-top flex h-full flex-col gap-sm rounded-card border border-[var(--border-subtle)] bg-[var(--surface-card)] p-xl hover:border-[var(--border-accent)]"
|
||||
>
|
||||
<h3 className="heading-h3 text-[var(--text-primary)]">{pillar.title}</h3>
|
||||
<p className="body-md text-[var(--text-secondary)]">
|
||||
@@ -664,7 +680,7 @@ export default function Home({ loaderData }: Route.ComponentProps) {
|
||||
key={member.name}
|
||||
className="sh-lift sh-reveal sh-reveal--in flex h-full flex-col items-start gap-sm rounded-card border border-[var(--border-subtle)] bg-[var(--surface-card)] p-xl hover:border-[var(--border-accent)]"
|
||||
>
|
||||
<span className="rounded-control bg-[var(--surface-accent-subtle)] px-xs py-2xs label-md uppercase text-[var(--text-accent)]">
|
||||
<span className="rounded-chip bg-[var(--surface-accent-subtle)] px-xs py-2xs label-md uppercase text-[var(--text-accent)]">
|
||||
{member.role}
|
||||
</span>
|
||||
<h3 className="heading-h3 text-[var(--text-primary)]">{member.name}</h3>
|
||||
@@ -680,59 +696,35 @@ export default function Home({ loaderData }: Route.ComponentProps) {
|
||||
{copy.networkLabel}
|
||||
</h3>
|
||||
|
||||
{partners.length > 0 ? (
|
||||
<ul className="grid list-none grid-cols-2 gap-md sm:grid-cols-3 lg:grid-cols-4">
|
||||
{partners.map((partner) => {
|
||||
const href = safeHref(partner.website);
|
||||
|
||||
/* The logo wall is a grid of equal tiles; the name is the
|
||||
tile's text when there is no logo to draw, and always its
|
||||
accessible name. */
|
||||
const inner = (
|
||||
<>
|
||||
{partner.logo ? (
|
||||
<img
|
||||
src={partner.logo.src}
|
||||
alt={partner.name}
|
||||
loading="lazy"
|
||||
className="max-h-[3.5rem] w-auto max-w-full object-contain"
|
||||
/>
|
||||
) : (
|
||||
<span className="body-sm-bold text-center text-[var(--text-secondary)]">
|
||||
{partner.name}
|
||||
</span>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
|
||||
return (
|
||||
<li
|
||||
key={partner.id}
|
||||
className={cx(
|
||||
"sh-reveal sh-reveal--in flex h-[5.5rem] items-center justify-center",
|
||||
"rounded-control border border-[var(--border-subtle)] bg-[var(--surface-card)] p-md",
|
||||
"transition-colors duration-[var(--motion-duration-base)]",
|
||||
"hover:border-[var(--border-accent)]",
|
||||
)}
|
||||
>
|
||||
{href ? (
|
||||
<a
|
||||
href={href}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="flex h-full w-full items-center justify-center"
|
||||
>
|
||||
{inner}
|
||||
</a>
|
||||
) : (
|
||||
inner
|
||||
)}
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
) : (
|
||||
{partners.length === 0 ? (
|
||||
<EmptyState message={copy.partnersEmpty} />
|
||||
) : partners.length >= PARTNER_MARQUEE_MIN ? (
|
||||
/* The wall drifts, as the third draft draws it. The track holds
|
||||
the tiles twice so the loop is seamless; the mask fades it out
|
||||
at both ends instead of cutting a tile in half. Both halves
|
||||
come from one list, so the wall can never show a partner the
|
||||
CMS does not hold. */
|
||||
<div className="sh-marquee-mask relative overflow-hidden">
|
||||
<ul className="sh-marquee flex list-none">
|
||||
{partners.map((partner) => (
|
||||
<PartnerTile key={partner.id} partner={partner} fixedWidth />
|
||||
))}
|
||||
{partners.map((partner) => (
|
||||
<PartnerTile
|
||||
key={`repeat-${partner.id}`}
|
||||
partner={partner}
|
||||
fixedWidth
|
||||
decorative
|
||||
/>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
) : (
|
||||
<ul className="grid list-none grid-cols-2 gap-md sm:grid-cols-3 lg:grid-cols-4">
|
||||
{partners.map((partner) => (
|
||||
<PartnerTile key={partner.id} partner={partner} />
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -327,7 +327,7 @@ function NewsMetaRow({ entry }: { entry: NewsListItem }) {
|
||||
return (
|
||||
<div className="flex flex-wrap items-center gap-sm">
|
||||
{entry.tag ? (
|
||||
<span className="rounded-[var(--radius-control)] bg-surface-accent-subtle px-xs py-2xs label-md uppercase text-text-accent">
|
||||
<span className="rounded-chip bg-surface-accent-subtle px-xs py-2xs label-md uppercase text-text-accent">
|
||||
{entry.tag}
|
||||
</span>
|
||||
) : null}
|
||||
|
||||
@@ -515,7 +515,7 @@ function ResourceRow({
|
||||
{entry.fileKind ? (
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className="flex h-14 w-11 shrink-0 items-center justify-center rounded-[var(--radius-control)] border border-border-default bg-surface-sunken label-md text-text-accent"
|
||||
className="flex h-14 w-11 shrink-0 items-center justify-center rounded-chip border border-border-default bg-surface-sunken label-md text-text-accent"
|
||||
>
|
||||
{entry.fileKind}
|
||||
</span>
|
||||
|
||||
@@ -60,7 +60,8 @@ A Tailwind 4 `@theme static` block. Raw ramps only, named by value:
|
||||
`--font-weight-regular..black`
|
||||
* space `--spacing-2xs..5xl` - radius `--radius-none..full` -
|
||||
border width `--border-width-sm..xl` - opacity `--opacity-0..100`
|
||||
* shadow `--shadow-xs..xl` - duration `--duration-instant..slower` -
|
||||
* shadow `--shadow-xs..xl` plus the dark-ground steps `--shadow-dark-lg|xl` -
|
||||
duration `--duration-instant..slower` -
|
||||
easing `--ease-standard | decelerate | accelerate | emphasized`
|
||||
* z ladder `--z-0..70` - containers `--container-prose | content | wide`
|
||||
|
||||
@@ -90,6 +91,25 @@ Plain CSS custom properties whose value is always `var(--<primitive>)`. Families
|
||||
`--focus-ring-*` `--overlay-*` `--radius-*` `--control-*` `--layout-*`
|
||||
`--elevation-*` `--motion-*` `--layer-*` `--type-body-base-*`
|
||||
|
||||
Two families are worth knowing by heart, because both were retuned to the
|
||||
Claude Design drafts rather than to the older Figma Button frame:
|
||||
|
||||
* **Shape.** The drafts draw three corners, not five. `--radius-chip` (2px) for
|
||||
a tag, thumbnail, flag or checkbox; `--radius-control` / `--radius-card` /
|
||||
`--radius-surface` (all 4px) for a button, field, menu, card or panel;
|
||||
`--radius-pill` for a filter chip or status pill. Nothing in the drafts is
|
||||
8px or 12px, which is why the old `--radius-control-lg` is gone. The tier-1
|
||||
ramp still carries `--radius-md` / `--radius-lg` - only the meanings moved.
|
||||
* **Elevation.** A shadow is a fraction of the ground it falls on, so
|
||||
`--elevation-card`, `--elevation-popover` and `--elevation-modal` are
|
||||
declared **per surface**. On the dark surface a resting card has no shadow at
|
||||
all (the drafts separate with a hairline) and the deep black - tier 1's
|
||||
`--shadow-dark-lg` / `--shadow-dark-xl`, the drafts' own
|
||||
`0 20px 44px rgba(0,0,0,.5)` and `0 24px 48px rgba(0,0,0,.6)` - is spent on
|
||||
what actually floats: a card under the pointer, the nav dropdown. The light
|
||||
surface keeps the soft ramp. Only `--elevation-flat` and `--elevation-raised`
|
||||
are surface-independent.
|
||||
|
||||
Interactive tokens are fully regular - for each of the five Figma button
|
||||
variants (`primary`, `secondary`, `dark`, `danger`, `ghost`) there is
|
||||
|
||||
@@ -163,12 +183,14 @@ Filenames are case-sensitive in production - match the table exactly.
|
||||
|
||||
## Known deviation from Figma
|
||||
|
||||
The published Ghost button hover paints `background/accent` (`#008764`) and keeps
|
||||
`base/turquoise-dark` (`#006b4f`) as the label - 1.40:1, which fails WCAG AA.
|
||||
`--interactive-ghost-fg-hover` is therefore `--color-white` on **both** surfaces
|
||||
(4.52:1, passes AA for body text). The two lines are marked `(a11y)` in
|
||||
`semantic.css`; revert them to `var(--color-green-700)` for pixel-exact parity
|
||||
if the designer prefers the failure.
|
||||
**Ghost is a text link, not a button.** The published Figma Ghost cell fills on
|
||||
hover (`background/accent` behind a `base/turquoise-dark` label - 1.40:1, a
|
||||
WCAG AA failure). The Claude Design drafts never fill a ghost control: every
|
||||
"All updates ->" / "What we do ->" is plain text in `--text-primary` that turns
|
||||
accent green under the pointer while the label-to-arrow gap opens from 8px to
|
||||
12px. The drafts win, so the ghost tokens carry no fill in any state, the
|
||||
variant opts out of the 3px lift in `Button.css`, and the old a11y workaround
|
||||
is no longer needed.
|
||||
|
||||
## Contrast audit
|
||||
|
||||
@@ -179,25 +201,26 @@ bold) and for non-text UI boundaries (1.4.11).
|
||||
|
||||
### Dark surface (`:root`, `[data-surface="dark"]`)
|
||||
|
||||
| text token | page `#1d1d1b` | raised `#2e2e2c` | sunken `#0b0b0a` | muted (white 8%) | accent-subtle (green 24%) | danger-subtle (red 24%) |
|
||||
| text token | page `#1d1d1b` | raised `#141413` | sunken `#0b0b0a` | muted (white 8%) | accent-subtle (green 24%) | danger-subtle (red 24%) |
|
||||
| --- | --- | --- | --- | --- | --- | --- |
|
||||
| `--text-primary` neutral-50 | 16.02 | 12.91 | 18.68 | 12.71 | 12.40 | 12.86 |
|
||||
| `--text-secondary` neutral-300 | 9.46 | 7.63 | 11.04 | 7.51 | 7.32 | 7.60 |
|
||||
| `--text-tertiary` neutral-400 | 5.56 | 4.48 | 6.48 | 4.41 | 4.30 | 4.46 |
|
||||
| `--text-accent` / `--text-link` green-400 | 6.02 | 4.85 | 7.02 | 4.78 | 4.66 | 4.83 |
|
||||
| `--text-link-hover` green-300 | 8.56 | 6.90 | 9.99 | 6.80 | 6.63 | 6.87 |
|
||||
| `--text-danger` red-400 | 5.39 | 4.34 | 6.29 | 4.28 | 4.17 | 4.33 |
|
||||
| `--text-disabled` neutral-500 | 2.36 | 1.91 | 2.76 | 1.88 | 1.83 | 1.90 |
|
||||
| `--text-primary` neutral-50 | 16.02 | 17.49 | 18.68 | 12.71 | 12.40 | 12.86 |
|
||||
| `--text-secondary` neutral-300 | 9.46 | 10.33 | 11.04 | 7.51 | 7.32 | 7.60 |
|
||||
| `--text-tertiary` neutral-400 | 5.56 | 6.07 | 6.48 | 4.41 | 4.30 | 4.46 |
|
||||
| `--text-accent` / `--text-link` green-400 | 6.02 | 6.57 | 7.02 | 4.78 | 4.66 | 4.83 |
|
||||
| `--text-link-hover` green-300 | 8.56 | 9.35 | 9.99 | 6.80 | 6.63 | 6.87 |
|
||||
| `--text-danger` red-400 | 5.39 | 5.89 | 6.29 | 4.28 | 4.17 | 4.33 |
|
||||
| `--text-disabled` neutral-500 | 2.36 | 2.58 | 2.76 | 1.88 | 1.83 | 1.90 |
|
||||
|
||||
`--text-primary`, `--text-secondary` and `--text-link-hover` pass AA everywhere.
|
||||
Everything below them is only cleared against `--surface-page` and
|
||||
`--surface-sunken`, which is where the design actually uses them:
|
||||
|
||||
* `--surface-raised` is the drafts' `#141413`, DARKER than the page, so every
|
||||
role gains contrast on it rather than losing it - the whole column clears AA.
|
||||
* `--text-tertiary`, `--text-accent`, `--text-link` and `--text-danger` land
|
||||
between 4.17 and 4.85 on `--surface-raised` and on the three translucent
|
||||
fills - AA for large text, **not** for body text. Card bodies use
|
||||
`--text-secondary`; keep tertiary/accent/danger body copy on the page or
|
||||
sunken surface, or raise the text a step.
|
||||
between 4.17 and 4.78 on the three translucent fills - AA for large text,
|
||||
**not** for body text. Card bodies use `--text-secondary`; keep
|
||||
tertiary/accent/danger body copy on an opaque surface, or raise it a step.
|
||||
* `--text-disabled` is 2.36:1 by design. WCAG 1.4.3 exempts the label of a
|
||||
disabled control, so this is deliberate and must not be repointed - it is
|
||||
the only token allowed below 3:1.
|
||||
@@ -250,16 +273,18 @@ Everything below them is only cleared against `--surface-page` and
|
||||
| dark white / `bg-hover` black | 21.00 |
|
||||
| dark `fg-disabled` neutral-300 / `bg-disabled` neutral-600 (dark surface) | 5.39 |
|
||||
| dark `fg-disabled` neutral-200 / `bg-disabled` neutral-500 (light surface) | 4.91 |
|
||||
| **ghost `fg-hover` white / `bg-hover` green-600** (was green-900, 2.62) | **4.52** |
|
||||
| ghost white / `bg-active` green-700 | 6.53 |
|
||||
| ghost `fg` green-400 / dark page | 6.02 |
|
||||
| ghost `fg` green-600 / light page | 4.52 |
|
||||
| ghost `fg` neutral-50 / dark page (no fill in any state) | 16.02 |
|
||||
| ghost `fg-hover` green-400 / dark page | 6.02 |
|
||||
| ghost `fg` neutral-800 / light page | 16.88 |
|
||||
| ghost `fg-hover` green-700 / light page | 6.53 |
|
||||
| **ghost `fg-disabled` neutral-500 / dark page** | **2.36** |
|
||||
| **ghost `fg-disabled` neutral-400 / light page** | **3.04** |
|
||||
| secondary `fg` neutral-50 / dark page | 16.02 |
|
||||
| secondary `fg` neutral-800 / light page | 16.88 |
|
||||
| **secondary `fg-disabled` neutral-500 / dark page** | **2.36** |
|
||||
| **secondary `fg-disabled` neutral-400 / light page** | **3.04** |
|
||||
|
||||
The four bolded disabled rows are the WCAG 1.4.3 exemption again - a disabled
|
||||
The bolded disabled rows are the WCAG 1.4.3 exemption again - a disabled
|
||||
control has no contrast minimum. Every enabled pair clears 4.5:1.
|
||||
|
||||
### Fields and boundaries
|
||||
|
||||
@@ -210,12 +210,25 @@
|
||||
|
||||
/* --------------------------------------------------------------------
|
||||
SHADOW ramp
|
||||
|
||||
Two ramps, because a shadow is a fraction of the ground it falls on.
|
||||
The soft steps are tuned for a white page; on the drafts' near-black
|
||||
ground a 12-28% black is simply invisible, so the deep steps below carry
|
||||
the two shadows the drafts actually draw:
|
||||
card hover 0 20px 44px rgba(0,0,0,0.5)
|
||||
nav dropdown 0 24px 48px rgba(0,0,0,0.6)
|
||||
`semantic.css` picks the ramp per surface via --elevation-*.
|
||||
-------------------------------------------------------------------- */
|
||||
--shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.06);
|
||||
--shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.08);
|
||||
--shadow-md: 0 4px 12px -2px rgb(0 0 0 / 0.12), 0 2px 4px -2px rgb(0 0 0 / 0.08);
|
||||
--shadow-lg: 0 12px 28px -6px rgb(0 0 0 / 0.18), 0 4px 8px -4px rgb(0 0 0 / 0.1);
|
||||
--shadow-xl: 0 24px 48px -12px rgb(0 0 0 / 0.28);
|
||||
|
||||
/* [drafts] the deep steps, for a shadow falling on the dark ground */
|
||||
--shadow-dark-lg: 0 20px 44px rgb(0 0 0 / 0.5);
|
||||
--shadow-dark-xl: 0 24px 48px rgb(0 0 0 / 0.6);
|
||||
|
||||
--shadow-none: 0 0 #0000;
|
||||
|
||||
/* --------------------------------------------------------------------
|
||||
|
||||
@@ -121,19 +121,18 @@
|
||||
--interactive-danger-border-disabled: var(--color-transparent);
|
||||
|
||||
/* --- interactive: ghost (text-only) -------------------------------------
|
||||
DEVIATION FROM FIGMA (a11y). The published component paints the hover
|
||||
background/accent (#008764) and keeps base/turquoise-dark (#006b4f) as
|
||||
the label - 1.40:1, far below WCAG AA. Both surfaces therefore use white
|
||||
on the accent fill, which is 4.52:1 and passes AA for body text. The two
|
||||
lines marked (a11y) are the only ones that differ from Figma; reverting
|
||||
them to var(--color-green-700) restores pixel parity and the failure. */
|
||||
The drafts never fill a ghost control. Every "All updates ->" / "What we
|
||||
do ->" link is plain text in --text-primary that turns accent green under
|
||||
the pointer while the label-to-arrow gap opens; the fill the old Figma
|
||||
Button frame painted on hover (background/accent behind a green label,
|
||||
1.40:1) is gone, and with it the a11y deviation it forced. */
|
||||
--interactive-ghost-bg: var(--color-transparent);
|
||||
--interactive-ghost-bg-hover: var(--color-green-600);
|
||||
--interactive-ghost-bg-active: var(--color-green-700);
|
||||
--interactive-ghost-bg-hover: var(--color-transparent);
|
||||
--interactive-ghost-bg-active: var(--color-transparent);
|
||||
--interactive-ghost-bg-disabled: var(--color-transparent);
|
||||
--interactive-ghost-fg: var(--color-green-400);
|
||||
--interactive-ghost-fg-hover: var(--color-white); /* (a11y) 4.52:1 on green-600; figma: green-700 = 1.40:1 */
|
||||
--interactive-ghost-fg-disabled: var(--color-green-400);
|
||||
--interactive-ghost-fg: var(--color-neutral-50);
|
||||
--interactive-ghost-fg-hover: var(--color-green-400); /* 6.02:1 on the page ground */
|
||||
--interactive-ghost-fg-disabled: var(--color-neutral-500);
|
||||
--interactive-ghost-border: var(--color-transparent);
|
||||
--interactive-ghost-border-hover: var(--color-transparent);
|
||||
--interactive-ghost-border-disabled: var(--color-transparent);
|
||||
@@ -165,6 +164,14 @@
|
||||
they carry the same value on either surface. */
|
||||
--overlay-picture-shade: var(--color-black-a20);
|
||||
--overlay-picture-tint: var(--color-green-200-a12);
|
||||
|
||||
/* --- elevation ----------------------------------------------------------
|
||||
The drafts give a resting card a hairline and no shadow at all, and keep
|
||||
the black for what genuinely floats: a card under the pointer and the
|
||||
navigation dropdown. */
|
||||
--elevation-card: var(--shadow-none);
|
||||
--elevation-popover: var(--shadow-dark-lg);
|
||||
--elevation-modal: var(--shadow-dark-xl);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
@@ -262,14 +269,14 @@
|
||||
--interactive-danger-border-hover: var(--color-transparent);
|
||||
--interactive-danger-border-disabled: var(--color-transparent);
|
||||
|
||||
/* --- interactive: ghost (text-only) - see the a11y note above ---------- */
|
||||
/* --- interactive: ghost (text-only) - see the note above --------------- */
|
||||
--interactive-ghost-bg: var(--color-transparent);
|
||||
--interactive-ghost-bg-hover: var(--color-green-600);
|
||||
--interactive-ghost-bg-active: var(--color-green-700);
|
||||
--interactive-ghost-bg-hover: var(--color-transparent);
|
||||
--interactive-ghost-bg-active: var(--color-transparent);
|
||||
--interactive-ghost-bg-disabled: var(--color-transparent);
|
||||
--interactive-ghost-fg: var(--color-green-600);
|
||||
--interactive-ghost-fg-hover: var(--color-white); /* (a11y) 4.52:1 on green-600; figma: green-700 = 1.40:1 */
|
||||
--interactive-ghost-fg-disabled: var(--color-green-600);
|
||||
--interactive-ghost-fg: var(--color-neutral-800);
|
||||
--interactive-ghost-fg-hover: var(--color-green-700); /* 6.53:1 on white */
|
||||
--interactive-ghost-fg-disabled: var(--color-neutral-400);
|
||||
--interactive-ghost-border: var(--color-transparent);
|
||||
--interactive-ghost-border-hover: var(--color-transparent);
|
||||
--interactive-ghost-border-disabled: var(--color-transparent);
|
||||
@@ -299,6 +306,11 @@
|
||||
they carry the same value on either surface. */
|
||||
--overlay-picture-shade: var(--color-black-a20);
|
||||
--overlay-picture-tint: var(--color-green-200-a12);
|
||||
|
||||
/* --- elevation - the soft ramp; the deep black belongs on the dark ground */
|
||||
--elevation-card: var(--shadow-md);
|
||||
--elevation-popover: var(--shadow-lg);
|
||||
--elevation-modal: var(--shadow-xl);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
@@ -308,7 +320,7 @@
|
||||
------------------------------------------------------------------------ */
|
||||
:root {
|
||||
/* --- shape -------------------------------------------------------------
|
||||
--radius-control / --radius-control-lg / --radius-card / --radius-surface
|
||||
--radius-chip / --radius-control / --radius-card / --radius-surface
|
||||
/ --radius-pill are declared in the @theme block near the bottom of this
|
||||
file so that they also generate rounded-* utilities. They are tier-2
|
||||
tokens like everything else here. */
|
||||
@@ -348,12 +360,13 @@
|
||||
--layout-content-max: var(--container-content);
|
||||
--layout-prose-max: var(--container-prose);
|
||||
|
||||
/* --- elevation ---------------------------------------------------------- */
|
||||
/* --- elevation ----------------------------------------------------------
|
||||
Only the two flattest steps are surface-independent. A shadow is a
|
||||
fraction of the ground it falls on, so --elevation-card / -popover /
|
||||
-modal are declared inside each surface block above: the dark surface
|
||||
takes the drafts' deep black, the light one keeps the soft ramp. */
|
||||
--elevation-flat: var(--shadow-none);
|
||||
--elevation-raised: var(--shadow-sm);
|
||||
--elevation-card: var(--shadow-md);
|
||||
--elevation-popover: var(--shadow-lg);
|
||||
--elevation-modal: var(--shadow-xl);
|
||||
|
||||
/* --- focus ring geometry ------------------------------------------------- */
|
||||
--focus-ring-width: var(--border-width-lg);
|
||||
@@ -430,7 +443,6 @@
|
||||
--color-interactive-dark-hover: var(--interactive-dark-bg-hover);
|
||||
--color-interactive-danger: var(--interactive-danger-bg);
|
||||
--color-interactive-danger-hover: var(--interactive-danger-bg-hover);
|
||||
--color-interactive-ghost-hover: var(--interactive-ghost-bg-hover);
|
||||
|
||||
--color-field-bg: var(--field-bg);
|
||||
--color-field-border: var(--field-border);
|
||||
@@ -443,13 +455,21 @@
|
||||
}
|
||||
|
||||
/* Shape semantics that also need to exist as Tailwind utilities
|
||||
(rounded-control / rounded-card / rounded-surface). They alias tier 1
|
||||
directly - never a tier-2 name, which would self-reference. */
|
||||
(rounded-chip / rounded-control / rounded-card / rounded-surface). They
|
||||
alias tier 1 directly - never a tier-2 name, which would self-reference.
|
||||
|
||||
THE DRAFTS DRAW THREE CORNERS, NOT FIVE. Every panel, card, button, input
|
||||
and menu in the Claude Design drafts is 4px; every tag, thumbnail, flag and
|
||||
checkbox is 2px; filter chips and the status pill are fully round. Nothing
|
||||
in the drafts is 8px or 12px, so `--radius-card` and `--radius-surface` come
|
||||
down to radius/sm and the old `--radius-control-lg` (radius/md, a quirk of
|
||||
the Figma Button frame's ghost cells) is gone. The tier-1 ramp is untouched:
|
||||
only the meanings moved. */
|
||||
@theme static {
|
||||
--radius-control: var(--radius-sm);
|
||||
--radius-control-lg: var(--radius-md);
|
||||
--radius-card: var(--radius-md);
|
||||
--radius-surface: var(--radius-lg);
|
||||
--radius-chip: var(--radius-xs); /* 2px - tags, thumbnails, checkboxes */
|
||||
--radius-control: var(--radius-sm); /* 4px - buttons, fields, menu items */
|
||||
--radius-card: var(--radius-sm); /* 4px */
|
||||
--radius-surface: var(--radius-sm); /* 4px */
|
||||
--radius-pill: var(--radius-full);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"scripts": {
|
||||
"build": "react-router build",
|
||||
"dev": "react-router dev --host",
|
||||
"start": "react-router-serve ./build/server/index.js",
|
||||
"start": "node --env-file-if-exists=.env ../../node_modules/.bin/react-router-serve ./build/server/index.js",
|
||||
"typecheck": "react-router typegen && tsc"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
Binary file not shown.
@@ -11,6 +11,7 @@
|
||||
"dev": "pnpm -r --parallel --stream dev",
|
||||
"dev:web": "pnpm --filter web dev",
|
||||
"dev:cms": "pnpm --filter cms develop",
|
||||
"seed": "pnpm --filter cms seed",
|
||||
"build": "pnpm --filter cms build && pnpm --filter web build",
|
||||
"start": "pnpm -r --parallel --stream start",
|
||||
"typecheck": "pnpm -r --stream typecheck"
|
||||
|
||||
Generated
+11
@@ -19,6 +19,9 @@ importers:
|
||||
'@strapi/plugin-users-permissions':
|
||||
specifier: 5.53.0
|
||||
version: 5.53.0(62i3dwrrxte2my3iox3m7s6qt4)
|
||||
'@strapi/provider-email-nodemailer':
|
||||
specifier: ^5.54.0
|
||||
version: 5.54.0
|
||||
'@strapi/strapi':
|
||||
specifier: 5.53.0
|
||||
version: 5.53.0(@babel/runtime@7.29.7)(@codemirror/autocomplete@6.20.3)(@codemirror/language@6.12.4)(@codemirror/lint@6.9.7)(@codemirror/search@6.7.2)(@codemirror/theme-one-dark@6.1.3)(@emotion/is-prop-valid@1.4.0)(@swc/helpers@0.5.23)(@types/hoist-non-react-statics@3.3.7(@types/react@18.3.31))(@types/node@20.19.43)(@types/react-dom@18.3.7(@types/react@18.3.31))(@types/react@18.3.31)(codemirror@5.65.21)(esbuild@0.28.2)(hono@4.13.7)(koa@2.16.4)(lightningcss@1.33.0)(pg@8.23.0)(postcss@8.5.28)(react-dom@18.3.1(react@18.3.1))(react-router-dom@6.30.6(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1)(redux@4.2.1)(styled-components@6.5.3(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(terser@5.51.2)(ts-toolbelt@9.6.0)(type-fest@0.21.3)
|
||||
@@ -2194,6 +2197,10 @@ packages:
|
||||
react-router-dom: ^6.30.3
|
||||
styled-components: ^6.0.0
|
||||
|
||||
'@strapi/provider-email-nodemailer@5.54.0':
|
||||
resolution: {integrity: sha512-G1zxBU2f8lGbz/A+lTO2HNZtr5gB2yTle3MV35DuvJdjTvaX0gvef+VcqbfuXrC7e7bqWcPzwkoc2GHpVgt/vw==}
|
||||
engines: {node: '>=20.0.0 <=26.x.x', npm: '>=6.0.0'}
|
||||
|
||||
'@strapi/provider-email-sendmail@5.53.0':
|
||||
resolution: {integrity: sha512-3G1Q/rm7+4uR6/kSOUWfiKdEENiGqYrEdHtDp6KtHMQmdzl730FqWAnhzk8sPF5mhPT7OHBciJtXZNZE4b/iDw==}
|
||||
engines: {node: '>=20.0.0 <=26.x.x', npm: '>=6.0.0'}
|
||||
@@ -9330,6 +9337,10 @@ snapshots:
|
||||
- ts-toolbelt
|
||||
- typescript
|
||||
|
||||
'@strapi/provider-email-nodemailer@5.54.0':
|
||||
dependencies:
|
||||
nodemailer: 9.0.1
|
||||
|
||||
'@strapi/provider-email-sendmail@5.53.0':
|
||||
dependencies:
|
||||
nodemailer: 9.0.1
|
||||
|
||||
Reference in New Issue
Block a user