UI: Load currencies from operations DB — 120+ with 'top' section #11

Closed
opened 2026-04-09 07:30:45 +00:00 by johan · 0 comments
Owner

Summary

Populate the currency dropdown from the currencies table in corporate.db. Display ~10 "top currencies" first (common/major currencies), followed by the full alphabetical list (~120 total).

Database Context

The currencies table exists in clavitor.ai/admin/corporate.db:

CREATE TABLE IF NOT EXISTS currencies (
    code TEXT PRIMARY KEY,      -- ISO 4217: USD, EUR, JPY...
    name TEXT NOT NULL,         -- "US Dollar"
    decimals INTEGER DEFAULT 2,
    exchange_rate REAL,         -- vs USD
    symbol TEXT,                -- "$", "€"
    symbol_position TEXT,       -- prefix or suffix
    is_active INTEGER DEFAULT 1,
    ...
);

Rates are populated via go run admin/scripts/fetch_rates.go (Frankfurter API).

Top Currencies (display first)

Define as constant/array in code:

  • USD, EUR, GBP, JPY, CAD, AUD, CHF, SEK, NOK, NZD

API Endpoint Needed

Create in clavitor.ai/main.go:

  • GET /api/currencies
  • Returns: { "top": [...], "all": [...] }

Frontend Implementation

  1. Fetch /api/currencies on page load (or embed in template)
  2. Render dropdown with section headers:
    • "Popular" section (top 10)
    • Divider
    • "All Currencies" section (remaining ~110, alphabetical)

Files to Modify

  • clavitor.ai/main.go — add /api/currencies endpoint
  • clavitor.ai/test-index.html — dynamic currency rendering
  • clavitor.ai/clavitor.css — section headers in dropdown

CSS Additions Needed

.dropdown-section {
    padding: 8px 16px;
    font-size: 11px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.dropdown-divider {
    border-top: 1px solid var(--border);
    margin: 8px 0;
}

Implementation Phases

  1. Create /api/currencies endpoint that queries DB
  2. Update HTML to fetch and render dynamically
  3. Add section headers styling

Depends On

  • Issue #2 (split selectors) — currency dropdown needs to exist first

Priority

Medium — enables international pricing display.

Assignee

Emma (backend) / Luna (frontend styling)

## Summary Populate the currency dropdown from the `currencies` table in `corporate.db`. Display ~10 "top currencies" first (common/major currencies), followed by the full alphabetical list (~120 total). ## Database Context The `currencies` table exists in `clavitor.ai/admin/corporate.db`: ```sql CREATE TABLE IF NOT EXISTS currencies ( code TEXT PRIMARY KEY, -- ISO 4217: USD, EUR, JPY... name TEXT NOT NULL, -- "US Dollar" decimals INTEGER DEFAULT 2, exchange_rate REAL, -- vs USD symbol TEXT, -- "$", "€" symbol_position TEXT, -- prefix or suffix is_active INTEGER DEFAULT 1, ... ); ``` Rates are populated via `go run admin/scripts/fetch_rates.go` (Frankfurter API). ## Top Currencies (display first) Define as constant/array in code: - USD, EUR, GBP, JPY, CAD, AUD, CHF, SEK, NOK, NZD ## API Endpoint Needed Create in `clavitor.ai/main.go`: - GET `/api/currencies` - Returns: `{ "top": [...], "all": [...] }` ## Frontend Implementation 1. Fetch `/api/currencies` on page load (or embed in template) 2. Render dropdown with section headers: - "Popular" section (top 10) - Divider - "All Currencies" section (remaining ~110, alphabetical) ## Files to Modify - [ ] `clavitor.ai/main.go` — add `/api/currencies` endpoint - [ ] `clavitor.ai/test-index.html` — dynamic currency rendering - [ ] `clavitor.ai/clavitor.css` — section headers in dropdown ## CSS Additions Needed ```css .dropdown-section { padding: 8px 16px; font-size: 11px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.08em; } .dropdown-divider { border-top: 1px solid var(--border); margin: 8px 0; } ``` ## Implementation Phases 1. Create `/api/currencies` endpoint that queries DB 2. Update HTML to fetch and render dynamically 3. Add section headers styling ## Depends On - Issue #2 (split selectors) — currency dropdown needs to exist first ## Priority Medium — enables international pricing display. ## Assignee Emma (backend) / Luna (frontend styling)
johan closed this issue 2026-04-09 14:20:18 +00:00
Sign in to join this conversation.
No description provided.