Compare commits
8
Commits
4f66dcf61d
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f12f5f92e2 | ||
|
|
2ca29efd73 | ||
|
|
0bce333173 | ||
|
|
a651519dbe | ||
|
|
29d8700081 | ||
|
|
51f7dcfdba | ||
|
|
55adee2286 | ||
|
|
0571890d47 |
@@ -0,0 +1,10 @@
|
||||
node_modules
|
||||
dist
|
||||
.astro
|
||||
.git
|
||||
.env
|
||||
.env.*
|
||||
design
|
||||
docs
|
||||
coordination
|
||||
.claude
|
||||
@@ -0,0 +1,5 @@
|
||||
# Copia questo file in .env.server (git-ignorato) e compila i valori.
|
||||
# deploy.sh lo usa in locale per l'istantanea degli orari e lo copia sul
|
||||
# server come .env (permessi 600) per il servizio "orari".
|
||||
GOOGLE_PLACES_API_KEY=
|
||||
GOOGLE_PLACE_ID=
|
||||
@@ -2,6 +2,7 @@
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
!.env.server.example
|
||||
|
||||
# OS
|
||||
.DS_Store
|
||||
@@ -10,3 +11,6 @@
|
||||
node_modules/
|
||||
dist/
|
||||
.astro/
|
||||
|
||||
# File di lavoro locali
|
||||
temp/
|
||||
|
||||
@@ -43,6 +43,8 @@ Stack: Astro (static) — see `docs/adr/0003-stack-astro-statico.md`. Node.js re
|
||||
- Dev: `npm run dev` (http://localhost:4321)
|
||||
- Build: `npm run build` (output in `dist/`)
|
||||
- Preview build: `npm run preview`
|
||||
- Deploy: `./deploy.sh` (Docker on the a75 server, needs `.env.server`, see `docs/runbooks/deploy.md`)
|
||||
- Opening hours come from Google Business Profile (ADR 0005): do not hard-code them
|
||||
- Test / Lint / Typecheck: not set up yet (`npm run check` needs `@astrojs/check`)
|
||||
- Design proposals: `python3 -m http.server 4173 --directory design`
|
||||
|
||||
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
# Sito statico Astro servito da nginx (ADR 0003, deploy come cam85: ADR 0004).
|
||||
# Stage 1: build con Node; stage 2: solo i file di dist/ dentro nginx.
|
||||
|
||||
FROM node:22-alpine AS build
|
||||
WORKDIR /app
|
||||
COPY package.json package-lock.json ./
|
||||
RUN --mount=type=cache,target=/root/.npm npm ci --no-audit --no-fund
|
||||
COPY astro.config.mjs tsconfig.json ./
|
||||
COPY public ./public
|
||||
COPY src ./src
|
||||
RUN npm run build
|
||||
|
||||
FROM nginx:1.27-alpine AS runner
|
||||
COPY docker/nginx.conf /etc/nginx/conf.d/default.conf
|
||||
COPY --from=build /app/dist /usr/share/nginx/html
|
||||
EXPOSE 3000
|
||||
@@ -0,0 +1,66 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
# Deploy sullo stesso server di cam85, con la stessa modalità (ADR 0004):
|
||||
# build dell'immagine in locale, trasferimento via docker save/load,
|
||||
# avvio con docker compose sulla rete "a75" dietro Nginx Proxy Manager.
|
||||
|
||||
SERVER="217.76.62.220"
|
||||
SSH_USER="root"
|
||||
APP_DIR="/home/ubuntu/officinezuliani"
|
||||
IMAGE_TAG="officinezuliani-web:latest"
|
||||
TARGET_PLATFORM="linux/amd64" # server x86_64 (verificato con uname -m)
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
# Il .env locale contiene solo il token Gitea e NON va mai copiato sul server.
|
||||
# Le variabili del server (chiave Places API e Place ID, ADR 0005) stanno in
|
||||
# .env.server, git-ignorato, copiato sul server come .env.
|
||||
if [[ ! -f .env.server ]]; then
|
||||
echo "Errore: .env.server non trovato (vedi .env.server.example)."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Istantanea degli orari dalla scheda Google, usata dalla build (tabella in
|
||||
# Dove siamo, dati strutturati, testo orari). Se Google non risponde si
|
||||
# prosegue con l'istantanea precedente.
|
||||
echo "→ Lettura orari dalla scheda Google..."
|
||||
(set -a; source .env.server; set +a; node scripts/orari-google.mjs --out src/data/orari-google.json) \
|
||||
|| echo " ⚠ orari non aggiornati, uso l'istantanea esistente"
|
||||
|
||||
echo "→ Build di verifica in locale..."
|
||||
npm run build
|
||||
|
||||
echo "→ Build immagine (piattaforma $TARGET_PLATFORM)..."
|
||||
docker buildx build --platform "$TARGET_PLATFORM" -t "$IMAGE_TAG" --load .
|
||||
|
||||
echo "→ Preparazione cartella e compose su $SERVER..."
|
||||
ssh "$SSH_USER@$SERVER" "mkdir -p '$APP_DIR'"
|
||||
rsync -az docker-compose.yml "$SSH_USER@$SERVER:$APP_DIR/docker-compose.yml"
|
||||
rsync -az --delete scripts/ "$SSH_USER@$SERVER:$APP_DIR/scripts/"
|
||||
rsync -az --chmod=F600 .env.server "$SSH_USER@$SERVER:$APP_DIR/.env"
|
||||
|
||||
echo "→ Trasferimento immagine..."
|
||||
docker save "$IMAGE_TAG" | gzip | ssh "$SSH_USER@$SERVER" "gunzip | docker load"
|
||||
|
||||
echo "→ Avvio container..."
|
||||
ssh "$SSH_USER@$SERVER" "
|
||||
set -e
|
||||
cd '$APP_DIR'
|
||||
docker compose up -d
|
||||
docker compose restart orari # rilegge script e chiave aggiornati
|
||||
docker compose ps
|
||||
"
|
||||
|
||||
echo "→ Verifica interna (dalla rete a75)..."
|
||||
ssh "$SSH_USER@$SERVER" "docker exec nginx-app-1 curl -s -o /dev/null -w 'HTTP %{http_code}\n' http://officinezuliani-site:3000/" || true
|
||||
|
||||
echo "→ Verifica orari letti da Google..."
|
||||
sleep 5
|
||||
ssh "$SSH_USER@$SERVER" "cd '$APP_DIR' && docker compose logs --tail 3 orari" || true
|
||||
|
||||
echo "→ Pulizia layer immagine inutilizzati..."
|
||||
ssh "$SSH_USER@$SERVER" "docker image prune -f" || true
|
||||
|
||||
echo "✓ Deploy completato — il container è raggiungibile come officinezuliani-site:3000 sulla rete \"a75\";"
|
||||
echo " il dominio pubblico va configurato come Proxy Host in Nginx Proxy Manager."
|
||||
@@ -0,0 +1,39 @@
|
||||
services:
|
||||
web:
|
||||
# Immagine costruita in locale e caricata sul server da deploy.sh
|
||||
# (docker save | docker load), come cam85: `up -d` senza --build usa
|
||||
# quella già presente; `build:` resta solo come fallback manuale.
|
||||
build: .
|
||||
image: officinezuliani-web:latest
|
||||
container_name: officinezuliani-site
|
||||
restart: always
|
||||
# Nessuna porta pubblicata: Nginx Proxy Manager raggiunge il container
|
||||
# sulla rete Docker condivisa "a75" come officinezuliani-site:3000.
|
||||
networks:
|
||||
- a75
|
||||
volumes:
|
||||
# orari.json scritto dal servizio "orari" (sola lettura per nginx)
|
||||
- orari-dati:/usr/share/nginx/html/dati:ro
|
||||
|
||||
orari:
|
||||
# Legge gli orari dalla scheda Google Business Profile (Places API) ogni
|
||||
# 24 ore e li scrive in orari.json (ADR 0005). La chiave sta solo nel .env
|
||||
# del server, copiato da deploy.sh a partire da .env.server locale.
|
||||
image: node:22-alpine
|
||||
container_name: officinezuliani-orari
|
||||
restart: always
|
||||
env_file:
|
||||
- .env
|
||||
command: ["node", "/app/orari-google.mjs", "--out", "/dati/orari.json", "--ogni", "24"]
|
||||
volumes:
|
||||
- ./scripts:/app:ro
|
||||
- orari-dati:/dati
|
||||
networks:
|
||||
- a75
|
||||
|
||||
volumes:
|
||||
orari-dati:
|
||||
|
||||
networks:
|
||||
a75:
|
||||
external: true
|
||||
@@ -0,0 +1,51 @@
|
||||
# Configurazione del container: Nginx Proxy Manager (rete Docker "a75")
|
||||
# termina HTTPS e inoltra qui in HTTP sulla porta 3000 (come cam85).
|
||||
# Solo il dominio definitivo è indicizzabile: gli altri host (es. il test
|
||||
# officinezuliani.a75.eu) ricevono noindex. Valore vuoto = header non inviato.
|
||||
map $http_host $robots_tag {
|
||||
default "noindex, nofollow";
|
||||
~*(^|\.)officinezulianiudine\.it$ "";
|
||||
}
|
||||
|
||||
server {
|
||||
listen 3000;
|
||||
server_name _;
|
||||
root /usr/share/nginx/html;
|
||||
|
||||
# URL puliti come sul sito attuale: /officina → officina.html
|
||||
location / {
|
||||
try_files $uri $uri.html $uri/ =404;
|
||||
}
|
||||
|
||||
# Vecchi link con .html → URL pulito (evita contenuti duplicati).
|
||||
# Su $request_uri e non con una location: altrimenti colpirebbe anche
|
||||
# il rimando interno di "index" e "/" andrebbe in loop.
|
||||
if ($request_uri ~ ^/index\.html) { return 301 /; }
|
||||
if ($request_uri ~ ^/(.+)\.html(\?.*)?$) { return 301 /$1; }
|
||||
|
||||
# Asset con hash nel nome: cache lunga
|
||||
location /_astro/ {
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
|
||||
location /img/ {
|
||||
expires 30d;
|
||||
}
|
||||
|
||||
# Orari letti da Google (servizio "orari"): sempre rivalidati
|
||||
location /dati/ {
|
||||
add_header Cache-Control "no-cache";
|
||||
add_header X-Robots-Tag "noindex" always;
|
||||
}
|
||||
|
||||
gzip on;
|
||||
gzip_types text/css application/javascript application/json image/svg+xml application/xml text/plain;
|
||||
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
||||
add_header X-Robots-Tag $robots_tag always;
|
||||
|
||||
# Il proxy davanti fa da origine pubblica: niente porta interna nei redirect
|
||||
absolute_redirect off;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
# ADR 0004: Host the site in Docker on the a75 server, deployed like cam85
|
||||
|
||||
## Status
|
||||
Accepted (2026-11-04) — supersedes the "hosting not decided" note in ADR 0003
|
||||
|
||||
## Context
|
||||
The site is static (ADR 0003). The owner already runs other sites on the VPS `217.76.62.220` (x86_64) with the same pattern as cam85: Docker containers on the shared network `a75`, published through Nginx Proxy Manager (container `nginx-app-1`), images built locally and loaded on the server.
|
||||
|
||||
## Decision
|
||||
- Image: multi-stage `Dockerfile` (Node 22 build → `nginx:1.27-alpine`) serving `dist/` with `docker/nginx.conf` (clean URLs, `.html` → 301, long cache for hashed assets)
|
||||
- `docker-compose.yml`: container `officinezuliani-site`, image `officinezuliani-web:latest`, no published ports, external network `a75`
|
||||
- `deploy.sh` (same flow as cam85): local `npm run build` check → `docker buildx --platform linux/amd64` → `docker save | ssh docker load` → `docker compose up -d` in `/home/ubuntu/officinezuliani`
|
||||
- The container listens on port 3000 (same convention as cam85); the public hostname is a Proxy Host in Nginx Proxy Manager pointing to `officinezuliani-site:3000`, with Let's Encrypt
|
||||
- Test hostname: `https://officinezuliani.a75.eu`. Every host except `officinezulianiudine.it` gets `X-Robots-Tag: noindex, nofollow` so the test copy is not indexed
|
||||
- No `.env` is copied: the site needs none, and the local `.env` holds only the Gitea token
|
||||
|
||||
## Consequences
|
||||
- Deploys need SSH access as root to the server and a local Docker with buildx
|
||||
- No registry: rollback means rebuilding an older commit and redeploying
|
||||
- DNS for the final domain (`officinezulianiudine.it`, today on Italiaonline/Duda) must be moved to the server only at launch; until then a test hostname can be used
|
||||
@@ -0,0 +1,22 @@
|
||||
# ADR 0005: Opening hours from the Google Business Profile via Places API
|
||||
|
||||
## Status
|
||||
Accepted (2026-11-04)
|
||||
|
||||
## Context
|
||||
Opening hours were hard-coded in the site. The client keeps them up to date on the Google Business Profile listing "Officine Zuliani E. di Peresani A. Tosoni B. & C. S.A.S.", including special closures (holidays, vacations). Having one source avoids mismatches between site and Google (also a local-SEO signal).
|
||||
|
||||
## Decision
|
||||
- Read hours with **Places API (New)** Place Details (`regularOpeningHours`, `currentOpeningHours`, `businessStatus`) using an API key restricted to Places API. The Business Profile API was rejected: owner OAuth and Google approval are overkill for reading hours.
|
||||
- `scripts/orari-google.mjs` normalizes the response to the site format: `settimana` (days grouped by identical time ranges) and `prossimiGiorni` (actual ranges for the next 7 days, special closures included). On any error it leaves the existing file untouched.
|
||||
- **Build time:** `deploy.sh` runs the script and writes `src/data/orari-google.json` (committed snapshot). The build uses it for the hours text, the table on /dove-siamo and the `openingHoursSpecification` JSON-LD. If it is missing, `src/data/orari.ts` falls back to hard-coded hours.
|
||||
- **Runtime:** a second container `officinezuliani-orari` (`node:22-alpine`, no custom image) runs the same script every 6 hours and writes `orari.json` to a shared volume served by nginx at `/dati/orari.json`. The "open now" sign fetches it in the browser and redraws bars and status; if the fetch fails, the build-time hours stay.
|
||||
- The key is never in the repository or in the browser: local `.env.server` (git-ignored) → copied by `deploy.sh` to the server as `.env` (mode 600).
|
||||
|
||||
## Consequences
|
||||
- The client edits hours only on Google; the sign follows within 6 hours, without a deploy. The /dove-siamo table and JSON-LD update at the next deploy.
|
||||
- About 120 Place Details requests per month: expected to stay within Google Maps Platform free monthly usage, but a billing account is required — check the current price list.
|
||||
- If Google returns no regular hours, nothing is overwritten (no blank sign).
|
||||
|
||||
## Update (2026-11-04)
|
||||
Refresh interval changed from 6 to **24 hours** (owner's request: hours change rarely). The sign therefore follows a change on Google within a day; about 30 requests per month plus one per deploy.
|
||||
@@ -2,5 +2,5 @@
|
||||
|
||||
- The Gitea repository (`andrearuffini/officinazuliani` on git.a75.it) is public: no secrets in commits; `.env` stays git-ignored.
|
||||
- Gitea Issues are the task board; no external tracker.
|
||||
- Stack: Astro static (`docs/adr/0003-stack-astro-statico.md`). Hosting and deploy target: not decided yet (record as an ADR).
|
||||
- Stack: Astro static (`docs/adr/0003-stack-astro-statico.md`). Hosting: Docker on the a75 server behind Nginx Proxy Manager (`docs/adr/0004-hosting-docker-server-a75.md`).
|
||||
- Visual direction: proposal 02 "Bottega" (`docs/adr/0002-direzione-visiva-bottega.md`).
|
||||
|
||||
@@ -3,15 +3,19 @@
|
||||
## Top-level areas
|
||||
- `src/pages/` → site pages: `index`, `officina`, `servizi`, `dove-siamo`, `contatti`, plus `sitemap.xml`
|
||||
- `src/layouts/Base.astro` → HTML shell, meta/OG, canonical, AutoRepair JSON-LD, header/footer, reveal script
|
||||
- `src/components/` → `Insegna` (open-now sign + weekly hours), `ServiziLista`, `Marchi`, `Faq` (+ FAQPage JSON-LD), `BloccoContatti`
|
||||
- `src/data/officina.ts` → single source of business data (NAP, hours, services, FAQ)
|
||||
- `src/components/` → `Insegna` (open-now sign + weekly hours), `ServiziLista`, `Marchi`, `Faq` (+ FAQPage JSON-LD), `BloccoContatti`, `StripFoto` (3-photo strip)
|
||||
- `src/data/officina.ts` → single source of business data (NAP, legal name, services, FAQ)
|
||||
- `src/data/orari.ts` → opening hours: Google snapshot `orari-google.json` or fallback (ADR 0005)
|
||||
- `scripts/orari-google.mjs` → reads hours from Places API (deploy + `orari` container on the server)
|
||||
- `src/styles/global.css` → design tokens and shared styles (ADR 0002)
|
||||
- `public/` → favicon, robots.txt, partner logos
|
||||
- `src/assets/home/`, `src/assets/officina/` → page photos (demonstrative, AI-generated; optimized by astro:assets via `StripFoto`)
|
||||
- `design/proposte/` → static design proposals (reference; 02 is the chosen direction)
|
||||
- `design/assets/sito-attuale/` → images downloaded from the current site
|
||||
- `docs/analisi/`, `docs/progetto/` → audit and development plan
|
||||
- `docs/` (adr, context, runbooks, handoffs), `coordination/`, `.gitea/` → workflow
|
||||
- `Dockerfile`, `docker/nginx.conf`, `docker-compose.yml`, `deploy.sh` → container image and deploy (ADR 0004)
|
||||
- `.claude/launch.json` → preview configs: `sito` (Astro dev, 4321), `proposte` (4173)
|
||||
|
||||
## Important flows
|
||||
- Opening hours: defined once in `src/data/officina.ts` → rendered as bars (Insegna), table (dove-siamo), JSON-LD (Base)
|
||||
- Opening hours: Google Business Profile → Places API → `orari-google.json` (build: text, table, JSON-LD) and `/dati/orari.json` (runtime: Insegna "open now", special closures)
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
# Handoff
|
||||
|
||||
## Issue
|
||||
None (explicit user instruction: deploy like cam85, same server, Docker)
|
||||
|
||||
## Goal
|
||||
Containerize the static site and deploy it on the a75 server with the cam85 flow.
|
||||
|
||||
## Status
|
||||
ready-for-review — live on https://officinezuliani.a75.eu
|
||||
|
||||
## What changed
|
||||
- `Dockerfile` (Node build → nginx), `docker/nginx.conf`, `.dockerignore`, `docker-compose.yml`, `deploy.sh`
|
||||
- ADR 0004, runbook deploy, module map, constraints, CLAUDE.md
|
||||
|
||||
## Files touched
|
||||
- see above
|
||||
|
||||
## Tests
|
||||
- Run: local container on :8089 — all pages 200, `/officina.html` → 301 `/officina`, `/index.html` → 301 `/`, unknown URL 404
|
||||
- Run: `./deploy.sh` → container `officinezuliani-site` up, internal check from `nginx-app-1` HTTP 200
|
||||
- Run: public HTTPS on https://officinezuliani.a75.eu — all pages 200, `.html` → 301, 404 for unknown, `X-Robots-Tag: noindex` present; real-domain Host header gets no noindex
|
||||
|
||||
## Risks / open questions
|
||||
- NPM proxy host forwards to port 3000: container switched to 3000 to match (cam85 convention)
|
||||
- HTTP is not redirected to HTTPS on the test host (NPM "Force SSL" off)
|
||||
- Real domain still points to Italiaonline/Duda: switch only at launch
|
||||
- No custom 404 page yet (nginx default)
|
||||
|
||||
## Suggested next step
|
||||
- Phase 2 content (service pages, FAQ page), contact form decision, custom 404 page
|
||||
@@ -0,0 +1,34 @@
|
||||
# Handoff
|
||||
|
||||
## Issue
|
||||
None (explicit user instruction: add the three home images)
|
||||
|
||||
## Goal
|
||||
Replace the three photo placeholders in the home with demonstrative images.
|
||||
|
||||
## Status
|
||||
done
|
||||
|
||||
## What changed
|
||||
- Three AI-generated demonstrative images (ChatGPT, prompts written in this session) in `src/assets/home/`: `piazzale.jpg`, `impianto-gpl.jpg`, `officina-lavoro.jpg`
|
||||
- Home uses Astro `<Picture>` → AVIF/WebP with srcset and descriptive `alt`; first image `fetchpriority="high"`
|
||||
- `og:image` (1200×630 from the forecourt image) and `twitter:card` via new optional `image` prop in `Base.astro`
|
||||
|
||||
## Files touched
|
||||
- `src/pages/index.astro`, `src/layouts/Base.astro`, `src/assets/home/*`
|
||||
|
||||
## Tests
|
||||
- Run: build OK; browser check 1280px and 375px — all three images load, no horizontal scroll
|
||||
- Not run: Lighthouse
|
||||
|
||||
## Risks / open questions
|
||||
- The images are AI-generated and do not show the real workshop: replace with real photos before the final launch (same file names → no code change)
|
||||
- The third slot shows "the workshop at work" instead of "the team" on purpose, to avoid presenting invented people as staff
|
||||
|
||||
## Update — /officina images
|
||||
- Three more AI images in `src/assets/officina/` (`interno`, `diagnosi`, `consulenza`), converted from the PNGs in `temp/`
|
||||
- Shared component `src/components/StripFoto.astro` now renders the photo strip on both home and /officina; /officina also gets its own `og:image`
|
||||
- Third slot shows a customer consultation instead of "the team" (same reason as home)
|
||||
|
||||
## Suggested next step
|
||||
- Photo shoot of the real workshop: replace the six files keeping the same names
|
||||
@@ -0,0 +1,32 @@
|
||||
# Handoff
|
||||
|
||||
## Issue
|
||||
None (explicit user instruction: read opening hours from the Google Business Profile via Places API)
|
||||
|
||||
## Goal
|
||||
Make Google Business Profile the single source of opening hours.
|
||||
|
||||
## Status
|
||||
done — live on https://officinezuliani.a75.eu
|
||||
|
||||
## What changed
|
||||
- `scripts/orari-google.mjs` (Places API → site format; `--cerca` to find the Place ID)
|
||||
- `src/data/orari.ts` (snapshot or fallback, `orariTesto` generated), `officina.ts` uses it; legal name added (footer + `legalName`)
|
||||
- Insegna reads `/dati/orari.json` at runtime, handles special closures, redraws bars
|
||||
- `docker-compose.yml`: `orari` service + shared volume; nginx `/dati/` no-cache; `deploy.sh` snapshot + `.env.server` transfer
|
||||
- ADR 0005, runbook, module map, CLAUDE.md
|
||||
|
||||
## Tests
|
||||
- Run: script with a stubbed Places response (regular hours + holiday + half day) → correct `settimana` / `prossimiGiorni`
|
||||
- Run: Insegna with a test `/dati/orari.json` (today closed) → "Chiuso ora · Riapriamo venerdì alle 8:00"; without file → build hours
|
||||
- Run: real Places API — Place ID `ChIJCY2DP7HKe0cR5gsnqt1z9aU` (Officine Zuliani E. di Peresani A. Tosoni B. & C. S.A.S., Viale Venezia 446); snapshot committed
|
||||
- Run: deploy — containers `officinezuliani-site` and `officinezuliani-orari` up; `/dati/orari.json` served (no-cache, noindex); live sign shows "Aperto ora · Chiudiamo alle 19:00"
|
||||
|
||||
## Risks / open questions
|
||||
- Google says Mon–Fri 8:00–12:00 / 14:00–19:00; the old site said 18:30. The site now follows Google: client to confirm the listing is right
|
||||
- Saturday: closed on Google
|
||||
- Billing account required on Google Cloud; check free usage on the current price list
|
||||
- Restrict the key to Places API (New) only
|
||||
|
||||
## Suggested next step
|
||||
- Phase 2 content (service pages, FAQ page); contact form decision
|
||||
+37
-5
@@ -1,7 +1,39 @@
|
||||
# Deploy
|
||||
|
||||
Hosting not decided yet (see `docs/adr/0003-stack-astro-statico.md`). Record the choice as a new ADR, then document here:
|
||||
- Build: `npm run build` → upload `dist/`
|
||||
- Server rule: serve `/<page>` from `/<page>.html` (e.g. nginx `try_files $uri $uri.html $uri/ =404;`)
|
||||
- Keep the current URLs (`/officina`, `/servizi`, `/dove-siamo`, `/contatti`) so no redirects are needed
|
||||
- Rollback procedure: TBD
|
||||
Hosting: Docker on the a75 server, same flow as cam85 (`docs/adr/0004-hosting-docker-server-a75.md`).
|
||||
|
||||
## Deploy
|
||||
```
|
||||
./deploy.sh
|
||||
```
|
||||
It builds locally, builds the amd64 image, loads it on `217.76.62.220`, runs `docker compose up -d` in `/home/ubuntu/officinezuliani` and checks `http://officinezuliani-site:3000/` from the Nginx Proxy Manager container.
|
||||
|
||||
Requirements: SSH key access as `root@217.76.62.220`, Docker with buildx, Node/npm, and a local `.env.server` (copy `.env.server.example`) with `GOOGLE_PLACES_API_KEY` and `GOOGLE_PLACE_ID`.
|
||||
|
||||
## Opening hours from Google (ADR 0005)
|
||||
- Find the Place ID once: `set -a; source .env.server; set +a; node scripts/orari-google.mjs --cerca "Officine Zuliani Udine"`
|
||||
- Each deploy refreshes `src/data/orari-google.json` (commit it with the deploy)
|
||||
- On the server, container `officinezuliani-orari` refreshes `/dati/orari.json` every 24 hours: `docker compose logs orari` shows the last updates
|
||||
|
||||
## Publish a hostname (one-time, Nginx Proxy Manager UI)
|
||||
1. DNS: A record of the hostname → `217.76.62.220`
|
||||
2. NPM → Proxy Hosts → Add: forward hostname `officinezuliani-site`, port `3000`, scheme `http`
|
||||
3. SSL tab: request a Let's Encrypt certificate, force SSL
|
||||
|
||||
## Test the image locally
|
||||
```
|
||||
docker buildx build --platform linux/amd64 -t officinezuliani-web:latest --load .
|
||||
docker run --rm -p 8089:3000 officinezuliani-web:latest # http://localhost:8089
|
||||
```
|
||||
|
||||
## Rollback
|
||||
Check out the previous good commit and run `./deploy.sh` again.
|
||||
|
||||
## Server layout
|
||||
- `/home/ubuntu/officinezuliani/docker-compose.yml`, `scripts/`, `.env` (from `.env.server`, mode 600) — all copied by deploy.sh
|
||||
- Volume `orari-dati` shared by `orari` (writes) and `web` (`/dati/`, read-only)
|
||||
- Container `officinezuliani-site` on network `a75`, port 3000, no host ports
|
||||
|
||||
## Hostnames
|
||||
- Test: https://officinezuliani.a75.eu (NPM proxy host #35, Let's Encrypt) — served with `noindex`
|
||||
- Production: `www.officinezulianiudine.it` — still on Italiaonline/Duda; at launch point DNS to `217.76.62.220`, add it to the NPM proxy host with a certificate, and redirect `officinezulianiudine.it` → `www`
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
#!/usr/bin/env node
|
||||
// Legge gli orari di apertura dalla scheda Google Business Profile tramite
|
||||
// Places API (New) e li salva nel formato usato dal sito (ADR 0005).
|
||||
//
|
||||
// Uso:
|
||||
// node scripts/orari-google.mjs --cerca "Officine Zuliani Udine" → trova il Place ID
|
||||
// node scripts/orari-google.mjs --out src/data/orari-google.json → aggiorna una volta
|
||||
// node scripts/orari-google.mjs --out /dati/orari.json --ogni 24 → ripete ogni 24 ore (server)
|
||||
//
|
||||
// Variabili d'ambiente: GOOGLE_PLACES_API_KEY, GOOGLE_PLACE_ID.
|
||||
// Se Google non risponde o i dati non sono validi, il file esistente NON viene toccato.
|
||||
|
||||
import { writeFileSync, renameSync, mkdirSync } from 'node:fs';
|
||||
import { dirname } from 'node:path';
|
||||
|
||||
const API = 'https://places.googleapis.com/v1';
|
||||
const chiave = process.env.GOOGLE_PLACES_API_KEY;
|
||||
const placeId = process.env.GOOGLE_PLACE_ID;
|
||||
|
||||
const arg = (nome) => {
|
||||
const i = process.argv.indexOf(nome);
|
||||
return i > -1 ? process.argv[i + 1] : undefined;
|
||||
};
|
||||
|
||||
const log = (...m) => console.log(new Date().toISOString(), ...m);
|
||||
|
||||
if (!chiave) {
|
||||
console.error('Manca GOOGLE_PLACES_API_KEY');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
async function cerca(testo) {
|
||||
const r = await fetch(`${API}/places:searchText`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-Goog-Api-Key': chiave,
|
||||
'X-Goog-FieldMask': 'places.id,places.displayName,places.formattedAddress',
|
||||
},
|
||||
body: JSON.stringify({ textQuery: testo, languageCode: 'it' }),
|
||||
});
|
||||
if (!r.ok) throw new Error(`Places API ${r.status}: ${await r.text()}`);
|
||||
const { places = [] } = await r.json();
|
||||
for (const p of places) console.log(`${p.id} ${p.displayName?.text} — ${p.formattedAddress}`);
|
||||
if (!places.length) console.log('Nessun risultato');
|
||||
}
|
||||
|
||||
const min = (t) => (t?.hour ?? 0) * 60 + (t?.minute ?? 0);
|
||||
|
||||
/** Periodi Google → fasce per giorno (0 = domenica). Un periodo senza "close" = aperto 24 ore. */
|
||||
function fascePerGiorno(periodi = []) {
|
||||
const perGiorno = new Map();
|
||||
const aggiungi = (chiave, fascia) => perGiorno.set(chiave, [...(perGiorno.get(chiave) ?? []), fascia]);
|
||||
for (const p of periodi) {
|
||||
const fine = !p.close ? 24 * 60 : p.close.day !== p.open.day ? 24 * 60 : min(p.close);
|
||||
const chiaveGiorno = p.open.date
|
||||
? `${p.open.date.year}-${String(p.open.date.month).padStart(2, '0')}-${String(p.open.date.day).padStart(2, '0')}`
|
||||
: p.open.day;
|
||||
aggiungi(chiaveGiorno, [min(p.open), fine]);
|
||||
}
|
||||
for (const f of perGiorno.values()) f.sort((a, b) => a[0] - b[0]);
|
||||
return perGiorno;
|
||||
}
|
||||
|
||||
/** Raggruppa i giorni con le stesse fasce: [{ giorni: [1,2,3,4,5], fasce: [[480,720], …] }]. */
|
||||
function settimana(perGiorno) {
|
||||
const gruppi = new Map();
|
||||
for (let g = 0; g < 7; g++) {
|
||||
const f = perGiorno.get(g);
|
||||
if (!f) continue;
|
||||
const k = JSON.stringify(f);
|
||||
gruppi.set(k, { giorni: [...(gruppi.get(k)?.giorni ?? []), g], fasce: f });
|
||||
}
|
||||
return [...gruppi.values()];
|
||||
}
|
||||
|
||||
/** Date dei prossimi 7 giorni (ora di Roma), per segnare come chiusi i giorni senza periodi. */
|
||||
function prossimeDate() {
|
||||
const fmt = new Intl.DateTimeFormat('en-CA', { timeZone: 'Europe/Rome' });
|
||||
return Array.from({ length: 7 }, (_, i) => fmt.format(new Date(Date.now() + i * 864e5)));
|
||||
}
|
||||
|
||||
async function aggiorna(out) {
|
||||
if (!placeId) throw new Error('Manca GOOGLE_PLACE_ID');
|
||||
const r = await fetch(`${API}/places/${placeId}?languageCode=it`, {
|
||||
headers: {
|
||||
'X-Goog-Api-Key': chiave,
|
||||
'X-Goog-FieldMask': 'regularOpeningHours,currentOpeningHours,businessStatus',
|
||||
},
|
||||
});
|
||||
if (!r.ok) throw new Error(`Places API ${r.status}: ${await r.text()}`);
|
||||
const dati = await r.json();
|
||||
|
||||
const regolari = settimana(fascePerGiorno(dati.regularOpeningHours?.periods));
|
||||
if (!regolari.length) throw new Error('Nessun orario regolare nella scheda: file non aggiornato');
|
||||
|
||||
const correnti = fascePerGiorno(dati.currentOpeningHours?.periods);
|
||||
const prossimiGiorni = {};
|
||||
if (dati.currentOpeningHours) for (const d of prossimeDate()) prossimiGiorni[d] = correnti.get(d) ?? [];
|
||||
|
||||
const risultato = {
|
||||
fonte: 'google',
|
||||
aggiornato: new Date().toISOString(),
|
||||
statoAttivita: dati.businessStatus ?? null,
|
||||
settimana: regolari,
|
||||
prossimiGiorni,
|
||||
};
|
||||
|
||||
mkdirSync(dirname(out), { recursive: true });
|
||||
const tmp = `${out}.tmp`;
|
||||
writeFileSync(tmp, `${JSON.stringify(risultato, null, 2)}\n`);
|
||||
renameSync(tmp, out); // scrittura atomica: nginx non legge mai un file a metà
|
||||
log(`Orari aggiornati in ${out}`);
|
||||
}
|
||||
|
||||
const testo = arg('--cerca');
|
||||
const out = arg('--out');
|
||||
const ogni = Number(arg('--ogni'));
|
||||
|
||||
if (testo) {
|
||||
await cerca(testo);
|
||||
} else if (out && ogni > 0) {
|
||||
// Servizio sul server: aggiorna subito, poi ogni N ore. Un errore non ferma il ciclo.
|
||||
for (;;) {
|
||||
try { await aggiorna(out); } catch (e) { log('Errore:', e.message); }
|
||||
await new Promise((r) => setTimeout(r, ogni * 3600e3));
|
||||
}
|
||||
} else if (out) {
|
||||
try { await aggiorna(out); } catch (e) { log('Errore:', e.message); process.exit(1); }
|
||||
} else {
|
||||
console.error('Specificare --cerca "testo" oppure --out <file> [--ogni <ore>]');
|
||||
process.exit(1);
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 312 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 445 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 557 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 475 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 359 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 588 KiB |
@@ -1,15 +1,19 @@
|
||||
---
|
||||
// Insegna smaltata con stato "aperto ora" e barre degli orari settimanali.
|
||||
// Le barre sono generate in HTML; lo script calcola solo lo stato con l'ora di Roma.
|
||||
// Le barre vengono generate in HTML con gli orari della build; nel browser lo
|
||||
// script legge /dati/orari.json (aggiornato dal server dalla scheda Google, ADR 0005),
|
||||
// ridisegna le barre e calcola lo stato con l'ora di Roma, incluse le chiusure
|
||||
// straordinarie. Se il file non è disponibile restano gli orari della build.
|
||||
import { officina } from '../data/officina';
|
||||
import { orari, fasceDelGiorno } from '../data/orari';
|
||||
|
||||
const nomi = ['D', 'L', 'M', 'M', 'G', 'V', 'S'];
|
||||
const ordine = [1, 2, 3, 4, 5, 6, 0];
|
||||
const inizio = 7 * 60, fine = 19 * 60 + 30; // scala verticale delle barre
|
||||
const pct = (v: number) => (((v - inizio) / (fine - inizio)) * 100).toFixed(1);
|
||||
const fasceDi = (g: number) => officina.orari.filter((o) => o.giorni.includes(g)).flatMap((o) => o.fasce);
|
||||
const pct = (v: number) => Math.max(0, Math.min(100, ((v - inizio) / (fine - inizio)) * 100));
|
||||
const stileBarra = ([a, b]: [number, number]) => `top:${pct(a).toFixed(1)}%;height:${(pct(b) - pct(a)).toFixed(1)}%`;
|
||||
---
|
||||
<aside class="insegna su" data-orari={JSON.stringify(officina.orari)} aria-label="Orari di apertura">
|
||||
<aside class="insegna su" data-orari={JSON.stringify(orari)} aria-label="Orari di apertura">
|
||||
<div class="stato"><i></i><span data-stato>Orari di apertura</span></div>
|
||||
<p data-sub>{officina.orariTesto}</p>
|
||||
<div class="settimana">
|
||||
@@ -17,7 +21,7 @@ const fasceDi = (g: number) => officina.orari.filter((o) => o.giorni.includes(g)
|
||||
<div class="giorno" data-giorno={g}>
|
||||
{nomi[g]}
|
||||
<div class="barra">
|
||||
{fasceDi(g).map(([a, b]) => <span style={`top:${pct(a)}%;height:${(+pct(b) - +pct(a)).toFixed(1)}%`} />)}
|
||||
{fasceDelGiorno(orari.settimana, g).map((f) => <span style={stileBarra(f)} />)}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
@@ -26,37 +30,71 @@ const fasceDi = (g: number) => officina.orari.filter((o) => o.giorni.includes(g)
|
||||
</aside>
|
||||
|
||||
<script>
|
||||
type Orari = { giorni: number[]; fasce: [number, number][] }[];
|
||||
import { fasceDelGiorno, type OrariDati, type Fascia } from '../data/orari';
|
||||
|
||||
const el = document.querySelector<HTMLElement>('.insegna');
|
||||
if (el) {
|
||||
const orari: Orari = JSON.parse(el.dataset.orari || '[]');
|
||||
// Ora corrente a Udine, indipendente dal fuso del visitatore
|
||||
const parti = new Intl.DateTimeFormat('en-GB', { timeZone: 'Europe/Rome', weekday: 'short', hour: '2-digit', minute: '2-digit', hourCycle: 'h23' }).formatToParts(new Date());
|
||||
const p = (t: string) => parti.find((x) => x.type === t)?.value ?? '';
|
||||
const g = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'].indexOf(p('weekday'));
|
||||
const m = +p('hour') * 60 + +p('minute');
|
||||
const fasce = (d: number) => orari.filter((o) => o.giorni.includes(d)).flatMap((o) => o.fasce);
|
||||
|
||||
const inizio = 7 * 60, fine = 19 * 60 + 30;
|
||||
const pct = (v: number) => Math.max(0, Math.min(100, ((v - inizio) / (fine - inizio)) * 100));
|
||||
const hhmm = (v: number) => `${Math.floor(v / 60)}:${String(v % 60).padStart(2, '0')}`;
|
||||
const giorniNome = ['domenica', 'lunedì', 'martedì', 'mercoledì', 'giovedì', 'venerdì', 'sabato'];
|
||||
|
||||
el.querySelector(`[data-giorno="${g}"]`)?.classList.add('oggi');
|
||||
const aperta = fasce(g).find(([a, b]) => m >= a && m < b);
|
||||
const stato = el.querySelector('[data-stato]')!, sub = el.querySelector('[data-sub]')!;
|
||||
// Data e ora correnti a Udine, indipendenti dal fuso del visitatore
|
||||
function adessoRoma(offsetGiorni = 0) {
|
||||
const d = new Date(Date.now() + offsetGiorni * 864e5);
|
||||
const parti = new Intl.DateTimeFormat('en-GB', { timeZone: 'Europe/Rome', weekday: 'short', hour: '2-digit', minute: '2-digit', hourCycle: 'h23' }).formatToParts(d);
|
||||
const p = (t: string) => parti.find((x) => x.type === t)?.value ?? '';
|
||||
return {
|
||||
giorno: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'].indexOf(p('weekday')),
|
||||
minuti: +p('hour') * 60 + +p('minute'),
|
||||
data: new Intl.DateTimeFormat('en-CA', { timeZone: 'Europe/Rome' }).format(d), // AAAA-MM-GG
|
||||
};
|
||||
}
|
||||
|
||||
function aggiorna(insegna: HTMLElement, dati: OrariDati) {
|
||||
// Fasce effettive: prima le eccezioni di Google (ferie, festivi), poi la settimana tipo
|
||||
const fasce = (offset: number): Fascia[] => {
|
||||
const { giorno, data } = adessoRoma(offset);
|
||||
return dati.prossimiGiorni?.[data] ?? fasceDelGiorno(dati.settimana, giorno);
|
||||
};
|
||||
|
||||
insegna.querySelectorAll<HTMLElement>('[data-giorno]').forEach((g) => {
|
||||
const barra = g.querySelector('.barra')!;
|
||||
barra.replaceChildren(...fasceDelGiorno(dati.settimana, +g.dataset.giorno!).map(([a, b]) => {
|
||||
const s = document.createElement('span');
|
||||
s.style.top = `${pct(a).toFixed(1)}%`;
|
||||
s.style.height = `${(pct(b) - pct(a)).toFixed(1)}%`;
|
||||
return s;
|
||||
}));
|
||||
});
|
||||
|
||||
const { giorno, minuti } = adessoRoma();
|
||||
insegna.querySelectorAll('.oggi').forEach((x) => x.classList.remove('oggi'));
|
||||
insegna.querySelector(`[data-giorno="${giorno}"]`)?.classList.add('oggi');
|
||||
|
||||
const stato = insegna.querySelector('[data-stato]')!, sub = insegna.querySelector('[data-sub]')!;
|
||||
const aperta = fasce(0).find(([a, b]) => minuti >= a && minuti < b);
|
||||
insegna.classList.toggle('chiuso', !aperta);
|
||||
if (aperta) {
|
||||
stato.textContent = 'Aperto ora';
|
||||
sub.textContent = `Chiudiamo alle ${hhmm(aperta[1])}`;
|
||||
} else {
|
||||
el.classList.add('chiuso');
|
||||
return;
|
||||
}
|
||||
stato.textContent = 'Chiuso ora';
|
||||
const oggiDopo = fasce(g).find(([a]) => a > m);
|
||||
if (oggiDopo) sub.textContent = `Riapriamo alle ${hhmm(oggiDopo[0])}`;
|
||||
else {
|
||||
for (let i = 1; i <= 7; i++) {
|
||||
const d = (g + i) % 7, f = fasce(d)[0];
|
||||
if (f) { sub.textContent = `Riapriamo ${i === 1 ? 'domani' : giorniNome[d]} alle ${hhmm(f[0])}`; break; }
|
||||
}
|
||||
const oggiDopo = fasce(0).find(([a]) => a > minuti);
|
||||
if (oggiDopo) { sub.textContent = `Riapriamo alle ${hhmm(oggiDopo[0])}`; return; }
|
||||
for (let i = 1; i <= 14; i++) {
|
||||
const f = fasce(i)[0];
|
||||
if (f) { sub.textContent = `Riapriamo ${i === 1 ? 'domani' : giorniNome[adessoRoma(i).giorno]} alle ${hhmm(f[0])}`; return; }
|
||||
}
|
||||
}
|
||||
|
||||
if (el) {
|
||||
aggiorna(el, JSON.parse(el.dataset.orari || '{}'));
|
||||
fetch('/dati/orari.json', { cache: 'no-cache' })
|
||||
.then((r) => (r.ok ? r.json() : null))
|
||||
.then((dati: OrariDati | null) => { if (dati?.settimana?.length) aggiorna(el, dati); })
|
||||
.catch(() => {}); // senza file restano gli orari della build
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -71,7 +109,7 @@ const fasceDi = (g: number) => officina.orari.filter((o) => o.giorni.includes(g)
|
||||
.settimana{display:grid;grid-template-columns:repeat(7,1fr);gap:6px;margin-top:24px}
|
||||
.giorno{font:600 12px/1 var(--display);text-align:center;color:#C9D6E6}
|
||||
.barra{height:64px;border-radius:6px;background:rgba(255,255,255,.08);margin-top:6px;position:relative;overflow:hidden}
|
||||
.barra span{position:absolute;left:0;right:0;background:var(--segnale);border-radius:3px}
|
||||
.barra :global(span){position:absolute;left:0;right:0;background:var(--segnale);border-radius:3px}
|
||||
.giorno.oggi{color:var(--segnale)}
|
||||
.giorno.oggi .barra{outline:2px solid var(--segnale)}
|
||||
.tel{display:block;margin-top:22px;font:800 30px/1 var(--display);text-decoration:none;color:var(--segnale)}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
---
|
||||
// Fila di tre foto (una larga + due quadrate) usata in home e in /officina.
|
||||
// La prima foto è vicina all'inizio pagina: priorità alta per l'LCP.
|
||||
import { Picture } from 'astro:assets';
|
||||
import type { ImageMetadata } from 'astro';
|
||||
|
||||
interface Foto { src: ImageMetadata; alt: string }
|
||||
interface Props { foto: [Foto, Foto, Foto] }
|
||||
|
||||
const { foto } = Astro.props;
|
||||
const [grande, ...piccole] = foto;
|
||||
---
|
||||
<div class="wrap strip su">
|
||||
<Picture src={grande.src} formats={['avif', 'webp']} widths={[480, 800, 1200]} sizes="(max-width: 900px) 100vw, 760px" alt={grande.alt} class="foto-img" loading="eager" fetchpriority="high" />
|
||||
{piccole.map((f) => (
|
||||
<Picture src={f.src} formats={['avif', 'webp']} widths={[400, 760]} sizes="(max-width: 900px) 100vw, 370px" alt={f.alt} class="foto-img" loading="eager" />
|
||||
))}
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.strip :global(picture){display:block;height:100%;min-height:0}
|
||||
.strip :global(.foto-img){width:100%;height:100%;object-fit:cover;border-radius:14px;display:block}
|
||||
@media (max-width:900px){.strip :global(.foto-img){height:240px}}
|
||||
</style>
|
||||
@@ -1,8 +1,10 @@
|
||||
// Dati dell'attività: unica fonte per pagine, contatti e dati strutturati (JSON-LD).
|
||||
// Da verificare col cliente: nome ufficiale, apertura il sabato (vedi docs/analisi).
|
||||
// Gli orari stanno in ./orari.ts (letti dalla scheda Google Business Profile).
|
||||
import { orari, orariTesto } from './orari';
|
||||
|
||||
export const officina = {
|
||||
nome: 'Officine Zuliani',
|
||||
ragioneSociale: 'Officine Zuliani E. di Peresani A. Tosoni B. & C. S.A.S.',
|
||||
sito: 'https://www.officinezulianiudine.it',
|
||||
indirizzo: {
|
||||
via: 'Viale Venezia 446',
|
||||
@@ -16,11 +18,8 @@ export const officina = {
|
||||
email: 'autogas.udine@libero.it',
|
||||
piva: '02026960308',
|
||||
mappa: 'https://maps.google.com/?q=Viale+Venezia+446+Udine',
|
||||
// Giorni: 0 = domenica … 6 = sabato. Orari in minuti dalla mezzanotte, ora di Roma.
|
||||
orari: [
|
||||
{ giorni: [1, 2, 3, 4, 5], fasce: [[8 * 60, 12 * 60], [14 * 60, 18 * 60 + 30]] },
|
||||
] as { giorni: number[]; fasce: [number, number][] }[],
|
||||
orariTesto: 'Lun–Ven 8:00–12:00 · 14:00–18:30',
|
||||
orari: orari.settimana,
|
||||
orariTesto: orariTesto(orari.settimana),
|
||||
reti: ['Rete Bosch AutoCrew', 'Assistenza ufficiale BRC', 'Installatore Prins'],
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
{
|
||||
"fonte": "google",
|
||||
"aggiornato": "2026-11-04T15:22:48.382Z",
|
||||
"statoAttivita": "OPERATIONAL",
|
||||
"settimana": [
|
||||
{
|
||||
"giorni": [
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5
|
||||
],
|
||||
"fasce": [
|
||||
[
|
||||
480,
|
||||
720
|
||||
],
|
||||
[
|
||||
840,
|
||||
1140
|
||||
]
|
||||
]
|
||||
}
|
||||
],
|
||||
"prossimiGiorni": {
|
||||
"2026-11-04": [
|
||||
[
|
||||
480,
|
||||
720
|
||||
],
|
||||
[
|
||||
840,
|
||||
1140
|
||||
]
|
||||
],
|
||||
"2026-11-05": [
|
||||
[
|
||||
480,
|
||||
720
|
||||
],
|
||||
[
|
||||
840,
|
||||
1140
|
||||
]
|
||||
],
|
||||
"2026-11-06": [
|
||||
[
|
||||
480,
|
||||
720
|
||||
],
|
||||
[
|
||||
840,
|
||||
1140
|
||||
]
|
||||
],
|
||||
"2026-11-07": [],
|
||||
"2026-11-08": [],
|
||||
"2026-11-09": [
|
||||
[
|
||||
480,
|
||||
720
|
||||
],
|
||||
[
|
||||
840,
|
||||
1140
|
||||
]
|
||||
],
|
||||
"2026-11-10": [
|
||||
[
|
||||
480,
|
||||
720
|
||||
],
|
||||
[
|
||||
840,
|
||||
1140
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
// Orari di apertura (ADR 0005).
|
||||
// Fonte: scheda Google Business Profile, letta tramite Places API da
|
||||
// scripts/orari-google.mjs. Ad ogni deploy lo script salva un'istantanea in
|
||||
// src/data/orari-google.json, usata qui al momento della build; sul server lo
|
||||
// stesso script aggiorna /dati/orari.json, che l'insegna legge dal browser.
|
||||
// Se l'istantanea manca si usano gli orari di riserva qui sotto.
|
||||
|
||||
/** Giorni: 0 = domenica … 6 = sabato. Fasce in minuti dalla mezzanotte, ora di Roma. */
|
||||
export type Fascia = [number, number];
|
||||
export type Settimana = { giorni: number[]; fasce: Fascia[] }[];
|
||||
export type OrariDati = {
|
||||
fonte: 'google' | 'riserva';
|
||||
aggiornato: string | null;
|
||||
settimana: Settimana;
|
||||
/** Fasce effettive dei prossimi giorni (chiusure e orari speciali inclusi), chiave AAAA-MM-GG. */
|
||||
prossimiGiorni: Record<string, Fascia[]>;
|
||||
};
|
||||
|
||||
const riserva: OrariDati = {
|
||||
fonte: 'riserva',
|
||||
aggiornato: null,
|
||||
settimana: [{ giorni: [1, 2, 3, 4, 5], fasce: [[8 * 60, 12 * 60], [14 * 60, 18 * 60 + 30]] }],
|
||||
prossimiGiorni: {},
|
||||
};
|
||||
|
||||
const istantanea = Object.values(
|
||||
import.meta.glob<OrariDati>('./orari-google.json', { eager: true, import: 'default' }),
|
||||
)[0];
|
||||
|
||||
export const orari: OrariDati = istantanea?.settimana?.length ? istantanea : riserva;
|
||||
|
||||
export const fasceDelGiorno = (settimana: Settimana, giorno: number): Fascia[] =>
|
||||
settimana.filter((o) => o.giorni.includes(giorno)).flatMap((o) => o.fasce);
|
||||
|
||||
const hhmm = (m: number) => `${Math.floor(m / 60)}:${String(m % 60).padStart(2, '0')}`;
|
||||
const abbr = ['Dom', 'Lun', 'Mar', 'Mer', 'Gio', 'Ven', 'Sab'];
|
||||
|
||||
/** Es. "Lun–Ven 8:00–12:00 · 14:00–18:30". Giorni consecutivi con gli stessi orari vengono raggruppati. */
|
||||
export function orariTesto(settimana: Settimana): string {
|
||||
const ordine = [1, 2, 3, 4, 5, 6, 0];
|
||||
const chiave = (g: number) => fasceDelGiorno(settimana, g).map(([a, b]) => `${hhmm(a)}–${hhmm(b)}`).join(' · ');
|
||||
const gruppi: { da: number; a: number; testo: string }[] = [];
|
||||
for (const g of ordine) {
|
||||
const t = chiave(g);
|
||||
if (!t) continue;
|
||||
const ultimo = gruppi.at(-1);
|
||||
if (ultimo && ultimo.testo === t && ordine.indexOf(g) === ordine.indexOf(ultimo.a) + 1) ultimo.a = g;
|
||||
else gruppi.push({ da: g, a: g, testo: t });
|
||||
}
|
||||
return gruppi.map((x) => `${abbr[x.da]}${x.a !== x.da ? `–${abbr[x.a]}` : ''} ${x.testo}`).join(' / ');
|
||||
}
|
||||
@@ -5,9 +5,10 @@ import { officina } from '../data/officina';
|
||||
interface Props {
|
||||
title: string;
|
||||
description: string;
|
||||
image?: string;
|
||||
}
|
||||
|
||||
const { title, description } = Astro.props;
|
||||
const { title, description, image } = Astro.props;
|
||||
// URL puliti come sul sito attuale: /officina, /servizi … (niente .html)
|
||||
const path = Astro.url.pathname.replace(/(index)?\.html$/, '') || '/';
|
||||
const canonical = new URL(path, Astro.site).href;
|
||||
@@ -27,6 +28,7 @@ const schema = {
|
||||
'@type': 'AutoRepair',
|
||||
'@id': `${officina.sito}/#officina`,
|
||||
name: officina.nome,
|
||||
legalName: officina.ragioneSociale,
|
||||
url: `${officina.sito}/`,
|
||||
telephone: officina.telefono.e164,
|
||||
email: officina.email,
|
||||
@@ -65,6 +67,8 @@ const schema = {
|
||||
<meta property="og:title" content={title}>
|
||||
<meta property="og:description" content={description}>
|
||||
<meta property="og:url" content={canonical}>
|
||||
{image && <meta property="og:image" content={new URL(image, Astro.site).href}>}
|
||||
{image && <meta name="twitter:card" content="summary_large_image">}
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,500;12..96,700;12..96,800&family=Source+Serif+4:ital,opsz,wght@0,8..60,400;0,8..60,600;1,8..60,400&display=swap" rel="stylesheet">
|
||||
@@ -87,7 +91,7 @@ const schema = {
|
||||
</main>
|
||||
|
||||
<footer class="site-footer"><div class="wrap">
|
||||
<span>{officina.nome} · {officina.indirizzo.via}, {officina.indirizzo.cap} {officina.indirizzo.citta} ({officina.indirizzo.provincia}) · P.IVA {officina.piva} · <a href={`mailto:${officina.email}`}>{officina.email}</a></span>
|
||||
<span>{officina.ragioneSociale} · {officina.indirizzo.via}, {officina.indirizzo.cap} {officina.indirizzo.citta} ({officina.indirizzo.provincia}) · P.IVA {officina.piva} · <a href={`mailto:${officina.email}`}>{officina.email}</a></span>
|
||||
<nav aria-label="Piè di pagina">{nav.map((n) => <a href={n.href}>{n.label}</a>)}</nav>
|
||||
</div></footer>
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ const righe = [1, 2, 3, 4, 5, 6, 0].map((g) => {
|
||||
</Base>
|
||||
|
||||
<style>
|
||||
.hero{display:grid;grid-template-columns:1.25fr 1fr;gap:48px;align-items:end;padding:40px 0 80px}
|
||||
.hero{display:grid;grid-template-columns:1.25fr 1fr;gap:48px;align-items:end;padding-top:40px;padding-bottom:80px}
|
||||
address{font-style:normal}
|
||||
.orari{width:100%;border-collapse:collapse;font:500 18px var(--display)}
|
||||
.orari th,.orari td{padding:14px 0;border-bottom:1px solid var(--riga);text-align:left}
|
||||
|
||||
+16
-6
@@ -1,15 +1,25 @@
|
||||
---
|
||||
import { getImage } from 'astro:assets';
|
||||
import Base from '../layouts/Base.astro';
|
||||
import Insegna from '../components/Insegna.astro';
|
||||
import StripFoto from '../components/StripFoto.astro';
|
||||
import ServiziLista from '../components/ServiziLista.astro';
|
||||
import Marchi from '../components/Marchi.astro';
|
||||
import Faq from '../components/Faq.astro';
|
||||
import BloccoContatti from '../components/BloccoContatti.astro';
|
||||
import { officina, faqHome } from '../data/officina';
|
||||
// Immagini dimostrative generate con AI (docs/handoffs/2026-11-04-immagini-home.md):
|
||||
// da sostituire con foto reali dell'officina prima del lancio.
|
||||
import piazzale from '../assets/home/piazzale.jpg';
|
||||
import impiantoGpl from '../assets/home/impianto-gpl.jpg';
|
||||
import officinaLavoro from '../assets/home/officina-lavoro.jpg';
|
||||
|
||||
const og = await getImage({ src: piazzale, width: 1200, height: 630, fit: 'cover', format: 'jpg' });
|
||||
---
|
||||
<Base
|
||||
title="Impianti GPL e metano a Udine | Officine Zuliani"
|
||||
description="Officine Zuliani, Viale Venezia 446 a Udine: impianti GPL e metano BRC e Prins, revisioni, tagliandi e ganci di traino. Preventivo gratuito, tel. 0432 234000."
|
||||
image={og.src}
|
||||
>
|
||||
<div class="wrap hero">
|
||||
<div class="su">
|
||||
@@ -20,11 +30,11 @@ import { officina, faqHome } from '../data/officina';
|
||||
<Insegna />
|
||||
</div>
|
||||
|
||||
<div class="wrap strip su">
|
||||
<div class="foto"><b>Foto reale: il piazzale e l'ingresso in Viale Venezia 446</b></div>
|
||||
<div class="foto"><b>Foto: un meccanico al lavoro su un impianto GPL</b></div>
|
||||
<div class="foto"><b>Foto: il team</b></div>
|
||||
</div>
|
||||
<StripFoto foto={[
|
||||
{ src: piazzale, alt: "Il piazzale dell'officina con auto parcheggiate, un camper e il portone aperto sull'area di lavoro" },
|
||||
{ src: impiantoGpl, alt: "Un meccanico con tuta blu e guanti collega il riduttore di un impianto GPL nel vano motore" },
|
||||
{ src: officinaLavoro, alt: "Due meccanici controllano il sottoscocca di un'auto sul ponte sollevatore; in primo piano lo strumento di diagnosi" },
|
||||
]} />
|
||||
|
||||
<section><div class="wrap due">
|
||||
<div class="su"><p class="kicker">L'officina</p><h2>Meccanici che ti spiegano le cose.</h2></div>
|
||||
@@ -47,7 +57,7 @@ import { officina, faqHome } from '../data/officina';
|
||||
</Base>
|
||||
|
||||
<style>
|
||||
.hero{display:grid;grid-template-columns:1.25fr 1fr;gap:48px;align-items:end;padding:40px 0 80px}
|
||||
.hero{display:grid;grid-template-columns:1.25fr 1fr;gap:48px;align-items:end;padding-top:40px;padding-bottom:80px}
|
||||
.fascia{background:var(--carta);border-top:1px solid var(--riga);border-bottom:1px solid var(--riga)}
|
||||
@media (max-width:900px){.hero{grid-template-columns:1fr}}
|
||||
</style>
|
||||
|
||||
@@ -1,11 +1,21 @@
|
||||
---
|
||||
import { getImage } from 'astro:assets';
|
||||
import Base from '../layouts/Base.astro';
|
||||
import StripFoto from '../components/StripFoto.astro';
|
||||
// Immagini dimostrative generate con AI (docs/handoffs/2026-11-04-immagini-home.md):
|
||||
// da sostituire con foto reali dell'officina prima del lancio.
|
||||
import interno from '../assets/officina/interno.jpg';
|
||||
import diagnosi from '../assets/officina/diagnosi.jpg';
|
||||
import consulenza from '../assets/officina/consulenza.jpg';
|
||||
import Marchi from '../components/Marchi.astro';
|
||||
import BloccoContatti from '../components/BloccoContatti.astro';
|
||||
|
||||
const og = await getImage({ src: interno, width: 1200, height: 630, fit: 'cover', format: 'jpg' });
|
||||
---
|
||||
<Base
|
||||
title="Autofficina a Udine specializzata in impianti a gas | Officine Zuliani"
|
||||
description="Officine Zuliani, autofficina di Udine: consulenza e installazione di impianti GPL e metano per auto e camper, diagnosi computerizzata, rete Bosch AutoCrew e assistenza BRC."
|
||||
image={og.src}
|
||||
>
|
||||
<div class="wrap page-head su">
|
||||
<p class="kicker">L'officina</p>
|
||||
@@ -13,11 +23,11 @@ import BloccoContatti from '../components/BloccoContatti.astro';
|
||||
<p class="lead">Da anni le Officine Zuliani sono un punto di riferimento a Udine per chi cerca soluzioni che fanno davvero risparmiare sul carburante.</p>
|
||||
</div>
|
||||
|
||||
<div class="wrap strip su">
|
||||
<div class="foto"><b>Foto reale: l'officina in Viale Venezia 446</b></div>
|
||||
<div class="foto"><b>Foto: attrezzatura di diagnosi</b></div>
|
||||
<div class="foto"><b>Foto: il team</b></div>
|
||||
</div>
|
||||
<StripFoto foto={[
|
||||
{ src: interno, alt: "L'interno dell'officina con due ponti sollevatori, banchi attrezzi e il portone aperto sul piazzale" },
|
||||
{ src: diagnosi, alt: "Un meccanico collega lo strumento di diagnosi computerizzata alla presa OBD di un'auto" },
|
||||
{ src: consulenza, alt: "Un meccanico spiega a un cliente l'impianto GPL nel vano motore della sua auto" },
|
||||
]} />
|
||||
|
||||
<section><div class="wrap due">
|
||||
<div class="su"><p class="kicker">Consulenza</p><h2>Ti aiutiamo a scegliere l'impianto giusto.</h2></div>
|
||||
|
||||
@@ -38,7 +38,7 @@ h2{font:800 clamp(34px,4.4vw,58px)/1 var(--display);letter-spacing:-.03em;color:
|
||||
|
||||
/* sections */
|
||||
section{padding:110px 0}
|
||||
.page-head{padding:40px 0 70px}
|
||||
.page-head{padding-top:40px;padding-bottom:70px}
|
||||
.due{display:grid;grid-template-columns:1fr 1fr;gap:64px;align-items:start}
|
||||
|
||||
/* photo slots (placeholder finché non arrivano le foto reali) */
|
||||
|
||||
Reference in New Issue
Block a user