From 8e1205359dd5c12e454ebee17ac66ea5faec4fa7 Mon Sep 17 00:00:00 2001 From: feco Date: Thu, 19 Nov 2026 11:07:13 +0000 Subject: [PATCH] Inviting shown but off until launch; waitlist confirmation; waitlist invites with a package MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit USER_INVITES (default false) keeps users from inviting others until the launch: the 'Meghívom' option and a 'Hívd meg, akit szeretsz' card on the persons page are shown, disabled, with 'Hamarosan'; the backend refuses with invites_disabled (admins may always). Joining the waitlist sends one confirmation e-mail (waitlist_joined) with a link that takes the address off the list and opts it out; at most 10 per address in 15 minutes. Admins can pick a package for waitlist invitations, like on the invitation form. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL --- crates/db/migrations/0025_waitlist_token.sql | 3 + crates/email-templates/src/lib.rs | 63 +++++++++++++++ deploy/docker-compose.yml | 2 + docs/promokodok.md | 7 ++ docs/szemely-meghivas.md | 2 + services/backend/src/config.rs | 6 ++ services/backend/src/routes/invitations.rs | 40 +++++++-- services/backend/src/routes/mod.rs | 1 + services/backend/src/routes/synastries.rs | 3 + services/backend/src/tests.rs | 81 +++++++++++++++++++ .../app/admin/meghivok/AdminInvitations.tsx | 18 ++++- services/frontend/src/app/globals.css | 5 ++ .../src/app/leiratkozas/Unsubscribe.tsx | 5 +- .../frontend/src/app/leiratkozas/page.tsx | 2 +- services/frontend/src/app/szemelyek/page.tsx | 53 ++++++++---- .../src/app/szemelyek/uj/NewPersonChooser.tsx | 17 +++- .../frontend/src/app/szemelyek/uj/page.tsx | 1 + services/frontend/src/lib/types.ts | 2 + 18 files changed, 285 insertions(+), 26 deletions(-) create mode 100644 crates/db/migrations/0025_waitlist_token.sql diff --git a/crates/db/migrations/0025_waitlist_token.sql b/crates/db/migrations/0025_waitlist_token.sql new file mode 100644 index 0000000..d491b3b --- /dev/null +++ b/crates/db/migrations/0025_waitlist_token.sql @@ -0,0 +1,3 @@ +-- The link in the waitlist confirmation e-mail that takes the address off +-- the list (only its hash is kept). +ALTER TABLE waitlist ADD COLUMN token_hash bytea UNIQUE; diff --git a/crates/email-templates/src/lib.rs b/crates/email-templates/src/lib.rs index 2f54b89..73b97b8 100644 --- a/crates/email-templates/src/lib.rs +++ b/crates/email-templates/src/lib.rs @@ -159,6 +159,7 @@ pub fn render(template: &str, locale: &str, payload: &Value) -> Result invitation(lang, payload, url)?, ("synastry_invite", _) => synastry_invite(lang, payload, url)?, + ("waitlist_joined", _) => waitlist_joined(lang, payload, url)?, _ => return Err(TemplateError::UnknownTemplate(template.to_owned())), }; Ok(content.render(lang)) @@ -283,6 +284,56 @@ fn name(payload: &Value, field: &str) -> Option { (!name.is_empty()).then(|| name.to_owned()) } +/// The confirmation of a waitlist sign-up, with the link that takes the address off the list. +fn waitlist_joined(lang: Lang, payload: &Value, url: String) -> Result { + let unsubscribe_url = field(payload, "unsubscribe_url")?; + let unsubscribe_post_url = field(payload, "unsubscribe_post_url")?; + Ok(match lang { + Lang::Hu => Content { + subject: "Felírtunk a Sorsfonalak várólistájára".into(), + preheader: Some("Amint bejuthatsz, ide írunk.".into()), + greeting: "Szia!".into(), + intro: "Köszönjük, hogy kíváncsi vagy a Sorsfonalakra! Az oldal egyelőre zártkörű, de felírtunk a várólistára: amint bejuthatsz, erre a címre írunk." + .into(), + quote: None, + points: Some(( + "Mi vár rád?", + vec![ + "a születési képleted percre pontosan kiszámolva és megrajzolva, egy rövid elemzéssel,", + "részletes elemzés, éves előrejelzés és kapcsolati összevetés azokkal, akiket szeretsz.", + ], + )), + button: "Körülnézek", + url, + note: "Ha nem te iratkoztál fel, vagy meggondoltad magad, a lenti linkkel törölheted a címed a listáról.".into(), + reason: Some("Ezt a levelet azért kaptad, mert ezt a címet megadták a Sorsfonalak várólistáján.".into()), + unsubscribe: Some(("Leiratkozás a várólistáról", unsubscribe_url)), + unsubscribe_post_url: Some(unsubscribe_post_url), + }, + Lang::En => Content { + subject: "You are on the Sorsfonalak waitlist".into(), + preheader: Some("We will write as soon as you can get in.".into()), + greeting: "Hi,".into(), + intro: "Thanks for your interest in Sorsfonalak! The site is invitation-only for now, but you are on the waitlist: we will write to this address as soon as you can get in." + .into(), + quote: None, + points: Some(( + "What awaits you:", + vec![ + "your birth chart, calculated to the minute and drawn, with a short reading,", + "detailed readings, a yearly forecast and comparisons with the people you love.", + ], + )), + button: "Take a look", + url, + note: "If it was not you, or you changed your mind, the link below takes your address off the list.".into(), + reason: Some("You got this e-mail because this address was entered on the Sorsfonalak waitlist.".into()), + unsubscribe: Some(("Leave the waitlist", unsubscribe_url)), + unsubscribe_post_url: Some(unsubscribe_post_url), + }, + }) +} + /// A user invites someone to compare their charts ("how compatible are we?"). fn synastry_invite(lang: Lang, payload: &Value, url: String) -> Result { let inviter = name(payload, "inviter_name"); @@ -539,6 +590,18 @@ mod tests { }) } + #[test] + fn waitlist_confirmation_has_the_leave_link() { + let hu = render("waitlist_joined", "hu", &invitation_payload()).unwrap(); + assert_eq!(hu.subject, "Felírtunk a Sorsfonalak várólistájára"); + assert!( + hu.text.contains("Leiratkozás a várólistáról: https://sorsfonalak.test/leiratkozas?token=abc"), + "{}", + hu.text + ); + assert!(hu.unsubscribe_post_url.is_some()); + } + #[test] fn synastry_invite_names_the_inviter() { let hu = render("synastry_invite", "hu", &invitation_payload()).unwrap(); diff --git a/deploy/docker-compose.yml b/deploy/docker-compose.yml index 265e99c..e5af6d7 100644 --- a/deploy/docker-compose.yml +++ b/deploy/docker-compose.yml @@ -88,6 +88,8 @@ services: # Purchases are off until real payments are connected; packages come # from promo codes and admins (MOCK_PAYMENTS=true: pretend purchases). MOCK_PAYMENTS: ${MOCK_PAYMENTS:-false} + # Users inviting others ("Meghívom"): shown but off until the launch. + USER_INVITES: ${USER_INVITES:-false} FREE_PERSON_SLOTS: ${FREE_PERSON_SLOTS:-0} # invite: new accounts need an invitation (admin page "Meghívók"); open: anyone. SIGNUP_MODE: ${SIGNUP_MODE:-invite} diff --git a/docs/promokodok.md b/docs/promokodok.md index 4a9b4d4..de80cc5 100644 --- a/docs/promokodok.md +++ b/docs/promokodok.md @@ -39,6 +39,13 @@ Az Admin → Meghívók oldalon az „Ajándék csomag” választóval minden m - **Újraküldéskor** a levélben ugyanaz a kód marad. - **Visszavonás:** a meghívó visszavonása a még fel nem használt kódot is visszavonja. - **A meghívók listájában** látszik a csomag, és hogy beváltották-e. +- **A várólistán lévőket** is csomaggal lehet meghívni: a „Várólista” táblázat fölötti választóval a „Meghívás” gomb azzal a csomaggal küldi a meghívót. + +## Várólista + +- **Visszaigazolás:** aki feliratkozik, egyszer kap egy visszaigazoló levelet (`waitlist_joined`), benne leiratkozó linkkel. +- **Leiratkozás:** a link leveszi a címet a listáról, és felveszi a „nem kér levelet” listára, így meghívót sem küldünk oda többet. +- **Korlát:** IP-címenként 15 percen belül legfeljebb 10 levél megy ki, hogy az űrlappal ne lehessen mások postafiókját elárasztani. A lista legfeljebb 10 000 cím. ## API diff --git a/docs/szemely-meghivas.md b/docs/szemely-meghivas.md index 0328493..e114392 100644 --- a/docs/szemely-meghivas.md +++ b/docs/szemely-meghivas.md @@ -5,6 +5,8 @@ Az „Új személy” oldalon két lehetőség van: - **Adatok megadása:** a felhasználó maga írja be a születési adatokat. Ez egy személyhelyet használ, ahogy eddig. - **Meghívom:** egy „Mennyire illünk össze?” meghívó (`synastry_invites`). A meghívott a saját adatait adja meg. Személyhely nem kell hozzá, és akkor is működik, ha a helyek elfogytak. +**Az élesítésig ki van kapcsolva:** a „Meghívom” lehetőség és a Személyek oldal „Hívd meg, akit szeretsz” kártyája látszik, de „Hamarosan” felirattal le van tiltva. A backend `invites_disabled` hibával utasítja el. Bekapcsolás: `USER_INVITES=true` a szerver `.env` fájljában. Az adminok a kapcsolótól függetlenül meghívhatnak, hogy ki tudják próbálni. + ## Menete 1. **A meghívó elkészül.** A meghívó megadhatja, kinek szól (ezt csak ő látja), a meghívott e-mail-címét (nem kötelező) és egy üzenetet (legfeljebb 300 karakter, link nélkül). A link `/meghivas/`, 14 napig érvényes. Megosztható másolással, a telefon megosztás menüjével, WhatsAppon vagy Facebookon. diff --git a/services/backend/src/config.rs b/services/backend/src/config.rs index 308e89b..499e2d4 100644 --- a/services/backend/src/config.rs +++ b/services/backend/src/config.rs @@ -45,6 +45,10 @@ pub struct Config { /// `MOCK_PAYMENTS` (default `false`): a stand-in payment that adds an /// analysis unit at once, until Stripe is connected. pub mock_payments: bool, + /// `USER_INVITES` (default `false`): users may invite others ("how + /// compatible are we?" links, which also let the invitee sign up). Off + /// until the launch; admins may always. + pub user_invites: bool, /// `GOOGLE_CLIENT_IDS`: comma-separated OAuth client ids accepted as the /// ID token audience; empty disables Google login. pub google_client_ids: Vec, @@ -119,6 +123,7 @@ impl Config { session_ttl_days: parsed("SESSION_TTL_DAYS", 30)?, password_login: parsed("PASSWORD_LOGIN", false)?, mock_payments: parsed("MOCK_PAYMENTS", false)?, + user_invites: parsed("USER_INVITES", false)?, google_client_ids: list("GOOGLE_CLIENT_IDS"), google_jwks_url: var("GOOGLE_JWKS_URL") .unwrap_or_else(|| "https://www.googleapis.com/oauth2/v3/certs".into()), @@ -156,6 +161,7 @@ impl Config { session_ttl_days: 30, password_login: true, mock_payments: true, + user_invites: true, google_client_ids: vec!["test-client.apps.googleusercontent.com".into()], google_jwks_url, bootstrap_admin_emails: vec!["admin@example.com".into()], diff --git a/services/backend/src/routes/invitations.rs b/services/backend/src/routes/invitations.rs index fda232e..c36b859 100644 --- a/services/backend/src/routes/invitations.rs +++ b/services/backend/src/routes/invitations.rs @@ -587,10 +587,12 @@ pub async fn unsubscribe( WithRejection(Query(q), _): WithRejection, ApiError>, ) -> ApiResult> { let mut tx = state.db.begin().await?; - // The link of a site invitation, or of a "how compatible are we?" one a user had us e-mail. + // The link of a site invitation, of a "how compatible are we?" one a user + // had us e-mail, or of the waitlist confirmation. let email: Option = sqlx::query_scalar( "SELECT i.email FROM invitation_tokens t JOIN invitations i ON i.id = t.invitation_id WHERE t.token_hash = $1 \ UNION ALL SELECT invitee_email FROM synastry_invites WHERE token_hash = $1 AND invitee_email IS NOT NULL \ + UNION ALL SELECT email FROM waitlist WHERE token_hash = $1 \ LIMIT 1", ) .bind(db::token_hash(q.token.trim())) @@ -607,6 +609,7 @@ pub async fn unsubscribe( .bind(&email) .execute(&mut *tx) .await?; + sqlx::query("DELETE FROM waitlist WHERE email = $1").bind(&email).execute(&mut *tx).await?; tx.commit().await?; Ok(Json(json!({ "unsubscribed": true }))) } @@ -621,19 +624,46 @@ pub struct WaitlistRequest { /// Joins the waitlist. Always answers the same, so it does not reveal who has an account. pub async fn join_waitlist( State(state): St, + headers: axum::http::HeaderMap, WithRejection(Json(req), _): Body, ) -> ApiResult<(StatusCode, Json)> { let email = normalize_email(&req.email)?; let locale = validate_locale(&state, req.locale.as_deref())?; - sqlx::query( - "INSERT INTO waitlist (email, locale) SELECT $1, $2 \ + // Every sign-up sends an e-mail: a few per address, so the form cannot be used to flood someone. + let ip = headers + .get("x-forwarded-for") + .and_then(|v| v.to_str().ok()) + .and_then(|v| v.split(',').next()) + .map(str::trim) + .unwrap_or("unknown"); + let key = format!("waitlist:{ip}"); + state.login_limiter.check(&key)?; + let token = db::new_token(); + let mut tx = state.db.begin().await?; + let added = sqlx::query( + "INSERT INTO waitlist (email, locale, token_hash) SELECT $1, $2, $3 \ WHERE NOT EXISTS (SELECT 1 FROM users WHERE email = $1) \ AND (SELECT count(*) FROM waitlist) < 10000 \ ON CONFLICT DO NOTHING", ) .bind(&email) .bind(&locale) - .execute(&state.db) - .await?; + .bind(db::token_hash(&token)) + .execute(&mut *tx) + .await? + .rows_affected() + == 1; + // A confirmation, once, unless the address asked for no more mail from us. + if added && !opted_out(&mut tx, &email).await? { + let (_, unsubscribe_url, unsubscribe_post_url) = links(&state, &token); + let payload = json!({ + "url": state.config.public_base_url, + "unsubscribe_url": unsubscribe_url, + "unsubscribe_post_url": unsubscribe_post_url, + }); + queue_email_to(&mut tx, None, &email, "waitlist_joined", &locale, payload).await?; + state.login_limiter.failed(&key); + } + tx.commit().await?; Ok((StatusCode::ACCEPTED, Json(json!({ "ok": true })))) } diff --git a/services/backend/src/routes/mod.rs b/services/backend/src/routes/mod.rs index 3336334..ce27b7f 100644 --- a/services/backend/src/routes/mod.rs +++ b/services/backend/src/routes/mod.rs @@ -162,6 +162,7 @@ async fn public_config(State(state): St) -> Json { "locales": c.supported_locales, "password_login": c.password_login, "mock_payments": c.mock_payments, + "user_invites": c.user_invites, "signup_mode": c.signup_mode.as_str(), "password_min_length": crate::auth::MIN_PASSWORD_LEN, })) diff --git a/services/backend/src/routes/synastries.rs b/services/backend/src/routes/synastries.rs index 151ad5e..3370eca 100644 --- a/services/backend/src/routes/synastries.rs +++ b/services/backend/src/routes/synastries.rs @@ -260,6 +260,9 @@ pub async fn create_invite( auth: AuthUser, WithRejection(Json(req), _): Body, ) -> ApiResult<(StatusCode, Json)> { + if !state.config.user_invites && !auth.user.has_role(db::Role::Admin) { + return Err(ApiError::conflict("invites_disabled", "A meghívás hamarosan indul.")); + } let chart = chart_or_primary(&state.db, req.chart_id, auth.id()).await?; // No links: the message may go out in an e-mail from our domain. let message = super::invitations::clean_message(req.message)?; diff --git a/services/backend/src/tests.rs b/services/backend/src/tests.rs index 5738de3..6051d5b 100644 --- a/services/backend/src/tests.rs +++ b/services/backend/src/tests.rs @@ -2056,3 +2056,84 @@ async fn an_invitation_brings_its_package_and_codes_fill_up(pool: PgPool) { (Some(2), Some(1), Some(5)) ); } + +#[sqlx::test(migrator = "db::MIGRATOR")] +async fn the_waitlist_confirms_and_can_be_left(pool: PgPool) { + let app = TestApp::with_config(pool.clone(), |c| c.signup_mode = crate::config::SignupMode::Invite).await; + let admin = app.register("admin@example.com", "Admin").await; + let from = |ip: &'static str| [("x-forwarded-for", ip)]; + + // one confirmation per address, even when sent again + for _ in 0..2 { + let r = app + .call_with( + "POST", + "/v1/public/waitlist", + None, + Some(json!({"email": "Wait@Example.com"})), + &from("198.51.100.7"), + ) + .await; + assert_eq!(r.status, StatusCode::ACCEPTED); + } + let mails: Vec<(Value,)> = sqlx::query_as( + "SELECT payload FROM email_outbox WHERE to_email = 'wait@example.com' AND template = 'waitlist_joined'", + ) + .fetch_all(&pool) + .await + .unwrap(); + assert_eq!(mails.len(), 1); + let leave = mails[0].0["unsubscribe_post_url"].as_str().unwrap().to_string(); + let token = leave.rsplit("token=").next().unwrap().to_string(); + + // leaving: off the list, and no invitation can be sent there any more + let r = app.call("POST", &format!("/v1/public/invitations/unsubscribe?token={token}"), None, None).await; + assert_eq!(r.status, StatusCode::OK, "{}", r.body); + assert!(app.get("/v1/admin/invitations", Some(&admin)).await.body["waitlist"].as_array().unwrap().is_empty()); + let r = app.post("/v1/admin/invitations", Some(&admin), json!({"emails": ["wait@example.com"]})).await; + assert_eq!(r.body["results"][0]["status"], "opted_out"); + // and signing up again sends nothing + app.call_with( + "POST", + "/v1/public/waitlist", + None, + Some(json!({"email": "wait@example.com"})), + &from("198.51.100.8"), + ) + .await; + let count: i64 = sqlx::query_scalar("SELECT count(*) FROM email_outbox WHERE to_email = 'wait@example.com'") + .fetch_one(&pool) + .await + .unwrap(); + assert_eq!(count, 1); + + // one address cannot flood the form + let mut last = StatusCode::OK; + for i in 0..12 { + let r = app + .call_with( + "POST", + "/v1/public/waitlist", + None, + Some(json!({"email": format!("w{i}@example.com")})), + &from("203.0.113.9"), + ) + .await; + last = r.status; + } + assert_eq!(last, StatusCode::TOO_MANY_REQUESTS); +} + +#[sqlx::test(migrator = "db::MIGRATOR")] +async fn user_invitations_wait_for_the_launch(pool: PgPool) { + let app = TestApp::with_config(pool, |c| c.user_invites = false).await; + assert_eq!(app.get("/v1/config", None).await.body["user_invites"], false); + let anna = app.register("anna@example.com", "Anna").await; + app.chart(&anna, "Saját", true, "1990-03-15").await; + let r = app.post("/v1/invites", Some(&anna), json!({"label": "Béla"})).await; + assert_eq!((r.status, r.body["error"]["code"].as_str()), (StatusCode::CONFLICT, Some("invites_disabled"))); + // admins may, to try it + let admin = app.register("admin@example.com", "Admin").await; + app.chart(&admin, "Saját", true, "1980-01-01").await; + assert_eq!(app.post("/v1/invites", Some(&admin), json!({})).await.status, StatusCode::CREATED); +} diff --git a/services/frontend/src/app/admin/meghivok/AdminInvitations.tsx b/services/frontend/src/app/admin/meghivok/AdminInvitations.tsx index 90b281c..0602de8 100644 --- a/services/frontend/src/app/admin/meghivok/AdminInvitations.tsx +++ b/services/frontend/src/app/admin/meghivok/AdminInvitations.tsx @@ -403,13 +403,15 @@ function InvitationRow({ invitation: i, onChange }: { invitation: AdminInvitatio function WaitlistTable({ waitlist, onChange }: { waitlist: WaitlistEntry[]; onChange: () => Promise }) { const [busy, setBusy] = useState(null); const [note, setNote] = useState(null); + const [pkg, setPkg] = useState(""); + const packages = usePackages(); async function invite(w: WaitlistEntry) { setBusy(w.email); setNote(null); try { const res = await api<{ results: InvitationResult[] }>("/admin/invitations", { - body: { emails: [w.email], locale: w.locale }, + body: { emails: [w.email], locale: w.locale, package: pkg || null }, }); const r = res.results[0]; if (r && r.status !== "invited") setNote(`${r.email}: ${RESULT[r.status]}`); @@ -440,6 +442,20 @@ function WaitlistTable({ waitlist, onChange }: { waitlist: WaitlistEntry[]; onCh Várólista

