mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-30 02:23:47 +00:00
fix(dashboard): show full name on welcome, fix gender mismatch on trial-expired card
User reported single-letter welcome "Добро пожаловать, О!" (short first_name "Олег"-style users) and a confused "Истекла" feminine label on the masculine "Пробный период истёк" trial-expired card. * Add `src/utils/displayName.ts` helper that composes `first_name + last_name` with `username` and `#telegram_id` fallbacks. Single source of truth for user-facing name rendering across the app. * Apply `displayName(user)` in Dashboard welcome, AppHeader mobile drawer, and DesktopSidebar profile chip. Now a user with `first_name="О"` and `last_name="Иванов"` sees "О Иванов" instead of just "О". * `SubscriptionCardExpired` — context-aware Russian label: for trial subscriptions render masculine "Истёк" (agrees with "пробный период"), for paid subscriptions keep feminine "Истекла" (agrees with "подписка"). Uses i18next `context: subscription.is_trial ? 'trial' : ''` — falls back to base key for EN/ZH/FA which are grammatically neutral. * Add `expiredDate_trial: "Истёк"` only to `ru.json` (no changes needed for other locales — i18next context falls back to `expiredDate`).
This commit is contained in:
@@ -5,6 +5,7 @@ import { useState, useEffect } from 'react';
|
||||
import { initDataUser } from '@telegram-apps/sdk-react';
|
||||
|
||||
import { useAuthStore } from '@/store/auth';
|
||||
import { displayName } from '@/utils/displayName';
|
||||
import { useShallow } from 'zustand/shallow';
|
||||
import { useTheme } from '@/hooks/useTheme';
|
||||
import { usePlatform } from '@/platform';
|
||||
@@ -340,9 +341,7 @@ export function AppHeader({
|
||||
<UserIcon className="h-5 w-5" />
|
||||
</div>
|
||||
<div>
|
||||
<div className="text-sm font-medium text-dark-100">
|
||||
{user?.first_name || user?.username}
|
||||
</div>
|
||||
<div className="text-sm font-medium text-dark-100">{displayName(user)}</div>
|
||||
<div className="text-xs text-dark-500">
|
||||
@{user?.username || `ID: ${user?.telegram_id}`}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user