This commit is contained in:
2025-10-21 22:29:44 +02:00
parent 04891bf449
commit a26c92ff2b
4 changed files with 27 additions and 11 deletions

View File

@@ -1,7 +1,11 @@
date,monster_name,monster_description,step_goal,monster_icon
2025-10-17,Test Monster,Can you catch this spooky creature?,30000,👻
2025-10-20,Dracula,The Count demands your steps!,60000,🧛
2025-10-21,Freddy Krueger,Don't fall asleep on your steps!,48000,🔪
2025-10-22,Mummy,Unwrap your potential!,48000,🧟
2025-10-23,Aliens,Take steps to another world!,72000,👽
2025-10-23,Xenomorph,The perfect organism hunts in the shadows!,72000,👽
2025-10-24,Predator,Hunt down those steps!,66000,👹
2025-10-27,Blob,This oozing creature is slow and easy to catch!,36000,🟢
2025-10-28,Godzilla,Each massive stride covers miles!,72000,🦖
2025-10-29,Werewolf,Fast and agile under the full moon!,78000,🐺
2025-10-30,Frankenstein's Monster,A lumbering creation seeks companionship!,48000,
2025-10-31,Dr. Jekyll/Mr. Hyde,Two personalities - one fast chase!,66000,🧪
1 date monster_name monster_description step_goal monster_icon
2025-10-17 Test Monster Can you catch this spooky creature? 30000 👻
2 2025-10-20 Dracula The Count demands your steps! 60000 🧛
3 2025-10-21 Freddy Krueger Don't fall asleep on your steps! 48000 🔪
4 2025-10-22 Mummy Unwrap your potential! 48000 🧟
5 2025-10-23 Aliens Xenomorph Take steps to another world! The perfect organism hunts in the shadows! 72000 👽
6 2025-10-24 Predator Hunt down those steps! 66000 👹
7 2025-10-27 Blob This oozing creature is slow and easy to catch! 36000 🟢
8 2025-10-28 Godzilla Each massive stride covers miles! 72000 🦖
9 2025-10-29 Werewolf Fast and agile under the full moon! 78000 🐺
10 2025-10-30 Frankenstein's Monster A lumbering creation seeks companionship! 48000
11 2025-10-31 Dr. Jekyll/Mr. Hyde Two personalities - one fast chase! 66000 🧪

View File

@@ -13,8 +13,19 @@ document.addEventListener('DOMContentLoaded', () => {
setupEventListeners();
setDefaultDate();
handleRouting();
checkAdminMode();
});
// Admin mode
function checkAdminMode() {
const urlParams = new URLSearchParams(window.location.search);
if (urlParams.get('admin') === 'true') {
document.querySelectorAll('.import-section').forEach(el => {
el.style.display = 'block';
});
}
}
// Routing
function handleRouting() {
// Handle initial load and hash changes
@@ -63,15 +74,17 @@ function initializeTabs() {
});
}
// Set default date to today
// Set default date to yesterday (since we enter steps the day after)
function setDefaultDate() {
const today = new Date().toISOString().split('T')[0];
const yesterday = new Date();
yesterday.setDate(yesterday.getDate() - 1);
const yesterdayStr = yesterday.toISOString().split('T')[0];
const dateInput = document.getElementById('step-date');
dateInput.value = today;
dateInput.value = yesterdayStr;
// Set max date to October 31, 2025
dateInput.max = '2025-10-31';
dateInput.min = '2025-10-15';
dateInput.min = '2025-10-20';
}
// Load initial data
@@ -832,6 +845,7 @@ async function importMonsters() {
}
const overwrite = overwriteCheckbox.checked;
console.log('Overwrite checkbox checked:', overwrite);
// Confirm if overwrite is selected
if (overwrite) {

View File

@@ -96,13 +96,10 @@
<strong>⏰ Important:</strong> The <strong>"Active Challenge"</strong> shows yesterday's monster.
Log your steps from yesterday to see if your team caught it!
</p>
<p style="margin: 8px 0; line-height: 1.6; font-size: 14px; color: #aaa;">
💡 You can enter steps for any past date, and catches will be updated automatically.
</p>
</div>
<!-- Monster CSV Import Section -->
<div class="import-section">
<div class="import-section" style="display: none;">
<h3>Admin: Import Monsters</h3>
<p class="help-text">Upload CSV with columns: date, monster_name, monster_description, step_goal, monster_icon</p>
<input type="file" id="monster-csv-file" accept=".csv">

View File

@@ -56,7 +56,8 @@ function initializeDatabase() {
`);
// Monster catches view - derived from actual step data
// Drop the old table if it exists and recreate as a view
// Drop the old table/view if it exists and recreate as a view
db.run(`DROP VIEW IF EXISTS monster_catches`);
db.run(`DROP TABLE IF EXISTS monster_catches`);
db.run(`
CREATE VIEW IF NOT EXISTS monster_catches AS