mirror of
https://github.com/wassname/pi-plan.git
synced 2026-09-28 14:45:05 +08:00
Reuse Unicode goal symbols in widget status counts
Co-Authored-By: Pi/OpenAI <288921227+claudypoo@users.noreply.github.com>
This commit is contained in:
+1
-2
@@ -141,10 +141,9 @@ export default function mainSupervisor(pi: ExtensionAPI) {
|
||||
const lines = visible.map((g) => `${mark(g.status)} G${items.indexOf(g) + 1}: ${g.subject}`);
|
||||
const hidden = sorted.slice(WIDGET_GOAL_LIMIT);
|
||||
if (hidden.length) {
|
||||
const symbols: Record<GoalStatus, string> = { done: "[x]", active: "[/]", open: "[ ]", cancelled: "[-]" };
|
||||
const counts = (["done", "active", "open", "cancelled"] as const).map(status => {
|
||||
const count = hidden.filter(g => g.status === status).length;
|
||||
return count ? `${count} ${symbols[status]}` : "";
|
||||
return count ? `${count} ${mark(status)}` : "";
|
||||
}).filter(Boolean);
|
||||
lines.push(`… ${counts.join(", ")}`);
|
||||
}
|
||||
|
||||
+4
-4
@@ -683,14 +683,14 @@ it("prioritizes unfinished goals and says when the widget list is truncated", as
|
||||
const f = fixture(); await f.draft();
|
||||
writeFileSync(f.path, "- [x] goal: completed one\n- [x] goal: completed two\n- [/] goal: active work\n- [ ] goal: open one\n- [ ] goal: open two\n");
|
||||
await f.command("ready");
|
||||
expect(f.ctx.ui.setWidget.mock.lastCall?.[1]).toEqual(["◼ G3: active work", "◻ G4: open one", "◻ G5: open two", "… 2 [x]"]);
|
||||
expect(f.ctx.ui.setWidget.mock.lastCall?.[1]).toEqual(["◼ G3: active work", "◻ G4: open one", "◻ G5: open two", "… 2 ✔"]);
|
||||
f.shutdown();
|
||||
});
|
||||
|
||||
it.each([
|
||||
["[x]", "[ ]", "[ ]", "… 1 [x], 2 [ ]"],
|
||||
["[/]", "[x]", "[-]", "… 1 [x], 1 [/], 1 [-]"],
|
||||
["[ ]", "[ ]", "[ ]", "… 3 [ ]"],
|
||||
["[x]", "[ ]", "[ ]", "… 1 ✔, 2 ◻"],
|
||||
["[/]", "[x]", "[-]", "… 1 ✔, 1 ◼, 1 ✗"],
|
||||
["[ ]", "[ ]", "[ ]", "… 3 ◻"],
|
||||
])("summarizes only hidden goal statuses: %s %s %s", async (first, second, third, summary) => {
|
||||
const f = fixture(); await f.draft();
|
||||
const marks = ["[/]", "[/]", "[/]", first, second, third];
|
||||
|
||||
Reference in New Issue
Block a user