Export template source from 15b93e42825a3f8055f6305999a12c5b1cc73330:quixos-instance/packages/project-runtime

This commit is contained in:
Quixos Template Publisher
2000-01-01 00:00:00 +00:00
commit e0c0ea0fb3
19 changed files with 1134 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
import type { Contexts } from "./gen/qx.js";
export const createProject = ({ objectId }: Contexts["createProject"]) => objectId;
export const addTask = async ({ input, ports }: Contexts["addTask"]) => {
const task = await ports.task.construct(input.trim() || "Untitled task");
await ports.tasks.connect(task);
return task;
};
export const taskCount = { kind: "derived" as const, get: async ({ ports }: Contexts["taskCountGet"]) =>
(await ports.tasks.resolve()).length,
};
export const searchDocument = { kind: "derived" as const, get: async ({ ports }: Contexts["searchDocumentGet"]) => {
const [name, tasks] = await Promise.all([ports.named["name.get"](), ports.tasks["tasks.resolve"]()]);
const count = tasks.length;
return {
title: name || "Untitled project",
subtitle: `Project · ${count} ${count === 1 ? "task" : "tasks"}`,
keywords: ["project", "workspace", count === 0 ? "empty" : "tasks"],
};
}};
export const stopWatch = () => null;