Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions frontend/src/i18n/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1098,6 +1098,7 @@ const en: Translations = {
langEn: 'English',
currency: 'Currency',
currencyHint: 'Display currency. Data is stored in UAH; converted at NBU rate.',
currencyDisabledTooltip: 'Currency conversion is under repair and will be available shortly',
currencyUah: 'Hryvnia (UAH)',
currencyUsd: 'US Dollar (USD)',
currencyEur: 'Euro (EUR)',
Expand Down
1 change: 1 addition & 0 deletions frontend/src/i18n/uk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1095,6 +1095,7 @@ const uk = {
langEn: 'English',
currency: 'Валюта',
currencyHint: 'Валюта відображення. Дані в базі зберігаються в UAH; конвертація за курсом НБУ.',
currencyDisabledTooltip: 'Валютна конвертація в розробці, буде доступна найближчим часом',
currencyUah: 'Гривня (UAH)',
currencyUsd: 'Долар США (USD)',
currencyEur: 'Євро (EUR)',
Expand Down
27 changes: 15 additions & 12 deletions frontend/src/pages/Profile/ProfilePage.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Card, Descriptions, Button, Space, Tag, Select, message } from 'antd';
import { Card, Descriptions, Button, Space, Tag, Select, Tooltip, message } from 'antd';
import { GlobalOutlined } from '@ant-design/icons';
import { useEffect } from 'react';
import PageHeader from '../../components/PageHeader';
Expand Down Expand Up @@ -112,17 +112,20 @@ export default function ProfilePage() {
</Descriptions.Item>
<Descriptions.Item label={t.profile.currency}>
<Space direction="vertical" size={4} style={{ width: '100%' }}>
<Select<SupportedCurrency>
value={preferredCurrency}
onChange={handleCurrencyChange}
style={{ width: 240 }}
options={[
{ value: 'UAH', label: t.profile.currencyUah },
{ value: 'USD', label: t.profile.currencyUsd },
{ value: 'EUR', label: t.profile.currencyEur },
]}
/>
<span style={{ color: '#8B949E', fontSize: 12 }}>{t.profile.currencyHint}</span>
<Tooltip title={t.profile.currencyDisabledTooltip} placement="top">
<Select<SupportedCurrency>
value={preferredCurrency}
onChange={handleCurrencyChange}
disabled
style={{ width: 240 }}
options={[
{ value: 'UAH', label: t.profile.currencyUah },
{ value: 'USD', label: t.profile.currencyUsd },
{ value: 'EUR', label: t.profile.currencyEur },
]}
/>
</Tooltip>
<span style={{ color: '#8B949E', fontSize: 12 }}>{t.profile.currencyDisabledTooltip}</span>
</Space>
</Descriptions.Item>
</Descriptions>
Expand Down
15 changes: 12 additions & 3 deletions frontend/src/stores/currencyStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,14 @@ export const useCurrencyStore = create<CurrencyState>((set, get) => ({
for (const r of rates as ExchangeRateDto[]) {
if (r.code === 'USD' || r.code === 'EUR') next[r.code] = r.rateToUah;
}
// HOTFIX (PR #628 follow-up): currency conversion is under repair — force UAH
// display for all users and reset any stale USD/EUR preference server-side so
// that numeric values are not mislabelled. See docs/ROADMAP.md "Currency".
if (prefs.preferredCurrency !== 'UAH') {
try { await updatePreferences('UAH'); } catch { /* ignore — will retry next login */ }
}
set({
preferredCurrency: prefs.preferredCurrency,
preferredCurrency: 'UAH',
rates: next,
loaded: true,
loading: false,
Expand All @@ -53,10 +59,13 @@ export const useCurrencyStore = create<CurrencyState>((set, get) => ({
},

setPreferredCurrency: async (c) => {
// HOTFIX: switcher is disabled in UI; always persist UAH.
const forced: SupportedCurrency = 'UAH';
const prev = get().preferredCurrency;
set({ preferredCurrency: c });
set({ preferredCurrency: forced });
try {
await updatePreferences(c);
await updatePreferences(forced);
void c;
} catch (e) {
set({ preferredCurrency: prev });
throw e;
Expand Down
Loading