Export template source from ba8d4f92667f39bb02d542cb492b71a32ec914bf:quixos-instance/packages/todo-react-runtime

This commit is contained in:
Quixos Template Publisher
2000-01-01 00:00:00 +00:00
commit 920d9ff004
32 changed files with 1897 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
import fs from "node:fs/promises";
import path from "node:path";
import { fileURLToPath } from "node:url";
import type { Contexts } from "./gen/qx.js";
const componentSourcePath = path.join(path.dirname(fileURLToPath(import.meta.url)), "todo-component.mjs");
export const source = () => fs.readFile(componentSourcePath, "utf8");
export const createComponent = ({ objectId }: Contexts["createComponent"]) => objectId;
export const props = { kind: "derived" as const, get: async ({ objectId, ports }: Contexts["propsGet"]): Promise<Record<string, unknown>> => {
const [title, status, priority, titleLive, statusLive, priorityLive, notesLive, dueDateLive, energyLive] = await Promise.all([
ports.data["title.get"](), ports.data["status.get"](), ports.data["priority.get"](),
ports.data.live["title.get"](), ports.data.live["status.get"](), ports.data.live["priority.get"](),
ports.data.live["notes.get"](), ports.data.live["dueDate.get"](), ports.data.live["energy.get"](),
]);
const priorityText = priority && priority !== "NORMAL" ? ` ${priority.toLowerCase()}` : "";
return {
task_id: ports.data.objectId, component_id: objectId, title: titleLive, status: statusLive,
priority: priorityLive, notes: notesLive, due_date: dueDateLive, energy: energyLive,
display_label: `[${status || "OPEN"}]${priorityText} ${title || "Untitled task"}`,
};
}};
export const stopWatch = () => null;