Akik meghívó nélkül próbáltak belépni, és kérték, hogy szóljunk nekik.

+ {waitlist.some((w) => w.invitation === null) && ( +
+ + + A „Meghívás” gomb ezzel a csomaggal küldi a meghívót; a regisztrációkor magától jóváíródik. +
+ )} {note && (

{note} diff --git a/services/frontend/src/app/globals.css b/services/frontend/src/app/globals.css index 812d425..58e9666 100644 --- a/services/frontend/src/app/globals.css +++ b/services/frontend/src/app/globals.css @@ -909,3 +909,8 @@ a.pair-row:hover strong { color: var(--gold); } .lp-wheel .w-aspect { stroke-dashoffset: 0; } .lp-wheel .w-aspect.w-asp-sextile { opacity: 1; } } + +.mode-option:disabled { cursor: not-allowed; opacity: 0.75; } +.mode-option:disabled:hover { border-color: var(--line-2); } +.mode-soon { margin-left: 8px; vertical-align: middle; font-family: var(--font-body); font-size: 11px; } +.invite-soon .btn:disabled { cursor: not-allowed; } diff --git a/services/frontend/src/app/leiratkozas/Unsubscribe.tsx b/services/frontend/src/app/leiratkozas/Unsubscribe.tsx index a83346a..19b84f2 100644 --- a/services/frontend/src/app/leiratkozas/Unsubscribe.tsx +++ b/services/frontend/src/app/leiratkozas/Unsubscribe.tsx @@ -20,7 +20,7 @@ export function Unsubscribe({ token }: { token: string | null }) { if (state === "done") { return (

- Leiratkoztál: erre a címre nem küldünk több meghívót. + Leiratkoztál: erre a címre nem küldünk több meghívót, és levettük a várólistáról.

); } @@ -40,7 +40,8 @@ export function Unsubscribe({ token }: { token: string | null }) { return (

- Ha leiratkozol, erre az e-mail-címre többé nem küldünk meghívót, és a mostani meghívód is érvényét veszti. + Ha leiratkozol, erre az e-mail-címre többé nem küldünk meghívót, levesszük a várólistáról, és a mostani meghívód + is érvényét veszti.

- + {invitesOpen ? ( + + ) : ( +
+
+

Hívd meg, akit szeretsz

+ Hamarosan +
+

+ Hamarosan te is meghívhatod a barátaidat, a családodat vagy a párodat: ők megadják a saját születési adataikat, + ingyen megkapják a képletüket, és együtt megnézitek, mennyire illetek össze. +

+
+ +
+
+ )} {!slots.unlimited && (
diff --git a/services/frontend/src/app/szemelyek/uj/NewPersonChooser.tsx b/services/frontend/src/app/szemelyek/uj/NewPersonChooser.tsx index 495745e..baa3250 100644 --- a/services/frontend/src/app/szemelyek/uj/NewPersonChooser.tsx +++ b/services/frontend/src/app/szemelyek/uj/NewPersonChooser.tsx @@ -14,16 +14,19 @@ import { NewPerson } from "./NewPerson"; export function NewPersonChooser({ canAdd, hasOwnChart, + invitesOpen, full, }: { /** A slot is free for typed-in data. */ canAdd: boolean; + /** Inviting is on (until the launch it is shown, but off). */ + invitesOpen: boolean; /** Inviting compares with the user's own chart. */ hasOwnChart: boolean; /** Shown instead of the form when no slot is left. */ full: React.ReactNode; }) { - const [mode, setMode] = useState<"data" | "invite">(canAdd ? "data" : "invite"); + const [mode, setMode] = useState<"data" | "invite">(canAdd || !invitesOpen ? "data" : "invite"); return (
@@ -41,11 +44,19 @@ export function NewPersonChooser({ type="button" role="tab" aria-selected={mode === "invite"} + aria-disabled={!invitesOpen} + disabled={!invitesOpen} className="mode-option" onClick={() => setMode("invite")} > - Meghívom - Ő adja meg a saját adatait, és megnézitek, mennyire illetek össze. Ingyenes, nem kell hozzá hely. + + Meghívom {!invitesOpen && Hamarosan} + + + {invitesOpen + ? "Ő adja meg a saját adatait, és megnézitek, mennyire illetek össze. Ingyenes, nem kell hozzá hely." + : "Hamarosan meghívhatod azokat, akiket szeretsz: ők adják meg a saját adataikat, és együtt nézitek meg, mennyire illetek össze."} +
{mode === "data" ? ( diff --git a/services/frontend/src/app/szemelyek/uj/page.tsx b/services/frontend/src/app/szemelyek/uj/page.tsx index d3de651..05d0fe6 100644 --- a/services/frontend/src/app/szemelyek/uj/page.tsx +++ b/services/frontend/src/app/szemelyek/uj/page.tsx @@ -27,6 +27,7 @@ export default async function NewPersonPage() {

Elfogytak a helyeid. Újabb személyhez válassz csomagot, vagy hívd meg.

diff --git a/services/frontend/src/lib/types.ts b/services/frontend/src/lib/types.ts index 26bbd3f..a687c3b 100644 --- a/services/frontend/src/lib/types.ts +++ b/services/frontend/src/lib/types.ts @@ -92,6 +92,8 @@ export interface PublicConfig { mock_payments: boolean; /** "invite": new accounts need an invitation. */ signup_mode: "invite" | "open"; + /** Users may invite others (off until the launch; admins always may). */ + user_invites: boolean; } export interface Position {