feat: Accounts page — create, edit, delete accounts with PluresDB#13
Conversation
Agent-Logs-Url: https://github.com/plures/pares-modulus/sessions/6ba5a4d3-18b7-4a80-8fc1-2e24cace7d72 Co-authored-by: kayodebristol <3579196+kayodebristol@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds an Accounts CRUD UI to the financial-advisor plugin and introduces a typed plugin PluginContext surface (including PluresDB collection access) so the page can create, edit, list, and delete accounts.
Changes:
- Add
Accounts.svelteSvelte 5 runes page implementing Accounts CRUD with dialogs, loading/empty states, and balance formatting. - Introduce
accounts.tshelpers/types and a module-levelcontext.tssingleton to exposePluginContextto pages. - Expand local
@plures/pares-radixtype stubs to includePluginContext/data APIs and tightenonActivatetyping; wireonActivate(ctx)to store the context.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| types/pares-radix.d.ts | Adds local type stubs for PluginContext and related APIs; updates RadixPlugin.onActivate to accept PluginContext. |
| plugins/financial-advisor/src/pages/Accounts.svelte | New Accounts CRUD page using PluresDB collection via stored plugin context; includes dialogs and UI states. |
| plugins/financial-advisor/src/lib/context.ts | New singleton module for storing/retrieving PluginContext. |
| plugins/financial-advisor/src/lib/accounts.ts | New account model/types, collection name constant, and ID/type label/icon helpers. |
| plugins/financial-advisor/src/index.ts | Stores activation context via setPluginContext(ctx) so pages can access PluresDB APIs. |
| <dialog | ||
| class="dialog" | ||
| open | ||
| aria-modal="true" | ||
| aria-labelledby="dialog-title" | ||
| onkeydown={handleFormKeydown} | ||
| > |
There was a problem hiding this comment.
Both dialogs are rendered with the open attribute but are never opened via HTMLDialogElement.showModal(). Without showModal(), focus trapping and background inertness are not guaranteed, and aria-modal="true" may be misleading. Consider wiring the dialogs to call showModal() on mount (and close() on teardown) to get proper modal behavior.
There was a problem hiding this comment.
Done in f19f265. Both dialogs now use a useModal Svelte action that calls showModal() on mount and close() on teardown. The action also handles:
- Escape via the native
cancelevent (withpreventDefaultso Svelte state stays the single source of truth) - Backdrop click by checking
e.target === nodeon the dialog's own click event
The separate overlay elements were removed entirely — the native ::backdrop pseudo-element handles the dimmed background instead. onDeactivate now also calls clearPluginContext() to prevent stale context after re-activation.
| async onActivate(ctx: PluginContext) { | ||
| console.log('[financial-advisor] Plugin activated'); | ||
| // TODO: Initialize PluresDB collections, load inference rules | ||
| setPluginContext(ctx); | ||
| // TODO: load inference rules into inference engine |
There was a problem hiding this comment.
onActivate stores the plugin context globally, but onDeactivate does not clear it. This can leave a stale PluginContext reachable from pages after the plugin is deactivated. Consider clearing the singleton in onDeactivate (after adding a clear/reset helper in lib/context.ts).
There was a problem hiding this comment.
This was already applied in f19f265 — onDeactivate now calls clearPluginContext(), and clearPluginContext was added to lib/context.ts in the same commit.
kayodebristol
left a comment
There was a problem hiding this comment.
Auto-approved: CI green + Copilot code review complete.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Agent-Logs-Url: https://github.com/plures/pares-modulus/sessions/c04226b5-9504-4a3d-b247-6e381220588b Co-authored-by: kayodebristol <3579196+kayodebristol@users.noreply.github.com>
|
@copilot apply changes based on the comments in this thread |
Implements the Accounts CRUD page for the
financial-advisorplugin, backed by thefa-accountsPluresDB collection.New files
src/lib/accounts.ts—Accountinterface,AccountTypeunion (checking | savings | credit | investment),FA_ACCOUNTS_COLLECTIONconstant,generateAccountId()viacrypto.randomUUID(), and type label/icon lookup maps.src/lib/context.ts— Module-levelPluginContextsingleton (setPluginContext/getPluginContext). Needed because Svelte'ssetContext/getContextis scoped to component trees and unavailable insideonActivate.src/pages/Accounts.svelte— Full Svelte 5 runes page with:<dialog>-based create/edit form (name, institution, type select, balance)aria-label; dialogs usearia-modal+aria-labelledby; CSS uses--color-*/--space-*/--radius-*design tokensModified files
types/pares-radix.d.ts— AddsDataCollection<T>,PluginContext, and supporting API interfaces (NotifyAPI,NavigationAPI,SettingsAPI,LLMAPI,InferenceAPI). TightensRadixPlugin.onActivatefromctx: unknown→ctx: PluginContext.src/index.ts— WiresonActivate(ctx)to callsetPluginContext(ctx)so the Accounts page can reach the PluresDB collection immediately on activation.PluresDB usage pattern
⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.