20 lines
1.2 KiB
TypeScript
20 lines
1.2 KiB
TypeScript
import componentSource from "./todo-component.js?browser-source";
|
|
import type { Contexts } from "./gen/qx.js";
|
|
|
|
export const source = () => componentSource;
|
|
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;
|