refactor: use shared constants for MIN/MAX_ADVANCE_DAYS

- Import constants from shared/constants.json in exchange page
- Remove hardcoded values for minAdvanceDays and maxAdvanceDays
This commit is contained in:
counterweight 2025-12-23 10:54:04 +01:00
parent 110e5ec07f
commit 27896ed136
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C

View file

@ -12,15 +12,15 @@ import { components } from "../generated/api";
import { formatDate, formatTime, getDateRange } from "../utils/date"; import { formatDate, formatTime, getDateRange } from "../utils/date";
import { formatEur } from "../utils/exchange"; import { formatEur } from "../utils/exchange";
import { layoutStyles, typographyStyles, bannerStyles, buttonStyles } from "../styles/shared"; import { layoutStyles, typographyStyles, bannerStyles, buttonStyles } from "../styles/shared";
import constants from "../../../shared/constants.json";
type ExchangePriceResponse = components["schemas"]["ExchangePriceResponse"]; type ExchangePriceResponse = components["schemas"]["ExchangePriceResponse"];
type ExchangeResponse = components["schemas"]["ExchangeResponse"]; type ExchangeResponse = components["schemas"]["ExchangeResponse"];
type BookableSlot = components["schemas"]["BookableSlot"]; type BookableSlot = components["schemas"]["BookableSlot"];
type AvailableSlotsResponse = components["schemas"]["AvailableSlotsResponse"]; type AvailableSlotsResponse = components["schemas"]["AvailableSlotsResponse"];
// Constants from shared config (will be fetched from API) // Constants from shared config
const MIN_ADVANCE_DAYS = 1; const { minAdvanceDays: MIN_ADVANCE_DAYS, maxAdvanceDays: MAX_ADVANCE_DAYS } = constants.exchange;
const MAX_ADVANCE_DAYS = 30;
type Direction = "buy" | "sell"; type Direction = "buy" | "sell";
type WizardStep = "details" | "booking"; type WizardStep = "details" | "booking";