# Legyen Nyugta

Landing page of [legyennyugta.hu](https://legyennyugta.hu), built with Astro 7 and Tailwind CSS 4. The structure follows `landing-astro`.

Design: Figma `LegyenNyugta-weboldal`.

| Path | Figma (desktop / mobile) |
| :--- | :--- |
| `/` | `19:312` / `241:579` (mobile menu `273:598`) |
| `/bankkartyas-fizetes/` | `364:164` / `273:1109` |
| `/kapcsolat/` | `427:1006` / – (form based on the `landing-astro` contact form) |
| `/adatkezelesi-tajekoztato/` | `436:2210` / – (text in `src/content/legal/adatkezelesi-tajekoztato.md`) |
| 404 | Not in Figma; based on the `landing-astro` 404 page |

Values unified or changed during development are listed in [docs/figma-elteresek.md](docs/figma-elteresek.md).

## Requirements

Node.js 24 (see `.nvmrc`); Astro needs at least 22.23.4.

## Project structure

```text
src/
├── assets/          # SVG icons, logo and images (optimised by astro:assets)
├── components/
│   ├── cards/       # Repeated blocks inside sections (feature, step, FAQ item)
│   ├── footer/
│   ├── forms/       # Contact form and its fields
│   ├── header/      # Header and the full-screen mobile menu
│   ├── sections/    # Page sections; page-specific ones in subfolders (card-payment/, contact/, not-found/)
│   └── ui/          # Primitives: Button, Container, Section, StoreBadge, QrPrompt…
├── config/          # Anchors, navigation, external links, icon map
├── content/legal/   # Legal texts in Markdown (privacy policy)
├── i18n/            # Copy (Hungarian dictionary)
├── layouts/
├── pages/
├── scripts/         # Client scripts: disclosure (menu), payment-methods, contact-form
└── styles/          # Tailwind entry and design tokens (@theme)
```

## Commands

| Command             | Action                                             |
| :------------------ | :------------------------------------------------- |
| `npm install`       | Installs dependencies                              |
| `npm run dev`       | Starts the dev server at `localhost:4321`          |
| `npm run build`     | Builds the site to `./dist/`                       |
| `npm run preview`   | Previews the build locally                         |
| `npx astro check`   | Type-checks the project                            |

## Deployment

A static build served by nginx (`Dockerfile`, `docker/nginx.conf`), based on `landing-astro`.

- The image is environment independent: it is built once with `IS_DEV=false` (production
  `robots.txt` with the Sitemap line) and promoted unchanged from DEV to TST to PRD.
- `IS_DEV` is a **runtime** environment variable. At container start
  `docker/40-legyennyugta-env.sh` replaces `robots.txt` with the disallow-all version when
  `IS_DEV=true` (DEV, TST) and keeps it for `false` (PRD). A missing or other value stops the
  container. In Kubernetes the Helm chart's `values-<env>.yaml` sets it
  ([legyennyugta_helm](https://dev.azure.com/paynance/Development/_git/legyennyugta_helm)).
- `NEW_MESSAGE_API_URL` (the management new message API, where the contact form posts from the
  browser) is a **runtime** environment variable as well, required and an http(s) URL. The image
  is built with the `__NEW_MESSAGE_API_URL__` placeholder, which `docker/40-legyennyugta-env.sh`
  replaces at container start. The Helm chart's `values-<env>.yaml` must set it.
- `IS_DEV` and `NEW_MESSAGE_API_URL` in `.env` only affect local `astro dev` / `astro build` and
  `make docker-run`.
- `APP_NAME` is a build-time variable (default `legyennyugta`); the contact form sends it as
  `source`.
- `APP_URL` (the public origin, Astro's `site`) is a **build-time** variable: it is baked into the
  canonical, `og:*`, sitemap and `robots.txt` URLs. The `Dockerfile` builds with
  `https://legyennyugta.hu`; `.env` sets it for local builds (e.g. `http://localhost:4321`).
- nginx serves the custom 404 page and a `/healthz` endpoint on port 8080.

| Command             | Action                                                              |
| :------------------ | :------------------------------------------------------------------ |
| `make docker-build` | Builds the image (`legyennyugta:local`); no env file needed         |
| `make docker-run`   | Runs it on `localhost:8080` with `IS_DEV` and `NEW_MESSAGE_API_URL` from `.env` |
| `make docker-stop`  | Stops and removes the container                          |
| `make help`         | Lists every target                                       |

## CI/CD

Azure Pipelines: [`pipelines/build.yaml`](pipelines/build.yaml) builds and releases the image,
nothing else. Deploying is the job of the
[legyennyugta_helm](https://dev.azure.com/paynance/Development/_git/legyennyugta_helm)
repository: its deploy pipeline is triggered by every successful run of this one and deploys
the image this run publishes in the `image` artifact (files `tag` and `digest`), by digest.

| Push to | This pipeline | Then (legyennyugta_helm deploy) |
| :------ | :------------ | :------------------------------ |
| `dev`   | **Build:** `npm ci`, `astro check`, `docker build` with the OCI labels (`BUILD_REVISION` = commit, `BUILD_VERSION` = build number, `BUILD_CREATED`), push as `paynance/legyennyugta:dev` (overwritten on every push). | DEV, without approval. |
| `main`  | **Release:** `npm ci`, `astro check`, dev-origin check, the next semver git tag, `docker build` and push as `paynance/legyennyugta:<x.y.z>`. | TST after approval, then the same image on PRD after approval. |

- **One release image.** Dev images are not kept per commit. The release image is built from
  `main`, tested on TST and promoted unchanged to PRD.
- **Dev-origin check.** The tree of the `main` commit must equal the tree of a commit on `dev`.
  A change made directly on `main` stops the run: merge it through `dev` first.
- **Versioning.** Conventional commits since the last tag: `BREAKING CHANGE:` or `type!:` →
  major, `feat:` → minor, anything else → patch; the first release is `1.0.0`. Rerunning a
  tagged commit reuses its tag, and its image if that was already pushed.
- **ADO setup.** `PaynanceDocker` registry connection; the build service needs permission to
  create tags in this repository. The deploy pipeline refers to this pipeline by its ADO name,
  `legyennyugta - ImageCreate`.
