Skip to content

Add country selector to settings with auto-populated defaults #21

Closed

Description

@khaira777

Summary

Add a country selector to the settings page with auto-populated defaults for currency, timezone, and phone settings.

Part of epic: #18
Blocked by: #20 (Phase 2 — countries table)

Scope

  • Migration: ALTER TABLE tenants ADD COLUMN country_id
  • Backfill from existing currency/timezone settings
  • Settings page: country selector dropdown (from /api/countries)
  • Auto-populate currency, timezone, phone defaults on selection
  • Allow manual overrides
  • Derive phoneDigits from selected country (remove manual setting)

Files Touched

  • main/db.ts (migration)
  • main/routes/settings.ts (add country_id)
  • frontend/src/app/(dashboard)/settings/page.tsx (country selector)

Acceptance Criteria

  • Settings page shows a country selector dropdown
  • Selecting a country auto-populates currency, timezone, phone defaults
  • Manual overrides are preserved
  • phoneDigits is derived from selected country (no manual setting)
  • Existing tenants are backfilled with correct country_id

Notes

  • This is the bridge between backend countries data and frontend locale behavior
  • The country selector should be prominent (top of settings, before currency/timezone)
  • Manual overrides take precedence over auto-populated defaults

Activity

  1. added
    enhancement
    on Jul 6, 2026
  2. khaira777 commented on Jul 6, 2026

    @khaira777
    ContributorAuthor

    Part of epic #18 — Internationalization

  3. added theissue type on Jul 6, 2026
  4. khaira777 commented on Jul 18, 2026

    @khaira777
    ContributorAuthor

    ✅ Completed — implementation diverges from spec but feature is fully functional.

    • Country dropdown in Settings page (frontend/src/app/(dashboard)/settings/page.tsx)
    • Saves to settings KV table (key: 'country'), not a tenants.country_id column
    • Auto-populates currency and timezone on selection (readonly fields)
    • Default: IN (India), seeded in migration

    Note: Spec proposed ALTER TABLE tenants ADD COLUMN country_id, but our architecture uses a flat settings KV table instead of a tenants table. The feature works identically from the user's perspective.

    Closing as complete.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions