fixed dev divider

This commit is contained in:
George Powell
2025-12-24 01:05:57 -05:00
parent 1edaec4bdd
commit 704a4e1996
2 changed files with 359 additions and 357 deletions

View File

@@ -49,14 +49,17 @@
year: "numeric", year: "numeric",
month: "long", month: "long",
day: "numeric", day: "numeric",
}) }),
); );
let isWon = $derived(guesses.some((g) => g.book.id === correctBookId)); let isWon = $derived(guesses.some((g) => g.book.id === correctBookId));
let grade = $derived( let grade = $derived(
isWon isWon
? getGrade(guesses.length, getBookById(correctBookId)?.popularity ?? 0) ? getGrade(
: "" guesses.length,
getBookById(correctBookId)?.popularity ?? 0,
)
: "",
); );
function getBookById(id: string): BibleBook | undefined { function getBookById(id: string): BibleBook | undefined {
@@ -83,7 +86,7 @@
const adjacent = isAdjacent(book.id, correctBookId); const adjacent = isAdjacent(book.id, correctBookId);
console.log( console.log(
`Guess: ${book.name} (order ${book.order}), Correct: ${correctBook.name} (order ${correctBook.order}), Adjacent: ${adjacent}` `Guess: ${book.name} (order ${book.order}), Correct: ${correctBook.name} (order ${correctBook.order}), Adjacent: ${adjacent}`,
); );
guesses = [ guesses = [
@@ -107,7 +110,8 @@
// Fallback UUID v4 generator for older browsers // Fallback UUID v4 generator for older browsers
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => { return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
const r = window.crypto.getRandomValues(new Uint8Array(1))[0] % 16 | 0; const r =
window.crypto.getRandomValues(new Uint8Array(1))[0] % 16 | 0;
const v = c === "x" ? r : (r & 0x3) | 0x8; const v = c === "x" ? r : (r & 0x3) | 0x8;
return v.toString(16); return v.toString(16);
}); });
@@ -166,7 +170,7 @@
if (!browser) return; if (!browser) return;
localStorage.setItem( localStorage.setItem(
`bibdle-guesses-${dailyVerse.date}`, `bibdle-guesses-${dailyVerse.date}`,
JSON.stringify(guesses.map((g) => g.book.id)) JSON.stringify(guesses.map((g) => g.book.id)),
); );
}); });
@@ -191,7 +195,7 @@
(async () => { (async () => {
try { try {
const response = await fetch( const response = await fetch(
`/api/submit-completion?anonymousId=${anonymousId}&date=${dailyVerse.date}` `/api/submit-completion?anonymousId=${anonymousId}&date=${dailyVerse.date}`,
); );
const result = await response.json(); const result = await response.json();
console.log("Stats response:", result); console.log("Stats response:", result);
@@ -201,7 +205,7 @@
statsData = result.stats; statsData = result.stats;
localStorage.setItem( localStorage.setItem(
`bibdle-stats-submitted-${dailyVerse.date}`, `bibdle-stats-submitted-${dailyVerse.date}`,
"true" "true",
); );
} else if (result.error) { } else if (result.error) {
console.error("Server error:", result.error); console.error("Server error:", result.error);
@@ -245,7 +249,7 @@
statsSubmitted = true; statsSubmitted = true;
localStorage.setItem( localStorage.setItem(
`bibdle-stats-submitted-${dailyVerse.date}`, `bibdle-stats-submitted-${dailyVerse.date}`,
"true" "true",
); );
} else if (result.error) { } else if (result.error) {
console.error("Server error:", result.error); console.error("Server error:", result.error);
@@ -279,7 +283,7 @@
year: "numeric", year: "numeric",
}); });
const formattedDate = dateFormatter.format( const formattedDate = dateFormatter.format(
new Date(`${dailyVerse.date}T00:00:00`) new Date(`${dailyVerse.date}T00:00:00`),
); );
const siteUrl = window.location.origin; const siteUrl = window.location.origin;
return [ return [
@@ -378,7 +382,9 @@
<div class="font-normal"></div> <div class="font-normal"></div>
</h1> </h1>
<div class="text-center mb-8"> <div class="text-center mb-8">
<span class="big-text">{isDev ? "Dev Edition" : ""} | {currentDate}</span> <span class="big-text"
>{isDev ? "Dev Edition | " : ""}{currentDate}</span
>
</div> </div>
<VerseDisplay {data} {isWon} /> <VerseDisplay {data} {isWon} />

View File

@@ -1,9 +1,5 @@
# todo # todo
- dark mode between sunset and sunrise
- https://news.ycombinator.com/item?id=44846281
- connect to cloudflare
- Difficulty levels - Difficulty levels
- difficult mode (guess old or new testament, first try _only_) - difficult mode (guess old or new testament, first try _only_)
- impossible mode (1894 scrivener koine greek NT or some hebrew version for OT) three guesses only - impossible mode (1894 scrivener koine greek NT or some hebrew version for OT) three guesses only
@@ -45,7 +41,7 @@ I created Bibdle from a combination of two things. The first is my lifelong desi
- switched to local copy of NKJV - switched to local copy of NKJV
- improved stats layout - improved stats layout
- general UI improvements - general UI improvements
- - added greek bible for future challenges
## december 22nd ## december 22nd