From 60332db1e4948318c84906fc21c2a33b55690fec Mon Sep 17 00:00:00 2001 From: Denozordec Date: Mon, 29 Jun 2026 15:19:22 +0700 Subject: [PATCH] =?UTF-8?q?fix(web):=20=D0=BA=D0=BE=D0=BD=D0=B2=D0=B5?= =?UTF-8?q?=D1=80=D1=82=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D1=82=D1=8C=20=D1=82?= =?UTF-8?q?=D0=B0=D1=80=D0=B8=D1=84=D1=8B=20VPS=20=D0=B2=20=D0=B1=D0=B0?= =?UTF-8?q?=D0=B7=D0=BE=D0=B2=D1=83=D1=8E=20=D0=B2=D0=B0=D0=BB=D1=8E=D1=82?= =?UTF-8?q?=D1=83=20=D0=BD=D0=B0=D1=81=D1=82=D1=80=D0=BE=D0=B5=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- apps/web/src/lib/format.ts | 5 +++++ apps/web/src/routes/_auth/vps.$vpsId.tsx | 12 ++++++++++-- apps/web/src/routes/_auth/vps.tsx | 7 +++++-- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/apps/web/src/lib/format.ts b/apps/web/src/lib/format.ts index 616b862..11cfb85 100644 --- a/apps/web/src/lib/format.ts +++ b/apps/web/src/lib/format.ts @@ -305,6 +305,11 @@ export function formatInProviderCurrency( appSettings: Settings[] | Settings | null, ratesData: RatesData | null, ): string { + const settings: Partial = Array.isArray(appSettings) + ? (appSettings[0] ?? {}) + : (appSettings ?? {}) + const autoConvert = settings.autoConvert !== false + if (!autoConvert) return formatCurrency(amount, currency) const converted = convertWithProviderRate(amount, currency, provider, appSettings, ratesData) return formatCurrency(converted.value, converted.currency) } diff --git a/apps/web/src/routes/_auth/vps.$vpsId.tsx b/apps/web/src/routes/_auth/vps.$vpsId.tsx index f31a223..28307c6 100644 --- a/apps/web/src/routes/_auth/vps.$vpsId.tsx +++ b/apps/web/src/routes/_auth/vps.$vpsId.tsx @@ -10,7 +10,7 @@ import { StickyNoteIcon, } from 'lucide-react' -import { snapshotQueryOptions } from '@/queries/snapshot' +import { snapshotQueryOptions, ratesQueryOptions } from '@/queries/snapshot' import { PageShell } from '@/components/page-shell' import { PageHeader } from '@/components/page-header' import { QueryState } from '@/components/query-state' @@ -24,6 +24,8 @@ import { getPaidUntilDate } from '@/lib/paid-until' import { effectiveVpsTariffCurrency, formatCurrency, + formatInProviderCurrency, + normalizeRatesPayload, tariffTypeLabel, vpsStatusLabel, paymentTypeLabel, @@ -56,6 +58,9 @@ function InfoRow({ label, value }: { label: string; value: React.ReactNode }) { function VpsDetailPage() { const { vpsId } = Route.useParams() const { data: snapshot, isLoading, isError, error, refetch } = useQuery(snapshotQueryOptions()) + const settings = snapshot?.settings[0] + const { data: rawRates } = useQuery(ratesQueryOptions(settings?.ratesUrl)) + const ratesData = normalizeRatesPayload(rawRates) ?? rawRates ?? null const vps = snapshot?.vps.find((v) => v.id === vpsId) const providerById = snapshot ? providerByIdMap(snapshot.providers) : new Map() @@ -215,9 +220,12 @@ function VpsDetailPage() {