feat: add i18n and avatar upload

This commit is contained in:
Vaka.pro
2026-04-26 22:16:59 +03:00
parent db41d4a246
commit 1b23097b18
22 changed files with 750 additions and 145 deletions

View File

@@ -9,8 +9,11 @@ import { api } from '@/lib/api';
import { WishCard } from '@/components/WishCard/WishCard';
import { Footer } from '@/components/Layout/Footer';
import { Gift } from 'lucide-react';
import { LanguageSwitcher } from '@/components/LanguageSwitcher';
import { useI18n } from '@/i18n/i18n';
export function PublicProfilePage() {
const { t } = useI18n();
const { slug = '' } = useParams<{ slug: string }>();
const queryClient = useQueryClient();
@@ -53,14 +56,17 @@ export function PublicProfilePage() {
return (
<div className="flex min-h-screen flex-col">
<div className="container-page flex justify-end pt-6">
<LanguageSwitcher />
</div>
<main className="container-page flex-1 py-10">
{profile.isLoading && <div className="text-muted">Loading...</div>}
{profile.isLoading && <div className="text-muted">{t('common.loading')}</div>}
{profile.isError && (
<div className="mx-auto max-w-lg rounded-xl border border-border bg-surface p-8 text-center shadow-card">
<h1 className="font-display text-2xl">Profile not found</h1>
<h1 className="font-display text-2xl">{t('public.notFoundTitle')}</h1>
<p className="mt-2 text-sm text-muted">
Check the link and try again. Slugs are case-sensitive.
{t('public.notFoundText')}
</p>
</div>
)}
@@ -79,18 +85,20 @@ export function PublicProfilePage() {
<Gift className="h-6 w-6" />
)}
</span>
<h1 className="font-display text-4xl">{profile.data.displayName}'s wishlist</h1>
<h1 className="font-display text-4xl">
{t('public.wishlistTitle', { name: profile.data.displayName })}
</h1>
{profile.data.bio && (
<p className="max-w-xl text-muted">{profile.data.bio}</p>
)}
</section>
{wishes.isLoading && <div className="text-muted">Loading wishes...</div>}
{wishes.isLoading && <div className="text-muted">{t('public.loadingWishes')}</div>}
{wishes.data && wishes.data.length === 0 && (
<div className="mx-auto max-w-lg rounded-xl border border-border bg-surface/80 p-10 text-center shadow-card">
<h2 className="text-xl font-semibold">No wishes yet</h2>
<p className="mt-1 text-sm text-muted">Check back later!</p>
<h2 className="text-xl font-semibold">{t('public.emptyTitle')}</h2>
<p className="mt-1 text-sm text-muted">{t('public.emptyText')}</p>
</div>
)}