hashquiz 1.0.0-beta.6 → 1.0.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +2 -7
- package/README.md +16 -0
- package/bin/hashquiz.js +355 -33
- package/package.json +1 -1
- package/supabase/migrations/20261130170000_lead_details.sql +9 -0
- package/web/assets/LeadForm-BqFRKn77.css +1 -0
- package/web/assets/LeadForm-CyU9p-NC.js +1 -0
- package/web/assets/SoloCatalog-BCqcjepQ.css +1 -0
- package/web/assets/SoloCatalog-N7vmcKBX.js +1 -0
- package/web/assets/SoloEndView-1nOIZgLK.js +1 -0
- package/web/assets/SoloEndView-C8NIAqeJ.css +1 -0
- package/web/assets/SoloIntroView-D1lYB8yi.js +1 -0
- package/web/assets/SoloLeaderboard-Cnw01tuX.js +1 -0
- package/web/assets/{SoloQuestionView-Cmf4MYWt.js → SoloQuestionView-BhuykIzF.js} +15 -15
- package/web/assets/{decks-CILP6Nug.js → decks-BNiNpRoi.js} +1 -1
- package/web/assets/{decks-DyA4U4Wi.js → decks-VuEnO8Am.js} +1 -1
- package/web/assets/deps-BokiFfKQ.js +1 -0
- package/web/assets/{index-D_fGdCHX.css → index-BzQ6jGVm.css} +1 -1
- package/web/assets/{index-DX4WkM4r.js → index-t6uIRzOv.js} +15 -15
- package/web/assets/solo-backend-CBEhye1F.js +1 -0
- package/web/index.html +2 -2
- package/web/assets/SoloCatalog-C2yyeNv7.css +0 -1
- package/web/assets/SoloCatalog-DTBlhnsB.js +0 -1
- package/web/assets/SoloEndView-Bn5FrTy9.css +0 -1
- package/web/assets/SoloEndView-BnFyJZ3B.js +0 -1
- package/web/assets/SoloIntroView-ojLTuZHH.js +0 -1
- package/web/assets/SoloLeaderboard-eVHseNB2.js +0 -1
- package/web/assets/deps-Rtqf7cy6.js +0 -1
- package/web/assets/solo-backend-DxFnwiPI.js +0 -1
- /package/web/assets/{solo-YNcyK1fh.js → format-5Txm-oDf.js} +0 -0
package/LICENSE.md
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
# HashQuiz licensing
|
|
2
2
|
|
|
3
|
-
> **DRAFT — not yet reviewed by a lawyer.** The texts below describe the intended licensing model.
|
|
4
|
-
> They must be reviewed before the repository is made public.
|
|
5
|
-
|
|
6
3
|
HashQuiz is **fair-code open-core**. The repository contains code under three licenses.
|
|
7
4
|
See [`docs/LICENSING.md`](docs/LICENSING.md) for a plain-language FAQ.
|
|
8
5
|
|
|
@@ -14,15 +11,13 @@ See [`docs/LICENSING.md`](docs/LICENSING.md) for a plain-language FAQ.
|
|
|
14
11
|
|
|
15
12
|
When a directory contains its own `LICENSE` file, that file takes precedence for its contents.
|
|
16
13
|
|
|
17
|
-
Versions of HashQuiz released before this change (up to and including v2.0.0) remain available under the MIT license.
|
|
18
|
-
|
|
19
14
|
---
|
|
20
15
|
|
|
21
16
|
## HashQuiz Sustainable Use License
|
|
22
17
|
|
|
23
|
-
Version 1.0
|
|
18
|
+
Version 1.0
|
|
24
19
|
|
|
25
|
-
Copyright (c) 2024-present
|
|
20
|
+
Copyright (c) 2024-present White Wood Tech
|
|
26
21
|
|
|
27
22
|
### Acceptance
|
|
28
23
|
|
package/README.md
CHANGED
|
@@ -50,6 +50,7 @@ from the environment:
|
|
|
50
50
|
| `HASHQUIZ_SITE_URL` | Public URL of the site (e.g. `https://hashquiz.ai`): canonical, `og:url`, absolute `og:image`, sitemap line of `robots.txt` |
|
|
51
51
|
| `HASHQUIZ_LANG` | `<html lang>` of the player page, e.g. `fr` (default `en`) |
|
|
52
52
|
| `HASHQUIZ_INDEXABLE` | `true` lets search engines index the player page (default: `noindex`). The host is always `noindex` |
|
|
53
|
+
| `HASHQUIZ_CATALOG` | `true` writes the public quiz catalogue (below). Off by default: each deploy decides to list its decks |
|
|
53
54
|
|
|
54
55
|
### Search engines and link previews
|
|
55
56
|
|
|
@@ -59,6 +60,21 @@ The player page ships a description, Open Graph tags and a 1200×630 `og.png`, a
|
|
|
59
60
|
Files in `public/` (or the folder given with `--public`) are copied to the site root last, so a decks repository
|
|
60
61
|
can add `llms.txt` or `sitemap.xml`, or replace `og.png` and `robots.txt`. The `Sitemap:` line of the generated
|
|
61
62
|
`robots.txt` appears only when `public/` holds a `sitemap.xml` and `HASHQUIZ_SITE_URL` is set.
|
|
63
|
+
With `HASHQUIZ_CATALOG=true`, `build` also writes a public catalogue in plain HTML, readable by search engines and
|
|
64
|
+
AI assistants without JavaScript:
|
|
65
|
+
|
|
66
|
+
| Path | Content |
|
|
67
|
+
| --- | --- |
|
|
68
|
+
| `/quiz/` | Every deck: title, description, tags, difficulty, number of questions |
|
|
69
|
+
| `/quiz/<slug>/` | One deck: description, author, tags, difficulty, links to host it and play it solo (`solo: true`) |
|
|
70
|
+
| `/quiz/tag/<tag>/` | The decks carrying a tag |
|
|
71
|
+
| `/404.html` | Not-found page linking to the catalogue |
|
|
72
|
+
| `/sitemap.xml` | Every catalogue page, when `HASHQUIZ_SITE_URL` is set (a `public/sitemap.xml` replaces it) |
|
|
73
|
+
|
|
74
|
+
No page shows a question or an answer. The pages carry JSON-LD (`ItemList`, `Quiz`, `BreadcrumbList`).
|
|
75
|
+
The slug comes from the deck folder (`decks/docker-basics/index.hashquiz.md` → `docker-basics`).
|
|
76
|
+
Labels are in French when `HASHQUIZ_LANG` starts with `fr`, in English otherwise.
|
|
77
|
+
|
|
62
78
|
Background: [SEO audit](https://github.com/WhiteWoodTech/hashquiz/blob/develop/docs/SEO_AUDIT.md).
|
|
63
79
|
|
|
64
80
|
### Theme
|
package/bin/hashquiz.js
CHANGED
|
@@ -4103,6 +4103,10 @@ function verifySoloRun(quiz, sub) {
|
|
|
4103
4103
|
}
|
|
4104
4104
|
// packages/core/src/solo-backend.ts
|
|
4105
4105
|
var EMAIL_RE = /^[^@\s]+@[^@\s]+\.[^@\s]+$/;
|
|
4106
|
+
var LEAD_SEGMENTS = ["tech-trainer", "non-tech-trainer", "training-org", "company", "teacher"];
|
|
4107
|
+
var LEAD_SOURCES = ["solo-end", "gallery", "podium"];
|
|
4108
|
+
var isLeadSegment = (v) => LEAD_SEGMENTS.includes(v);
|
|
4109
|
+
var isLeadSource = (v) => LEAD_SOURCES.includes(v);
|
|
4106
4110
|
// packages/backend-local/src/index.ts
|
|
4107
4111
|
class LocalTransport {
|
|
4108
4112
|
subscribers = new Map;
|
|
@@ -4199,7 +4203,10 @@ CREATE TABLE IF NOT EXISTS leads (
|
|
|
4199
4203
|
email TEXT NOT NULL CHECK (length(email) <= 254),
|
|
4200
4204
|
consent INTEGER NOT NULL CHECK (consent = 1),
|
|
4201
4205
|
deck_id TEXT CHECK (length(deck_id) <= 200),
|
|
4202
|
-
created_at TEXT NOT NULL
|
|
4206
|
+
created_at TEXT NOT NULL,
|
|
4207
|
+
segment TEXT,
|
|
4208
|
+
founders INTEGER NOT NULL DEFAULT 0 CHECK (founders IN (0, 1)),
|
|
4209
|
+
source TEXT
|
|
4203
4210
|
) STRICT;
|
|
4204
4211
|
`;
|
|
4205
4212
|
var RANKED_COLS = "id, pseudo, score, total_time_ms AS totalTimeMs, finished_at AS finishedAt";
|
|
@@ -4219,7 +4226,15 @@ class SoloStore {
|
|
|
4219
4226
|
db.run("PRAGMA journal_mode = WAL");
|
|
4220
4227
|
db.run("PRAGMA foreign_keys = ON");
|
|
4221
4228
|
db.run(SCHEMA);
|
|
4222
|
-
db.
|
|
4229
|
+
const leadCols = new Set(db.query("PRAGMA table_info(leads)").all().map((c) => c.name));
|
|
4230
|
+
if (!leadCols.has("segment"))
|
|
4231
|
+
db.run("ALTER TABLE leads ADD COLUMN segment TEXT");
|
|
4232
|
+
if (!leadCols.has("founders")) {
|
|
4233
|
+
db.run("ALTER TABLE leads ADD COLUMN founders INTEGER NOT NULL DEFAULT 0 CHECK (founders IN (0, 1))");
|
|
4234
|
+
}
|
|
4235
|
+
if (!leadCols.has("source"))
|
|
4236
|
+
db.run("ALTER TABLE leads ADD COLUMN source TEXT");
|
|
4237
|
+
db.run("PRAGMA user_version = 2");
|
|
4223
4238
|
this.insertRunStmt = db.prepare(`INSERT INTO solo_runs (id, deck_id, deck_version, pseudo, score, correct_count, question_count, total_time_ms, finished_at)
|
|
4224
4239
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`);
|
|
4225
4240
|
this.insertAnswerStmt = db.prepare(`INSERT INTO solo_answers (run_id, position, deck_index, choices, is_correct, answer_time_ms, points)
|
|
@@ -4237,7 +4252,7 @@ class SoloStore {
|
|
|
4237
4252
|
)
|
|
4238
4253
|
) AS rank
|
|
4239
4254
|
FROM solo_runs r WHERE r.id = ?`);
|
|
4240
|
-
this.leadStmt = db.prepare("INSERT INTO leads (email, consent, deck_id, created_at) VALUES (?, 1, ?, ?)");
|
|
4255
|
+
this.leadStmt = db.prepare("INSERT INTO leads (email, consent, deck_id, created_at, segment, founders, source) VALUES (?, 1, ?, ?, ?, ?, ?)");
|
|
4241
4256
|
this.insertAll = db.transaction((id, run, finishedAt) => {
|
|
4242
4257
|
this.insertRunStmt.run(id, run.deckId, run.deckVersion, run.pseudo, run.score, run.correctCount, run.questionCount, run.totalTimeMs, finishedAt);
|
|
4243
4258
|
for (const a of run.answers) {
|
|
@@ -4272,10 +4287,10 @@ class SoloStore {
|
|
|
4272
4287
|
rank(runId) {
|
|
4273
4288
|
return this.rankStmt.get(runId)?.rank ?? null;
|
|
4274
4289
|
}
|
|
4275
|
-
insertLead(email, deckId) {
|
|
4290
|
+
insertLead(email, deckId, details = {}) {
|
|
4276
4291
|
if (!EMAIL_RE.test(email))
|
|
4277
4292
|
throw new Error("invalid email");
|
|
4278
|
-
this.leadStmt.run(email, deckId, new Date().toISOString());
|
|
4293
|
+
this.leadStmt.run(email, deckId, new Date().toISOString(), details.segment ?? null, details.founders === true ? 1 : 0, details.source ?? null);
|
|
4279
4294
|
}
|
|
4280
4295
|
close() {
|
|
4281
4296
|
this.db.close();
|
|
@@ -4379,13 +4394,23 @@ function createSoloHttpHandler(o) {
|
|
|
4379
4394
|
return body.res;
|
|
4380
4395
|
if (!isRecord(body.value))
|
|
4381
4396
|
return reason(422, "invalid lead");
|
|
4382
|
-
const { email, deckId } = body.value;
|
|
4397
|
+
const { email, deckId, segment, founders, source } = body.value;
|
|
4383
4398
|
if (typeof email !== "string" || email.length > 254 || !EMAIL_RE.test(email))
|
|
4384
4399
|
return reason(422, "invalid email");
|
|
4385
4400
|
if (deckId !== undefined && deckId !== null && (typeof deckId !== "string" || deckId.length > 200)) {
|
|
4386
4401
|
return reason(422, "invalid deckId");
|
|
4387
4402
|
}
|
|
4388
|
-
|
|
4403
|
+
if (segment !== undefined && segment !== null && !isLeadSegment(segment))
|
|
4404
|
+
return reason(422, "invalid segment");
|
|
4405
|
+
if (founders !== undefined && typeof founders !== "boolean")
|
|
4406
|
+
return reason(422, "invalid founders");
|
|
4407
|
+
if (source !== undefined && source !== null && !isLeadSource(source))
|
|
4408
|
+
return reason(422, "invalid source");
|
|
4409
|
+
o.store.insertLead(email, typeof deckId === "string" ? deckId : null, {
|
|
4410
|
+
segment: isLeadSegment(segment) ? segment : undefined,
|
|
4411
|
+
founders: founders === true,
|
|
4412
|
+
source: isLeadSource(source) ? source : undefined
|
|
4413
|
+
});
|
|
4389
4414
|
return empty(204);
|
|
4390
4415
|
}
|
|
4391
4416
|
return async (req) => {
|
|
@@ -5373,8 +5398,8 @@ function serveStatic(root, port, home, decksDir, publicDir) {
|
|
|
5373
5398
|
}
|
|
5374
5399
|
|
|
5375
5400
|
// packages/server/src/build.ts
|
|
5376
|
-
import { cpSync, existsSync as existsSync4, mkdirSync as
|
|
5377
|
-
import { resolve as
|
|
5401
|
+
import { cpSync, existsSync as existsSync4, mkdirSync as mkdirSync3, readFileSync as readFileSync3, rmSync, statSync as statSync3, writeFileSync as writeFileSync2 } from "fs";
|
|
5402
|
+
import { resolve as resolve6 } from "path";
|
|
5378
5403
|
|
|
5379
5404
|
// packages/server/src/seo.ts
|
|
5380
5405
|
var TRUE = new Set(["1", "true", "yes"]);
|
|
@@ -5422,14 +5447,308 @@ function renderRobots(settings, hasSitemap) {
|
|
|
5422
5447
|
`);
|
|
5423
5448
|
}
|
|
5424
5449
|
|
|
5450
|
+
// packages/server/src/catalog.ts
|
|
5451
|
+
import { mkdirSync as mkdirSync2, writeFileSync } from "fs";
|
|
5452
|
+
import { dirname as dirname3, resolve as resolve5 } from "path";
|
|
5453
|
+
var TEXT = {
|
|
5454
|
+
fr: {
|
|
5455
|
+
catalogTitle: "Tous les quiz",
|
|
5456
|
+
catalogIntro: "Quiz multijoueurs en temps r\xE9el, \xE9crits en Markdown. Lancez-en un sur grand \xE9cran, les joueurs r\xE9pondent depuis leur t\xE9l\xE9phone.",
|
|
5457
|
+
home: "Accueil",
|
|
5458
|
+
quizzes: "Quiz",
|
|
5459
|
+
questions: (n) => `${n} question${n > 1 ? "s" : ""}`,
|
|
5460
|
+
perGame: (n) => `${n} par partie`,
|
|
5461
|
+
difficulty: { easy: "facile", medium: "moyen", hard: "difficile" },
|
|
5462
|
+
by: "par",
|
|
5463
|
+
solo: "Jouable en solo",
|
|
5464
|
+
host: "Animer ce quiz",
|
|
5465
|
+
playSolo: "Jouer en solo",
|
|
5466
|
+
tag: (t) => `Quiz sur ${t}`,
|
|
5467
|
+
notFound: "Page introuvable",
|
|
5468
|
+
notFoundText: "Cette page n'existe pas. Les quiz sont tous sur le catalogue.",
|
|
5469
|
+
seeCatalog: "Voir les quiz"
|
|
5470
|
+
},
|
|
5471
|
+
en: {
|
|
5472
|
+
catalogTitle: "All quizzes",
|
|
5473
|
+
catalogIntro: "Real-time multiplayer quizzes written in Markdown. Run one on a big screen, players answer from their phones.",
|
|
5474
|
+
home: "Home",
|
|
5475
|
+
quizzes: "Quizzes",
|
|
5476
|
+
questions: (n) => `${n} question${n > 1 ? "s" : ""}`,
|
|
5477
|
+
perGame: (n) => `${n} per game`,
|
|
5478
|
+
difficulty: { easy: "easy", medium: "medium", hard: "hard" },
|
|
5479
|
+
by: "by",
|
|
5480
|
+
solo: "Playable solo",
|
|
5481
|
+
host: "Host this quiz",
|
|
5482
|
+
playSolo: "Play solo",
|
|
5483
|
+
tag: (t) => `${t} quizzes`,
|
|
5484
|
+
notFound: "Page not found",
|
|
5485
|
+
notFoundText: "This page does not exist. Every quiz is in the catalogue.",
|
|
5486
|
+
seeCatalog: "Browse quizzes"
|
|
5487
|
+
}
|
|
5488
|
+
};
|
|
5489
|
+
function catalogEnabled(env) {
|
|
5490
|
+
return ["1", "true", "yes"].includes((env.HASHQUIZ_CATALOG ?? "").trim().toLowerCase());
|
|
5491
|
+
}
|
|
5492
|
+
var slugify = (s) => s.normalize("NFD").replace(/[\u0300-\u036F]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
5493
|
+
function deckSlug(id) {
|
|
5494
|
+
const path = id.replace(/(^|\/)index\.hashquiz\.md$/, "").replace(/\.hashquiz\.md$/, "");
|
|
5495
|
+
return path.split("/").map(slugify).filter(Boolean).join("/") || "quiz";
|
|
5496
|
+
}
|
|
5497
|
+
var tagSlug = (tag) => slugify(tag) || encodeURIComponent(tag.toLowerCase());
|
|
5498
|
+
function catalogDecks(entries) {
|
|
5499
|
+
const used = new Set;
|
|
5500
|
+
return entries.map(({ id, content }) => ({ id, quiz: parseQuizFile(content) })).sort((a, b) => (a.quiz.meta.title || a.id).localeCompare(b.quiz.meta.title || b.id)).map(({ id, quiz }) => {
|
|
5501
|
+
const base = deckSlug(id);
|
|
5502
|
+
let slug = base;
|
|
5503
|
+
for (let i = 2;used.has(slug) || slug === "tag"; i++)
|
|
5504
|
+
slug = `${base}-${i}`;
|
|
5505
|
+
used.add(slug);
|
|
5506
|
+
return { id, slug, quiz };
|
|
5507
|
+
});
|
|
5508
|
+
}
|
|
5509
|
+
var esc = (s) => s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
5510
|
+
var ldJson = (data) => JSON.stringify(data).replace(/</g, "\\u003c");
|
|
5511
|
+
function difficultyOf(quiz) {
|
|
5512
|
+
if (quiz.meta.targetDifficulty)
|
|
5513
|
+
return quiz.meta.targetDifficulty;
|
|
5514
|
+
const score = { easy: 1, medium: 2, hard: 3 };
|
|
5515
|
+
const avg = quiz.questions.reduce((s, q) => s + score[q.difficulty], 0) / (quiz.questions.length || 1);
|
|
5516
|
+
return avg < 1.67 ? "easy" : avg < 2.34 ? "medium" : "hard";
|
|
5517
|
+
}
|
|
5518
|
+
var abs = (ctx, path) => ctx.siteUrl ? `${ctx.siteUrl}${path}` : path;
|
|
5519
|
+
var CSS = `
|
|
5520
|
+
:root{--bg:#130A42;--card:#1d1258;--text:#F9F8F8;--muted:#c9c3e6;--violet:#6523EE;--purple:#A833F5}
|
|
5521
|
+
*{box-sizing:border-box}
|
|
5522
|
+
body{margin:0;background:var(--bg);color:var(--text);font:16px/1.6 system-ui,-apple-system,"Segoe UI",sans-serif}
|
|
5523
|
+
a{color:#d3b4ff}
|
|
5524
|
+
header,main,footer{max-width:960px;margin:0 auto;padding:0 16px}
|
|
5525
|
+
header{display:flex;align-items:center;gap:12px;padding-top:20px;padding-bottom:8px}
|
|
5526
|
+
header img{width:40px;height:40px;border-radius:10px}
|
|
5527
|
+
header a{color:var(--text);text-decoration:none;font-weight:700}
|
|
5528
|
+
nav.crumbs{font-size:14px;color:var(--muted)}
|
|
5529
|
+
nav.crumbs a{color:var(--muted)}
|
|
5530
|
+
h1{font-size:clamp(28px,5vw,40px);line-height:1.2;margin:16px 0 8px}
|
|
5531
|
+
h2{margin-top:40px}
|
|
5532
|
+
.intro{color:var(--muted);font-size:18px}
|
|
5533
|
+
.grid{list-style:none;padding:0;display:grid;gap:16px;grid-template-columns:repeat(auto-fill,minmax(260px,1fr))}
|
|
5534
|
+
.card{background:var(--card);border-radius:14px;padding:18px}
|
|
5535
|
+
.card h2,.card h3{margin:0 0 6px;font-size:20px}
|
|
5536
|
+
.card p{margin:6px 0;color:var(--muted)}
|
|
5537
|
+
.meta{display:flex;flex-wrap:wrap;gap:8px;font-size:14px;color:var(--muted);padding:0;list-style:none}
|
|
5538
|
+
.tags{display:flex;flex-wrap:wrap;gap:6px;padding:0;list-style:none}
|
|
5539
|
+
.tags a{display:inline-block;font-size:13px;padding:2px 10px;border-radius:999px;background:#2a1b73;text-decoration:none;color:var(--text)}
|
|
5540
|
+
.actions{display:flex;flex-wrap:wrap;gap:12px;margin:20px 0}
|
|
5541
|
+
.btn{display:inline-block;padding:10px 18px;border-radius:10px;background:var(--violet);color:#fff;text-decoration:none;font-weight:600}
|
|
5542
|
+
.btn.alt{background:transparent;border:2px solid var(--purple)}
|
|
5543
|
+
footer{color:var(--muted);font-size:14px;padding-top:40px;padding-bottom:40px}
|
|
5544
|
+
`;
|
|
5545
|
+
function page(ctx, o) {
|
|
5546
|
+
const url = abs(ctx, o.path);
|
|
5547
|
+
const lds = o.ld.map((d) => `<script type="application/ld+json">${ldJson(d)}</script>`).join(`
|
|
5548
|
+
`);
|
|
5549
|
+
return `<!DOCTYPE html>
|
|
5550
|
+
<html lang="${esc(ctx.langTag)}">
|
|
5551
|
+
<head>
|
|
5552
|
+
<meta charset="UTF-8">
|
|
5553
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
5554
|
+
<title>${esc(o.title)}</title>
|
|
5555
|
+
<meta name="description" content="${esc(o.description)}">
|
|
5556
|
+
<meta name="theme-color" content="#130A42">
|
|
5557
|
+
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
|
|
5558
|
+
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
|
|
5559
|
+
${ctx.siteUrl ? `<link rel="canonical" href="${esc(url)}">
|
|
5560
|
+
<meta property="og:url" content="${esc(url)}">
|
|
5561
|
+
` : ""}<meta property="og:type" content="website">
|
|
5562
|
+
<meta property="og:site_name" content="HashQuiz">
|
|
5563
|
+
<meta property="og:title" content="${esc(o.title)}">
|
|
5564
|
+
<meta property="og:description" content="${esc(o.description)}">
|
|
5565
|
+
<meta property="og:image" content="${esc(abs(ctx, "/og.png"))}">
|
|
5566
|
+
<meta name="twitter:card" content="summary_large_image">
|
|
5567
|
+
<style>${CSS}</style>
|
|
5568
|
+
${lds}
|
|
5569
|
+
</head>
|
|
5570
|
+
<body>
|
|
5571
|
+
<header><a href="/quiz/"><img src="/favicon.svg" alt=""></a><a href="/quiz/">HashQuiz</a></header>
|
|
5572
|
+
<main>
|
|
5573
|
+
${o.body}
|
|
5574
|
+
</main>
|
|
5575
|
+
<footer>HashQuiz \xB7 <a href="https://github.com/WhiteWoodTech/hashquiz">GitHub</a></footer>
|
|
5576
|
+
</body>
|
|
5577
|
+
</html>
|
|
5578
|
+
`;
|
|
5579
|
+
}
|
|
5580
|
+
function crumbs(ctx, items) {
|
|
5581
|
+
const html = `<nav class="crumbs" aria-label="breadcrumb">${items.map((c, i) => i === items.length - 1 ? esc(c.name) : `<a href="${esc(c.path)}">${esc(c.name)}</a>`).join(" \u203A ")}</nav>`;
|
|
5582
|
+
const ld = {
|
|
5583
|
+
"@context": "https://schema.org",
|
|
5584
|
+
"@type": "BreadcrumbList",
|
|
5585
|
+
itemListElement: items.map((c, i) => ({ "@type": "ListItem", position: i + 1, name: c.name, item: abs(ctx, c.path) }))
|
|
5586
|
+
};
|
|
5587
|
+
return { html, ld };
|
|
5588
|
+
}
|
|
5589
|
+
function tagList(tags) {
|
|
5590
|
+
if (!tags.length)
|
|
5591
|
+
return "";
|
|
5592
|
+
return `<ul class="tags">${tags.map((t) => `<li><a href="/quiz/tag/${tagSlug(t)}/">#${esc(t)}</a></li>`).join("")}</ul>`;
|
|
5593
|
+
}
|
|
5594
|
+
function metaLine(ctx, quiz) {
|
|
5595
|
+
const t = TEXT[ctx.lang];
|
|
5596
|
+
const items = [t.questions(quiz.questions.length)];
|
|
5597
|
+
if (quiz.meta.maxQuestions && quiz.meta.maxQuestions < quiz.questions.length)
|
|
5598
|
+
items.push(t.perGame(quiz.meta.maxQuestions));
|
|
5599
|
+
items.push(t.difficulty[difficultyOf(quiz)]);
|
|
5600
|
+
if (quiz.meta.solo)
|
|
5601
|
+
items.push(t.solo);
|
|
5602
|
+
return `<ul class="meta">${items.map((i) => `<li>${esc(i)}</li>`).join('<li aria-hidden="true">\xB7</li>')}</ul>`;
|
|
5603
|
+
}
|
|
5604
|
+
function deckCard(ctx, d) {
|
|
5605
|
+
const { meta } = d.quiz;
|
|
5606
|
+
return `<li class="card"><h2><a href="/quiz/${d.slug}/">${esc(meta.title || d.id)}</a></h2>
|
|
5607
|
+
${meta.description ? `<p>${esc(meta.description.trim())}</p>` : ""}
|
|
5608
|
+
${metaLine(ctx, d.quiz)}
|
|
5609
|
+
${tagList(meta.tags)}</li>`;
|
|
5610
|
+
}
|
|
5611
|
+
function quizLd(ctx, d, path) {
|
|
5612
|
+
const { meta } = d.quiz;
|
|
5613
|
+
return {
|
|
5614
|
+
"@context": "https://schema.org",
|
|
5615
|
+
"@type": "Quiz",
|
|
5616
|
+
name: meta.title || d.id,
|
|
5617
|
+
...meta.description && { description: meta.description.trim() },
|
|
5618
|
+
url: abs(ctx, path),
|
|
5619
|
+
inLanguage: ctx.langTag,
|
|
5620
|
+
isAccessibleForFree: true,
|
|
5621
|
+
educationalLevel: difficultyOf(d.quiz),
|
|
5622
|
+
...meta.tags.length && { keywords: meta.tags.join(", ") },
|
|
5623
|
+
...meta.author && { author: { "@type": "Person", name: meta.author } }
|
|
5624
|
+
};
|
|
5625
|
+
}
|
|
5626
|
+
function renderCatalog(decks, seo) {
|
|
5627
|
+
const lang = seo.lang?.toLowerCase().startsWith("fr") ? "fr" : "en";
|
|
5628
|
+
const ctx = { lang, langTag: seo.lang ?? "en", ...seo.siteUrl && { siteUrl: seo.siteUrl } };
|
|
5629
|
+
const t = TEXT[lang];
|
|
5630
|
+
const files = [];
|
|
5631
|
+
const home = { name: t.quizzes, path: "/quiz/" };
|
|
5632
|
+
{
|
|
5633
|
+
const c = crumbs(ctx, [home]);
|
|
5634
|
+
files.push({
|
|
5635
|
+
path: "quiz/index.html",
|
|
5636
|
+
content: page(ctx, {
|
|
5637
|
+
path: "/quiz/",
|
|
5638
|
+
title: `${t.catalogTitle} \xB7 HashQuiz`,
|
|
5639
|
+
description: t.catalogIntro,
|
|
5640
|
+
body: `<h1>${esc(t.catalogTitle)}</h1>
|
|
5641
|
+
<p class="intro">${esc(t.catalogIntro)}</p>
|
|
5642
|
+
<ul class="grid">${decks.map((d) => deckCard(ctx, d)).join(`
|
|
5643
|
+
`)}</ul>`,
|
|
5644
|
+
ld: [
|
|
5645
|
+
{
|
|
5646
|
+
"@context": "https://schema.org",
|
|
5647
|
+
"@type": "ItemList",
|
|
5648
|
+
name: t.catalogTitle,
|
|
5649
|
+
itemListElement: decks.map((d, i) => ({ "@type": "ListItem", position: i + 1, url: abs(ctx, `/quiz/${d.slug}/`), name: d.quiz.meta.title || d.id }))
|
|
5650
|
+
},
|
|
5651
|
+
c.ld
|
|
5652
|
+
]
|
|
5653
|
+
})
|
|
5654
|
+
});
|
|
5655
|
+
}
|
|
5656
|
+
for (const d of decks) {
|
|
5657
|
+
const { meta, questions } = d.quiz;
|
|
5658
|
+
const title = meta.title || d.id;
|
|
5659
|
+
const description = (meta.description ?? "").trim() || `${title} \xB7 ${t.questions(questions.length)}`;
|
|
5660
|
+
const path = `/quiz/${d.slug}/`;
|
|
5661
|
+
const actions = `<div class="actions"><a class="btn" href="/host/">${esc(t.host)}</a>${meta.solo ? `<a class="btn alt" href="/#/solo/${encodeURIComponent(d.id)}">${esc(t.playSolo)}</a>` : ""}</div>`;
|
|
5662
|
+
const header = `<h1>${esc(title)}</h1>
|
|
5663
|
+
${meta.description ? `<p class="intro">${esc(meta.description.trim())}</p>
|
|
5664
|
+
` : ""}${metaLine(ctx, d.quiz)}
|
|
5665
|
+
${meta.author ? `<p>${esc(t.by)} ${esc(meta.author)}</p>
|
|
5666
|
+
` : ""}${tagList(meta.tags)}`;
|
|
5667
|
+
const c = crumbs(ctx, [home, { name: title, path }]);
|
|
5668
|
+
files.push({
|
|
5669
|
+
path: `quiz/${d.slug}/index.html`,
|
|
5670
|
+
content: page(ctx, {
|
|
5671
|
+
path,
|
|
5672
|
+
title: `${title} \xB7 HashQuiz`,
|
|
5673
|
+
description,
|
|
5674
|
+
body: `${c.html}
|
|
5675
|
+
${header}
|
|
5676
|
+
${actions}`,
|
|
5677
|
+
ld: [quizLd(ctx, d, path), c.ld]
|
|
5678
|
+
})
|
|
5679
|
+
});
|
|
5680
|
+
}
|
|
5681
|
+
const byTag = new Map;
|
|
5682
|
+
for (const d of decks) {
|
|
5683
|
+
for (const tag of new Set(d.quiz.meta.tags)) {
|
|
5684
|
+
const key = tagSlug(tag);
|
|
5685
|
+
const entry = byTag.get(key) ?? { label: tag, decks: [] };
|
|
5686
|
+
entry.decks.push(d);
|
|
5687
|
+
byTag.set(key, entry);
|
|
5688
|
+
}
|
|
5689
|
+
}
|
|
5690
|
+
for (const [key, { label, decks: tagged }] of byTag) {
|
|
5691
|
+
const path = `/quiz/tag/${key}/`;
|
|
5692
|
+
const c = crumbs(ctx, [home, { name: `#${label}`, path }]);
|
|
5693
|
+
files.push({
|
|
5694
|
+
path: `quiz/tag/${key}/index.html`,
|
|
5695
|
+
content: page(ctx, {
|
|
5696
|
+
path,
|
|
5697
|
+
title: `${t.tag(label)} \xB7 HashQuiz`,
|
|
5698
|
+
description: `${t.tag(label)} : ${tagged.map((d) => d.quiz.meta.title || d.id).join(", ")}`,
|
|
5699
|
+
body: `${c.html}
|
|
5700
|
+
<h1>${esc(t.tag(label))}</h1>
|
|
5701
|
+
<ul class="grid">${tagged.map((d) => deckCard(ctx, d)).join(`
|
|
5702
|
+
`)}</ul>`,
|
|
5703
|
+
ld: [c.ld]
|
|
5704
|
+
})
|
|
5705
|
+
});
|
|
5706
|
+
}
|
|
5707
|
+
files.push({
|
|
5708
|
+
path: "404.html",
|
|
5709
|
+
content: page(ctx, {
|
|
5710
|
+
path: "/404.html",
|
|
5711
|
+
title: `${t.notFound} \xB7 HashQuiz`,
|
|
5712
|
+
description: t.notFoundText,
|
|
5713
|
+
body: `<h1>${esc(t.notFound)}</h1>
|
|
5714
|
+
<p class="intro">${esc(t.notFoundText)}</p>
|
|
5715
|
+
<div class="actions"><a class="btn" href="/quiz/">${esc(t.seeCatalog)}</a></div>`,
|
|
5716
|
+
ld: []
|
|
5717
|
+
}).replace('<meta name="theme-color"', `<meta name="robots" content="noindex">
|
|
5718
|
+
<meta name="theme-color"`)
|
|
5719
|
+
});
|
|
5720
|
+
if (seo.siteUrl) {
|
|
5721
|
+
const urls = files.filter((f) => f.path.endsWith("index.html")).map((f) => `${seo.siteUrl}/${f.path.replace(/index\.html$/, "").split("/").map(encodeURIComponent).join("/")}`);
|
|
5722
|
+
files.push({
|
|
5723
|
+
path: "sitemap.xml",
|
|
5724
|
+
content: `<?xml version="1.0" encoding="UTF-8"?>
|
|
5725
|
+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
5726
|
+
${urls.map((u) => ` <url><loc>${esc(u)}</loc></url>`).join(`
|
|
5727
|
+
`)}
|
|
5728
|
+
</urlset>
|
|
5729
|
+
`
|
|
5730
|
+
});
|
|
5731
|
+
}
|
|
5732
|
+
return files;
|
|
5733
|
+
}
|
|
5734
|
+
function writeCatalog(outDir, entries, seo) {
|
|
5735
|
+
const files = renderCatalog(catalogDecks(entries), seo);
|
|
5736
|
+
for (const f of files) {
|
|
5737
|
+
const target = resolve5(outDir, f.path);
|
|
5738
|
+
mkdirSync2(dirname3(target), { recursive: true });
|
|
5739
|
+
writeFileSync(target, f.content);
|
|
5740
|
+
}
|
|
5741
|
+
return files.map((f) => f.path);
|
|
5742
|
+
}
|
|
5743
|
+
|
|
5425
5744
|
// packages/server/src/build.ts
|
|
5426
5745
|
function buildSite({ decksDir, outDir, publicDir, env = process.env }) {
|
|
5427
5746
|
const seo = seoFromEnv(env);
|
|
5428
|
-
const publicAbs = publicDir !== undefined ?
|
|
5747
|
+
const publicAbs = publicDir !== undefined ? resolve6(publicDir) : resolve6("public");
|
|
5429
5748
|
if (publicDir !== undefined && !(existsSync4(publicAbs) && statSync3(publicAbs).isDirectory())) {
|
|
5430
5749
|
throw new Error(`Public folder not found: ${publicDir}`);
|
|
5431
5750
|
}
|
|
5432
|
-
const decksAbs =
|
|
5751
|
+
const decksAbs = resolve6(decksDir);
|
|
5433
5752
|
if (!existsSync4(decksAbs))
|
|
5434
5753
|
throw new Error(`Decks folder not found: ${decksDir}`);
|
|
5435
5754
|
const decks = collectDecks(decksAbs);
|
|
@@ -5454,35 +5773,36 @@ function buildSite({ decksDir, outDir, publicDir, env = process.env }) {
|
|
|
5454
5773
|
const web = findWebDist();
|
|
5455
5774
|
if (!web)
|
|
5456
5775
|
throw new Error("Prebuilt web apps not found (in the hashquiz repo, run `bun run build:web` first)");
|
|
5457
|
-
const out =
|
|
5776
|
+
const out = resolve6(outDir);
|
|
5458
5777
|
if (out === decksAbs)
|
|
5459
5778
|
throw new Error("--out must differ from the decks folder");
|
|
5460
5779
|
rmSync(out, { recursive: true, force: true });
|
|
5461
|
-
|
|
5780
|
+
mkdirSync3(out, { recursive: true });
|
|
5462
5781
|
cpSync(web, out, { recursive: true });
|
|
5463
5782
|
const hasPublic = existsSync4(publicAbs) && statSync3(publicAbs).isDirectory();
|
|
5464
|
-
const
|
|
5465
|
-
|
|
5783
|
+
const catalog = catalogEnabled(env) ? writeCatalog(out, decks, seo) : [];
|
|
5784
|
+
const hasSitemap = catalog.includes("sitemap.xml") || hasPublic && existsSync4(resolve6(publicAbs, "sitemap.xml"));
|
|
5785
|
+
writeFileSync2(resolve6(out, "robots.txt"), renderRobots(seo, hasSitemap));
|
|
5466
5786
|
if (hasPublic)
|
|
5467
5787
|
cpSync(publicAbs, out, { recursive: true });
|
|
5468
|
-
const playerHtml =
|
|
5469
|
-
const themed = hasPublic && existsSync4(
|
|
5788
|
+
const playerHtml = resolve6(out, "index.html");
|
|
5789
|
+
const themed = hasPublic && existsSync4(resolve6(publicAbs, THEME_FILE));
|
|
5470
5790
|
const page = (html) => themed ? linkTheme(html) : html;
|
|
5471
|
-
|
|
5472
|
-
const hostHtml =
|
|
5791
|
+
writeFileSync2(playerHtml, page(applySeo(readFileSync3(playerHtml, "utf-8"), seo)));
|
|
5792
|
+
const hostHtml = resolve6(out, "host/index.html");
|
|
5473
5793
|
if (themed)
|
|
5474
|
-
|
|
5794
|
+
writeFileSync2(hostHtml, page(readFileSync3(hostHtml, "utf-8")));
|
|
5475
5795
|
const manifest = JSON.stringify(decks);
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5796
|
+
writeFileSync2(resolve6(out, "host/decks.json"), manifest);
|
|
5797
|
+
writeFileSync2(resolve6(out, "decks.json"), manifest);
|
|
5798
|
+
writeFileSync2(resolve6(out, "hashquiz-config.js"), renderConfigScript(configFromEnv(env)));
|
|
5479
5799
|
return decks.length;
|
|
5480
5800
|
}
|
|
5481
5801
|
|
|
5482
5802
|
// packages/backend-supabase/src/cli/edge-bundle.ts
|
|
5483
5803
|
import { existsSync as existsSync5 } from "fs";
|
|
5484
5804
|
import { mkdir } from "fs/promises";
|
|
5485
|
-
import { dirname as
|
|
5805
|
+
import { dirname as dirname4, join as join3 } from "path";
|
|
5486
5806
|
var EDGE_CORE_FILE = "functions/_shared/solo-core.js";
|
|
5487
5807
|
var EDGE_CORE_BANNER = `import { Buffer } from "node:buffer";
|
|
5488
5808
|
`;
|
|
@@ -5500,7 +5820,7 @@ async function bundleEdgeCore(outFile) {
|
|
|
5500
5820
|
${result.logs.map((l) => String(l)).join(`
|
|
5501
5821
|
`)}`);
|
|
5502
5822
|
}
|
|
5503
|
-
await mkdir(
|
|
5823
|
+
await mkdir(dirname4(outFile), { recursive: true });
|
|
5504
5824
|
await Bun.write(outFile, EDGE_CORE_BANNER + stripModulePathComments(await result.outputs[0].text()));
|
|
5505
5825
|
}
|
|
5506
5826
|
function stripModulePathComments(code) {
|
|
@@ -5511,7 +5831,7 @@ if (false) {}
|
|
|
5511
5831
|
import { existsSync as existsSync6, statSync as statSync4 } from "fs";
|
|
5512
5832
|
import { cp, mkdtemp, rm } from "fs/promises";
|
|
5513
5833
|
import { tmpdir } from "os";
|
|
5514
|
-
import { basename, join as join4, resolve as
|
|
5834
|
+
import { basename, join as join4, resolve as resolve7 } from "path";
|
|
5515
5835
|
var USAGE = "Usage: hashquiz supabase deploy --project <ref> [--site-url <url>] [--dry-run]";
|
|
5516
5836
|
var SECRET_ENV = ["SUPABASE_ACCESS_TOKEN", "SUPABASE_DB_PASSWORD"];
|
|
5517
5837
|
function supabaseDeploySteps(o) {
|
|
@@ -5531,13 +5851,13 @@ function isProject(dir) {
|
|
|
5531
5851
|
function findSupabaseDir() {
|
|
5532
5852
|
const here = import.meta.dirname;
|
|
5533
5853
|
const candidates = [
|
|
5534
|
-
|
|
5535
|
-
|
|
5854
|
+
resolve7(here, "../supabase"),
|
|
5855
|
+
resolve7(here, "../../supabase")
|
|
5536
5856
|
];
|
|
5537
5857
|
return candidates.find(isProject) ?? null;
|
|
5538
5858
|
}
|
|
5539
5859
|
async function copySupabaseProject(src, destSupabaseDir, edgeCore) {
|
|
5540
|
-
const coreFile =
|
|
5860
|
+
const coreFile = resolve7(src, EDGE_CORE_FILE);
|
|
5541
5861
|
if (edgeCore === "copy" && !existsSync6(coreFile)) {
|
|
5542
5862
|
throw new Error(`supabase: ${EDGE_CORE_FILE} missing in ${src} (run \`bun run build:edge\`)`);
|
|
5543
5863
|
}
|
|
@@ -5550,7 +5870,7 @@ async function copySupabaseProject(src, destSupabaseDir, edgeCore) {
|
|
|
5550
5870
|
filter: (p) => {
|
|
5551
5871
|
if (basename(p).startsWith(".env") && !statSync4(p).isDirectory())
|
|
5552
5872
|
return false;
|
|
5553
|
-
return edgeCore === "copy" ||
|
|
5873
|
+
return edgeCore === "copy" || resolve7(p) !== coreFile;
|
|
5554
5874
|
}
|
|
5555
5875
|
});
|
|
5556
5876
|
}
|
|
@@ -5655,7 +5975,7 @@ async function supabaseCommand(args, env, run = defaultRunner, log = console.log
|
|
|
5655
5975
|
}
|
|
5656
5976
|
// packages/server/src/cli.ts
|
|
5657
5977
|
import { readFileSync as readFileSync4 } from "fs";
|
|
5658
|
-
import { resolve as
|
|
5978
|
+
import { resolve as resolve8 } from "path";
|
|
5659
5979
|
var [, , command, arg, ...flags] = process.argv;
|
|
5660
5980
|
function printUsage() {
|
|
5661
5981
|
console.log(`
|
|
@@ -5674,7 +5994,9 @@ function printUsage() {
|
|
|
5674
5994
|
HASHQUIZ_SOLO_SCORING, HASHQUIZ_PLAYER_URL
|
|
5675
5995
|
(or their VITE_* names) from the environment, and
|
|
5676
5996
|
HASHQUIZ_SITE_URL, HASHQUIZ_LANG,
|
|
5677
|
-
HASHQUIZ_INDEXABLE for search engines
|
|
5997
|
+
HASHQUIZ_INDEXABLE for search engines, and
|
|
5998
|
+
HASHQUIZ_CATALOG=true for the public quiz
|
|
5999
|
+
pages under /quiz/.
|
|
5678
6000
|
supabase deploy --project <ref> [--site-url <url>] [--dry-run]
|
|
5679
6001
|
Deploy the solo backend to a Supabase project:
|
|
5680
6002
|
migrations, the solo-submit Edge Function and its
|
|
@@ -5737,7 +6059,7 @@ if (command === "dev") {
|
|
|
5737
6059
|
process.exit(1);
|
|
5738
6060
|
}
|
|
5739
6061
|
try {
|
|
5740
|
-
const content = readFileSync4(
|
|
6062
|
+
const content = readFileSync4(resolve8(arg), "utf-8");
|
|
5741
6063
|
const quiz = parseQuizFile(content);
|
|
5742
6064
|
const result = validateQuiz(quiz);
|
|
5743
6065
|
if (result.valid) {
|
package/package.json
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
-- "Create my quiz" form: who leaves the lead (segment), whether they want the founders offer, and where the
|
|
2
|
+
-- form was shown (source). Same lists as LEAD_SEGMENTS and LEAD_SOURCES in @hashquiz/core.
|
|
3
|
+
-- The existing `grant insert on public.leads` covers the new columns; anon still cannot read the table.
|
|
4
|
+
|
|
5
|
+
alter table public.leads
|
|
6
|
+
add column segment text
|
|
7
|
+
check (segment in ('tech-trainer', 'non-tech-trainer', 'training-org', 'company', 'teacher')),
|
|
8
|
+
add column founders bool not null default false,
|
|
9
|
+
add column source text check (source in ('solo-end', 'gallery', 'podium'));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.lead[data-v-16f1c9fd]{background:var(--hq-surface);border:1px solid var(--hq-border);border-radius:var(--hq-radius);width:100%;padding:1rem}.lead__form[data-v-16f1c9fd]{flex-direction:column;gap:.6rem;display:flex}.lead__title[data-v-16f1c9fd]{margin:0 0 .25rem;font-size:1.05rem}.lead__consent[data-v-16f1c9fd]{color:var(--hq-text-muted);cursor:pointer;align-items:flex-start;gap:.6rem;font-size:.9rem;display:flex}.lead__consent input[data-v-16f1c9fd]{accent-color:var(--hq-accent);flex-shrink:0;width:1.1rem;height:1.1rem;margin-top:.2rem}.lead__error[data-v-16f1c9fd]{color:var(--hq-wrong);margin:0;font-size:.9rem}.lead__thanks[data-v-16f1c9fd]{text-align:center;color:var(--hq-correct);margin:0;font-weight:600}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{A as e,C as t,E as n,I as r,N as i,P as a,S as o,_ as s,b as c,d as l,g as u,h as d,j as f,m as p,n as m,r as h,v as g,y as _,z as v}from"./index-t6uIRzOv.js";import{n as y,r as b,t as x}from"./solo-backend-CBEhye1F.js";/* empty css */var S={class:`lead`,"aria-labelledby":`lead-title`},C={key:0,class:`lead__thanks`,role:`status`},w=[`aria-invalid`],T=[`value`],E={class:`lead__consent`},D={class:`lead__consent`},O=[`disabled`],k={key:0,class:`lead__error`,role:`status`},A=l(n({__name:`LeadForm`,props:{source:{default:`solo-end`}},setup(n){let l=n,A={"tech-trainer":`Formateur·rice tech`,"non-tech-trainer":`Formateur·rice non tech`,"training-org":`Organisme de formation`,company:`Entreprise`,teacher:`Enseignant·e`},j=h(),M=a(``),N=a(``),P=a(!1),F=a(!1),I=a(`idle`),L=_(()=>x.test(M.value.trim())),R=_(()=>L.value&&b(N.value)&&F.value&&I.value!==`sending`);async function z(){if(!R.value||!b(N.value))return;I.value=`sending`,await m();let e=await j.submitLead(M.value,{segment:N.value,founders:P.value,source:l.source});I.value=e.ok?`done`:`error`}return(n,a)=>(e(),t(`section`,S,[I.value===`done`?(e(),t(`p`,C,`Merci, vous serez prévenu·e du lancement !`)):(e(),t(`form`,{key:1,class:`lead__form`,novalidate:``,onSubmit:s(z,[`prevent`])},[a[7]||=c(`h3`,{id:`lead-title`,class:`lead__title`},`Créez vos propres quiz : bientôt disponible`,-1),a[8]||=c(`label`,{class:`solo-label`,for:`lead-email`},`Email`,-1),i(c(`input`,{id:`lead-email`,"onUpdate:modelValue":a[0]||=e=>M.value=e,class:`solo-input`,type:`email`,autocomplete:`email`,inputmode:`email`,required:``,"aria-invalid":M.value!==``&&!L.value},null,8,w),[[u,M.value]]),a[9]||=c(`label`,{class:`solo-label`,for:`lead-segment`},`Vous êtes`,-1),i(c(`select`,{id:`lead-segment`,"onUpdate:modelValue":a[1]||=e=>N.value=e,class:`solo-input`,required:``},[a[4]||=c(`option`,{value:``,disabled:``},`Choisir…`,-1),(e(!0),t(g,null,f(r(y),n=>(e(),t(`option`,{key:n,value:n},v(A[n]),9,T))),128))],512),[[d,N.value]]),c(`label`,E,[i(c(`input`,{"onUpdate:modelValue":a[2]||=e=>P.value=e,type:`checkbox`},null,512),[[p,P.value]]),a[5]||=c(`span`,null,`Je veux l'offre fondateurs (prévente)`,-1)]),c(`label`,D,[i(c(`input`,{"onUpdate:modelValue":a[3]||=e=>F.value=e,type:`checkbox`,required:``},null,512),[[p,F.value]]),a[6]||=c(`span`,null,`J'accepte d'être recontacté·e au sujet de HashQuiz`,-1)]),c(`button`,{class:`solo-btn solo-btn--ghost hq-press`,type:`submit`,disabled:!R.value},`Me prévenir`,8,O),I.value===`error`?(e(),t(`p`,k,`Oups, réessayez.`)):o(``,!0)],32))]))}}),[[`__scopeId`,`data-v-16f1c9fd`]]);export{A as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.solo-catalog[data-v-ec33f116]{width:100%;margin-top:2.5rem}.solo-catalog__title[data-v-ec33f116]{text-align:center;color:var(--hq-text-muted);margin:0 0 1rem;font-size:1rem;font-weight:600}.solo-catalog__list[data-v-ec33f116]{flex-direction:column;gap:.75rem;margin:0;padding:0;list-style:none;display:flex}.solo-catalog__card[data-v-ec33f116]{color:inherit;border-radius:var(--hq-radius);text-decoration:none;display:block}.solo-catalog__card[data-v-ec33f116] .qip{transition:border-color .15s,transform .12s steps(2,end),box-shadow .12s steps(2,end)}.solo-catalog__card[data-v-ec33f116]:hover .qip{border-color:var(--hq-accent);transform:translate(calc(var(--hq-pixel) * -1), calc(var(--hq-pixel) * -1));box-shadow:var(--hq-pixel) var(--hq-pixel) 0 var(--hq-accent-2)}.solo-catalog__card[data-v-ec33f116]:focus-visible{outline:2px solid var(--hq-accent);outline-offset:3px}.solo-catalog__create[data-v-ec33f116]{width:100%;font:inherit;color:var(--hq-text);text-align:left;cursor:pointer;background:var(--hq-surface);border:1px dashed var(--hq-border);border-radius:var(--hq-radius);flex-direction:column;align-items:flex-start;gap:.5rem;padding:1rem;transition:border-color .15s;display:flex}.solo-catalog__create[data-v-ec33f116]:hover{border-color:var(--hq-accent)}.solo-catalog__create[data-v-ec33f116]:focus-visible{outline:2px solid var(--hq-accent);outline-offset:3px}.solo-catalog__create-badge[data-v-ec33f116]{text-transform:uppercase;letter-spacing:.08em;background:var(--hq-accent);color:var(--hq-text);border-radius:2px;padding:.1rem .4rem;font-size:.75rem}.solo-catalog__create-title[data-v-ec33f116]{font-size:1.05rem;font-weight:600}.solo-catalog__create-skeleton[data-v-ec33f116]{flex-direction:column;gap:.35rem;width:100%;display:flex}.solo-catalog__create-skeleton i[data-v-ec33f116]{background:var(--hq-border);border-radius:2px;height:.5rem;display:block}.solo-catalog__create-skeleton i[data-v-ec33f116]:nth-child(2){width:80%}.solo-catalog__create-skeleton i[data-v-ec33f116]:nth-child(3){width:55%}@media (prefers-reduced-motion:reduce){.solo-catalog__card[data-v-ec33f116]:hover .qip{transform:none}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{A as e,C as t,E as n,F as r,I as i,O as a,P as o,S as s,T as c,b as l,d as u,j as d,s as f,t as p,v as m,x as h}from"./index-t6uIRzOv.js";import{t as g}from"./decks-BNiNpRoi.js";import{n as _}from"./decks-VuEnO8Am.js";import{t as v}from"./LeadForm-CyU9p-NC.js";var y={key:0,class:`solo-catalog`,"aria-labelledby":`solo-catalog-title`},b={class:`solo-catalog__list`},x=[`aria-expanded`],S=[`href`,`aria-label`],C=u(n({__name:`SoloCatalog`,setup(n){let u=o(!1),C=r([]);return a(async()=>{try{C.value=(await _()).map(e=>({id:e.id,info:g(e)}))}catch(e){console.error(`Solo quizzes unavailable:`,e)}}),(n,r)=>C.value.length?(e(),t(`section`,y,[r[2]||=l(`h2`,{id:`solo-catalog-title`,class:`solo-catalog__title`},`Ou jouez en solo`,-1),l(`ul`,b,[l(`li`,null,[u.value?(e(),h(v,{key:0,source:`gallery`})):(e(),t(`button`,{key:1,type:`button`,class:`solo-catalog__create`,"aria-expanded":u.value,onClick:r[0]||=e=>u.value=!0},[...r[1]||=[l(`span`,{class:`solo-catalog__create-badge`},`Bientôt`,-1),l(`span`,{class:`solo-catalog__create-title`},`Créer mon quiz`,-1),l(`span`,{class:`solo-catalog__create-skeleton`,"aria-hidden":`true`},[l(`i`),l(`i`),l(`i`)],-1)]],8,x))]),(e(!0),t(m,null,d(C.value,n=>(e(),t(`li`,{key:n.id},[l(`a`,{class:`solo-catalog__card`,href:i(p)(n.id),"aria-label":`Jouer en solo : ${n.info.title}`},[c(i(f),{"quiz-info":n.info,compact:``},null,8,[`quiz-info`])],8,S)]))),128))])])):s(``,!0)}}),[[`__scopeId`,`data-v-ec33f116`]]);export{C as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{A as e,C as t,E as n,I as r,P as i,S as a,T as o,b as s,d as c,r as l,t as u,v as d,w as f,z as p}from"./index-t6uIRzOv.js";import{n as m,t as h}from"./format-5Txm-oDf.js";import{t as g}from"./SoloLeaderboard-Cnw01tuX.js";import{t as _}from"./LeadForm-CyU9p-NC.js";/* empty css */function v(e,t){return`${t.origin}${t.pathname}${u(e)}`}function y(e){let t=e.rank===null?``:` (${m(e.rank)} au classement)`;return`J'ai fait ${e.score.toLocaleString(`fr-FR`)} pts sur le quiz « ${e.title} »${t}. À toi de jouer !`}async function b(e,t){if(t.share)try{return await t.share(e),`shared`}catch(e){if(e?.name===`AbortError`)return`cancelled`}if(!t.clipboard)return`failed`;try{return await t.clipboard.writeText(`${e.text} ${e.url}`),`copied`}catch{return`failed`}}var x={class:`solo-end`},S={class:`solo-end__summary`},C={class:`solo-end__name`},w={class:`solo-end__score`},T={class:`solo-end__meta`},E={key:0,class:`solo-end__rank`},D={class:`solo-end__status`,role:`status`},O={class:`solo-end__actions`},k=[`href`],A={key:0,class:`solo-end__share-note`,role:`status`},j=c(n({__name:`SoloEndView`,setup(n){let c=l(),u={copied:`Lien copié !`,failed:`Partage indisponible sur ce navigateur.`},m=i(``);async function j(){let e=c.deck;if(!e)return;let t=e.quiz.meta.title||e.name,n=await b({title:t,text:y({title:t,score:c.score,rank:c.myRank}),url:v(e.id,location)},navigator);m.value=n===`copied`||n===`failed`?u[n]:``}return(n,i)=>(e(),t(`div`,x,[s(`div`,S,[s(`p`,C,p(r(c).pseudo),1),s(`p`,w,p(r(c).score.toLocaleString(`fr-FR`))+` pts`,1),s(`p`,T,p(r(c).correctCount)+`/`+p(r(c).total)+` bonnes réponses · `+p(r(h)(r(c).totalTimeMs)),1),r(c).myRank===null?a(``,!0):(e(),t(`p`,E,[f(` #`+p(r(c).myRank),1),r(c).runCount===null?a(``,!0):(e(),t(d,{key:0},[f(` sur `+p(r(c).runCount),1)],64))]))]),s(`div`,D,[r(c).submitState===`saving`?(e(),t(d,{key:0},[f(`Enregistrement du score…`)],64)):r(c).submitState===`error`?(e(),t(`button`,{key:1,class:`solo-end__retry`,onClick:i[0]||=e=>r(c).retrySubmit()},` Score non enregistré — réessayer `)):r(c).submitState===`stale`?(e(),t(d,{key:2},[f(` Score non enregistré : ce quiz a été mis à jour. Rejouez pour utiliser la nouvelle version. `)],64)):a(``,!0)]),s(`div`,O,[s(`button`,{class:`solo-btn hq-press`,onClick:i[1]||=e=>r(c).playAgain()},`Rejouer`),s(`a`,{class:`solo-btn solo-btn--ghost hq-press`,href:r(`#/`)},`Menu`,8,k),s(`button`,{class:`solo-btn solo-btn--ghost hq-press`,onClick:j},`Partager`)]),m.value?(e(),t(`p`,A,p(m.value),1)):a(``,!0),o(g,{live:r(c).liveOthers,rows:r(c).board},null,8,[`live`,`rows`]),o(_)]))}}),[[`__scopeId`,`data-v-c555ea86`]]);export{j as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.solo-end[data-v-c555ea86]{flex-direction:column;align-items:center;gap:1.25rem;padding-top:1rem;display:flex}.solo-end__summary[data-v-c555ea86]{text-align:center}.solo-end__name[data-v-c555ea86]{margin:0 0 .25rem;font-size:1.3rem;font-weight:700}.solo-end__score[data-v-c555ea86]{font-family:var(--hq-font-pixel);color:var(--hq-figure);margin:0;font-size:2rem;font-weight:700}.solo-end__meta[data-v-c555ea86]{color:var(--hq-text-muted);font-variant-numeric:tabular-nums;margin:.35rem 0 0}.solo-end__rank[data-v-c555ea86]{margin:.5rem 0 0;font-size:1.15rem;font-weight:700}.solo-end__actions[data-v-c555ea86]{gap:.75rem;width:100%;display:flex}.solo-end__actions .solo-btn[data-v-c555ea86]{text-align:center;flex:1 1 0;text-decoration:none;display:block}.solo-end__share-note[data-v-c555ea86]{color:var(--hq-text-muted);margin:-.5rem 0 0;font-size:.85rem}.solo-end__status[data-v-c555ea86]{color:var(--hq-text-muted);margin:0;font-size:.9rem}.solo-end__status[data-v-c555ea86]:empty{display:none}.solo-end__retry[data-v-c555ea86]{color:var(--hq-wrong);cursor:pointer;background:0 0;border:none;padding:.25rem;font-family:inherit;text-decoration:underline}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{A as e,C as t,E as n,I as r,N as i,P as a,T as o,_ as s,b as c,d as l,g as u,r as d,s as f,v as p,y as m}from"./index-t6uIRzOv.js";import{t as h}from"./decks-BNiNpRoi.js";import{t as g}from"./SoloLeaderboard-Cnw01tuX.js";/* empty css */var _={class:`solo-intro`},v={key:0,class:`solo-intro__unavailable`,role:`status`},y={key:1,class:`solo-intro__unavailable`,role:`status`},b=[`maxlength`],x=[`disabled`],S=l(n({__name:`SoloIntroView`,setup(n){let l=d(),S=a(l.pseudo),C=m(()=>l.deck?h(l.deck):null);return(n,a)=>(e(),t(`div`,_,[r(l).phase===`loading`?(e(),t(`p`,v,`Chargement du quiz…`)):r(l).phase===`unavailable`||!r(l).deck?(e(),t(`p`,y,` Ce quiz n'est pas disponible en solo. `)):(e(),t(p,{key:2},[o(r(f),{"quiz-info":C.value,"play-count":r(l).runCount??void 0,compact:``},null,8,[`quiz-info`,`play-count`]),c(`form`,{class:`solo-intro__form`,onSubmit:a[1]||=s(e=>r(l).start(S.value),[`prevent`])},[a[2]||=c(`label`,{class:`solo-label`,for:`solo-pseudo`},`Votre pseudo`,-1),i(c(`input`,{id:`solo-pseudo`,"onUpdate:modelValue":a[0]||=e=>S.value=e,class:`solo-input`,autocomplete:`nickname`,required:``,maxlength:r(24)},null,8,b),[[u,S.value]]),c(`button`,{class:`solo-btn hq-press`,type:`submit`,disabled:!S.value.trim()},`Commencer`,8,x)],32),o(g,{live:r(l).liveOthers,rows:r(l).board},null,8,[`live`,`rows`])],64))]))}}),[[`__scopeId`,`data-v-67931efa`]]);export{S as default};
|