Skip to content

feat: Accounts page — create, edit, delete accounts with PluresDB#13

Merged
kayodebristol merged 6 commits into
mainfrom
copilot/create-edit-delete-accounts-page
Mar 31, 2026
Merged

feat: Accounts page — create, edit, delete accounts with PluresDB#13
kayodebristol merged 6 commits into
mainfrom
copilot/create-edit-delete-accounts-page

Conversation

Copilot AI commented Mar 29, 2026

Copy link
Copy Markdown
Contributor

Implements the Accounts CRUD page for the financial-advisor plugin, backed by the fa-accounts PluresDB collection.

New files

  • src/lib/accounts.tsAccount interface, AccountType union (checking | savings | credit | investment), FA_ACCOUNTS_COLLECTION constant, generateAccountId() via crypto.randomUUID(), and type label/icon lookup maps.
  • src/lib/context.ts — Module-level PluginContext singleton (setPluginContext / getPluginContext). Needed because Svelte's setContext/getContext is scoped to component trees and unavailable inside onActivate.
  • src/pages/Accounts.svelte — Full Svelte 5 runes page with:
    • Animated skeleton loader, empty state with onboarding CTA
    • Account list: type icon, name, institution, type badge, formatted balance (negative in red)
    • Accessible <dialog>-based create/edit form (name, institution, type select, balance)
    • Delete confirmation dialog naming the target account
    • All interactive elements have aria-label; dialogs use aria-modal + aria-labelledby; CSS uses --color-* / --space-* / --radius-* design tokens

Modified files

  • types/pares-radix.d.ts — Adds DataCollection<T>, PluginContext, and supporting API interfaces (NotifyAPI, NavigationAPI, SettingsAPI, LLMAPI, InferenceAPI). Tightens RadixPlugin.onActivate from ctx: unknownctx: PluginContext.
  • src/index.ts — Wires onActivate(ctx) to call setPluginContext(ctx) so the Accounts page can reach the PluresDB collection immediately on activation.

PluresDB usage pattern

// onActivate stores context; Accounts.svelte retrieves it:
const ctx = getPluginContext();
const collection = ctx?.data.collection<Account>(FA_ACCOUNTS_COLLECTION);

// Create
await collection.put(account.id, account);

// List all
const accounts = await collection.query();

// Delete
await collection.delete(id);

⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.

Copilot AI changed the title [WIP] Add accounts page for financial-advisor plugin feat: Accounts page — create, edit, delete accounts with PluresDB Mar 29, 2026
Copilot AI requested a review from kayodebristol March 29, 2026 04:32
@kayodebristol kayodebristol requested a review from Copilot March 29, 2026 05:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.svelte Svelte 5 runes page implementing Accounts CRUD with dialogs, loading/empty states, and balance formatting.
  • Introduce accounts.ts helpers/types and a module-level context.ts singleton to expose PluginContext to pages.
  • Expand local @plures/pares-radix type stubs to include PluginContext/data APIs and tighten onActivate typing; wire onActivate(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.

Comment thread plugins/financial-advisor/src/pages/Accounts.svelte Outdated
Comment thread plugins/financial-advisor/src/pages/Accounts.svelte Outdated
Comment on lines +270 to +276
<dialog
class="dialog"
open
aria-modal="true"
aria-labelledby="dialog-title"
onkeydown={handleFormKeydown}
>

Copilot AI Mar 29, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot apply changes based on this feedback

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 cancel event (with preventDefault so Svelte state stays the single source of truth)
  • Backdrop click by checking e.target === node on 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.

Comment thread plugins/financial-advisor/src/lib/context.ts
Comment on lines +223 to +226
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

Copilot AI Mar 29, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot apply changes based on this feedback

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was already applied in f19f265onDeactivate now calls clearPluginContext(), and clearPluginContext was added to lib/context.ts in the same commit.

@kayodebristol kayodebristol left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-approved: CI green + Copilot code review complete.

kayodebristol and others added 3 commits March 30, 2026 19:01
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>
@kayodebristol kayodebristol marked this pull request as ready for review March 31, 2026 02:02
Copilot AI requested a review from kayodebristol March 31, 2026 02:10
@kayodebristol kayodebristol merged commit 1bfbd62 into main Mar 31, 2026
1 check passed
@kayodebristol

Copy link
Copy Markdown
Contributor

@copilot apply changes based on the comments in this thread

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Accounts page — create, edit, delete accounts with PluresDB

3 participants