@startsimpli/integrations 0.2.144 → 0.2.145

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@startsimpli/integrations",
3
- "version": "0.2.144",
3
+ "version": "0.2.145",
4
4
  "description": "Provider-agnostic types, API clients, hooks, and UI primitives for email + calendar integrations across StartSimpli apps, plus foundry customer email (subpath ./comms).",
5
5
  "license": "MIT",
6
6
  "homepage": "https://startsimpli.com",
@@ -704,3 +704,26 @@ describe('TrackerPage — paging a large list', () => {
704
704
  expect(screen.queryByRole('button', { name: /load more/i })).toBeNull();
705
705
  });
706
706
  });
707
+
708
+ describe('TrackerPage — quick filters', () => {
709
+ it('narrows to overdue, blocked or in progress with one click, and back to all', async () => {
710
+ const rows = [
711
+ commitment({ externalId: 'commit:late', title: 'Late one', dueAt: '2026-08-05T00:00:00Z' }),
712
+ commitment({ externalId: 'commit:blk', title: 'Stuck one', status: 'blocked', statusReason: 'waiting' }),
713
+ commitment({ externalId: 'commit:wip', title: 'Moving one', status: 'in_progress' }),
714
+ ];
715
+ render(<TrackerPage api={makeApi({ rows })} scope={SCOPE} now={NOW} />);
716
+ await screen.findByText('Late one');
717
+ await userEvent.click(screen.getByRole('button', { name: 'Overdue' }));
718
+ expect(screen.getByText('Late one')).toBeInTheDocument();
719
+ expect(screen.queryByText('Stuck one')).toBeNull();
720
+ await userEvent.click(screen.getByRole('button', { name: 'Blocked' }));
721
+ expect(screen.getByText('Stuck one')).toBeInTheDocument();
722
+ expect(screen.queryByText('Late one')).toBeNull();
723
+ await userEvent.click(screen.getByRole('button', { name: 'In progress' }));
724
+ expect(screen.getByText('Moving one')).toBeInTheDocument();
725
+ await userEvent.click(screen.getByRole('button', { name: 'All' }));
726
+ expect(screen.getByText('Late one')).toBeInTheDocument();
727
+ expect(screen.getByText('Stuck one')).toBeInTheDocument();
728
+ });
729
+ });
@@ -28,6 +28,7 @@ import * as React from 'react';
28
28
 
29
29
  import { isStalled, runCoverage, runProgress } from '../../corpus/runs';
30
30
  import { stripMarkdown } from '../Markdown';
31
+ import { isOverdue } from '../../corpus/work-item-logic';
31
32
  import { useTrackerName } from '../../task-tracker/useTrackerName';
32
33
  import type { MemberConnectionsApi } from './types';
33
34
  import { failureMessage, unfilteredMessage } from './work-items';
@@ -337,14 +338,19 @@ export function TrackerPage({
337
338
  }, [canQueue, pollMs, maxAutoResumes, scope.orgId, sweepEpoch]);
338
339
 
339
340
  const [filterText, setFilterText] = React.useState('');
341
+ type QuickKey = 'all' | 'overdue' | 'blocked' | 'in_progress';
342
+ const [quick, setQuick] = React.useState<QuickKey>('all');
340
343
  /** Client-side narrowing over the loaded page: title, owner, subject or project name. */
341
344
  const matches = React.useCallback((r: Commitment) => {
345
+ if (quick === 'overdue' && !isOverdue(r, clock)) return false;
346
+ if (quick === 'blocked' && r.status !== 'blocked') return false;
347
+ if (quick === 'in_progress' && r.status !== 'in_progress') return false;
342
348
  const q = filterText.trim().toLowerCase();
343
349
  if (!q) return true;
344
350
  const project = r.focusId ? projectNames[r.focusId] ?? '' : '';
345
351
  return [r.title, r.ownerName, r.subject, project, r.detail].some((v) => (v ?? '').toLowerCase().includes(q));
346
- }, [filterText, projectNames]);
347
- const filtering = filterText.trim().length > 0;
352
+ }, [filterText, quick, clock, projectNames]);
353
+ const filtering = filterText.trim().length > 0 || quick !== 'all';
348
354
  const groups = React.useMemo(
349
355
  () => groupTracker(rows.filter(matches), { now: clock, timeZone }),
350
356
  [rows, matches, clock, timeZone],
@@ -439,7 +445,17 @@ export function TrackerPage({
439
445
  placeholder="Filter to-dos by title, owner or project…" aria-label="Filter to-dos"
440
446
  />
441
447
  ) : null}
442
- {filtering && owed === 0 && rows.length > 0 ? <p className={cn.muted}>No to-dos match “{filterText.trim()}”.</p> : null}
448
+ {rows.length > 0 ? (
449
+ <div className="flex flex-wrap gap-2" role="group" aria-label="Quick filters">
450
+ {([['all', 'All'], ['overdue', 'Overdue'], ['blocked', 'Blocked'], ['in_progress', 'In progress']] as Array<[QuickKey, string]>).map(([key, label]) => (
451
+ <button
452
+ key={key} type="button" aria-pressed={quick === key} onClick={() => setQuick(key)}
453
+ className={`rounded-full border px-3 py-1 text-xs ${quick === key ? 'border-gray-900 bg-gray-900 text-white' : 'border-gray-300 text-gray-700'}`}
454
+ >{label}</button>
455
+ ))}
456
+ </div>
457
+ ) : null}
458
+ {filtering && owed === 0 && rows.length > 0 ? <p className={cn.muted}>No to-dos match{filterText.trim() ? ` “${filterText.trim()}”` : ' this filter'}.</p> : null}
443
459
  <div className="flex flex-wrap items-center gap-3">
444
460
  <p className={cn.muted} data-testid="tracker-summary">
445
461
  {loading ? 'Loading…' : `${owed} owed · ${c.today} today · ${c.inProgress} in progress`}