added skip add-child for new users to allow for adding a shared child

This commit is contained in:
Brian Bjarke Jensen
2025-11-11 14:39:59 +01:00
parent dea3b5d3b5
commit c745ab1b7a
2 changed files with 45 additions and 2 deletions
+26 -2
View File
@@ -275,9 +275,9 @@
})
.then((response) => response.json())
.then((children) => {
// If no children, redirect to add-child page
// If no children, show welcome message with option to add
if (children.length === 0) {
window.location.href = "/add-child.html";
showNoChildrenMessage();
return;
}
@@ -290,6 +290,30 @@
});
}
function showNoChildrenMessage() {
const content = document.getElementById("content");
content.className = "";
content.innerHTML = `
<h1>👶 Welcome to Baby Monitor</h1>
<div style="text-align: center; padding: 40px 20px;">
<div style="font-size: 64px; margin-bottom: 20px;">🍼</div>
<h2 style="color: #333; margin-bottom: 15px;">No Children Added Yet</h2>
<p style="color: #666; margin-bottom: 30px; line-height: 1.6;">
You can add a child to start tracking or redeem a child share code<br>
from another user to access their child's information.
</p>
<div style="display: flex; gap: 15px; justify-content: center; flex-wrap: wrap;">
<a href="/add-child.html" class="button" style="text-decoration: none; display: inline-block;">
Add Your Child
</a>
<a href="/settings.html" class="button secondary" style="text-decoration: none; display: inline-block;">
🔗 Redeem Share Code
</a>
</div>
</div>
`;
}
let activeFeeding = null;
let userChildren = [];
let lastFeeding = null;