alpha01 filetti: web app, crossword service and tor batch

This commit is contained in:
2026-06-05 16:22:17 +02:00
parent 47d8957e15
commit 9cb8a5aa8f
29 changed files with 8590 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
import { notFound } from "next/navigation";
import { CrosswordRuntimePage } from "@/components/crossword-runtime-page";
import { LanguageSwitcher } from "@/components/language-switcher";
import { getDictionary, isLocale } from "@/lib/i18n";
type CrosswordPageProps = {
params: Promise<{ locale: string; id: string }>;
};
export default async function CrosswordPage({ params }: CrosswordPageProps) {
const { locale, id } = await params;
if (!isLocale(locale)) {
notFound();
}
const dict = getDictionary(locale);
return (
<main className="shell stack">
<section className="card play-header">
<div className="hero__topline">
<span className="hero__badge">{dict.play.badge}</span>
<LanguageSwitcher locale={locale} path={`/crosswords/${id}`} />
</div>
<h1 className="page-title">Progetto Enigma</h1>
<p className="page-subtitle">{dict.play.subtitle}</p>
</section>
<CrosswordRuntimePage
id={id}
locale={locale}
labels={{
player: dict.player,
clues: dict.clues,
play: dict.play,
loading: dict.play.loading,
errorPrefix: dict.play.errorPrefix,
}}
/>
</main>
);
}

View File

@@ -0,0 +1,42 @@
import { notFound } from "next/navigation";
import { CrosswordSolutionRuntimePage } from "@/components/crossword-solution-runtime-page";
import { LanguageSwitcher } from "@/components/language-switcher";
import { getDictionary, isLocale } from "@/lib/i18n";
type CrosswordSolutionPageProps = {
params: Promise<{ locale: string; id: string }>;
};
export default async function CrosswordSolutionPage({ params }: CrosswordSolutionPageProps) {
const { locale, id } = await params;
if (!isLocale(locale)) {
notFound();
}
const dict = getDictionary(locale);
return (
<main className="shell stack">
<section className="card play-header">
<div className="hero__topline">
<span className="hero__badge">{dict.solution.badge}</span>
<LanguageSwitcher locale={locale} path={`/crosswords/${id}/solution`} />
</div>
<h1 className="page-title">Progetto Enigma</h1>
<p className="page-subtitle">{dict.solution.subtitle}</p>
</section>
<CrosswordSolutionRuntimePage
id={id}
locale={locale}
labels={{
player: dict.player,
clues: dict.clues,
solution: dict.solution,
loading: dict.play.loading,
errorPrefix: dict.play.errorPrefix,
}}
/>
</main>
);
}

View File

@@ -0,0 +1,34 @@
import { notFound } from "next/navigation";
import { CrosswordConfigForm } from "@/components/crossword-config-form";
import { LanguageSwitcher } from "@/components/language-switcher";
import { getDictionary, isLocale } from "@/lib/i18n";
type NewCrosswordPageProps = {
params: Promise<{ locale: string }>;
};
export default async function NewCrosswordPage({ params }: NewCrosswordPageProps) {
const { locale } = await params;
if (!isLocale(locale)) {
notFound();
}
const dict = getDictionary(locale);
return (
<main className="shell stack">
<section className="hero">
<div className="hero__topline">
<span className="hero__badge">{dict.newPage.badge}</span>
<LanguageSwitcher locale={locale} path="/new" />
</div>
<h1 className="page-title">{dict.newPage.title}</h1>
<p className="page-subtitle">{dict.newPage.subtitle}</p>
</section>
<section className="card panel">
<CrosswordConfigForm locale={locale} dict={dict.form} />
</section>
</main>
);
}

View File

@@ -0,0 +1,85 @@
import Link from "next/link";
import { notFound } from "next/navigation";
import { CrosswordConfigForm } from "@/components/crossword-config-form";
import { LanguageSwitcher } from "@/components/language-switcher";
import { getDictionary, isLocale } from "@/lib/i18n";
import { getMockCrosswordResponse } from "@/lib/mock-crossword";
type LocalizedHomePageProps = {
params: Promise<{ locale: string }>;
};
export default async function LocalizedHomePage({ params }: LocalizedHomePageProps) {
const { locale } = await params;
if (!isLocale(locale)) {
notFound();
}
const dict = getDictionary(locale);
const crossword = getMockCrosswordResponse(locale);
return (
<main className="shell stack">
<section className="hero">
<div className="hero__topline">
<span className="hero__badge">{dict.home.badge}</span>
<LanguageSwitcher locale={locale} />
</div>
<h1>{dict.home.title}</h1>
<p>{dict.home.subtitle}</p>
</section>
<section className="home-grid">
<div className="card panel">
<h2>{dict.home.requestTitle}</h2>
<p className="muted">{dict.home.requestText}</p>
<CrosswordConfigForm locale={locale} dict={dict.form} />
</div>
<div className="stack">
<div className="card panel">
<h2>{dict.home.structureTitle}</h2>
<div className="chip-row">
{dict.home.structureChips.map((chip) => (
<span className="chip" key={chip}>
{chip}
</span>
))}
</div>
<p className="muted contract-note">{dict.home.structureText}</p>
</div>
<div className="card panel">
<h2>{dict.home.demoTitle}</h2>
<div className="kpi-grid">
<div className="kpi">
<span className="muted">{dict.home.kpis.words}</span>
<strong>{crossword.summary.total_words}</strong>
</div>
<div className="kpi">
<span className="muted">{dict.home.kpis.intersections}</span>
<strong>{crossword.summary.intersections}</strong>
</div>
<div className="kpi">
<span className="muted">{dict.home.kpis.rows}</span>
<strong>{crossword.grid.rows}</strong>
</div>
<div className="kpi">
<span className="muted">{dict.home.kpis.cols}</span>
<strong>{crossword.grid.cols}</strong>
</div>
</div>
<div className="actions" style={{ marginTop: 18 }}>
<Link className="button" href={`/${locale}/crosswords/demo-transport`}>
{dict.home.openDemo}
</Link>
<Link className="button button--secondary" href={`/${locale}/new`}>
{dict.home.openConfig}
</Link>
</div>
</div>
</div>
</section>
</main>
);
}