@startsimpli/integrations 0.2.201 → 0.2.203
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 +6 -6
- package/src/__tests__/briefing-markdown.test.ts +64 -0
- package/src/__tests__/converse-cards.test.ts +53 -0
- package/src/__tests__/converse-page.test.tsx +148 -37
- package/src/__tests__/converse-roci.test.ts +22 -0
- package/src/__tests__/converse-structure.test.ts +27 -0
- package/src/__tests__/converse-view.test.ts +46 -0
- package/src/__tests__/corpus-tracker.test.tsx +32 -176
- package/src/__tests__/data-table-logic.test.ts +75 -0
- package/src/__tests__/data-table.test.tsx +133 -0
- package/src/__tests__/home-brief.test.tsx +25 -40
- package/src/__tests__/library-call-shape.test.tsx +164 -0
- package/src/__tests__/load-error.test.tsx +1 -1
- package/src/__tests__/mini-markdown.test.tsx +24 -0
- package/src/__tests__/overview-page.test.tsx +36 -6
- package/src/__tests__/plan-shell.test.tsx +6 -4
- package/src/__tests__/timeline-events.test.ts +65 -0
- package/src/__tests__/timeline-table.test.tsx +66 -0
- package/src/__tests__/todo-table-model.test.ts +75 -0
- package/src/__tests__/todo-table.test.tsx +202 -0
- package/src/__tests__/tracker-timeline-component.test.tsx +4 -4
- package/src/__tests__/tracker-timeline-reader.test.ts +1 -1
- package/src/comms/__tests__/app-sends-page.test.tsx +69 -0
- package/src/comms/api/comms.ts +23 -0
- package/src/comms/components/ResultsPanel.tsx +2 -2
- package/src/comms/components/SendLog.tsx +20 -8
- package/src/comms/components/index.ts +1 -0
- package/src/comms/components/pages/AppSendsPage.tsx +58 -0
- package/src/comms/hooks/index.ts +8 -3
- package/src/components/FolderTree.tsx +12 -3
- package/src/components/index.ts +2 -1
- package/src/components/pages/ConversePage.tsx +114 -105
- package/src/components/pages/LibraryPage.tsx +63 -24
- package/src/components/pages/TrackerPage.tsx +170 -474
- package/src/components/pages/converse/CardView.tsx +72 -0
- package/src/components/pages/converse/SettingsMenu.tsx +37 -0
- package/src/components/pages/converse/Thread.tsx +48 -33
- package/src/components/pages/converse/useNeedsYou.ts +60 -0
- package/src/components/pages/home/BriefCard.tsx +16 -7
- package/src/components/pages/home/HomeBriefPage.tsx +6 -91
- package/src/components/pages/home/MiniMarkdown.tsx +51 -0
- package/src/components/pages/home/{DueSoonLine.tsx → dueSoonText.ts} +2 -11
- package/src/components/pages/home/index.ts +1 -1
- package/src/components/pages/overview/OverviewPage.tsx +46 -83
- package/src/components/pages/plan/TalkPage.tsx +5 -14
- package/src/components/pages/plan/TimelinePage.tsx +4 -2
- package/src/components/pages/tracker/SweepPanel.tsx +108 -0
- package/src/components/pages/tracker/TimelineTable.tsx +70 -0
- package/src/components/pages/tracker/TrackerTimeline.tsx +32 -15
- package/src/components/table/DataTable.tsx +92 -0
- package/src/components/table/RowMenu.tsx +35 -0
- package/src/components/table/TablePagination.tsx +63 -0
- package/src/components/table/TableToolbar.tsx +56 -0
- package/src/components/table/TodoTable.tsx +142 -0
- package/src/components/table/index.ts +10 -0
- package/src/components/table/table-logic.ts +60 -0
- package/src/components/table/todo-model.ts +93 -0
- package/src/corpus/briefing/generate-weekly.ts +4 -0
- package/src/corpus/briefing/generate.ts +4 -0
- package/src/corpus/briefing/index.ts +1 -0
- package/src/corpus/briefing/markdown.ts +71 -0
- package/src/corpus/client.ts +38 -146
- package/src/corpus/converse/cards.ts +69 -0
- package/src/corpus/converse/index.ts +6 -0
- package/src/corpus/converse/roci.ts +13 -0
- package/src/corpus/converse/structure.ts +39 -0
- package/src/corpus/converse/view.ts +34 -0
- package/src/corpus/index.ts +2 -0
- package/src/corpus/participants.ts +220 -0
- package/src/corpus/timeline-events.ts +83 -0
- package/src/corpus/tracker-sort.ts +9 -3
- package/src/corpus/tracker-timeline-client.ts +2 -0
- package/src/corpus/tracker-timeline.ts +4 -0
- package/src/corpus/types.ts +32 -5
- package/src/native/app/__tests__/plan-talk-registry.test.tsx +2 -1
- package/src/native/converse/ConverseScreen.tsx +3 -5
- package/src/native/home/HomeScreen.tsx +1 -1
- package/src/native/home/tab.tsx +1 -2
- package/src/native/plan/PlanTab.tsx +1 -2
- package/src/native/plan/__tests__/plan-tab.test.tsx +5 -5
- package/src/native/talk/TalkTab.tsx +1 -1
- package/src/native/talk/__tests__/talk-tab.test.tsx +1 -1
- package/src/__tests__/home-needs-your-call.test.tsx +0 -65
- package/src/components/pages/tracker/TrackerBoard.tsx +0 -45
- package/src/components/pages/tracker/TrackerToolbar.tsx +0 -44
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* OVERVIEW: every project on one row: who it is waiting on, the next step, how much is open. Click a heading to sort,
|
|
5
|
-
*
|
|
5
|
+
* use the ONE filter to show projects with nothing open or only one person's, click a row to open the project. A project with nothing open is the same row, only quieter. The numbers come from
|
|
6
6
|
* `buildOverview` (pure); nothing about people, areas or workflow is built in.
|
|
7
7
|
*/
|
|
8
8
|
import * as React from 'react';
|
|
9
9
|
|
|
10
10
|
import { LoadError } from '../../LoadError';
|
|
11
|
+
import { DataTable, FilterSelect, type DataTableColumn, type TableSort } from '../../table';
|
|
11
12
|
import { buildOverview, NO_PROJECT, type OverviewRow } from '../../../corpus/overview';
|
|
12
13
|
import type { Commitment, CorpusScope, Focus, PlanningApi } from '../../../corpus/types';
|
|
13
14
|
|
|
@@ -44,8 +45,9 @@ async function readAll<T>(read: (page: number) => Promise<{ results: T[]; next:
|
|
|
44
45
|
export function OverviewPage({ api, scope, meNames, onOpenProject, now }: OverviewPageProps) {
|
|
45
46
|
const [data, setData] = React.useState<{ focuses: Focus[]; items: Array<Commitment & { focusId?: string }> } | null>(null);
|
|
46
47
|
const [error, setError] = React.useState('');
|
|
47
|
-
|
|
48
|
-
const [
|
|
48
|
+
// The one filter: 'open' (default), 'all' (adds projects with nothing open), or `who:<owner key>`.
|
|
49
|
+
const [show, setShow] = React.useState<string>('open');
|
|
50
|
+
const [sort, setSort] = React.useState<TableSort | null>(null);
|
|
49
51
|
const [attempt, setAttempt] = React.useState(0);
|
|
50
52
|
|
|
51
53
|
React.useEffect(() => {
|
|
@@ -70,20 +72,15 @@ export function OverviewPage({ api, scope, meNames, onOpenProject, now }: Overvi
|
|
|
70
72
|
|
|
71
73
|
const people = overview.columns;
|
|
72
74
|
const anyOwner = people.some((c) => c.key !== '');
|
|
73
|
-
const
|
|
74
|
-
const
|
|
75
|
-
const
|
|
75
|
+
const who = show.startsWith('who:') ? show.slice(4) : null;
|
|
76
|
+
const idleCount = overview.rows.filter((r) => r.open === 0).length;
|
|
77
|
+
const visible = who !== null ? overview.rows.filter((r) => r.cells[who]) : show === 'all' ? overview.rows : overview.rows.filter((r) => r.open > 0);
|
|
78
|
+
const live = visible;
|
|
76
79
|
const val = (r: OverviewRow, k: SortKey): string | number =>
|
|
77
80
|
k === 'project' ? r.title.toLowerCase() : k === 'status' ? r.focus?.status ?? '' : k === 'waiting' ? r.waiting?.label.toLowerCase() ?? '' : k === 'open' ? r.open : r.lastActivity ?? '';
|
|
78
|
-
const
|
|
81
|
+
const dir = sort?.dir === 'desc' ? -1 : 1;
|
|
82
|
+
const rows = sort ? [...live].sort((a, b) => (val(a, sort.key as SortKey) < val(b, sort.key as SortKey) ? -dir : val(a, sort.key as SortKey) > val(b, sort.key as SortKey) ? dir : 0)) : live;
|
|
79
83
|
const open = (r: OverviewRow, owner?: string) => r.id !== NO_PROJECT && onOpenProject(r.id, owner);
|
|
80
|
-
const head = (key: SortKey, label: string) => (
|
|
81
|
-
<th scope="col" className="px-4 py-3" aria-sort={sort?.key === key ? (sort.dir === 1 ? 'ascending' : 'descending') : undefined}>
|
|
82
|
-
<button type="button" onClick={() => setSort(sort?.key === key ? { key, dir: sort.dir === 1 ? -1 : 1 } : { key, dir: key === 'open' || key === 'activity' ? -1 : 1 })} className="uppercase tracking-wide hover:text-gray-900">
|
|
83
|
-
{label}{sort?.key === key ? (sort.dir === 1 ? ' ↑' : ' ↓') : ''}
|
|
84
|
-
</button>
|
|
85
|
-
</th>
|
|
86
|
-
);
|
|
87
84
|
const waitingCell = (r: OverviewRow) =>
|
|
88
85
|
!r.waiting ? <span className="text-gray-300">–</span> : (
|
|
89
86
|
<>
|
|
@@ -99,79 +96,45 @@ export function OverviewPage({ api, scope, meNames, onOpenProject, now }: Overvi
|
|
|
99
96
|
</>
|
|
100
97
|
);
|
|
101
98
|
|
|
99
|
+
const columns: Array<DataTableColumn<OverviewRow>> = [
|
|
100
|
+
{
|
|
101
|
+
key: 'project', header: 'Project', sortable: true,
|
|
102
|
+
render: (r) => (r.id === NO_PROJECT
|
|
103
|
+
? <span className="font-medium">{r.title}</span>
|
|
104
|
+
: <button type="button" onClick={() => open(r, who ?? undefined)} className="text-left font-medium hover:underline">{r.title}</button>),
|
|
105
|
+
},
|
|
106
|
+
{ key: 'status', header: 'Status', sortable: true, hideOnPhone: true, render: (r) => (r.focus && STATUS[r.focus.status] ? <span className={`rounded-full px-2 py-0.5 text-xs ${STATUS[r.focus.status].cls}`}>{STATUS[r.focus.status].label}</span> : null) },
|
|
107
|
+
{ key: 'waiting', header: 'Waiting on', sortable: true, hideOnPhone: true, render: waitingCell },
|
|
108
|
+
{ key: 'next', header: 'Next step', render: nextCell },
|
|
109
|
+
{ key: 'open', header: 'Open', sortable: true, className: 'whitespace-nowrap', render: (r) => <>{r.open}{r.overdue ? <div className="mt-0.5 text-xs text-red-700">{r.overdue} overdue</div> : null}</> },
|
|
110
|
+
{ key: 'activity', header: 'Last activity', sortable: true, hideOnPhone: true, className: 'text-gray-500', render: (r) => dueText(r.lastActivity) ?? '–' },
|
|
111
|
+
];
|
|
112
|
+
|
|
102
113
|
return (
|
|
103
114
|
<div className="space-y-4" data-testid="overview">
|
|
104
|
-
{anyOwner ? (
|
|
105
|
-
<div className="flex flex-wrap items-center gap-2"
|
|
106
|
-
<
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
115
|
+
{anyOwner || idleCount ? (
|
|
116
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
117
|
+
<FilterSelect
|
|
118
|
+
label="Show" value={show} onChange={setShow}
|
|
119
|
+
options={[
|
|
120
|
+
{ value: 'open', label: `Open projects · ${overview.rows.length - idleCount}` },
|
|
121
|
+
...(idleCount ? [{ value: 'all', label: `All projects · ${overview.rows.length}` }] : []),
|
|
122
|
+
...people.filter((c) => c.key !== '' || anyOwner).map((c) => ({ value: `who:${c.key}`, label: `Waiting on ${c.label} · ${c.total}` })),
|
|
123
|
+
]}
|
|
124
|
+
/>
|
|
111
125
|
</div>
|
|
112
126
|
) : null}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
</tr>
|
|
125
|
-
</thead>
|
|
126
|
-
<tbody>
|
|
127
|
-
{rows.map((r) => (
|
|
128
|
-
<tr key={r.id} className="border-t border-gray-200 align-top hover:bg-gray-50">
|
|
129
|
-
<th scope="row" className="px-4 py-3 text-left font-medium text-gray-900">
|
|
130
|
-
{r.id === NO_PROJECT ? <span>{r.title}</span> : <button type="button" onClick={() => open(r, who ?? undefined)} className="text-left hover:underline">{r.title}</button>}
|
|
131
|
-
</th>
|
|
132
|
-
<td className="px-4 py-3">{r.focus && STATUS[r.focus.status] ? <span className={`rounded-full px-2 py-0.5 text-xs ${STATUS[r.focus.status].cls}`}>{STATUS[r.focus.status].label}</span> : null}</td>
|
|
133
|
-
<td className="px-4 py-3">{waitingCell(r)}</td>
|
|
134
|
-
<td className="px-4 py-3">{nextCell(r)}</td>
|
|
135
|
-
<td className="whitespace-nowrap px-4 py-3 text-gray-900">{r.open}{r.overdue ? <div className="mt-0.5 text-xs text-red-700">{r.overdue} overdue</div> : null}</td>
|
|
136
|
-
<td className="px-4 py-3 text-gray-500">{dueText(r.lastActivity) ?? '–'}</td>
|
|
137
|
-
</tr>
|
|
138
|
-
))}
|
|
139
|
-
</tbody>
|
|
140
|
-
</table>
|
|
141
|
-
</div>
|
|
142
|
-
|
|
143
|
-
<ul className="space-y-3 md:hidden">
|
|
144
|
-
{rows.map((r) => (
|
|
145
|
-
<li key={r.id} className="space-y-1.5 rounded-xl border border-gray-200 bg-white p-4">
|
|
146
|
-
<div className="flex items-center gap-2">
|
|
147
|
-
{r.id === NO_PROJECT ? <span className="flex-1 font-medium">{r.title}</span> : <button type="button" onClick={() => open(r, who ?? undefined)} className="flex-1 text-left font-medium hover:underline">{r.title}</button>}
|
|
148
|
-
{r.focus && STATUS[r.focus.status] ? <span className={`rounded-full px-2 py-0.5 text-xs ${STATUS[r.focus.status].cls}`}>{STATUS[r.focus.status].label}</span> : null}
|
|
149
|
-
</div>
|
|
150
|
-
{anyOwner && r.waiting ? <div className="text-sm text-gray-700"><span className="text-gray-500">Waiting on</span> {r.waiting.label}{r.moreWaiting ? <span className="text-gray-500"> + {r.moreWaiting} more</span> : null}</div> : null}
|
|
151
|
-
{r.next ? <div className="text-sm text-gray-800"><span className="text-gray-500">Next</span> {r.next.title}</div> : null}
|
|
152
|
-
<div className={`text-xs ${r.overdue ? 'text-red-700' : 'text-gray-500'}`}>{r.open} open{r.overdue ? ` · ${r.overdue} overdue` : ''}</div>
|
|
153
|
-
</li>
|
|
154
|
-
))}
|
|
155
|
-
</ul>
|
|
156
|
-
|
|
157
|
-
{idle.length ? (
|
|
158
|
-
<details className="rounded-xl border border-gray-200 bg-white px-4 py-3 text-sm">
|
|
159
|
-
<summary className="cursor-pointer text-gray-600">{idle.length} {idle.length === 1 ? 'project has' : 'projects have'} nothing open</summary>
|
|
160
|
-
<ul className="mt-2 flex flex-wrap gap-2">
|
|
161
|
-
{idle.map((r) => (
|
|
162
|
-
<li key={r.id}><button type="button" onClick={() => open(r)} className="rounded-md bg-gray-100 px-2 py-1 text-gray-800 hover:bg-gray-200">{r.title}</button></li>
|
|
163
|
-
))}
|
|
164
|
-
</ul>
|
|
165
|
-
</details>
|
|
166
|
-
) : null}
|
|
127
|
+
<DataTable
|
|
128
|
+
tableId="overview"
|
|
129
|
+
columns={columns}
|
|
130
|
+
rows={rows}
|
|
131
|
+
rowKey={(r) => r.id}
|
|
132
|
+
sort={sort}
|
|
133
|
+
onSort={setSort}
|
|
134
|
+
onRowClick={(r) => open(r, who ?? undefined)}
|
|
135
|
+
rowClassName={(r) => (r.open === 0 ? 'text-gray-500' : '')}
|
|
136
|
+
emptyMessage="No projects match."
|
|
137
|
+
/>
|
|
167
138
|
</div>
|
|
168
139
|
);
|
|
169
140
|
}
|
|
170
|
-
|
|
171
|
-
function Chip({ active, onClick, children }: { active: boolean; onClick: () => void; children: React.ReactNode }) {
|
|
172
|
-
return (
|
|
173
|
-
<button type="button" onClick={onClick} aria-pressed={active} className={`rounded-full border px-3 py-1.5 text-sm ${active ? 'border-indigo-600 bg-indigo-600 text-white' : 'border-gray-300 bg-white text-gray-700'}`}>
|
|
174
|
-
{children}
|
|
175
|
-
</button>
|
|
176
|
-
);
|
|
177
|
-
}
|
|
@@ -1,27 +1,18 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* TALK: ONE screen for the conversation with
|
|
5
|
-
* No modes
|
|
4
|
+
* TALK: ONE screen for the conversation with Roci: to-dos, questions, plans, the relay and voice notes, in one thread.
|
|
5
|
+
* No modes and no subtitle (Quinn dislikes them): the mic's colour is the state.
|
|
6
|
+
* The host mounts the `ConversePage`; this only gives it its width.
|
|
6
7
|
*/
|
|
7
8
|
import * as React from 'react';
|
|
8
9
|
|
|
9
|
-
import { TAB_COPY } from '../../../corpus/nav-copy';
|
|
10
|
-
|
|
11
10
|
export interface TalkPageProps {
|
|
12
11
|
/** The `ConversePage`. */
|
|
13
12
|
talk: React.ReactNode;
|
|
14
|
-
classNames?: Partial<Record<'root'
|
|
13
|
+
classNames?: Partial<Record<'root', string>>;
|
|
15
14
|
}
|
|
16
15
|
|
|
17
|
-
const DEFAULTS = { root: 'space-y-3', subtitle: 'text-sm text-gray-500' };
|
|
18
|
-
|
|
19
16
|
export function TalkPage({ talk, classNames = {} }: TalkPageProps) {
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<div className={cn.root}>
|
|
23
|
-
<p className={cn.subtitle} data-testid="talk-mode-subtitle">{TAB_COPY.talk.subtitle}</p>
|
|
24
|
-
{talk}
|
|
25
|
-
</div>
|
|
26
|
-
);
|
|
17
|
+
return <div className={classNames.root ?? 'mx-auto max-w-2xl'}>{talk}</div>;
|
|
27
18
|
}
|
|
@@ -19,15 +19,17 @@ export interface TimelinePageProps {
|
|
|
19
19
|
now?: number;
|
|
20
20
|
timeZone?: string;
|
|
21
21
|
className?: string;
|
|
22
|
+
/** Open the to-do an event is about (its `externalId`). */
|
|
23
|
+
onOpenItem?: (externalId: string) => void;
|
|
22
24
|
}
|
|
23
25
|
|
|
24
|
-
export function TimelinePage({ api, scope, now, timeZone, className }: TimelinePageProps) {
|
|
26
|
+
export function TimelinePage({ api, scope, now, timeZone, className, onOpenItem }: TimelinePageProps) {
|
|
25
27
|
const [mountedAt] = React.useState(() => Date.now());
|
|
26
28
|
if (!api.timeline) return <p className="text-sm text-gray-500">The timeline is not available in this workspace.</p>;
|
|
27
29
|
return (
|
|
28
30
|
<TrackerTimeline
|
|
29
31
|
api={api} orgId={scope.orgId} now={now ?? mountedAt} timeZone={timeZone}
|
|
30
|
-
filter={NO_FILTER} className={className} heading={false}
|
|
32
|
+
filter={NO_FILTER} className={className} heading={false} onOpenItem={onOpenItem}
|
|
31
33
|
/>
|
|
32
34
|
);
|
|
33
35
|
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import { isStalled, runProgress } from '../../../corpus/runs';
|
|
4
|
+
import type { ExtractionRun } from '../../../corpus/types';
|
|
5
|
+
|
|
6
|
+
type SweepSlot = 'card' | 'muted' | 'error' | 'warning' | 'progressTrack' | 'progressBar';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* A SWEEP IN FLIGHT, and afterwards what it did (bd startsim-768w.38.28).
|
|
10
|
+
*
|
|
11
|
+
* The old button blocked on a call that could not finish, so the only states it
|
|
12
|
+
* ever had were "spinning" and "504". A six-minute job has four states a person
|
|
13
|
+
* actually needs, and every one of them is a sentence rather than a spinner:
|
|
14
|
+
*
|
|
15
|
+
* GOING how far, out of what, and that it survives leaving the page. A
|
|
16
|
+
* progress bar with no denominator is a spinner with extra steps.
|
|
17
|
+
* STALLED the driver went away — a container replacement, usually. Said out
|
|
18
|
+
* loud with a Resume, because a sweep that silently stops looking
|
|
19
|
+
* busy is the worst of the four.
|
|
20
|
+
* DONE what it wrote, AND whether the model actually answered.
|
|
21
|
+
* FAILED why, and what it kept. Partial progress is progress and nobody
|
|
22
|
+
* should start over by hand because the screen did not say so.
|
|
23
|
+
*
|
|
24
|
+
* THE MODEL LINE IS THE POINT OF THE BEAD. `fromModel: 0` used to be the entire
|
|
25
|
+
* report of a blown provider timeout, and it reads exactly like "the model found
|
|
26
|
+
* nothing to add". It is not allowed to render that way any more: if the model
|
|
27
|
+
* did not answer, this says so, says it timed out when it did, and names how many
|
|
28
|
+
* meetings got only the deterministic pass.
|
|
29
|
+
*/
|
|
30
|
+
export function SweepPanel({
|
|
31
|
+
sweep, now, classNames: cn,
|
|
32
|
+
}: {
|
|
33
|
+
sweep: ExtractionRun;
|
|
34
|
+
now: number;
|
|
35
|
+
classNames: Record<SweepSlot, string>;
|
|
36
|
+
}) {
|
|
37
|
+
const progress = runProgress(sweep);
|
|
38
|
+
const stalled = isStalled(sweep, now);
|
|
39
|
+
const busy = (sweep.status === 'queued' || sweep.status === 'running') && !stalled;
|
|
40
|
+
const totals = sweep.totals;
|
|
41
|
+
const failure = sweep.lastModelFailure;
|
|
42
|
+
|
|
43
|
+
// A finished run leaves nothing on the page: the list is the result.
|
|
44
|
+
if (sweep.status === 'succeeded') return null;
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<div className={cn.card} role="status" aria-live="polite">
|
|
48
|
+
{busy || stalled ? (
|
|
49
|
+
<>
|
|
50
|
+
<p className="text-sm text-gray-800">
|
|
51
|
+
Reading your meetings — {progress.done} of {progress.total} meetings
|
|
52
|
+
{totals.created > 0 ? `, ${totals.created} items so far` : ''}.
|
|
53
|
+
</p>
|
|
54
|
+
<div className={`mt-2 ${cn.progressTrack}`}>
|
|
55
|
+
<div className={cn.progressBar} style={{ width: `${Math.max(progress.percent, 2)}%` }} />
|
|
56
|
+
</div>
|
|
57
|
+
</>
|
|
58
|
+
) : null}
|
|
59
|
+
|
|
60
|
+
{busy ? (
|
|
61
|
+
<p className={`mt-2 ${cn.muted}`}>
|
|
62
|
+
{/* The single most useful sentence on the screen: it removes the
|
|
63
|
+
reason somebody sits and watches, or presses the button again. */}
|
|
64
|
+
This keeps going if you close this page. Come back and it will still be here.
|
|
65
|
+
</p>
|
|
66
|
+
) : null}
|
|
67
|
+
|
|
68
|
+
{stalled ? (
|
|
69
|
+
<p className={`mt-2 ${cn.warning}`}>
|
|
70
|
+
This run stopped before it finished — the process that was doing the work went
|
|
71
|
+
away. Everything it had already read is saved. Resume picks up at meeting{' '}
|
|
72
|
+
{progress.done + 1}, not at the beginning.
|
|
73
|
+
</p>
|
|
74
|
+
) : null}
|
|
75
|
+
|
|
76
|
+
{sweep.status === 'failed' ? (
|
|
77
|
+
<p className={cn.error}>
|
|
78
|
+
This run stopped: {sweep.error || 'the workspace could not be reached'}. It kept
|
|
79
|
+
everything it had already read — {progress.done} of {progress.total} meetings,{' '}
|
|
80
|
+
{totals.created} items. Running it again carries on from there.
|
|
81
|
+
</p>
|
|
82
|
+
) : null}
|
|
83
|
+
|
|
84
|
+
{totals.modelFailures > 0 ? (
|
|
85
|
+
<p className={`mt-2 ${cn.warning}`} role="status">
|
|
86
|
+
{/* NOT `fromModel: 0` on its own. That reading — "nothing to add" —
|
|
87
|
+
is what hid a week of degraded runs. */}
|
|
88
|
+
On {totals.modelFailures} of {totals.modelFailures + totals.modelCalls} passes the model
|
|
89
|
+
did not answer
|
|
90
|
+
{failure?.timedOut ? ' — it timed out' : failure ? ` — ${failure.message}` : ''}. Those{' '}
|
|
91
|
+
{sweep.modelIncompleteIds.length} meeting
|
|
92
|
+
{sweep.modelIncompleteIds.length === 1 ? '' : 's'} were read by the deterministic pass
|
|
93
|
+
only, so anything stated in the notes but not written into a next-step list is still
|
|
94
|
+
missing from them. Running it again gives the model another go; nothing is duplicated.
|
|
95
|
+
</p>
|
|
96
|
+
) : null}
|
|
97
|
+
|
|
98
|
+
{totals.droppedOutOfScope > 0 ? (
|
|
99
|
+
<p className={cn.error} role="status">
|
|
100
|
+
{totals.droppedOutOfScope} record{totals.droppedOutOfScope === 1 ? '' : 's'} from another
|
|
101
|
+
workspace were returned by the data API and excluded before extracting.
|
|
102
|
+
</p>
|
|
103
|
+
) : null}
|
|
104
|
+
</div>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// ---------------------------------------------------------------------------
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE TIMELINE TABLE: what happened, when, to which to-do, by whom or what, and the to-do's ONE current status.
|
|
3
|
+
* Same shared `DataTable` and footer as the to-do list. No category column (it repeated the status), no amount
|
|
4
|
+
* column (nothing here has an amount). The rows are derived from the bounded server read, so sort and paging are
|
|
5
|
+
* over that read; the page says when the read was capped.
|
|
6
|
+
*/
|
|
7
|
+
import * as React from 'react';
|
|
8
|
+
|
|
9
|
+
import { DataTable, readPageSize, writePageSize, type DataTableColumn, type PageSize, type TableSort } from '../../table';
|
|
10
|
+
import { statusCell } from '../../table/todo-model';
|
|
11
|
+
import { relativeWhen, type TimelineRow } from '../../../corpus/timeline-events';
|
|
12
|
+
|
|
13
|
+
const MUTED = 'text-gray-500 dark:text-gray-400';
|
|
14
|
+
|
|
15
|
+
export function TimelineTable({ rows, now, onOpenItem, emptyMessage }: {
|
|
16
|
+
rows: TimelineRow[];
|
|
17
|
+
now: number;
|
|
18
|
+
onOpenItem?: (externalId: string) => void;
|
|
19
|
+
emptyMessage: string;
|
|
20
|
+
}) {
|
|
21
|
+
const [sort, setSort] = React.useState<TableSort | null>(null);
|
|
22
|
+
const [page, setPage] = React.useState(1);
|
|
23
|
+
const [pageSize, setPageSize] = React.useState<PageSize>(() => readPageSize('timeline'));
|
|
24
|
+
|
|
25
|
+
const sorted = React.useMemo(() => {
|
|
26
|
+
if (!sort) return rows;
|
|
27
|
+
const dir = sort.dir === 'asc' ? 1 : -1;
|
|
28
|
+
const key = (r: TimelineRow) => (sort.key === 'when' ? r.at : sort.key === 'what' ? r.what : r.title.toLowerCase());
|
|
29
|
+
return [...rows].sort((a, b) => (key(a) < key(b) ? -dir : key(a) > key(b) ? dir : 0));
|
|
30
|
+
}, [rows, sort]);
|
|
31
|
+
// A new set of rows (a filter or range change) starts at page one.
|
|
32
|
+
React.useEffect(() => setPage(1), [rows]);
|
|
33
|
+
const visible = sorted.slice((page - 1) * pageSize, page * pageSize);
|
|
34
|
+
|
|
35
|
+
const columns = React.useMemo<Array<DataTableColumn<TimelineRow>>>(() => [
|
|
36
|
+
{ key: 'what', header: 'What happened', sortable: true, className: 'w-48 whitespace-nowrap', render: (r) => <span className="text-gray-900 dark:text-gray-100">{r.what}</span> },
|
|
37
|
+
{
|
|
38
|
+
key: 'when', header: 'When', sortable: true, className: 'w-36 whitespace-nowrap',
|
|
39
|
+
render: (r) => (
|
|
40
|
+
<span className="text-gray-700 dark:text-gray-200" title={`${new Date(r.at).toLocaleString('en-US', { dateStyle: 'medium', timeStyle: r.estimated ? undefined : 'short', timeZone: 'UTC' })} UTC${r.estimated ? ' (date estimated)' : ''}`}>
|
|
41
|
+
{relativeWhen(r.at, now)}
|
|
42
|
+
</span>
|
|
43
|
+
),
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
key: 'title', header: 'To-do', sortable: true,
|
|
47
|
+
render: (r) => (onOpenItem && r.externalId
|
|
48
|
+
? <button type="button" onClick={() => onOpenItem(r.externalId!)} className="block max-w-[22rem] truncate text-left font-medium text-gray-900 hover:underline dark:text-gray-100">{r.title}</button>
|
|
49
|
+
: <span className="block max-w-[22rem] truncate font-medium text-gray-900 dark:text-gray-100">{r.title}</span>),
|
|
50
|
+
},
|
|
51
|
+
{ key: 'by', header: 'By', hideOnPhone: true, className: 'w-36 whitespace-nowrap', render: (r) => <span className={MUTED}>{r.actor}</span> },
|
|
52
|
+
{
|
|
53
|
+
key: 'status', header: 'Status', className: 'w-36 whitespace-nowrap',
|
|
54
|
+
render: (r) => {
|
|
55
|
+
const s = statusCell(r.status);
|
|
56
|
+
return <span className="inline-flex items-center gap-2 text-gray-700 dark:text-gray-200"><span aria-hidden className={`h-2 w-2 rounded-full ${s.dot}`} />{s.label}</span>;
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
], [now, onOpenItem]);
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<DataTable<TimelineRow>
|
|
63
|
+
tableId="timeline" columns={columns} rows={visible} rowKey={(r) => r.id}
|
|
64
|
+
sort={sort} onSort={(s) => { setSort(s); setPage(1); }}
|
|
65
|
+
page={page} pageSize={pageSize} total={sorted.length} onPage={setPage}
|
|
66
|
+
onPageSize={(n) => { writePageSize('timeline', n); setPageSize(n); setPage(1); }}
|
|
67
|
+
emptyMessage={emptyMessage}
|
|
68
|
+
/>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
@@ -13,7 +13,11 @@
|
|
|
13
13
|
import * as React from 'react';
|
|
14
14
|
|
|
15
15
|
import { LoadError } from '../../LoadError';
|
|
16
|
-
import { DEFAULT_RANGES,
|
|
16
|
+
import { DEFAULT_RANGES, RangeTimelineChart } from '@startsimpli/ui/insights';
|
|
17
|
+
|
|
18
|
+
import { FilterSelect, TableToolbar } from '../../table';
|
|
19
|
+
import { EVENT_FILTERS, timelineEvents } from '../../../corpus/timeline-events';
|
|
20
|
+
import { TimelineTable } from './TimelineTable';
|
|
17
21
|
|
|
18
22
|
import { buildTimeline, anchorOf, type TimelineFilter } from '../../../corpus/tracker-timeline';
|
|
19
23
|
import type { TimelineRead } from '../../../corpus/tracker-timeline-client';
|
|
@@ -33,6 +37,8 @@ export interface TrackerTimelineProps {
|
|
|
33
37
|
className?: string;
|
|
34
38
|
/** Draw the 'Timeline' heading. A page that already titles itself Timeline turns this off (one title per page). */
|
|
35
39
|
heading?: boolean;
|
|
40
|
+
/** Open the to-do an event is about. */
|
|
41
|
+
onOpenItem?: (externalId: string) => void;
|
|
36
42
|
}
|
|
37
43
|
|
|
38
44
|
const FILTER_DEBOUNCE_MS = 400;
|
|
@@ -48,7 +54,7 @@ function useDebounced<T>(value: T, ms: number): T {
|
|
|
48
54
|
}
|
|
49
55
|
|
|
50
56
|
export function TrackerTimeline({
|
|
51
|
-
api, orgId, filter, now, timeZone = 'UTC', debounceMs = FILTER_DEBOUNCE_MS, className, heading = true,
|
|
57
|
+
api, orgId, filter, now, timeZone = 'UTC', debounceMs = FILTER_DEBOUNCE_MS, className, heading = true, onOpenItem,
|
|
52
58
|
}: TrackerTimelineProps) {
|
|
53
59
|
const apiRef = React.useRef(api);
|
|
54
60
|
apiRef.current = api;
|
|
@@ -57,7 +63,11 @@ export function TrackerTimeline({
|
|
|
57
63
|
const [error, setError] = React.useState('');
|
|
58
64
|
const [loading, setLoading] = React.useState(true);
|
|
59
65
|
|
|
60
|
-
|
|
66
|
+
// The page can drive the search (the tracker's old strip); on its own, the timeline has its own box.
|
|
67
|
+
const [ownSearch, setOwnSearch] = React.useState('');
|
|
68
|
+
const [eventKind, setEventKind] = React.useState('all');
|
|
69
|
+
const searchText = filter.search ?? ownSearch;
|
|
70
|
+
const debouncedSearch = useDebounced(searchText, debounceMs);
|
|
61
71
|
const filterKey = JSON.stringify({
|
|
62
72
|
status: filter.status ?? null, overdueOnly: Boolean(filter.overdueOnly),
|
|
63
73
|
owner: filter.owner ?? '', search: debouncedSearch,
|
|
@@ -82,6 +92,11 @@ export function TrackerTimeline({
|
|
|
82
92
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
83
93
|
}, [orgId, filterKey, anchor, timeZone, attempt]);
|
|
84
94
|
|
|
95
|
+
const rangeDays = DEFAULT_RANGES.find((r) => r.id === range)?.days ?? 30;
|
|
96
|
+
const rows = React.useMemo(
|
|
97
|
+
() => (read ? timelineEvents(read, now, timeZone, rangeDays).filter((r) => eventKind === 'all' || r.kind === eventKind) : []),
|
|
98
|
+
[read, now, timeZone, rangeDays, eventKind],
|
|
99
|
+
);
|
|
85
100
|
const built = React.useMemo(() => (read ? buildTimeline(read, now, timeZone) : null), [read, now, timeZone]);
|
|
86
101
|
|
|
87
102
|
return (
|
|
@@ -91,7 +106,16 @@ export function TrackerTimeline({
|
|
|
91
106
|
{loading && !built ? <p className="text-sm text-gray-500">Loading the timeline…</p> : null}
|
|
92
107
|
{built ? (
|
|
93
108
|
<>
|
|
94
|
-
<
|
|
109
|
+
<TableToolbar
|
|
110
|
+
search={ownSearch} onSearch={setOwnSearch} searchLabel="Search events" searchPlaceholder="Search events"
|
|
111
|
+
>
|
|
112
|
+
<FilterSelect label="Event" value={eventKind} options={[...EVENT_FILTERS]} onChange={setEventKind} />
|
|
113
|
+
<FilterSelect
|
|
114
|
+
label="Range" value={range}
|
|
115
|
+
options={DEFAULT_RANGES.map((r) => ({ value: r.id, label: `Last ${r.days} days` }))}
|
|
116
|
+
onChange={setRange}
|
|
117
|
+
/>
|
|
118
|
+
</TableToolbar>
|
|
95
119
|
<RangeTimelineChart
|
|
96
120
|
series={built.series}
|
|
97
121
|
anchor={anchor}
|
|
@@ -107,19 +131,12 @@ export function TrackerTimeline({
|
|
|
107
131
|
{built.estimatedDone} done {built.estimatedDone === 1 ? 'to-do has' : 'to-dos have'} no completion date and {built.estimatedDone === 1 ? 'is' : 'are'} counted on the day {built.estimatedDone === 1 ? 'it was' : 'they were'} last updated.
|
|
108
132
|
</p>
|
|
109
133
|
) : null}
|
|
110
|
-
<
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
direction="back"
|
|
114
|
-
range={range}
|
|
115
|
-
hideRangeSelector
|
|
116
|
-
showCategory
|
|
117
|
-
pageSize={10}
|
|
118
|
-
title="To-dos in this window"
|
|
119
|
-
emptyMessage="No to-dos in this window."
|
|
134
|
+
<TimelineTable
|
|
135
|
+
rows={rows} now={now} onOpenItem={onOpenItem}
|
|
136
|
+
emptyMessage={eventKind === 'all' ? 'Nothing happened to a to-do in this window.' : 'No matching events in this window.'}
|
|
120
137
|
/>
|
|
121
138
|
{read?.truncated ? (
|
|
122
|
-
<p className="text-xs text-gray-500">The table
|
|
139
|
+
<p className="text-xs text-gray-500">The table and its page count cover the newest 200 per kind (created, done, overdue); the chart counts all of them.</p>
|
|
123
140
|
) : null}
|
|
124
141
|
</>
|
|
125
142
|
) : null}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE ONE TABLE. Columns, sortable headers and the shared pagination footer; it holds no rows
|
|
3
|
+
* of its own and sorts/pages nothing locally: the host passes one server page and answers
|
|
4
|
+
* `onSort` / `onPage` / `onPageSize` with a server query. Used by to-dos, Timeline and every
|
|
5
|
+
* later list, so they cannot drift apart.
|
|
6
|
+
*
|
|
7
|
+
* `hideBelow` collapses a column on a phone: the row keeps its title, due and status, the rest
|
|
8
|
+
* belong in the row's detail.
|
|
9
|
+
*/
|
|
10
|
+
import * as React from 'react';
|
|
11
|
+
|
|
12
|
+
import { TablePagination } from './TablePagination';
|
|
13
|
+
import { ariaSort, nextSort, type PageSize, type TableSort } from './table-logic';
|
|
14
|
+
|
|
15
|
+
export interface DataTableColumn<Row> {
|
|
16
|
+
key: string;
|
|
17
|
+
header: string;
|
|
18
|
+
sortable?: boolean;
|
|
19
|
+
/** Tailwind width/alignment for the cell, e.g. `w-24 text-right`. */
|
|
20
|
+
className?: string;
|
|
21
|
+
/** Hide this column under the `md` breakpoint (phones). */
|
|
22
|
+
hideOnPhone?: boolean;
|
|
23
|
+
/** Visually hide the header text (checkbox and menu columns) while keeping it for screen readers. */
|
|
24
|
+
srOnlyHeader?: boolean;
|
|
25
|
+
render: (row: Row) => React.ReactNode;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface DataTableProps<Row> {
|
|
29
|
+
/** Names the table for remembered settings and test ids. */
|
|
30
|
+
tableId: string;
|
|
31
|
+
columns: Array<DataTableColumn<Row>>;
|
|
32
|
+
rows: Row[];
|
|
33
|
+
rowKey: (row: Row) => string;
|
|
34
|
+
sort?: TableSort | null;
|
|
35
|
+
onSort?: (sort: TableSort) => void;
|
|
36
|
+
/** Paging is the host's server query. Leave `onPage` out for a short list (Today) and no footer is drawn. */
|
|
37
|
+
page?: number;
|
|
38
|
+
pageSize?: PageSize;
|
|
39
|
+
total?: number;
|
|
40
|
+
onPage?: (page: number) => void;
|
|
41
|
+
onPageSize?: (size: PageSize) => void;
|
|
42
|
+
loading?: boolean;
|
|
43
|
+
emptyMessage?: string;
|
|
44
|
+
/** Extra classes for one row, e.g. a muted finished row. */
|
|
45
|
+
rowClassName?: (row: Row) => string;
|
|
46
|
+
/** A full-width row above the first record (the inline add row). */
|
|
47
|
+
topRow?: React.ReactNode;
|
|
48
|
+
/** Makes the whole row clickable (Enter/Space too). Controls inside the row keep their own clicks. */
|
|
49
|
+
onRowClick?: (row: Row) => void;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const hide = (c: { hideOnPhone?: boolean }) => (c.hideOnPhone ? 'hidden md:table-cell' : '');
|
|
53
|
+
|
|
54
|
+
export function DataTable<Row>({
|
|
55
|
+
tableId, columns, rows, rowKey, sort, onSort, page = 1, pageSize = 25, total = rows.length, onPage, onPageSize,
|
|
56
|
+
loading, emptyMessage = 'Nothing to show.', rowClassName, topRow, onRowClick,
|
|
57
|
+
}: DataTableProps<Row>) {
|
|
58
|
+
return (
|
|
59
|
+
<div className="w-full min-w-0 max-w-full overflow-hidden rounded-lg border border-gray-200 bg-white dark:border-gray-700 dark:bg-gray-900" data-testid={`table-${tableId}`}>
|
|
60
|
+
<div className="overflow-x-auto">
|
|
61
|
+
<table className="w-full border-collapse text-left text-sm">
|
|
62
|
+
<thead>
|
|
63
|
+
<tr className="border-b border-gray-200 text-xs font-medium text-gray-500 dark:border-gray-700 dark:text-gray-400">
|
|
64
|
+
{columns.map((c) => (
|
|
65
|
+
<th key={c.key} scope="col" aria-sort={c.sortable && onSort ? ariaSort(sort ?? null, c.key) : undefined} className={`px-2 py-2 md:px-3 font-medium ${hide(c)} ${c.className ?? ''}`}>
|
|
66
|
+
{c.sortable && onSort ? (
|
|
67
|
+
<button type="button" onClick={() => onSort?.(nextSort(sort ?? null, c.key))} className="inline-flex items-center gap-1 hover:text-gray-900 dark:hover:text-gray-100">
|
|
68
|
+
{c.header}
|
|
69
|
+
<span aria-hidden className="w-3 text-[10px]">{sort?.key === c.key ? (sort.dir === 'asc' ? '▲' : '▼') : ''}</span>
|
|
70
|
+
</button>
|
|
71
|
+
) : c.srOnlyHeader ? <span className="sr-only">{c.header}</span> : c.header}
|
|
72
|
+
</th>
|
|
73
|
+
))}
|
|
74
|
+
</tr>
|
|
75
|
+
</thead>
|
|
76
|
+
<tbody className={loading ? 'opacity-60' : undefined}>
|
|
77
|
+
{topRow ? <tr className="border-b border-gray-200 bg-gray-50 dark:border-gray-700 dark:bg-gray-800/60"><td colSpan={columns.length} className="px-3 py-2">{topRow}</td></tr> : null}
|
|
78
|
+
{rows.map((row) => (
|
|
79
|
+
<tr key={rowKey(row)} onClick={onRowClick ? (e) => { if (!(e.target as HTMLElement).closest('button,a,input,select,[role=menu]')) onRowClick(row); } : undefined} className={`${onRowClick ? 'cursor-pointer ' : ''}border-b border-gray-100 last:border-b-0 hover:bg-gray-50 dark:border-gray-800 dark:hover:bg-gray-800/60 ${rowClassName?.(row) ?? ''}`}>
|
|
80
|
+
{columns.map((c) => <td key={c.key} className={`px-2 py-2.5 md:px-3 align-middle ${hide(c)} ${c.className ?? ''}`}>{c.render(row)}</td>)}
|
|
81
|
+
</tr>
|
|
82
|
+
))}
|
|
83
|
+
</tbody>
|
|
84
|
+
</table>
|
|
85
|
+
</div>
|
|
86
|
+
{rows.length === 0 && (loading || emptyMessage) ? (
|
|
87
|
+
<p className="px-3 py-6 text-center text-sm text-gray-500 dark:text-gray-400">{loading ? 'Loading…' : emptyMessage}</p>
|
|
88
|
+
) : null}
|
|
89
|
+
{onPage && onPageSize ? <TablePagination page={page} pageSize={pageSize} total={total} onPage={onPage} onPageSize={onPageSize} /> : null}
|
|
90
|
+
</div>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** The row's "…" menu: one button, a short list. Closes on selection, Escape and an outside click. */
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
export interface RowMenuItem { label: string; onSelect?: () => void; href?: string; disabled?: boolean }
|
|
5
|
+
|
|
6
|
+
export function RowMenu({ label, items }: { label: string; items: RowMenuItem[] }) {
|
|
7
|
+
const [open, setOpen] = React.useState(false);
|
|
8
|
+
const ref = React.useRef<HTMLDivElement>(null);
|
|
9
|
+
React.useEffect(() => {
|
|
10
|
+
if (!open) return undefined;
|
|
11
|
+
const away = (e: MouseEvent) => { if (!ref.current?.contains(e.target as Node)) setOpen(false); };
|
|
12
|
+
const esc = (e: KeyboardEvent) => { if (e.key === 'Escape') setOpen(false); };
|
|
13
|
+
document.addEventListener('mousedown', away);
|
|
14
|
+
document.addEventListener('keydown', esc);
|
|
15
|
+
return () => { document.removeEventListener('mousedown', away); document.removeEventListener('keydown', esc); };
|
|
16
|
+
}, [open]);
|
|
17
|
+
const item = 'block w-full px-3 py-1.5 text-left text-sm text-gray-800 hover:bg-gray-100 disabled:opacity-40 dark:text-gray-100 dark:hover:bg-gray-800';
|
|
18
|
+
return (
|
|
19
|
+
<div ref={ref} className="relative inline-block">
|
|
20
|
+
<button
|
|
21
|
+
type="button" aria-label={label} aria-haspopup="menu" aria-expanded={open} onClick={() => setOpen((o) => !o)}
|
|
22
|
+
className="rounded px-1.5 py-0.5 text-gray-500 hover:bg-gray-100 dark:text-gray-400 dark:hover:bg-gray-800"
|
|
23
|
+
>⋯</button>
|
|
24
|
+
{open ? (
|
|
25
|
+
<div role="menu" className="absolute right-0 z-20 mt-1 min-w-[10rem] overflow-hidden rounded-md border border-gray-200 bg-white py-1 shadow-lg dark:border-gray-700 dark:bg-gray-900">
|
|
26
|
+
{items.map((i) => (i.href ? (
|
|
27
|
+
<a key={i.label} role="menuitem" href={i.href} target="_blank" rel="noreferrer" className={item} onClick={() => setOpen(false)}>{i.label}</a>
|
|
28
|
+
) : (
|
|
29
|
+
<button key={i.label} type="button" role="menuitem" disabled={i.disabled} className={item} onClick={() => { setOpen(false); i.onSelect?.(); }}>{i.label}</button>
|
|
30
|
+
)))}
|
|
31
|
+
</div>
|
|
32
|
+
) : null}
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
}
|