Skip to content

tauplatform/currency-converter

Repository files navigation

Currency Converter (Rhodes)

A Rhodes mobile app that fetches FX rates from Frankfurter (base EUR), displays them with flags, and includes an in-app converter.

Prerequisites

Run in RhoSimulator

rake run:rhosimulator

This starts the simulator and serves the app.

Key Screens

  • Rates list: Shows EUR-based rates with local-time "Rates updated" header and emoji flags per currency. Tap 🔄 Обновить or the toolbar Refresh to refetch; the callback returns to the list when done.
  • Converter: Open via toolbar Convert or the screen button. Swap currencies and tap Calculate to get a live conversion (AJAX posts to /app/CurrencyRate/calculate).

Data Flow

  1. CurrencyRateController#load_rates calls Frankfurter and renders loading.erb.
  2. rates_callback saves rates (CurrencyRate table) and redirects to index.
  3. should_update_rates? skips the fetch if data is < 1 hour old.

Flags

Flags come from public/js/flag.js (exposed as window.currencyFlags) and are applied on page load in app/CurrencyRate/index.erb via data-currency attributes.

Common Actions

  • Force refresh: button 🔄 Refresh or toolbar Refresh (navigates to /app/CurrencyRate/load_rates).
  • Open converter: button 📱 Converter or toolbar Convert (navigates to /app/CurrencyRate/converter).

Troubleshooting

  • If rates never return: check rhosimulator/rholog.txt for network errors/status in rates_callback.
  • If flags are blank: ensure flag.js is loaded (see app/layout.erb) and window.currencyFlags is populated.
  • If Time.parse fails: confirm require 'time' at the top of currency_rate_controller.rb.

Structure Highlights

  • Controllers: app/CurrencyRate/currency_rate_controller.rb
  • Views: app/CurrencyRate/index.erb, converter.erb, loading.erb
  • JS helpers: public/js/flag.js, public/js/converter.js (legacy; AJAX now inline in converter.erb)
  • Toolbar setup: app/application.rb

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors