feat(converter): add shareable conversion links via query parameters

This commit is contained in:
2026-03-30 17:42:08 +02:00
parent 86fe4b516c
commit a45393ac00
4 changed files with 237 additions and 20 deletions

View File

@@ -15,6 +15,7 @@ Modern currency and crypto converter built with Next.js 14, TypeScript, Tailwind
- Fiat flags from `currency-flags`
- Default pair: `USD -> BTC`
- Instant conversion with swap action
- Shareable conversion links via query params (`amount`, `from`, `to`)
- Current rate, inverse rate, and last update timestamp
- Client-side validation for invalid/negative amounts
- Loading, error, and empty states
@@ -166,6 +167,22 @@ If empty, the app uses the local default (`/api/rates`).
- Supported ranges: `24h`, `7d`, `30d`, `1y`, `all`.
- Example response fields: `priceUsd`, `change24hPct`, `marketCapUsd`, `volume24hUsd`, `priceHistoryRange`, `priceHistory`, `updatedAt`.
## Shareable Links
You can share the current converter state using URL query params:
- `amount`
- `from`
- `to`
Example:
```text
/?amount=100&from=USD&to=BTC
```
The app safely parses these params on load and falls back to defaults when values are invalid or unsupported.
## Architecture Notes
- `app/api/rates/route.ts` is the single internal market endpoint for the frontend.