feat(frontend): avatar upload QOL — feedback, re-crop, drop, progress, history

Task 12 batch around the existing crop/preview flow:
- Success Notice (auto-dismiss ~2.5s) after an avatar upload.
- "Reposition" re-crops the current avatar without re-picking a file.
- Drag & drop an image straight onto the profile avatar circle.
- Real upload progress via a new XHR-backed api.upload (fetch has none);
  refreshOnce now also stores the renewed token (reload-restore fix).
- Local avatar history (last 5, IndexedDB, this-device-only) strip that
  re-uploads a stored crop. Stored as ArrayBuffer (Blob is not cloneable
  under structuredClone); label makes the per-device scope explicit.
- Added a "success" tone to Notice.

Infra (same session): registered @shared/@features/@pages/@app/@test path
aliases in vite.config + tsconfigs and rewrote deep ../../../ imports;
moved avatar components into components/avatar/ to keep folders at <=4 files.

Tests: avatarHistory cap/order, recrop visibility, drop-opens-cropper,
client upload/progress/401-retry. bun test 103 pass, lint 0 errors, build ok.
This commit is contained in:
loki5512344 2026-09-28 22:56:01 +02:00
parent e79b0aedd2
commit fd2e29cede
Signed by: boba
GPG key ID: 253067914055423B
92 changed files with 808 additions and 287 deletions

View file

