@stevecastaneda/paseo-progress 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/client/panel.tsx CHANGED
@@ -10,7 +10,7 @@ import { raised } from "./surfaces";
10
10
  import { When } from "./when";
11
11
  import React, { useEffect, useRef, useState } from "react";
12
12
  import { ActivityIndicator, Animated, Platform, Pressable, ScrollView, Text, View } from "react-native";
13
- import { finishedAtTop, shortTitle, type Activity, type Dashboard, type FileIssue, type ProgressSegment, type StuckItem, type Ticket } from "../shared/dashboard";
13
+ import { finishedToFold, isFinished, shortTitle, type Activity, type Dashboard, type FileIssue, type ProgressSegment, type StuckItem, type Ticket } from "../shared/dashboard";
14
14
  import { PROGRESS_FILE, type TicketStatus } from "../shared/events";
15
15
  import { formatEstimate, formatMinutes, formatWorkDone, minutesSince } from "../shared/format";
16
16
  import { markPanelOpened } from "../shared/rpc";
@@ -416,26 +416,25 @@ function StuckSection({ colors, items, now }: { colors: Colors; items: StuckItem
416
416
  // the app session like the history tab.
417
417
  const finishedShown = new Map<string, boolean>();
418
418
 
419
- // Finished tickets at the top fold into one row, so the work still ahead is
420
- // near the top without scrolling (see finishedAtTop).
419
+ // Finished tickets fold into one row at the top, so the work still ahead is
420
+ // near the top without scrolling (see finishedToFold).
421
421
  function TicketList({ colors, dashboard, live, now, workspaceId, onOpen }: { colors: Colors; dashboard: Dashboard; live: boolean; now: number; workspaceId: string; onOpen(id: string): void }) {
422
422
  const [shown, setShown] = useState(() => finishedShown.get(workspaceId) ?? false);
423
423
  const toggle = () => {
424
424
  finishedShown.set(workspaceId, !shown);
425
425
  setShown(!shown);
426
426
  };
427
- const folded = finishedAtTop(dashboard.tickets);
427
+ const finished = finishedToFold(dashboard.tickets);
428
428
  const row = (ticket: Ticket) => (
429
429
  <TicketRow key={ticket.id} colors={colors} ticket={ticket} live={live} now={now} onOpen={() => onOpen(ticket.id)}
430
430
  deliverables={dashboard.deliverables.filter((deliverable) => deliverable.ticketId === ticket.id).length} />
431
431
  );
432
- if (!folded) return <>{dashboard.tickets.map(row)}</>;
433
- const finished = dashboard.tickets.slice(0, folded);
432
+ if (!finished.length) return <>{dashboard.tickets.map(row)}</>;
434
433
  return (
435
434
  <>
436
435
  <FinishedRow colors={colors} tickets={finished} shown={shown} onPress={toggle} />
437
436
  {shown ? finished.map(row) : null}
438
- {dashboard.tickets.slice(folded).map(row)}
437
+ {dashboard.tickets.filter((ticket) => !isFinished(ticket)).map(row)}
439
438
  </>
440
439
  );
441
440
  }
@@ -328,15 +328,17 @@ export function shortTitle(title) {
328
328
  const index = title.indexOf(":");
329
329
  return index > 0 && index <= 24 ? title.slice(0, index) : title;
330
330
  }
331
- // How many tickets at the top of the list are finished (done or skipped), so
332
- // the panel can fold them into one row and the work still ahead sits near the
333
- // top. Only the leading run folds: a ticket finished out of order stays in
334
- // place, so the plan's order never looks shuffled. A single one isn't worth a
335
- // fold row. Once every ticket is finished nothing is ahead, and the whole list
336
- // is the record of the run, so nothing folds.
337
- export function finishedAtTop(tickets) {
338
- const index = tickets.findIndex((ticket) => ticket.status !== "done" && ticket.status !== "skipped");
339
- return index >= 2 ? index : 0;
331
+ // The finished tickets (done or skipped) the panel folds into one row at the
332
+ // top, in plan order, so the work still ahead sits near the top. A ticket
333
+ // finished out of order folds too. A single one isn't worth a fold row. Once
334
+ // every ticket is finished nothing is ahead, and the whole list is the record
335
+ // of the run, so nothing folds.
336
+ export function finishedToFold(tickets) {
337
+ const finished = tickets.filter(isFinished);
338
+ return finished.length >= 2 && finished.length < tickets.length ? finished : [];
339
+ }
340
+ export function isFinished(ticket) {
341
+ return ticket.status === "done" || ticket.status === "skipped";
340
342
  }
341
343
  function plural(count, noun) {
342
344
  return `${count} ${count === 1 ? noun : `${noun}s`}`;
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@stevecastaneda/paseo-progress",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@stevecastaneda/paseo-progress",
9
- "version": "0.1.6",
9
+ "version": "0.1.7",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@getpaseo/client": "^0.9.2",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stevecastaneda/paseo-progress",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "A live progress dashboard per worktree for Paseo, drawn from a file agents write with the paseo-progress command.",
5
5
  "license": "MIT",
6
6
  "author": "Steve Castaneda",
@@ -449,15 +449,18 @@ export function shortTitle(title: string): string {
449
449
  return index > 0 && index <= 24 ? title.slice(0, index) : title;
450
450
  }
451
451
 
452
- // How many tickets at the top of the list are finished (done or skipped), so
453
- // the panel can fold them into one row and the work still ahead sits near the
454
- // top. Only the leading run folds: a ticket finished out of order stays in
455
- // place, so the plan's order never looks shuffled. A single one isn't worth a
456
- // fold row. Once every ticket is finished nothing is ahead, and the whole list
457
- // is the record of the run, so nothing folds.
458
- export function finishedAtTop(tickets: Ticket[]): number {
459
- const index = tickets.findIndex((ticket) => ticket.status !== "done" && ticket.status !== "skipped");
460
- return index >= 2 ? index : 0;
452
+ // The finished tickets (done or skipped) the panel folds into one row at the
453
+ // top, in plan order, so the work still ahead sits near the top. A ticket
454
+ // finished out of order folds too. A single one isn't worth a fold row. Once
455
+ // every ticket is finished nothing is ahead, and the whole list is the record
456
+ // of the run, so nothing folds.
457
+ export function finishedToFold(tickets: Ticket[]): Ticket[] {
458
+ const finished = tickets.filter(isFinished);
459
+ return finished.length >= 2 && finished.length < tickets.length ? finished : [];
460
+ }
461
+
462
+ export function isFinished(ticket: Ticket): boolean {
463
+ return ticket.status === "done" || ticket.status === "skipped";
461
464
  }
462
465
 
463
466
  function plural(count: number, noun: string): string {