@startsimpli/integrations 0.2.229 → 0.2.231
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 +4 -4
- package/src/__tests__/corpus-ask-lookup.test.ts +70 -0
- package/src/__tests__/today-agenda-list.test.tsx +96 -0
- package/src/__tests__/today-agenda-route.test.ts +41 -0
- package/src/__tests__/today-agenda.test.ts +143 -0
- package/src/comms/__tests__/email-auth.test.tsx +173 -0
- package/src/comms/api/comms.ts +21 -0
- package/src/comms/components/EmailAuthApply.tsx +83 -0
- package/src/comms/components/EmailAuthPanel.tsx +140 -0
- package/src/comms/components/SendingDomain.tsx +3 -0
- package/src/comms/components/index.ts +1 -0
- package/src/comms/hooks/index.ts +38 -0
- package/src/comms/types/index.ts +77 -0
- package/src/components/pages/home/BriefCard.tsx +5 -3
- package/src/components/pages/home/HomeBriefPage.tsx +17 -6
- package/src/components/pages/home/TodayAgendaList.tsx +115 -0
- package/src/components/pages/home/index.ts +2 -0
- package/src/corpus/ask-items.ts +15 -5
- package/src/corpus/converse/brain.ts +3 -3
- package/src/corpus/give-up.ts +4 -0
- package/src/corpus/index.ts +4 -0
- package/src/corpus/llm.ts +5 -1
- package/src/corpus/today-agenda-route.ts +80 -0
- package/src/corpus/today-agenda.ts +144 -0
- package/src/native/home/AgendaSection.tsx +40 -0
- package/src/native/home/HomeScreen.tsx +14 -9
- package/src/native/home/__tests__/agenda-controller.test.ts +54 -0
- package/src/native/home/__tests__/home-agenda.test.tsx +42 -0
- package/src/native/home/agenda-controller.ts +46 -0
- package/src/native/home/tab.tsx +5 -1
- package/src/native/index.ts +2 -0
|
@@ -28,6 +28,7 @@ import { localDate } from '../today';
|
|
|
28
28
|
import { questionWindow } from '../ask-items-intent';
|
|
29
29
|
import { BRIEF_ME, NEEDS_ME, buildQueue, firstPrompt, relayItemsFrom, startBriefing, stepBriefing, type BriefingEffect, type BriefingState } from './briefing-queue';
|
|
30
30
|
import type { ConverseBrain, ConverseSource, HistoryLine } from './types';
|
|
31
|
+
import { isGiveUp } from '../give-up';
|
|
31
32
|
|
|
32
33
|
const MIN_AUTO = 0.85;
|
|
33
34
|
/** A spoken answer is read in full, but not forever. */
|
|
@@ -122,7 +123,6 @@ export function speakableAnswer(answer: string): string {
|
|
|
122
123
|
|
|
123
124
|
/** What is said when Ask has nothing usable: say what cannot be seen, never a raw status word. */
|
|
124
125
|
export const CANNOT_SEE = 'I could not find anything about that in your items or notes. You can ask what is due this week, or tell me what to add.';
|
|
125
|
-
const GIVE_UP = /^\W*(unanswerable|unknown|n\/a|none|null|undefined)\W*$/i;
|
|
126
126
|
|
|
127
127
|
/** Times each awaited step into `timings` (a step that runs twice adds up). */
|
|
128
128
|
function stopwatch() {
|
|
@@ -162,7 +162,7 @@ export function createConverseBrain(deps: ConverseBrainDeps): ConverseBrain {
|
|
|
162
162
|
if (!deps.answerFrom) return { text: NO_FLEET_STATUS, forRelay: true, intent: 'relay' as const };
|
|
163
163
|
const said = await timed('answer', () => deps.answerFrom!({ question: `${utterance}\n\n${NO_FILLER}`, material: `Fleet status as of ${snap.updatedAt || 'an unknown time'}:\n${snap.text}` }).catch(() => ''));
|
|
164
164
|
const spoken = speakableAnswer(said);
|
|
165
|
-
const body = !spoken ||
|
|
165
|
+
const body = !spoken || isGiveUp(spoken) ? speakableAnswer(snap.text.split('\n').filter((l) => l.trim() && !l.startsWith('#')).slice(0, 4).join(' ')) : spoken;
|
|
166
166
|
if (!stale) return { text: body, intent: 'question' as const };
|
|
167
167
|
// The age is added here, not left to the model: a snapshot must never sound live.
|
|
168
168
|
const age = ageWords(snap.updatedAt, now);
|
|
@@ -307,7 +307,7 @@ export function createConverseBrain(deps: ConverseBrainDeps): ConverseBrain {
|
|
|
307
307
|
const answered = await (earlyAsk ?? timed('ask', () => deps.ask({ question: askQuestion(utterance, history), timeZone, now })));
|
|
308
308
|
// The screen gets the whole answer (cleaned for reading); the voice gets a short version of a long one.
|
|
309
309
|
const full = speakable(answered.answer ?? '', 400) || (answered.answer ?? '').trim();
|
|
310
|
-
if (!full ||
|
|
310
|
+
if (!full || isGiveUp(full)) return { text: CANNOT_SEE, intent: 'question' as const };
|
|
311
311
|
const short = spokenSummary(full);
|
|
312
312
|
const sources = answered.sources ?? (answered.citations ? askSources(answered) : undefined);
|
|
313
313
|
const listed: PlayedItem[] = (sources ?? []).filter((x) => x.id.startsWith('item:')).map((x) => ({ id: x.id.replace(/^item:/, ''), title: x.title }));
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** A model's non-answer ("unanswerable", "unanswerable: true", "n/a", ...) as the WHOLE of an answer: never shown, treated as no answer. */
|
|
2
|
+
const GIVE_UP = /^\W*(unanswerable|unknown|n\/a|none|null|undefined)(\W+(true|false))?\W*$/i;
|
|
3
|
+
|
|
4
|
+
export const isGiveUp = (text: string): boolean => GIVE_UP.test(text);
|
package/src/corpus/index.ts
CHANGED
|
@@ -289,6 +289,10 @@ export type {
|
|
|
289
289
|
// Today, defined once (bd startsim-cqeho): the date helpers and the selector the briefing composes on.
|
|
290
290
|
export { dueDay, localDate, selectToday, todayKind } from './today';
|
|
291
291
|
export type { TodayEntry, TodayItem, TodayKind, TodayRule } from './today';
|
|
292
|
+
export { buildTodayAgenda } from './today-agenda';
|
|
293
|
+
export type { AgendaAction, AgendaDraft, AgendaEvent, AgendaItem, AgendaShipped, AgendaSource, AgendaTodo, TodayAgenda, TodayAgendaInput } from './today-agenda';
|
|
294
|
+
export { answerTodayItem, loadTodayAgenda } from './today-agenda-route';
|
|
295
|
+
export type { TodayAgendaDeps } from './today-agenda-route';
|
|
292
296
|
// Daily briefing: what is on one person's plate today (bd startsim-kgkp1).
|
|
293
297
|
export * from './briefing';
|
|
294
298
|
export * from './converse';
|
package/src/corpus/llm.ts
CHANGED
|
@@ -20,6 +20,7 @@ import { SpeechService } from '@startsimpli/llm/speech';
|
|
|
20
20
|
import type { SpeechServiceConfig } from '@startsimpli/llm/speech';
|
|
21
21
|
|
|
22
22
|
import { answerSystemPrompt, renderAnswerPrompt } from './ask';
|
|
23
|
+
import { isGiveUp } from './give-up';
|
|
23
24
|
import { classifySystemPrompt, renderClassifyPrompt } from './classify';
|
|
24
25
|
import { renderTeamPrompt, teamSystemPrompt } from './classify-team';
|
|
25
26
|
import {
|
|
@@ -172,7 +173,10 @@ export function parseAnswerDraft(raw: string): AnswerDraft | null {
|
|
|
172
173
|
const extraction = extractJson(raw);
|
|
173
174
|
if (!extraction.success || !extraction.json || typeof extraction.json !== 'object') return null;
|
|
174
175
|
const json = extraction.json as Record<string, unknown>;
|
|
175
|
-
const
|
|
176
|
+
const rawAnswer = typeof json.answer === 'string' ? json.answer : '';
|
|
177
|
+
// The model wrote its give-up INTO the answer string: that is no answer, not something to show.
|
|
178
|
+
if (rawAnswer && isGiveUp(rawAnswer)) return { answer: '', citations: [], unanswerable: true };
|
|
179
|
+
const answer = rawAnswer;
|
|
176
180
|
if (!answer && json.unanswerable !== true) return null;
|
|
177
181
|
const citations = Array.isArray(json.citations)
|
|
178
182
|
? json.citations
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE TODAY AGENDA'S SERVER SIDE (ASK 2). Request-free like the briefing and notify logic, so a Next route is a few
|
|
3
|
+
* lines. Every optional source is best-effort: a failing read leaves that source out, never the list.
|
|
4
|
+
*
|
|
5
|
+
* load = needs-you queue (relay items, decisions, fleet lines, orgs) + to-dos + drafts + events + shipped -> agenda
|
|
6
|
+
* answer = record his answer on a queue item (it leaves the queue), tell the relay, answer a one-question decision
|
|
7
|
+
*/
|
|
8
|
+
import { buildNeedsYou, loadOrgItems, policyFrom } from './attention';
|
|
9
|
+
import type { OrgItem } from './attention/orgs';
|
|
10
|
+
import { buildFleetView } from './converse/fleet-view';
|
|
11
|
+
import { loadFleetSnapshot } from './converse/fleet';
|
|
12
|
+
import { answerDecision, getDecision } from './notify/handle';
|
|
13
|
+
import { loadState, saveState } from './notify/state';
|
|
14
|
+
import { NotifyError, type NotifyDeps } from './notify/types';
|
|
15
|
+
import { buildTodayAgenda, type AgendaDraft, type AgendaEvent, type AgendaShipped, type AgendaTodo, type TodayAgenda } from './today-agenda';
|
|
16
|
+
|
|
17
|
+
export interface TodayAgendaDeps {
|
|
18
|
+
http: NotifyDeps['http'];
|
|
19
|
+
ownerSub: string;
|
|
20
|
+
now?: () => number;
|
|
21
|
+
orgs?: () => Promise<OrgItem[]>;
|
|
22
|
+
/** The person's live to-dos (the same read the briefing uses). */
|
|
23
|
+
loadTodos(): Promise<AgendaTodo[]>;
|
|
24
|
+
/** Optional sources. A tenant that cannot read one omits it; nothing is invented in its place. */
|
|
25
|
+
loadDrafts?(): Promise<AgendaDraft[]>;
|
|
26
|
+
loadEvents?(): Promise<AgendaEvent[]>;
|
|
27
|
+
loadShipped?(): Promise<AgendaShipped[]>;
|
|
28
|
+
/** Hands an answer to a relay question back to the relay. */
|
|
29
|
+
deliverRelay?(d: { id: string; text: string; answer: string; source?: string; link?: string }): Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const soft = async <T>(read: (() => Promise<T[]>) | undefined): Promise<T[]> => {
|
|
33
|
+
if (!read) return [];
|
|
34
|
+
try { return await read(); } catch (e) { console.error('[today] a source could not be read', e); return []; }
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
async function queueFor(deps: TodayAgendaDeps) {
|
|
38
|
+
const [snap, state] = await Promise.all([loadFleetSnapshot(deps as never).catch(() => null), loadState(deps)]);
|
|
39
|
+
const queue = buildNeedsYou({
|
|
40
|
+
view: snap?.inputs ? buildFleetView(snap.inputs) : null,
|
|
41
|
+
decisions: state.decisions, policy: policyFrom(state.attention), answered: state.answered,
|
|
42
|
+
relay: state.relay_items, orgs: await soft(deps.orgs),
|
|
43
|
+
});
|
|
44
|
+
return { queue, state };
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export async function loadTodayAgenda(deps: TodayAgendaDeps, opts: { timeZone?: string } = {}): Promise<TodayAgenda> {
|
|
48
|
+
const [{ queue }, todos, drafts, events, shipped] = await Promise.all([
|
|
49
|
+
queueFor(deps), soft(deps.loadTodos), soft(deps.loadDrafts), soft(deps.loadEvents), soft(deps.loadShipped),
|
|
50
|
+
]);
|
|
51
|
+
return buildTodayAgenda({ now: (deps.now ?? Date.now)(), timeZone: opts.timeZone, needsYou: queue.items, todos, drafts, events, shipped });
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** Records his answer to one queue item. The item leaves the queue because `state.answered` now names it. */
|
|
55
|
+
export async function answerTodayItem(deps: TodayAgendaDeps, req: { id?: unknown; answer?: unknown }): Promise<{ id: string }> {
|
|
56
|
+
const id = String(req.id ?? '');
|
|
57
|
+
const answer = String(req.answer ?? '').replace(/\s+/g, ' ').trim().slice(0, 500);
|
|
58
|
+
if (!answer) throw new NotifyError('An answer is needed.', 400);
|
|
59
|
+
const { queue, state } = await queueFor(deps);
|
|
60
|
+
const item = queue.items.find((i) => i.id === id);
|
|
61
|
+
if (!item) throw new NotifyError('That is no longer waiting on you.', 404);
|
|
62
|
+
const relayItem = id.startsWith('relay:') ? (state.relay_items ?? []).find((r) => `relay:${r.id}` === id) : undefined;
|
|
63
|
+
let delivered: 'decision' | 'relay' | undefined;
|
|
64
|
+
let deliveryFailed = false;
|
|
65
|
+
if (relayItem && deps.deliverRelay) {
|
|
66
|
+
try { await deps.deliverRelay({ id: relayItem.id, text: relayItem.text, answer, ...(relayItem.source ? { source: relayItem.source } : {}), ...(relayItem.link ? { link: relayItem.link } : {}) }); delivered = 'relay'; }
|
|
67
|
+
catch (e) { deliveryFailed = true; console.error('[today] could not tell the relay his answer (kept for it to read back)', e); }
|
|
68
|
+
}
|
|
69
|
+
if (item.ref) {
|
|
70
|
+
try {
|
|
71
|
+
const d = await getDecision(deps as NotifyDeps, item.ref);
|
|
72
|
+
if (d.questions.length === 1) { await answerDecision(deps as NotifyDeps, item.ref, { answer }); delivered = 'decision'; }
|
|
73
|
+
} catch (e) { console.error('[today] could not deliver the answer to its decision', e); }
|
|
74
|
+
}
|
|
75
|
+
let answered = { ...state.answered, [id]: { answer, at: new Date((deps.now ?? Date.now)()).toISOString(), conversation_id: 'today', ...(item.ref ? { ref: item.ref } : {}), ...(delivered ? { delivered } : {}), ...(relayItem ? { source: 'relay' as const } : {}), ...(deliveryFailed ? { delivery_failed: true } : {}) } };
|
|
76
|
+
const keys = Object.keys(answered);
|
|
77
|
+
if (keys.length > 300) answered = Object.fromEntries(keys.slice(-300).map((k) => [k, (answered as Record<string, never>)[k]]));
|
|
78
|
+
await saveState(deps, { ...state, answered });
|
|
79
|
+
return { id };
|
|
80
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE TODAY AGENDA (ASK 2): a short ranked list of what the person must do today, each item with the reason it is
|
|
3
|
+
* today and ONE action. Provider independent and PURE: `now` and the person's zone come in, and every source is an
|
|
4
|
+
* optional input (a source that has nothing, or failed to read, is simply an empty list).
|
|
5
|
+
*
|
|
6
|
+
* Sources: (1) questions only he can answer and (4) agent work blocked on him, both from the needs-you queue;
|
|
7
|
+
* (2) drafts waiting for him to send; (3) due and overdue to-dos and today's calendar; (5) what shipped since yesterday.
|
|
8
|
+
* It supersedes "Today draws no to-dos and no Needs your call": one list, one flow, nothing new beside it.
|
|
9
|
+
*/
|
|
10
|
+
import type { QueuedItem } from './attention/types';
|
|
11
|
+
import { dueDay, localDate } from './today';
|
|
12
|
+
import { isLiveStatus } from './item-status';
|
|
13
|
+
|
|
14
|
+
export interface AgendaTodo { id: string; title: string; status: string; dueAt?: string | null; priority?: number }
|
|
15
|
+
export interface AgendaDraft { id: string; title: string; to?: string; link?: string }
|
|
16
|
+
export interface AgendaEvent { id: string; title: string; startsAt: string; endsAt?: string; link?: string }
|
|
17
|
+
export interface AgendaShipped { id: string; text: string; at: string; link?: string }
|
|
18
|
+
|
|
19
|
+
export type AgendaSource = 'decision' | 'blocked' | 'draft' | 'todo' | 'event';
|
|
20
|
+
export type AgendaAction =
|
|
21
|
+
| { kind: 'answer'; label: string; questionId: string; options: string[]; /** An open question: the answer is typed, not Yes / No. */ freeform: boolean }
|
|
22
|
+
| { kind: 'complete'; label: string; todoIds: string[] }
|
|
23
|
+
| { kind: 'open'; label: string; href: string };
|
|
24
|
+
|
|
25
|
+
export interface AgendaItem { id: string; source: AgendaSource; title: string; reason: string; action: AgendaAction; score: number }
|
|
26
|
+
export interface TodayAgenda {
|
|
27
|
+
/** At most `cap` items: what to do now. */
|
|
28
|
+
doNow: AgendaItem[];
|
|
29
|
+
/** Everything else that is today, collapsed by default. */
|
|
30
|
+
rest: AgendaItem[];
|
|
31
|
+
/** One line each, newest first. A footer, not work. */
|
|
32
|
+
shipped: AgendaShipped[];
|
|
33
|
+
/** Items in doNow + rest. */
|
|
34
|
+
total: number;
|
|
35
|
+
/** Nothing to do (shipped lines do not count). */
|
|
36
|
+
empty: boolean;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface TodayAgendaInput {
|
|
40
|
+
now: number;
|
|
41
|
+
timeZone?: string;
|
|
42
|
+
needsYou?: QueuedItem[];
|
|
43
|
+
todos?: AgendaTodo[];
|
|
44
|
+
drafts?: AgendaDraft[];
|
|
45
|
+
events?: AgendaEvent[];
|
|
46
|
+
shipped?: AgendaShipped[];
|
|
47
|
+
cap?: number;
|
|
48
|
+
/** Shipped lines kept (default 5). */
|
|
49
|
+
shippedMax?: number;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
53
|
+
const monthDay = (day: string) => `${MONTHS[Number(day.slice(5, 7)) - 1]} ${Number(day.slice(8, 10))}`;
|
|
54
|
+
const norm = (s: string) => s.toLowerCase().replace(/[^a-z0-9]+/g, ' ').trim();
|
|
55
|
+
const clock = (iso: string, timeZone: string) =>
|
|
56
|
+
new Intl.DateTimeFormat('en-US', { timeZone, hour: 'numeric', minute: '2-digit' }).format(new Date(iso));
|
|
57
|
+
/** A line that is agent work waiting on him (a PR, a credential, an approval), not a question. */
|
|
58
|
+
const YES_NO = /yes\s*\/\s*no|^\s*(should|shall|can|may|do|does|did|is|are|will|would|ok|okay)\b/i;
|
|
59
|
+
const BLOCKED = /\b(pr|pull request|merge|credentials?|api key|token|password|login|approv\w*|sign[- ]?off|permission|access)\b/i;
|
|
60
|
+
|
|
61
|
+
// Base scores: an urgent blocker first, then blocked agents, then his decisions, then the clock, then drafts and to-dos.
|
|
62
|
+
const BASE = { urgent: 1000, blocked: 800, decision: 600, event: 500, draft: 400, overdue: 300, digest: 150, dueToday: 200 };
|
|
63
|
+
|
|
64
|
+
function fromNeedsYou(q: QueuedItem): AgendaItem {
|
|
65
|
+
const blocked = q.source === 'org' || BLOCKED.test(q.text);
|
|
66
|
+
const source: AgendaSource = blocked ? 'blocked' : 'decision';
|
|
67
|
+
const urgent = q.class === 'urgent';
|
|
68
|
+
const digest = q.class === 'digest' && !blocked;
|
|
69
|
+
const reason = urgent ? 'Urgent: waiting on you now'
|
|
70
|
+
: digest ? `Can wait: optional or on hold${q.from ? ` (${q.from})` : ''}`
|
|
71
|
+
: blocked ? `Work is blocked until you act${q.from ? ` (${q.from})` : ''}`
|
|
72
|
+
: `Waiting on your answer${q.from ? ` (${q.from})` : ''}`;
|
|
73
|
+
const action: AgendaAction = q.link && blocked
|
|
74
|
+
? { kind: 'open', label: 'Open it', href: q.link }
|
|
75
|
+
: { kind: 'answer', label: q.options?.length ? 'Choose' : 'Answer', questionId: q.id, options: q.options ?? [], freeform: !q.options?.length && !YES_NO.test(q.text) };
|
|
76
|
+
return { id: q.id, source, title: q.text, reason, action, score: (urgent ? BASE.urgent : blocked ? BASE.blocked : digest ? BASE.digest : BASE.decision) + q.importance / 10 };
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function buildTodayAgenda(input: TodayAgendaInput): TodayAgenda {
|
|
80
|
+
const timeZone = input.timeZone ?? 'UTC';
|
|
81
|
+
const today = localDate(input.now, timeZone);
|
|
82
|
+
const items: AgendaItem[] = (input.needsYou ?? []).filter((q) => q.class !== 'noise').map(fromNeedsYou);
|
|
83
|
+
|
|
84
|
+
// To-dos: due on or before today, live, grouped by title so a recurring overdue to-do is one line that closes every copy.
|
|
85
|
+
const groups = new Map<string, { todos: AgendaTodo[]; days: string[] }>();
|
|
86
|
+
for (const t of input.todos ?? []) {
|
|
87
|
+
if (!isLiveStatus(t.status) || t.status === 'blocked') continue;
|
|
88
|
+
const day = dueDay(t.dueAt, timeZone);
|
|
89
|
+
if (!day || day > today) continue;
|
|
90
|
+
const g = groups.get(norm(t.title)) ?? { todos: [], days: [] };
|
|
91
|
+
g.todos.push(t); g.days.push(day);
|
|
92
|
+
groups.set(norm(t.title), g);
|
|
93
|
+
}
|
|
94
|
+
for (const g of groups.values()) {
|
|
95
|
+
const first = [...g.days].sort()[0];
|
|
96
|
+
const overdue = first < today;
|
|
97
|
+
const times = g.todos.length > 1 ? `, ${g.todos.length} times` : '';
|
|
98
|
+
items.push({
|
|
99
|
+
id: `todo:${g.todos[0].id}`, source: 'todo', title: g.todos[0].title,
|
|
100
|
+
reason: overdue ? `Overdue since ${monthDay(first)}${times}` : 'Due today',
|
|
101
|
+
action: { kind: 'complete', label: g.todos.length > 1 ? 'Done, close all' : 'Mark done', todoIds: g.todos.map((t) => t.id) },
|
|
102
|
+
score: (overdue ? BASE.overdue : BASE.dueToday) - Math.min(...g.todos.map((t) => t.priority ?? 4)),
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
for (const d of input.drafts ?? []) {
|
|
107
|
+
items.push({
|
|
108
|
+
id: `draft:${d.id}`, source: 'draft', title: d.title,
|
|
109
|
+
reason: d.to ? `Drafted for ${d.to}, waiting for you to send` : 'Drafted and waiting for you to send',
|
|
110
|
+
action: { kind: 'open', label: 'Review and send', href: d.link ?? '#' }, score: BASE.draft,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
for (const e of input.events ?? []) {
|
|
115
|
+
const t = Date.parse(e.startsAt);
|
|
116
|
+
if (Number.isNaN(t) || localDate(t, timeZone) !== today) continue;
|
|
117
|
+
const end = e.endsAt ? Date.parse(e.endsAt) : t + 3600_000;
|
|
118
|
+
if (end < input.now) continue; // already over
|
|
119
|
+
items.push({
|
|
120
|
+
id: `event:${e.id}`, source: 'event', title: e.title,
|
|
121
|
+
reason: t <= input.now ? 'On now' : `Today at ${clock(e.startsAt, timeZone)}`,
|
|
122
|
+
action: { kind: 'open', label: 'Open event', href: e.link ?? '#' },
|
|
123
|
+
score: BASE.event + Math.max(0, 100 - Math.max(0, (t - input.now) / 3600_000) * 5),
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// The same thing named twice (a fleet line and the to-do) is one item: keep the higher-ranked one.
|
|
128
|
+
const seen = new Map<string, AgendaItem>();
|
|
129
|
+
for (const i of [...items].sort(byRank)) if (!seen.has(norm(i.title))) seen.set(norm(i.title), i);
|
|
130
|
+
const ranked = [...seen.values()].sort(byRank);
|
|
131
|
+
|
|
132
|
+
const cap = input.cap ?? 5;
|
|
133
|
+
const yesterday = shiftDay(today, -1);
|
|
134
|
+
const shipped = [...(input.shipped ?? [])]
|
|
135
|
+
.filter((s) => !Number.isNaN(Date.parse(s.at)) && localDate(Date.parse(s.at), timeZone) >= yesterday)
|
|
136
|
+
.sort((a, b) => Date.parse(b.at) - Date.parse(a.at))
|
|
137
|
+
.slice(0, input.shippedMax ?? 5);
|
|
138
|
+
return { doNow: ranked.slice(0, cap), rest: ranked.slice(cap), shipped, total: ranked.length, empty: ranked.length === 0 };
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const byRank = (a: AgendaItem, b: AgendaItem) => b.score - a.score || a.id.localeCompare(b.id);
|
|
142
|
+
function shiftDay(day: string, by: number): string {
|
|
143
|
+
const d = new Date(`${day}T00:00:00Z`); d.setUTCDate(d.getUTCDate() + by); return d.toISOString().slice(0, 10);
|
|
144
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Linking, View } from 'react-native';
|
|
2
|
+
import { Alert, Button, ListRow, Skeleton, Text, useTheme } from '@startsimpli/ui-native';
|
|
3
|
+
import { useControllerState } from '../components/useControllerState';
|
|
4
|
+
import type { AgendaItem } from '../../corpus/today-agenda';
|
|
5
|
+
import type { AgendaController } from './agenda-controller';
|
|
6
|
+
|
|
7
|
+
/** Today's ranked list on the phone: each row is its title, the reason it is today, and ONE action. */
|
|
8
|
+
export function AgendaSection({ controller }: { controller: AgendaController }) {
|
|
9
|
+
const theme = useTheme();
|
|
10
|
+
const s = useControllerState(controller);
|
|
11
|
+
if (s.loading && !s.agenda) return <Skeleton height={120} />;
|
|
12
|
+
if (s.error && !s.agenda) return <Alert variant="destructive">{s.error}</Alert>;
|
|
13
|
+
const items = s.agenda ? [...s.agenda.doNow] : [];
|
|
14
|
+
const rest = s.agenda?.rest.length ?? 0;
|
|
15
|
+
return (
|
|
16
|
+
<View testID="home-agenda" style={{ gap: theme.spacing.xs }}>
|
|
17
|
+
{s.notice ? <Alert variant="destructive">{s.notice}</Alert> : null}
|
|
18
|
+
{items.length === 0 ? <Text variant="callout">Nothing needs you today.</Text> : items.map((i) => <Row key={i.id} item={i} controller={controller} />)}
|
|
19
|
+
{rest > 0 ? <Text variant="footnote" testID="home-agenda-rest">{rest} more on the web</Text> : null}
|
|
20
|
+
</View>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function Row({ item, controller }: { item: AgendaItem; controller: AgendaController }) {
|
|
25
|
+
const a = item.action;
|
|
26
|
+
return (
|
|
27
|
+
<ListRow
|
|
28
|
+
testID={`home-agenda-${item.id}`}
|
|
29
|
+
title={item.title}
|
|
30
|
+
subtitle={a.kind === 'answer' && a.freeform ? `${item.reason}. Answer in Talk.` : item.reason}
|
|
31
|
+
footer={
|
|
32
|
+
<>
|
|
33
|
+
{a.kind === 'answer' && a.freeform ? null : a.kind === 'answer' ? (a.options.length ? a.options : ['Yes', 'No']).map((o) => <Button key={o} testID={`home-agenda-answer-${o}`} title={o} size="sm" onPress={() => void controller.answer(item, o)} />)
|
|
34
|
+
: a.kind === 'complete' ? <Button testID="home-agenda-complete" title={a.label} size="sm" onPress={() => void controller.complete(item)} />
|
|
35
|
+
: <Button testID="home-agenda-open" title={a.label} size="sm" onPress={() => { void Linking.openURL(a.href); }} />}
|
|
36
|
+
</>
|
|
37
|
+
}
|
|
38
|
+
/>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
@@ -4,6 +4,8 @@ import { Alert, Button, EmptyState, Text, Header, IconTile, ListRow, SectionHead
|
|
|
4
4
|
import { iconName, toneKey } from '../screens/shared/displayView';
|
|
5
5
|
import { useControllerState } from '../components/useControllerState';
|
|
6
6
|
import { timeAgo, type HomeArrival, type HomeController } from './controller';
|
|
7
|
+
import type { AgendaController } from './agenda-controller';
|
|
8
|
+
import { AgendaSection } from './AgendaSection';
|
|
7
9
|
|
|
8
10
|
export interface HomeScreenProps {
|
|
9
11
|
controller: HomeController;
|
|
@@ -25,35 +27,38 @@ export interface HomeScreenProps {
|
|
|
25
27
|
/** False while another tab is showing; the counts reload each time Home comes back. Default true. */
|
|
26
28
|
active?: boolean;
|
|
27
29
|
now?: () => number;
|
|
30
|
+
/** The ranked do-now list. When given it IS Today: it replaces "What has come in" and "Latest arrivals" (opt-in; other tenants keep them). */
|
|
31
|
+
agenda?: AgendaController;
|
|
28
32
|
}
|
|
29
33
|
|
|
30
34
|
/** The front door, as the web Home draws it: brand, "What has come in" counts, "Latest arrivals". */
|
|
31
|
-
export function HomeScreen({ controller, brand, tagline, onTalk, onOpenPlan, briefing, title, subtitle, onOpenType, onOpenArrival, active = true, now = Date.now }: HomeScreenProps) {
|
|
35
|
+
export function HomeScreen({ controller, brand, tagline, onTalk, onOpenPlan, briefing, title, subtitle, onOpenType, onOpenArrival, active = true, now = Date.now, agenda }: HomeScreenProps) {
|
|
32
36
|
const theme = useTheme();
|
|
33
37
|
const haptic = useHaptics();
|
|
34
38
|
const s = useControllerState(controller);
|
|
35
|
-
useEffect(() => { if (active) void controller.load(); }, [controller, active]);
|
|
39
|
+
useEffect(() => { if (active) void (agenda ? agenda.load() : controller.load()); }, [controller, agenda, active]);
|
|
36
40
|
return (
|
|
37
41
|
<View style={{ flex: 1 }}>
|
|
38
42
|
<Header large testID="home-header" title={title ?? brand} subtitle={title ? undefined : (subtitle ?? tagline)} />
|
|
39
43
|
<FlatList
|
|
40
44
|
testID="home-list"
|
|
41
|
-
data={s.arrivals}
|
|
45
|
+
data={agenda ? [] : s.arrivals}
|
|
42
46
|
keyExtractor={(a) => `${a.type}-${a.id}`}
|
|
43
47
|
refreshControl={<RefreshControl refreshing={false} onRefresh={() => { haptic('light', 'pull-to-refresh'); void controller.refresh(); }} tintColor={theme.colors.mutedForeground} />}
|
|
44
48
|
contentContainerStyle={{ paddingHorizontal: theme.layout.gutter, paddingBottom: theme.spacing.xl, flexGrow: 1 }}
|
|
45
49
|
ListHeaderComponent={
|
|
46
50
|
<View style={{ gap: theme.spacing.xs, paddingBottom: theme.spacing.xs }}>
|
|
47
51
|
{briefing ? <View testID="home-briefing" style={{ marginTop: theme.spacing.sm, paddingBottom: theme.spacing.sm }}>{briefing}</View> : null}
|
|
48
|
-
{
|
|
52
|
+
{agenda ? <AgendaSection controller={agenda} /> : null}
|
|
53
|
+
{!agenda && s.dueSoon ? (
|
|
49
54
|
<Pressable accessibilityRole="button" accessibilityLabel={`${s.dueSoon}. Open Plan`} disabled={!onOpenPlan} onPress={onOpenPlan} testID="home-due-soon" hitSlop={8}>
|
|
50
55
|
<Text variant="callout">{s.dueSoon}{onOpenPlan ? ' ›' : ''}</Text>
|
|
51
56
|
</Pressable>
|
|
52
57
|
) : null}
|
|
53
58
|
{onTalk ? <Button testID="home-talk" title="Talk to Tandem" size="lg" style={{ marginTop: theme.spacing.sm }} onPress={onTalk} /> : null}
|
|
54
59
|
{s.error ? <Alert variant="destructive">{s.error}</Alert> : null}
|
|
55
|
-
<SectionHeader title="What has come in" />
|
|
56
|
-
<View style={{ flexDirection: 'row', gap: theme.spacing.sm }}>
|
|
60
|
+
{agenda ? null : <SectionHeader title="What has come in" />}
|
|
61
|
+
{agenda ? null : <View style={{ flexDirection: 'row', gap: theme.spacing.sm }}>
|
|
57
62
|
{s.metrics.map((m) => (
|
|
58
63
|
<View key={m.key} style={{ flex: 1, minWidth: 0 }} testID={`home-metric-${m.key}`}>
|
|
59
64
|
{s.loading ? <Skeleton height={72} /> : (
|
|
@@ -63,11 +68,11 @@ export function HomeScreen({ controller, brand, tagline, onTalk, onOpenPlan, bri
|
|
|
63
68
|
)}
|
|
64
69
|
</View>
|
|
65
70
|
))}
|
|
66
|
-
</View>
|
|
67
|
-
<SectionHeader title="Latest arrivals" />
|
|
71
|
+
</View>}
|
|
72
|
+
{agenda ? null : <SectionHeader title="Latest arrivals" />}
|
|
68
73
|
</View>
|
|
69
74
|
}
|
|
70
|
-
ListEmptyComponent={s.loading ? null : <EmptyState icon="note" title="No records yet" description="Record a note to get started." />}
|
|
75
|
+
ListEmptyComponent={agenda || s.loading ? null : <EmptyState icon="note" title="No records yet" description="Record a note to get started." />}
|
|
71
76
|
renderItem={({ item }) => (
|
|
72
77
|
<ListRow
|
|
73
78
|
leading={<IconTile icon={iconName(item.display.icon)} tone={item.display.status ? toneKey(item.display.status.tone) : 'info'} />}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { createAgendaController } from '../agenda-controller';
|
|
3
|
+
import type { AgendaItem, TodayAgenda } from '../../../corpus/today-agenda';
|
|
4
|
+
|
|
5
|
+
const todo = (id: string): AgendaItem => ({ id: `todo:${id}`, source: 'todo', title: id, reason: 'Due today', score: 1, action: { kind: 'complete', label: 'Mark done', todoIds: [id] } });
|
|
6
|
+
const q = (id: string): AgendaItem => ({ id, source: 'decision', title: id, reason: 'Only you can decide', score: 2, action: { kind: 'answer', label: 'Choose', questionId: id, options: ['yes', 'no'], freeform: false } });
|
|
7
|
+
const agenda = (doNow: AgendaItem[], rest: AgendaItem[] = []): TodayAgenda => ({ doNow, rest, shipped: [], total: doNow.length + rest.length, empty: !doNow.length && !rest.length });
|
|
8
|
+
const api = (a: TodayAgenda) => ({ load: vi.fn(async () => a), answer: vi.fn(async () => undefined), complete: vi.fn(async () => undefined) });
|
|
9
|
+
|
|
10
|
+
describe('native agenda controller', () => {
|
|
11
|
+
it('loads the agenda once and exposes it', async () => {
|
|
12
|
+
const c = createAgendaController({ api: api(agenda([todo('a')])) });
|
|
13
|
+
expect(c.getState().loading).toBe(true);
|
|
14
|
+
await c.load();
|
|
15
|
+
expect(c.getState()).toMatchObject({ loading: false, error: null });
|
|
16
|
+
expect(c.getState().agenda!.doNow).toHaveLength(1);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('completing removes the item at once, saves through the api, and a later rest item moves up to fill do-now', async () => {
|
|
20
|
+
const x = api(agenda([todo('a')], [todo('b')]));
|
|
21
|
+
const c = createAgendaController({ api: x, cap: 1 });
|
|
22
|
+
await c.load();
|
|
23
|
+
const p = c.complete(c.getState().agenda!.doNow[0]);
|
|
24
|
+
expect(c.getState().agenda!.doNow.map((i) => i.id)).toEqual(['todo:b']);
|
|
25
|
+
await p;
|
|
26
|
+
expect(x.complete).toHaveBeenCalledWith(['a']);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('answering saves the answer under the question id and removes the item', async () => {
|
|
30
|
+
const x = api(agenda([q('relay:r1')]));
|
|
31
|
+
const c = createAgendaController({ api: x });
|
|
32
|
+
await c.load();
|
|
33
|
+
await c.answer(c.getState().agenda!.doNow[0], 'yes');
|
|
34
|
+
expect(x.answer).toHaveBeenCalledWith('relay:r1', 'yes');
|
|
35
|
+
expect(c.getState().agenda!.doNow).toHaveLength(0);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('puts the item back with a plain notice when the save fails', async () => {
|
|
39
|
+
const x = api(agenda([todo('a')]));
|
|
40
|
+
x.complete.mockRejectedValueOnce(new Error('offline'));
|
|
41
|
+
const c = createAgendaController({ api: x });
|
|
42
|
+
await c.load();
|
|
43
|
+
await c.complete(c.getState().agenda!.doNow[0]);
|
|
44
|
+
expect(c.getState().agenda!.doNow.map((i) => i.id)).toEqual(['todo:a']);
|
|
45
|
+
expect(c.getState().notice).toMatch(/did not save/i);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('a failed load is an error message, not a crash', async () => {
|
|
49
|
+
const x = { ...api(agenda([])), load: vi.fn(async () => { throw new Error('boom'); }) };
|
|
50
|
+
const c = createAgendaController({ api: x });
|
|
51
|
+
await c.load();
|
|
52
|
+
expect(c.getState().error).toBeTruthy();
|
|
53
|
+
});
|
|
54
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
+
|
|
3
|
+
vi.mock('react-native', async () => {
|
|
4
|
+
const stub = await import('../../../../../ui-native/test/rn-stub');
|
|
5
|
+
return { ...stub, Linking: { openURL: async () => {} } };
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
import { act, allText, hostById, press, render } from '../../../../../ui-native/test/render';
|
|
9
|
+
import { createFakeNativeCorpusApi } from '../../corpus/fake';
|
|
10
|
+
import { createHomeController } from '../controller';
|
|
11
|
+
import { createAgendaController } from '../agenda-controller';
|
|
12
|
+
import { HomeScreen } from '../HomeScreen';
|
|
13
|
+
import type { TodayAgenda } from '../../../corpus/today-agenda';
|
|
14
|
+
|
|
15
|
+
const agenda: TodayAgenda = {
|
|
16
|
+
doNow: [{ id: 'todo:t1', source: 'todo', title: 'Send invoice', reason: 'Overdue since Nov 20', score: 1, action: { kind: 'complete', label: 'Mark done', todoIds: ['t1'] } }],
|
|
17
|
+
rest: [], shipped: [], total: 1, empty: false,
|
|
18
|
+
};
|
|
19
|
+
const tick = () => act(async () => { await new Promise((res) => setTimeout(res, 20)); });
|
|
20
|
+
|
|
21
|
+
describe('HomeScreen with an agenda', () => {
|
|
22
|
+
it('shows the ranked list instead of the counts and arrivals, and marking done closes the to-do', async () => {
|
|
23
|
+
const api = { load: async () => agenda, answer: vi.fn(async () => {}), complete: vi.fn(async () => {}) };
|
|
24
|
+
const home = createHomeController({ api: createFakeNativeCorpusApi(), types: [{ key: 'commitment', label: 'To-dos' }] });
|
|
25
|
+
const r = render(<HomeScreen controller={home} brand="Tandem" title="Today" agenda={createAgendaController({ api })} />);
|
|
26
|
+
await tick();
|
|
27
|
+
const text = allText(r);
|
|
28
|
+
expect(text).toContain('Send invoice');
|
|
29
|
+
expect(text).toContain('Overdue since Nov 20');
|
|
30
|
+
expect(text).not.toContain('What has come in');
|
|
31
|
+
expect(text).not.toContain('Latest arrivals');
|
|
32
|
+
await press(hostById(r, 'home-agenda-complete'));
|
|
33
|
+
expect(api.complete).toHaveBeenCalledWith(['t1']);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('without an agenda it is unchanged: counts and arrivals', async () => {
|
|
37
|
+
const home = createHomeController({ api: createFakeNativeCorpusApi(), types: [{ key: 'commitment', label: 'To-dos' }] });
|
|
38
|
+
const r = render(<HomeScreen controller={home} brand="Tandem" title="Today" />);
|
|
39
|
+
await tick();
|
|
40
|
+
expect(allText(r)).toContain('What has come in');
|
|
41
|
+
});
|
|
42
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Today list's state on the phone (ASK 2): the same `TodayAgenda` the web list draws, as a framework-free
|
|
3
|
+
* controller. Done items leave at once; a failed save puts the item back with a plain notice.
|
|
4
|
+
*/
|
|
5
|
+
import type { TodayAgendaApi } from '../../components/pages/home/TodayAgendaList';
|
|
6
|
+
import type { AgendaItem, TodayAgenda } from '../../corpus/today-agenda';
|
|
7
|
+
|
|
8
|
+
export interface AgendaState { loading: boolean; agenda: TodayAgenda | null; error: string | null; notice: string | null }
|
|
9
|
+
export interface AgendaController {
|
|
10
|
+
getState(): AgendaState;
|
|
11
|
+
subscribe(listener: () => void): () => void;
|
|
12
|
+
load(): Promise<void>;
|
|
13
|
+
answer(item: AgendaItem, answer: string): Promise<void>;
|
|
14
|
+
complete(item: AgendaItem): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const without = (a: TodayAgenda, id: string, cap: number): TodayAgenda => {
|
|
18
|
+
const all = [...a.doNow, ...a.rest].filter((i) => i.id !== id);
|
|
19
|
+
return { ...a, doNow: all.slice(0, cap), rest: all.slice(cap), total: all.length, empty: all.length === 0 };
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export function createAgendaController({ api, cap = 5 }: { api: TodayAgendaApi; cap?: number }): AgendaController {
|
|
23
|
+
let state: AgendaState = { loading: true, agenda: null, error: null, notice: null };
|
|
24
|
+
const listeners = new Set<() => void>();
|
|
25
|
+
const set = (patch: Partial<AgendaState>) => { state = { ...state, ...patch }; listeners.forEach((l) => l()); };
|
|
26
|
+
|
|
27
|
+
async function settle(item: AgendaItem, save: () => Promise<void>) {
|
|
28
|
+
const before = state.agenda;
|
|
29
|
+
if (!before) return;
|
|
30
|
+
set({ agenda: without(before, item.id, cap), notice: null });
|
|
31
|
+
try { await save(); }
|
|
32
|
+
catch { set({ agenda: before, notice: 'That did not save. It is back in your list; try again.' }); }
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return {
|
|
36
|
+
getState: () => state,
|
|
37
|
+
subscribe(l) { listeners.add(l); return () => { listeners.delete(l); }; },
|
|
38
|
+
async load() {
|
|
39
|
+
set({ loading: true });
|
|
40
|
+
try { set({ loading: false, agenda: await api.load(), error: null }); }
|
|
41
|
+
catch (e) { set({ loading: false, error: (e as Error)?.message || 'Today could not be loaded.' }); }
|
|
42
|
+
},
|
|
43
|
+
answer: (item, answer) => settle(item, () => api.answer(item.action.kind === 'answer' ? item.action.questionId : item.id, answer)),
|
|
44
|
+
complete: (item) => settle(item, () => api.complete(item.action.kind === 'complete' ? item.action.todoIds : [])),
|
|
45
|
+
};
|
|
46
|
+
}
|
package/src/native/home/tab.tsx
CHANGED
|
@@ -6,6 +6,7 @@ import type { FoundryTab } from '../components/FoundryTabsShell';
|
|
|
6
6
|
import type { NativeCorpusApi } from '../corpus/api';
|
|
7
7
|
import { createHomeController, type HomeController, type HomeType } from './controller';
|
|
8
8
|
import { HomeScreen } from './HomeScreen';
|
|
9
|
+
import type { AgendaController } from './agenda-controller';
|
|
9
10
|
|
|
10
11
|
export interface HomeTabOptions {
|
|
11
12
|
api: Pick<NativeCorpusApi, 'entities'> & Partial<Pick<NativeCorpusApi, 'schema' | 'corpus'>>;
|
|
@@ -27,6 +28,8 @@ export interface HomeTabOptions {
|
|
|
27
28
|
/** The Today framing: its title and one plain line (`TAB_COPY.today`). Absent: the brand and tagline. */
|
|
28
29
|
copy?: { label: string; subtitle: string };
|
|
29
30
|
timeZone?: string;
|
|
31
|
+
/** The ranked do-now list (ASK 2). When given, Today shows it instead of the counts and arrivals. */
|
|
32
|
+
agenda?: AgendaController;
|
|
30
33
|
}
|
|
31
34
|
|
|
32
35
|
/** The to-dos counted on the due-soon line: one server page of what is still owed. */
|
|
@@ -40,7 +43,7 @@ function dueSoonReader(api: HomeTabOptions['api'], timeZone?: string) {
|
|
|
40
43
|
}
|
|
41
44
|
|
|
42
45
|
/** The Home tab as one `FoundryTabsShell` entry. */
|
|
43
|
-
export function homeTab({ api, brand, tagline, key = 'home', label = 'Home', types, controller = createHomeController({ api, types, displays: api.schema ? () => api.schema!.displays() : undefined, dueSoon: dueSoonReader(api), hideArrivals: ['commitment'] }), tabs = {}, talkKey, planKey, briefing, copy }: HomeTabOptions): FoundryTab {
|
|
46
|
+
export function homeTab({ api, brand, tagline, key = 'home', label = 'Home', types, controller = createHomeController({ api, types, displays: api.schema ? () => api.schema!.displays() : undefined, dueSoon: dueSoonReader(api), hideArrivals: ['commitment'] }), tabs = {}, talkKey, planKey, briefing, copy, agenda }: HomeTabOptions): FoundryTab {
|
|
44
47
|
return {
|
|
45
48
|
key, label,
|
|
46
49
|
render: ({ openTab, active }) => (
|
|
@@ -51,6 +54,7 @@ export function homeTab({ api, brand, tagline, key = 'home', label = 'Home', typ
|
|
|
51
54
|
tagline={tagline}
|
|
52
55
|
title={copy?.label}
|
|
53
56
|
briefing={briefing?.()}
|
|
57
|
+
agenda={agenda}
|
|
54
58
|
onTalk={talkKey ? () => openTab(talkKey) : undefined}
|
|
55
59
|
onOpenPlan={planKey ? () => openTab(planKey) : undefined}
|
|
56
60
|
onOpenType={(type) => { if (tabs[type]) openTab(tabs[type]); }}
|
package/src/native/index.ts
CHANGED
|
@@ -40,6 +40,8 @@ export { TrackerListScreen, type TrackerListScreenProps } from './tracker/Tracke
|
|
|
40
40
|
export { TrackerDetailScreen, type TrackerDetailScreenProps } from './tracker/TrackerDetailScreen';
|
|
41
41
|
export { trackerTab, type TrackerTabOptions } from './tracker/tab';
|
|
42
42
|
export * from './home/controller';
|
|
43
|
+
export { createAgendaController } from './home/agenda-controller';
|
|
44
|
+
export type { AgendaController, AgendaState } from './home/agenda-controller';
|
|
43
45
|
export { HomeScreen, type HomeScreenProps } from './home/HomeScreen';
|
|
44
46
|
export { homeTab, type HomeTabOptions } from './home/tab';
|
|
45
47
|
export { createStore, errorMessage } from './screens/store';
|