Files
zendegi/packages/z-timeline/web/index.html
2026-03-02 11:05:57 +01:00

117 lines
4.7 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<!--
If you are serving your web app in a path other than the root, change the
href value below to reflect the base path you are serving from.
The path provided below has to start and end with a slash "/" in order for
it to work correctly.
For more details:
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
This is a placeholder for base href that will be replaced by the value of
the `--base-href` argument provided to `flutter build`.
-->
<base href="$FLUTTER_BASE_HREF">
<meta charset="UTF-8">
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
<meta name="description" content="A new Flutter project.">
<!-- iOS meta tags & icons -->
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="z_timeline">
<link rel="apple-touch-icon" href="icons/Icon-192.png">
<!-- Favicon -->
<link rel="icon" type="image/png" href="favicon.png"/>
<title>z_timeline</title>
<link rel="manifest" href="manifest.json">
</head>
<body>
<!-- Dev-mode fake data: provides window.__zendegi__ so the timeline
renders standalone without the React parent. Harmless in production
because React overwrites __zendegi__ before Flutter loads. -->
<script>
(function () {
// Only bootstrap if no bridge exists yet (i.e. not embedded in React)
if (window.__zendegi__) return;
var state = {
timeline: { id: "tl-1", title: "My Project" },
groups: {
"g-1": { id: "g-1", title: "Design", sortOrder: 0 },
"g-2": { id: "g-2", title: "Engineering", sortOrder: 1 },
"g-3": { id: "g-3", title: "Launch", sortOrder: 2 },
},
items: {
"e-1": { id: "e-1", groupId: "g-1", title: "Brand identity", start: "2026-01-02", end: "2026-01-08", lane: 1 },
"e-2": { id: "e-2", groupId: "g-1", title: "UI mockups", start: "2026-01-06", end: "2026-01-14", lane: 2 },
"e-3": { id: "e-3", groupId: "g-1", title: "Design review", start: "2026-01-20", end: "2026-01-22", lane: 1 },
"e-10": { id: "e-10", groupId: "g-1", title: "Kickoff meeting", start: "2026-01-01", end: null, lane: 3 },
"e-4": { id: "e-4", groupId: "g-2", title: "API scaffolding", start: "2026-01-05", end: "2026-01-12", lane: 1 },
"e-5": { id: "e-5", groupId: "g-2", title: "Auth flow", start: "2026-01-10", end: "2026-01-18", lane: 2 },
"e-6": { id: "e-6", groupId: "g-2", title: "Dashboard UI", start: "2026-01-15", end: "2026-01-25", lane: 3 },
"e-7": { id: "e-7", groupId: "g-3", title: "QA testing", start: "2026-01-19", end: "2026-01-26", lane: 1 },
"e-8": { id: "e-8", groupId: "g-3", title: "Beta release", start: "2026-01-24", end: "2026-01-28", lane: 2 },
"e-9": { id: "e-9", groupId: "g-3", title: "Marketing prep", start: "2026-01-08", end: "2026-01-15", lane: 1 },
"e-11": { id: "e-11", groupId: "g-3", title: "Go-live", start: "2026-01-28", end: null, lane: 3 },
},
groupOrder: ["g-1", "g-2", "g-3"],
selectedItemId: null,
};
var _updateState = null;
window.__zendegi__ = {
getState: function () {
return JSON.stringify(state);
},
onEvent: function (jsonStr) {
var event = JSON.parse(jsonStr);
console.log(event);
if (event.type === "entry_moved") {
var p = event.payload;
var item = state.items[p.entryId];
if (item) {
// Update in place — normalized makes this trivial
item.start = p.newStart
? new Date(p.newStart).toISOString().split("T")[0]
: item.start;
item.end = p.newEnd
? new Date(p.newEnd).toISOString().split("T")[0]
: null;
item.groupId = p.newGroupId;
item.lane = p.newLane;
// Push updated state back to Flutter
if (_updateState) {
_updateState(JSON.stringify(state));
}
}
} else if (event.type === "content_height") {
console.log("[z-timeline dev] content_height:", event.payload.height);
} else {
console.log("[z-timeline dev] event:", event);
}
},
set updateState(callback) {
_updateState = callback;
},
};
console.log("[z-timeline dev] Standalone mode — fake data loaded");
})();
</script>
<script src="flutter_bootstrap.js" async></script>
</body>
</html>