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

157 lines
5.4 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: [
{
id: "g-1",
title: "Design",
sortOrder: 0,
items: [
{ id: "e-1", title: "Brand identity", start: "2026-01-02", end: "2026-01-08", lane: 1 },
{ id: "e-2", title: "UI mockups", start: "2026-01-06", end: "2026-01-14", lane: 2 },
{ id: "e-3", title: "Design review", start: "2026-01-20", end: "2026-01-22", lane: 1 },
{ id: "e-10", title: "Kickoff meeting", start: "2026-01-01", end: null, lane: 3 },
],
},
{
id: "g-2",
title: "Engineering",
sortOrder: 1,
items: [
{ id: "e-4", title: "API scaffolding", start: "2026-01-05", end: "2026-01-12", lane: 1 },
{ id: "e-5", title: "Auth flow", start: "2026-01-10", end: "2026-01-18", lane: 2 },
{ id: "e-6", title: "Dashboard UI", start: "2026-01-15", end: "2026-01-25", lane: 3 },
],
},
{
id: "g-3",
title: "Launch",
sortOrder: 2,
items: [
{ id: "e-7", title: "QA testing", start: "2026-01-19", end: "2026-01-26", lane: 1 },
{ id: "e-8", title: "Beta release", start: "2026-01-24", end: "2026-01-28", lane: 2 },
{ id: "e-9", title: "Marketing prep", start: "2026-01-08", end: "2026-01-15", lane: 1 },
{ id: "e-11", title: "Go-live", start: "2026-01-28", end: null, lane: 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 entry = null;
var sourceGroup = null;
// Find and remove the entry from its current group
for (var i = 0; i < state.timeline.groups.length; i++) {
var g = state.timeline.groups[i];
for (var j = 0; j < g.items.length; j++) {
if (g.items[j].id === p.entryId) {
entry = g.items.splice(j, 1)[0];
sourceGroup = g;
break;
}
}
if (entry) break;
}
if (entry) {
// Update start/end from payload (ISO 8601 → date-only)
entry.start = new Date(p.newStart).toISOString().split("T")[0];
entry.end = p.newEnd
? new Date(p.newEnd).toISOString().split("T")[0]
: null;
// Preserve the lane from the drop target
entry.lane = p.newLane;
// Add to target group
var targetGroup = state.timeline.groups.find(
function (g) { return g.id === p.newGroupId; }
);
if (targetGroup) {
targetGroup.items.push(entry);
}
// 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>