Files
OmO Orchestrator 942ceda7e5 feat: add three sample uploadable mini-apps
Self-contained XHTML bundles (Shift Log, Tool Library, Gratitude Wall) that
mount through the real upload/publish path and use the window.commons SDK.
Published to /api/blob and verified mounting + executing in a real browser.
2026-11-20 02:30:03 -05:00

81 lines
3.3 KiB
HTML

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style>
.commons-app { font-family: system-ui, sans-serif; max-width: 560px; margin: 0 auto; padding: 16px; color: #1f2329; }
.commons-app h2 { font-size: 20px; margin: 0 0 4px; }
.commons-app .sub { color: #6b7280; font-size: 13px; margin: 0 0 16px; }
.commons-app .row { display: flex; gap: 8px; margin-bottom: 8px; }
.commons-app input { flex: 1; padding: 10px; border: 1px solid #d0d5dd; border-radius: 8px; font-size: 14px; }
.commons-app #to { max-width: 160px; }
.commons-app button { background: #1677FF; color: #fff; border: 0; border-radius: 8px; padding: 10px 16px; font-size: 14px; cursor: pointer; }
.commons-app button:hover { background: #0f5ed6; }
.commons-app h3 { font-size: 15px; margin: 18px 0 8px; }
.commons-app ul { list-style: none; padding: 0; margin: 0; }
.commons-app li { border-left: 3px solid #1677FF; background: #f7faff; border-radius: 0 8px 8px 0; padding: 10px 12px; margin-bottom: 8px; font-size: 14px; }
.commons-app li .to { color: #1677FF; font-weight: 600; }
.commons-app .empty { color: #9aa1ab; font-size: 13px; padding: 12px 0; }
</style>
</head>
<body>
<div class="commons-app">
<h2>Gratitude Wall</h2>
<p class="sub">Thank a neighbour out loud. Notes are signed events on the shared log - a small ledger of goodwill.</p>
<div class="row">
<input id="to" type="text" placeholder="to (name)" />
<input id="msg" type="text" placeholder="what they did" />
<button id="post-btn" type="button">Post</button>
</div>
<h3>Recent thanks</h3>
<ul id="list"></ul>
<p id="empty" class="empty">No notes yet. Be the first to say thanks.</p>
</div>
<script>
<![CDATA[
(function () {
var api = window.commons;
var listEl = document.getElementById("list");
var emptyEl = document.getElementById("empty");
function render(entries) {
var notes = [];
for (var i = 0; i < entries.length; i++) {
var p = entries[i].payload;
if (p && p.type === "gratitude.note") { notes.push(p); }
}
emptyEl.style.display = notes.length === 0 ? "block" : "none";
listEl.innerHTML = "";
notes.slice().reverse().forEach(function (n) {
var li = document.createElement("li");
var to = document.createElement("span");
to.className = "to";
to.textContent = "To " + (n.to || "a neighbour") + ": ";
var msg = document.createElement("span");
msg.textContent = n.message || "";
li.appendChild(to);
li.appendChild(msg);
listEl.appendChild(li);
});
}
function refresh() {
api.eventlog.readAll().then(render);
}
document.getElementById("post-btn").addEventListener("click", function () {
var to = document.getElementById("to").value.trim();
var message = document.getElementById("msg").value.trim();
if (!message) { return; }
api.eventlog.append({ type: "gratitude.note", to: to, message: message }).then(function () {
document.getElementById("to").value = "";
document.getElementById("msg").value = "";
refresh();
});
});
refresh();
})();
]]>
</script>
</body>
</html>