From 26d529b09bedcf86ae298e973d1d02d5eed6eb0d Mon Sep 17 00:00:00 2001 From: nurdotnet <278048682+nurdotnet@users.noreply.github.com> Date: Tue, 21 Apr 2026 20:33:10 +0500 Subject: [PATCH] fix(web): remove TanStack devtools palm icon; restore user profile on dashboard - Drop ReactQueryDevtools floating button (the "palm tree" in corner) - Dashboard now shows: greeting with user name, stat cards, user profile (name/email/roles/orgId), and roadmap - Add amber banner when API calls fail (typical cause: API not restarted after pulling new catalog code) with explicit fix instructions Co-Authored-By: Claude Opus 4.7 (1M context) --- src/food-market.web/src/App.tsx | 2 - .../src/pages/DashboardPage.tsx | 39 ++++++++++++++++++- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/src/food-market.web/src/App.tsx b/src/food-market.web/src/App.tsx index 5b6a948..cb761d0 100644 --- a/src/food-market.web/src/App.tsx +++ b/src/food-market.web/src/App.tsx @@ -1,6 +1,5 @@ import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom' import { QueryClient, QueryClientProvider } from '@tanstack/react-query' -import { ReactQueryDevtools } from '@tanstack/react-query-devtools' import { LoginPage } from '@/pages/LoginPage' import { DashboardPage } from '@/pages/DashboardPage' import { CountriesPage } from '@/pages/CountriesPage' @@ -49,7 +48,6 @@ export default function App() { } /> - ) } diff --git a/src/food-market.web/src/pages/DashboardPage.tsx b/src/food-market.web/src/pages/DashboardPage.tsx index 9b7a74a..e5d5d42 100644 --- a/src/food-market.web/src/pages/DashboardPage.tsx +++ b/src/food-market.web/src/pages/DashboardPage.tsx @@ -4,6 +4,14 @@ import { PageHeader } from '@/components/PageHeader' import { api } from '@/lib/api' import type { PagedResult } from '@/lib/types' +interface MeResponse { + sub: string + name: string + email: string + roles: string[] + orgId: string +} + function useCount(url: string) { return useQuery({ queryKey: [url, 'count'], @@ -33,18 +41,33 @@ function StatCard({ icon: Icon, label, value, isLoading }: StatCardProps) { } export function DashboardPage() { + const me = useQuery({ + queryKey: ['me'], + queryFn: async () => (await api.get('/api/me')).data, + }) const products = useCount('/api/catalog/products') const counterparties = useCount('/api/catalog/counterparties') const stores = useCount('/api/catalog/stores') const retailPoints = useCount('/api/catalog/retail-points') + const anyError = [products, counterparties, stores, retailPoints].find(q => q.error)?.error as Error | undefined + return (
+ {anyError && ( +
+
API недоступен или ещё не обновился
+
+ Перезапусти API после git pull: Ctrl+C → dotnet run --project src/food-market.api +
+
+ )} +
@@ -52,7 +75,19 @@ export function DashboardPage() {
-
+ {me.data && ( +
+

Текущий пользователь

+
+
Имя:
{me.data.name}
+
Email:
{me.data.email}
+
Роли:
{me.data.roles.join(', ')}
+
Организация:
{me.data.orgId}
+
+
+ )} + +

Что дальше

  • Phase 2: приёмка товара, розничные продажи, складские остатки