feat(web): PWA — manifest, icone, meta iOS

- src/app/manifest.ts (Next 14 file convention) → /manifest.webmanifest
- public/icons/icon.svg + icon-maskable.svg (vettoriali, palette editoriale)
- scripts/generate-icons.mjs (sharp): genera icon-192/512.png,
  apple-touch-icon-180.png, icon-maskable-512.png, badge-72.png
- layout.tsx: viewport con themeColor light/dark, manifest link,
  appleWebApp meta (capable + title), icons (svg + png + apple touch)
- .eslintrc: ignora scripts Node out-of-project; lint-staged: .mjs format-only

Display standalone, lang it, theme #221d18 (ink) / bg #f6f0df (carta).
Sblocca "Installa app" su Chrome/Edge/Android e "Aggiungi alla Home" su
iOS Safari — quest'ultimo è pre-requisito per ricevere le push su iOS.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
lucianoandClaude Opus 4.7 committed 2026-04-29 22:03:19 +02:00
1 parent bb48357179
commit cf7361f735
14 files changed
+133 -5

No files matched your search

+26 -1
View File
@@ -1,4 +1,4 @@
import type { Metadata } from 'next';
import type { Metadata, Viewport } from 'next';
import { Fraunces, Inter_Tight, JetBrains_Mono } from 'next/font/google';
import { notFound } from 'next/navigation';
import { NextIntlClientProvider } from 'next-intl';
@@ -35,6 +35,16 @@ export function generateStaticParams() {
return locales.map((locale) => ({ locale }));
}
export const viewport: Viewport = {
themeColor: [
{ media: '(prefers-color-scheme: light)', color: '#f6f0df' },
{ media: '(prefers-color-scheme: dark)', color: '#221d18' },
],
width: 'device-width',
initialScale: 1,
// Su iOS standalone mode mantiene il colore della status bar coerente.
};
export async function generateMetadata({
params: { locale },
}: {
@@ -44,6 +54,21 @@ export async function generateMetadata({
return {
title: t('title'),
description: t('description'),
manifest: '/manifest.webmanifest',
applicationName: 'KetoPath',
appleWebApp: {
capable: true,
title: 'KetoPath',
statusBarStyle: 'default',
},
icons: {
icon: [
{ url: '/icons/icon.svg', type: 'image/svg+xml' },
{ url: '/icons/icon-192.png', sizes: '192x192', type: 'image/png' },
{ url: '/icons/icon-512.png', sizes: '512x512', type: 'image/png' },
],
apple: [{ url: '/icons/apple-touch-icon.png', sizes: '180x180', type: 'image/png' }],
},
};
}
+48
View File
@@ -0,0 +1,48 @@
// Web App Manifest (Next.js 14 file convention).
// Servito a /manifest.webmanifest. PRD §5.6 — installabile su iOS/Android per
// abilitare le notifiche push sui dispositivi mobili (vedi ADR 0003).
import type { MetadataRoute } from 'next';
export default function manifest(): MetadataRoute.Manifest {
return {
name: 'KetoPath — Una keto italiana',
short_name: 'KetoPath',
description:
'Chetogenica e digiuno intermittente personalizzati: piani settimanali, lista spesa, notifiche.',
lang: 'it',
start_url: '/',
scope: '/',
display: 'standalone',
orientation: 'portrait',
background_color: '#f6f0df',
theme_color: '#221d18',
categories: ['health', 'lifestyle', 'food'],
icons: [
{
src: '/icons/icon.svg',
sizes: 'any',
type: 'image/svg+xml',
purpose: 'any',
},
{
src: '/icons/icon-192.png',
sizes: '192x192',
type: 'image/png',
purpose: 'any',
},
{
src: '/icons/icon-512.png',
sizes: '512x512',
type: 'image/png',
purpose: 'any',
},
{
src: '/icons/icon-maskable-512.png',
sizes: '512x512',
type: 'image/png',
purpose: 'maskable',
},
],
};
}