@ -1,7 +1,7 @@
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { createBrowserRouter, RouterProvider } from 'react-router'
import { SessionProvider } from '../features/auth/session'
import { ActiveThemeProvider } from '../features/themes/useActiveTheme'
import { SessionProvider } from '@features/auth/session'
import { ActiveThemeProvider } from '@features/themes/useActiveTheme'
import { routes } from './routes'
const queryClient = new QueryClient({

View file

@ -1,28 +1,28 @@
import i18next, { type i18n } from 'i18next'
import LanguageDetector from 'i18next-browser-languagedetector'
import { initReactI18next } from 'react-i18next'
import { accountEn } from '../features/account/i18n/en'
import { accountRu } from '../features/account/i18n/ru'
import { authEn } from '../features/auth/i18n/en'
import { authRu } from '../features/auth/i18n/ru'
import { clickguiEn } from '../features/clickgui/i18n/en'
import { configsEn } from '../features/configs/i18n/en'
import { clickguiRu } from '../features/clickgui/i18n/ru'
import { configsRu } from '../features/configs/i18n/ru'
import { deviceLinkEn } from '../features/device-link/i18n/en'
import { deviceLinkRu } from '../features/device-link/i18n/ru'
import { downloadEn } from '../features/download/i18n/en'
import { profileEn } from '../features/profile/i18n/en'
import { profileRu } from '../features/profile/i18n/ru'
import { showcaseEn } from '../features/showcase/i18n/en'
import { downloadRu } from '../features/download/i18n/ru'
import { showcaseRu } from '../features/showcase/i18n/ru'
import { landingEn } from '../features/landing/i18n/en'
import { landingRu } from '../features/landing/i18n/ru'
import { themesEn } from '../features/themes/i18n/en'
import { themesRu } from '../features/themes/i18n/ru'
import { commonEn } from '../shared/i18n/common.en'
import { commonRu } from '../shared/i18n/common.ru'
import { accountEn } from '@features/account/i18n/en'
import { accountRu } from '@features/account/i18n/ru'
import { authEn } from '@features/auth/i18n/en'
import { authRu } from '@features/auth/i18n/ru'
import { clickguiEn } from '@features/clickgui/i18n/en'
import { configsEn } from '@features/configs/i18n/en'
import { clickguiRu } from '@features/clickgui/i18n/ru'
import { configsRu } from '@features/configs/i18n/ru'
import { deviceLinkEn } from '@features/device-link/i18n/en'
import { deviceLinkRu } from '@features/device-link/i18n/ru'
import { downloadEn } from '@features/download/i18n/en'
import { profileEn } from '@features/profile/i18n/en'
import { profileRu } from '@features/profile/i18n/ru'
import { showcaseEn } from '@features/showcase/i18n/en'
import { downloadRu } from '@features/download/i18n/ru'
import { showcaseRu } from '@features/showcase/i18n/ru'
import { landingEn } from '@features/landing/i18n/en'
import { landingRu } from '@features/landing/i18n/ru'
import { themesEn } from '@features/themes/i18n/en'
import { themesRu } from '@features/themes/i18n/ru'
import { commonEn } from '@shared/i18n/common.en'
import { commonRu } from '@shared/i18n/common.ru'
/** Creates and initializes an i18next instance. Each call is independent, so tests can run in isolation. */
export function initI18n(lng?: 'ru' | 'en'): i18n {

View file

@ -1,14 +1,14 @@
import type { accountRu } from '../features/account/i18n/ru'
import type { authRu } from '../features/auth/i18n/ru'
import type { clickguiRu } from '../features/clickgui/i18n/ru'
import type { configsRu } from '../features/configs/i18n/ru'
import type { deviceLinkRu } from '../features/device-link/i18n/ru'
import type { downloadRu } from '../features/download/i18n/ru'
import type { landingRu } from '../features/landing/i18n/ru'
import type { profileRu } from '../features/profile/i18n/ru'
import type { showcaseRu } from '../features/showcase/i18n/ru'
import type { themesRu } from '../features/themes/i18n/ru'
import type { commonRu } from '../shared/i18n/common.ru'
import type { accountRu } from '@features/account/i18n/ru'
import type { authRu } from '@features/auth/i18n/ru'
import type { clickguiRu } from '@features/clickgui/i18n/ru'
import type { configsRu } from '@features/configs/i18n/ru'
import type { deviceLinkRu } from '@features/device-link/i18n/ru'
import type { downloadRu } from '@features/download/i18n/ru'
import type { landingRu } from '@features/landing/i18n/ru'
import type { profileRu } from '@features/profile/i18n/ru'
import type { showcaseRu } from '@features/showcase/i18n/ru'
import type { themesRu } from '@features/themes/i18n/ru'
import type { commonRu } from '@shared/i18n/common.ru'
declare module 'i18next' {
interface CustomTypeOptions {

View file

@ -1,19 +1,19 @@
import type { RouteObject } from 'react-router'
import { RequireAuth } from '../features/auth/RequireAuth'
import { AppShell } from '../shared/layout/AppShell'
import HomePage from '../pages/public/HomePage'
import LoginPage from '../pages/public/auth/LoginPage'
import RegisterPage from '../pages/public/auth/RegisterPage'
import ProfilePage from '../pages/public/ProfilePage'
import NotFoundPage from '../pages/public/NotFoundPage'
import { RequireAuth } from '@features/auth/RequireAuth'
import { AppShell } from '@shared/layout/AppShell'
import HomePage from '@pages/public/HomePage'
import LoginPage from '@pages/public/auth/LoginPage'
import RegisterPage from '@pages/public/auth/RegisterPage'
import ProfilePage from '@pages/public/ProfilePage'
import NotFoundPage from '@pages/public/NotFoundPage'
// Code-split: the download page pulls in react-markdown, so it loads on demand.
import DownloadRoute from '../pages/download/DownloadRoute'
import AccountPage from '../pages/app/AccountPage'
import LinkPage from '../pages/app/LinkPage'
import ThemesRoute from '../pages/themes/ThemesRoute'
import ConfigsPage from '../pages/app/ConfigsPage'
import ShowcaseRoute from '../pages/showcase/ShowcaseRoute'
import ListingRoute from '../pages/showcase/ListingRoute'
import DownloadRoute from '@pages/download/DownloadRoute'
import AccountPage from '@pages/app/AccountPage'
import LinkPage from '@pages/app/LinkPage'
import ThemesRoute from '@pages/themes/ThemesRoute'
import ConfigsPage from '@pages/app/ConfigsPage'
import ShowcaseRoute from '@pages/showcase/ShowcaseRoute'
import ListingRoute from '@pages/showcase/ListingRoute'
export const routes: RouteObject[] = [
{