feat(calendar): search/date filter on the meeting-linking event picker
A real mailbox import is thousands of events — searching/filtering belongs where the user is actually tying a meeting to one, not just the general browse list in Settings. Defaults the date filter to the selected meeting's own recording date, since that's almost always the event being linked.
This commit is contained in:
1 parent
00de9d3f68
commit
7e646b3e0f
1 file changed
+36
-1
@@ -94,6 +94,35 @@
|
||||
await meetings.attachEvent(m.id, eventId);
|
||||
}
|
||||
|
||||
// ---- Search/date filter for the event picker (a real mailbox import can
|
||||
// be thousands of events) — defaults to the recording's own date since
|
||||
// that's almost always the event being linked. ----
|
||||
let eventLinkSearch = $state("");
|
||||
let eventLinkDateFilter = $state("");
|
||||
$effect(() => {
|
||||
const m = meetings.selected;
|
||||
eventLinkDateFilter = m ? eventLocalYmd(m.started_at) : "";
|
||||
eventLinkSearch = "";
|
||||
});
|
||||
|
||||
function eventLocalYmd(unixSecs: number | null): string {
|
||||
if (!unixSecs) return "";
|
||||
const d = new Date(unixSecs * 1000);
|
||||
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
|
||||
}
|
||||
|
||||
let filteredLinkEvents = $derived(
|
||||
calendar.events.filter((ev) => {
|
||||
if (eventLinkDateFilter && eventLocalYmd(ev.starts_at) !== eventLinkDateFilter) return false;
|
||||
if (
|
||||
eventLinkSearch &&
|
||||
!(ev.subject ?? "").toLowerCase().includes(eventLinkSearch.toLowerCase())
|
||||
)
|
||||
return false;
|
||||
return true;
|
||||
}),
|
||||
);
|
||||
|
||||
// ---- Attendee-aware speaker naming (T6.5, FR-SPK-4) ----
|
||||
const NEW_NAME = "__new__";
|
||||
let addingNameFor = $state<string | null>(null);
|
||||
@@ -275,11 +304,15 @@
|
||||
{#if !meetings.selected}
|
||||
<p class="muted">Select a meeting to link it to a calendar event.</p>
|
||||
{:else}
|
||||
<div class="row">
|
||||
<input type="text" bind:value={eventLinkSearch} placeholder="Search event title…" />
|
||||
<input type="date" bind:value={eventLinkDateFilter} />
|
||||
</div>
|
||||
<label class="pick"
|
||||
>Linked event
|
||||
<select value={meetings.selected.calendar_event_id ?? ""} onchange={onPickEvent}>
|
||||
<option value="" disabled>{eventDetail ? "Change event…" : "Link an event…"}</option>
|
||||
{#each calendar.events as ev (ev.id)}
|
||||
{#each filteredLinkEvents as ev (ev.id)}
|
||||
<option value={ev.id}
|
||||
>{ev.subject ?? "(untitled)"} — {formatEventTime(ev.starts_at)}</option
|
||||
>
|
||||
@@ -290,6 +323,8 @@
|
||||
<p class="muted small">
|
||||
No events imported yet — import a <code>.pst</code> from Settings → Calendar.
|
||||
</p>
|
||||
{:else if filteredLinkEvents.length === 0}
|
||||
<p class="muted small">No events match this search/date — try clearing one.</p>
|
||||
{/if}
|
||||
|
||||
{#if eventDetail}
|
||||
|
||||
Reference in new issue
Block a user