Source
This app’s code and revision history are public. Download a copy or explore the files below.
Public
The app’s code and revision history are public.
Run it yourself
Take the whole tree and run it on your own machine. The download needs no account. Cloning needs a sign-in.
Download .zip
bounded clone 381bd6356d4b794ac2a7c1b8
A copy you download is not bounded. The guarantees this app runs under - declared egress, proven invariants, writes that fail closed - live in the runtime serving this page, not in the files. What you get is auditable source you can read and run, with no runtime guarantees attached.
src/main.tsx
// Baby's entry. "/" keeps the static landing and mounts the start card into its hero.
// /app (Today, Timeline, Charts, Family, the report) and /join hide the landing and load the app.
import { lazy, Suspense } from "react";
import { createRoot } from "react-dom/client";
import { usePath } from "./lib/router";
import { Toaster, AppSkeleton } from "./ui";
import { StartCard } from "./Start";
import "./styles.css";
const App = lazy(() => import("./App"));
const APP_ROUTE = /^\/(app(\/|$)|join\/?$)/;
function Root() {
const path = usePath();
const inApp = APP_ROUTE.test(path);
document.body.classList.toggle("app-mode", inApp);
document.body.classList.toggle("report-mode", path === "/app/report");
return (
<>
{inApp && (
<Suspense fallback={<AppSkeleton />}>
<App path={path.replace(/\/$/, "") || "/"} />
</Suspense>
)}
<Toaster />
</>
);
}
// The night look before the app loads, so a dark room never gets a bright flash.
const look = (() => { try { return JSON.parse(localStorage.getItem("baby:look") || '"auto"'); } catch { return "auto"; } })();
const hour = new Date().getHours();
if (APP_ROUTE.test(location.pathname) && location.pathname !== "/app/report" && (look === "night" || (look === "auto" && (hour >= 19 || hour < 7 || matchMedia("(prefers-color-scheme: dark)").matches)))) {
document.body.classList.add("night");
}
createRoot(document.getElementById("app")!).render(<Root />);
const startSlot = document.getElementById("start");
if (startSlot) createRoot(startSlot).render(<StartCard />);
if (import.meta.env.PROD && "serviceWorker" in navigator) {
window.addEventListener("load", () => void navigator.serviceWorker.register("/sw.js").catch(() => null));
}
const head = document.querySelector(".site-head");
const onScroll = () => head?.classList.toggle("scrolled", window.scrollY > 4);
window.addEventListener("scroll", onScroll, { passive: true });
onScroll();
Change history
Quality pass: undo on timers, sleep by hour chart, diaper color, fixes
Bounded source sync
Bounded source sync
Bounded source sync