Deploy only what changed; pages notice a new version; home page: personal analyses
- CI: ci/changed-services.sh compares HEAD with the last deployment's v* tag: the Rust tests run only when a Rust service changed, only the changed images are built, and the server's .env gets a tag per built service (TAG_FRONTEND, TAG_BACKEND, ...; TAG stays the fallback), so only their containers restart. Everything when in doubt. - The frontend image knows its version (APP_VERSION, the commit): Next's deploymentId (a page from an older version reloads on navigation) and /api/version. VersionWatcher checks every 5 minutes and when the tab comes to the front: idle with nothing typed, the page reloads; otherwise a "Frissült az oldal" notice offers it. - Home page: "Nem sablonszöveg, hanem a te elemzésed" in the hero, the "Miért más?" section now about analyses written for each chart; the two hero buttons side by side on phones. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
@@ -6,14 +6,17 @@ RUN --mount=type=cache,target=/root/.npm,sharing=locked npm ci --no-audit --no-f
|
||||
|
||||
FROM node:22.23-alpine AS build
|
||||
WORKDIR /app
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
# The commit being built (the CI passes it): Next's deployment id and /api/version.
|
||||
ARG APP_VERSION=""
|
||||
ENV NEXT_TELEMETRY_DISABLED=1 APP_VERSION=$APP_VERSION
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
|
||||
FROM node:22.23-alpine
|
||||
WORKDIR /app
|
||||
ENV NODE_ENV=production NEXT_TELEMETRY_DISABLED=1 PORT=3000 HOSTNAME=0.0.0.0
|
||||
ARG APP_VERSION=""
|
||||
ENV NODE_ENV=production NEXT_TELEMETRY_DISABLED=1 PORT=3000 HOSTNAME=0.0.0.0 APP_VERSION=$APP_VERSION
|
||||
RUN addgroup -S app && adduser -S -G app app
|
||||
COPY --from=build --chown=app:app /app/.next/standalone ./
|
||||
COPY --from=build --chown=app:app /app/.next/static ./.next/static
|
||||
|
||||
@@ -4,6 +4,10 @@ const config: NextConfig = {
|
||||
// Small self-contained server for the container image.
|
||||
output: "standalone",
|
||||
poweredByHeader: false,
|
||||
// The image's version (the commit, APP_VERSION from the CI build): a page
|
||||
// loaded from an older version reloads itself on its next navigation, and
|
||||
// VersionWatcher offers a reload when a new one is out. None in development.
|
||||
deploymentId: process.env.APP_VERSION || undefined,
|
||||
// The fonts of the share preview images are read from disk at run time.
|
||||
outputFileTracingIncludes: {
|
||||
"/s/[slug]/kep/[file]": ["./src/assets/og/*.ttf"],
|
||||
|
||||
@@ -71,10 +71,23 @@ export function Landing({ inviteOnly, loggedIn = false }: { inviteOnly: boolean;
|
||||
Add meg, mikor és hol születtél: percre pontosan kiszámoljuk a képletedet, és személyre szóló elemzést írunk
|
||||
belőle. Megmutatjuk, mit hoz az éved, és mennyire illetek össze azzal, akit szeretsz.
|
||||
</p>
|
||||
<p className="ai-line lp-ai-line lp-rise lp-r3">
|
||||
Részletes, személyre szóló elemzések a legfejlettebb AI-modellekkel: percek alatt, egy személyes konzultáció
|
||||
árának töredékéért.
|
||||
</p>
|
||||
<div className="lp-personal lp-rise lp-r3">
|
||||
<svg aria-hidden="true" viewBox="0 0 24 24" className="lp-personal-icon">
|
||||
<path d="M12 3.5a7.5 7.5 0 0 1 7.5 7.5c0 3-.6 5.7-1.6 7.8" />
|
||||
<path d="M4.5 11a7.5 7.5 0 0 1 3-6" />
|
||||
<path d="M8 11a4 4 0 0 1 8 0c0 3.4-.9 6.4-2.3 8.6" />
|
||||
<path d="M12 11c0 3.8-1.2 6.9-3.2 9" />
|
||||
<path d="M4.6 14.5c.4 1.8.2 3.4-.4 4.6" />
|
||||
</svg>
|
||||
<div>
|
||||
<strong className="lp-personal-title">Nem sablonszöveg, hanem a te elemzésed</strong>
|
||||
<p className="lp-personal-text">
|
||||
Sok horoszkópoldalon előre megírt bekezdések állnak össze: minden Halak ugyanazt kapja. Itt minden
|
||||
elemzés a te képletedből készül. Nem azt olvasod, hogy „a Halak érzékeny”, hanem hogy a te Halak Napod a
|
||||
te házaidban, a te fényszögeiddel mit jelent, percek alatt, a legfejlettebb AI-modellekkel.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="lp-actions lp-rise lp-r4">
|
||||
<Link href={start} className="btn btn-primary lp-btn">
|
||||
{signIn}
|
||||
@@ -195,7 +208,7 @@ export function Landing({ inviteOnly, loggedIn = false }: { inviteOnly: boolean;
|
||||
<div className="lp-intro">
|
||||
<span className="eyebrow">Miért más?</span>
|
||||
<h2 id="why-title" className="lp-h2">
|
||||
Alapos elemzés, töredék áron
|
||||
Személyre szabott, nem előre megírt
|
||||
</h2>
|
||||
</div>
|
||||
<ul className="lp-why-grid">
|
||||
@@ -204,10 +217,11 @@ export function Landing({ inviteOnly, loggedIn = false }: { inviteOnly: boolean;
|
||||
<path d="M12 3l1.8 4.6L18.5 9l-4.7 1.6L12 15l-1.8-4.4L5.5 9l4.7-1.4z" />
|
||||
<path d="M18 15l.9 2.1L21 18l-2.1.9L18 21l-.9-2.1L15 18l2.1-.9z" />
|
||||
</svg>
|
||||
<h3 className="lp-step-title">A legfejlettebb AI-modellek</h3>
|
||||
<h3 className="lp-step-title">Minden mondat rólad szól</h3>
|
||||
<p className="lp-small">
|
||||
Az elemzéseket a legújabb, legnagyobb nyelvi modellek írják, a te képleted pontosan kiszámolt adataiból. Nem
|
||||
sablonszövegekből rakjuk össze: minden mondat a te képletedről szól.
|
||||
Nem csillagjegyenként előre megírt szövegekből rakjuk össze. A legújabb, legnagyobb nyelvi modellek a te
|
||||
képleted pontosan kiszámolt adataiból írják meg, ezért két ember elemzése akkor is más, ha ugyanaz a
|
||||
csillagjegyük.
|
||||
</p>
|
||||
</li>
|
||||
<li className="card lp-why-card">
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
// The version this frontend runs (the commit it was built from), for the
|
||||
// pages' new-version notice (VersionWatcher). null in development.
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export function GET() {
|
||||
return Response.json({ version: process.env.APP_VERSION || null }, { headers: { "cache-control": "no-store" } });
|
||||
}
|
||||
@@ -1814,3 +1814,28 @@ span.tarot-fan-card { cursor: default; }
|
||||
}
|
||||
.pw-eye:hover, .pw-eye:focus-visible { color: var(--gold); }
|
||||
.pw-eye svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
|
||||
|
||||
/* The home page: analyses written for each chart, not template texts. */
|
||||
.lp-personal {
|
||||
display: flex; gap: 14px; align-items: flex-start; max-width: 560px; padding: 16px 18px;
|
||||
border: 1px solid rgba(217, 180, 106, 0.35); border-radius: 14px; background: rgba(217, 180, 106, 0.07);
|
||||
}
|
||||
.lp-personal-icon { width: 30px; height: 30px; flex: none; margin-top: 2px; fill: none; stroke: var(--gold); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
|
||||
.lp-personal-title { display: block; color: var(--ink); font-size: 17px; font-weight: 600; margin-bottom: 4px; }
|
||||
.lp-personal-text { margin: 0; color: var(--ink-2); font-size: 15.5px; line-height: 1.6; }
|
||||
/* Phones: the hero's two buttons side by side (each takes half the row). */
|
||||
@media (max-width: 479px) {
|
||||
.lp-hero .lp-actions { flex-wrap: nowrap; gap: 10px; }
|
||||
.lp-hero .lp-actions .lp-btn { flex: 1 1 auto; min-width: 0; padding: 0 14px; font-size: 15px; text-align: center; }
|
||||
}
|
||||
|
||||
/* "Frissült az oldal": a new version is out (VersionWatcher). */
|
||||
.update-note {
|
||||
position: fixed; top: calc(12px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 80;
|
||||
display: flex; align-items: center; gap: 12px; width: max-content; max-width: calc(100vw - 24px); padding: 10px 12px 10px 16px;
|
||||
background: var(--panel, #121a2e); color: var(--ink, #ece6d8); border: 1px solid var(--gold); border-radius: 14px;
|
||||
box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35); font-size: 15px;
|
||||
}
|
||||
.update-note-later { border: 0; background: none; color: var(--ink-2, #c9cfdc); font: inherit; font-size: 14px; cursor: pointer; padding: 6px; }
|
||||
.update-note-later:hover { color: var(--gold); }
|
||||
@media (max-width: 479px) { .update-note { flex-wrap: wrap; justify-content: center; text-align: center; } }
|
||||
|
||||
@@ -9,6 +9,7 @@ import { PaymentReturn } from "@/components/PaymentReturn";
|
||||
import { SiteFooter } from "@/components/PublicFooter";
|
||||
import { SiteHeader } from "@/components/SiteHeader";
|
||||
import { ValidationMessages } from "@/components/ValidationMessages";
|
||||
import { VersionWatcher } from "@/components/VersionWatcher";
|
||||
import { getMe } from "@/lib/server";
|
||||
import { loadSky } from "@/lib/sky";
|
||||
import { siteUrl } from "@/lib/share";
|
||||
@@ -44,6 +45,7 @@ export default async function RootLayout({ children }: { children: React.ReactNo
|
||||
<body>
|
||||
<NightSky />
|
||||
<KeyboardSafe />
|
||||
<VersionWatcher />
|
||||
<ValidationMessages />
|
||||
{me && <SiteHeader me={me} sky={sky} />}
|
||||
{children}
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
/** How often an open page asks (only while it is in front). */
|
||||
const EVERY_MS = 5 * 60 * 1000;
|
||||
/** No key, click or touch for this long counts as idle. */
|
||||
const IDLE_MS = 2 * 60 * 1000;
|
||||
|
||||
/** Typed text that a reload would lose (a reply being written, a form filled in). */
|
||||
function unsaved(): boolean {
|
||||
const fields = document.querySelectorAll<HTMLInputElement | HTMLTextAreaElement>(
|
||||
"textarea, input:not([type]), input[type=text], input[type=email], input[type=search], input[type=password]",
|
||||
);
|
||||
return Array.from(fields).some(
|
||||
(f) => !f.readOnly && !f.disabled && f.value.trim() !== "" && f.value !== f.defaultValue,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* When a new version of the site is out (its /api/version differs from the
|
||||
* one this page was built from, Next's `data-dpl-id`): an idle page with
|
||||
* nothing typed in reloads itself; otherwise a small notice offers the reload.
|
||||
* (A click on a link reloads anyway: Next's skew protection.)
|
||||
*/
|
||||
export function VersionWatcher() {
|
||||
const [fresh, setFresh] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
const mine = document.documentElement.dataset.dplId;
|
||||
if (!mine) return;
|
||||
let lastInput = Date.now();
|
||||
let dismissed = false;
|
||||
const touched = () => {
|
||||
lastInput = Date.now();
|
||||
};
|
||||
const check = async () => {
|
||||
if (document.visibilityState !== "visible" || dismissed) return;
|
||||
try {
|
||||
const res = await fetch("/api/version", { cache: "no-store" });
|
||||
const { version } = (await res.json()) as { version: string | null };
|
||||
if (!version || version === mine) return;
|
||||
const idle = Date.now() - lastInput > IDLE_MS;
|
||||
if (idle && !unsaved() && !document.querySelector("dialog[open]")) window.location.reload();
|
||||
else setFresh(true);
|
||||
} catch {
|
||||
// Offline or mid-deployment: the next check tries again.
|
||||
}
|
||||
};
|
||||
const timer = window.setInterval(check, EVERY_MS);
|
||||
const onVisible = () => document.visibilityState === "visible" && void check();
|
||||
document.addEventListener("visibilitychange", onVisible);
|
||||
window.addEventListener("focus", onVisible);
|
||||
window.addEventListener("online", onVisible);
|
||||
for (const e of ["keydown", "pointerdown", "touchstart"]) window.addEventListener(e, touched, { passive: true });
|
||||
const later = () => {
|
||||
dismissed = true;
|
||||
setFresh(false);
|
||||
window.setTimeout(() => (dismissed = false), 30 * 60 * 1000);
|
||||
};
|
||||
window.addEventListener("version-watcher:later", later);
|
||||
return () => {
|
||||
window.clearInterval(timer);
|
||||
document.removeEventListener("visibilitychange", onVisible);
|
||||
window.removeEventListener("focus", onVisible);
|
||||
window.removeEventListener("online", onVisible);
|
||||
for (const e of ["keydown", "pointerdown", "touchstart"]) window.removeEventListener(e, touched);
|
||||
window.removeEventListener("version-watcher:later", later);
|
||||
};
|
||||
}, []);
|
||||
|
||||
if (!fresh) return null;
|
||||
return (
|
||||
<div className="update-note" role="status">
|
||||
<span>Frissült az oldal: elérhető az új változata.</span>
|
||||
<button type="button" className="btn btn-primary btn-sm" onClick={() => window.location.reload()}>
|
||||
Frissítés
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="update-note-later"
|
||||
aria-label="Később"
|
||||
onClick={() => window.dispatchEvent(new Event("version-watcher:later"))}
|
||||
>
|
||||
Később
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user