a few small fixes

This commit is contained in:
counterweight 2025-12-26 19:00:56 +01:00
parent f6c552cefd
commit 8503c760dc
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
8 changed files with 157 additions and 55 deletions

View file

@ -7,6 +7,7 @@ import { formatDate, formatTime } from "../../utils/date";
import { formatEur } from "../../utils/exchange";
import { bannerStyles } from "../../styles/shared";
import { useTranslation } from "../../hooks/useTranslation";
import { useLanguage } from "../../hooks/useLanguage";
type BookableSlot = components["schemas"]["BookableSlot"];
type ExchangeResponse = components["schemas"]["ExchangeResponse"];
@ -217,6 +218,10 @@ export function BookingStep({
onBackToDetails,
}: BookingStepProps) {
const t = useTranslation("exchange");
const { locale } = useLanguage();
// Map locale codes to Intl locale strings
const intlLocale = locale === "es" ? "es-ES" : locale === "ca" ? "ca-ES" : "en-US";
return (
<>
{/* Trade Summary Card */}
@ -277,10 +282,10 @@ export function BookingStep({
}}
>
<div style={styles.dateWeekday}>
{date.toLocaleDateString("es-ES", { weekday: "short" })}
{date.toLocaleDateString(intlLocale, { weekday: "short" })}
</div>
<div style={styles.dateDay}>
{date.toLocaleDateString("es-ES", {
{date.toLocaleDateString(intlLocale, {
month: "short",
day: "numeric",
})}
@ -312,7 +317,7 @@ export function BookingStep({
<div style={styles.section}>
<h2 style={styles.sectionTitle}>
{t("bookingStep.availableSlots")}{" "}
{selectedDate.toLocaleDateString("es-ES", {
{selectedDate.toLocaleDateString(intlLocale, {
weekday: "long",
month: "long",
day: "numeric",

View file

@ -7,6 +7,7 @@ import { formatTime } from "../../utils/date";
import { formatEur } from "../../utils/exchange";
import { buttonStyles } from "../../styles/shared";
import { useTranslation } from "../../hooks/useTranslation";
import { useLanguage } from "../../hooks/useLanguage";
type BookableSlot = components["schemas"]["BookableSlot"];
type Direction = "buy" | "sell";
@ -156,6 +157,10 @@ export function ConfirmationStep({
onBack,
}: ConfirmationStepProps) {
const t = useTranslation("exchange");
const { locale } = useLanguage();
// Map locale codes to Intl locale strings
const intlLocale = locale === "es" ? "es-ES" : locale === "ca" ? "ca-ES" : "en-US";
return (
<>
{/* Compressed Booking Summary */}
@ -168,7 +173,7 @@ export function ConfirmationStep({
</div>
<div style={styles.compressedBookingDetails}>
<span>
{selectedDate?.toLocaleDateString("es-ES", {
{selectedDate?.toLocaleDateString(intlLocale, {
weekday: "short",
month: "short",
day: "numeric",