From 37b7ccb52ef827a738fa0a7ed7498a59e3561da6 Mon Sep 17 00:00:00 2001 From: smanylov Date: Fri, 8 May 2026 13:57:55 +0700 Subject: [PATCH] fix loading --- src/app/[locale]/layout.tsx | 16 ++--- src/app/[locale]/watch-doc/layout.tsx | 2 +- src/app/actions/violationActions.ts | 1 - src/app/providers/ClientProviders.tsx | 25 ------- src/app/providers/WatchDocProviders.tsx | 11 +++ .../ui/tracking-page/tracking-statistic.tsx | 69 ++++++++++++++++--- 6 files changed, 80 insertions(+), 44 deletions(-) delete mode 100644 src/app/providers/ClientProviders.tsx create mode 100644 src/app/providers/WatchDocProviders.tsx diff --git a/src/app/[locale]/layout.tsx b/src/app/[locale]/layout.tsx index fc99f20..6e83cdd 100644 --- a/src/app/[locale]/layout.tsx +++ b/src/app/[locale]/layout.tsx @@ -2,7 +2,8 @@ import type { Metadata } from "next"; import { NextIntlClientProvider, hasLocale } from 'next-intl'; import { notFound } from 'next/navigation'; import { routing } from '@/i18n/routing'; -import ClientProviders from '@/app/providers/ClientProviders'; +import { ToastProvider } from '@/app/providers/ToastProvider'; +import Providers from '@/app/providers/getQueryServer'; import { Suspense } from 'react'; import "../styles/globals.css"; @@ -32,13 +33,12 @@ export default async function RootLayout({ return ( - Loading...}> - - - {children} - - - + + + {children} + + + ); diff --git a/src/app/[locale]/watch-doc/layout.tsx b/src/app/[locale]/watch-doc/layout.tsx index f78fe70..f5aeb39 100644 --- a/src/app/[locale]/watch-doc/layout.tsx +++ b/src/app/[locale]/watch-doc/layout.tsx @@ -1,7 +1,7 @@ 'use client' import { PdfProvider } from '@/app/contexts/PdfContext'; -import { WatchDocProviders } from '@/app/providers/ClientProviders'; +import { WatchDocProviders } from '@/app/providers/WatchDocProviders'; export default function RootLayout({ children }: { children: React.ReactNode }) { return ( diff --git a/src/app/actions/violationActions.ts b/src/app/actions/violationActions.ts index 05c9777..1f66284 100644 --- a/src/app/actions/violationActions.ts +++ b/src/app/actions/violationActions.ts @@ -300,7 +300,6 @@ export async function fetchViolationFinalSummaryStatistic() { if (response.ok) { let parsed = await response.json(); - console.log(parsed); if (parsed?.message_code === 0) { return parsed?.message_body; diff --git a/src/app/providers/ClientProviders.tsx b/src/app/providers/ClientProviders.tsx deleted file mode 100644 index b937ccb..0000000 --- a/src/app/providers/ClientProviders.tsx +++ /dev/null @@ -1,25 +0,0 @@ -'use client'; - -import Providers from './getQueryServer'; -import { ToastProvider } from './ToastProvider'; - -export default function ClientProviders({ - children -}: { - children: React.ReactNode; -}) { - return ( - - {children} - - - ); -} - -export function WatchDocProviders({ children }: { children: React.ReactNode }) { - return ( - - {children} - - ); -} \ No newline at end of file diff --git a/src/app/providers/WatchDocProviders.tsx b/src/app/providers/WatchDocProviders.tsx new file mode 100644 index 0000000..2a705d0 --- /dev/null +++ b/src/app/providers/WatchDocProviders.tsx @@ -0,0 +1,11 @@ +'use client'; + +import Providers from './getQueryServer'; + +export function WatchDocProviders({ children }: { children: React.ReactNode }) { + return ( + + {children} + + ); +} \ No newline at end of file diff --git a/src/app/ui/tracking-page/tracking-statistic.tsx b/src/app/ui/tracking-page/tracking-statistic.tsx index 7974a34..9f1f713 100644 --- a/src/app/ui/tracking-page/tracking-statistic.tsx +++ b/src/app/ui/tracking-page/tracking-statistic.tsx @@ -1,10 +1,10 @@ 'use client' -import {IconLink, IconDocument, IconCheck, IconPerson, IconGlobe, IconCity} from '@/app/ui/icons/icons'; +import { IconLink, IconDocument, IconCheck, IconPerson, IconGlobe, IconCity } from '@/app/ui/icons/icons'; import { useTrackingStats } from '@/app/hooks/react-query/useTrackingStats'; export function TrackingStatistic() { - const { data } = useTrackingStats(); + const { data, isLoading } = useTrackingStats(); return (
- {data?.documentsCount ? data?.documentsCount : 0} +
+ {isLoading ? ( +
+
+
+ ) : ( + data?.documentsCount ? data?.documentsCount : 0 + )} +
Документов @@ -36,14 +46,25 @@ export function TrackingStatistic() {
-
- {data?.totalViews? data?.totalViews : 0} +
+
+
+ {isLoading ? ( +
+
+
+ ) : ( + data?.totalViews ? data?.totalViews : 0 + )} +
Открытий
-{/*
+ {/*
@@ -59,7 +80,17 @@ export function TrackingStatistic() {
- {data?.uniqueIps ? data?.uniqueIps : 0} +
+ {isLoading ? ( +
+
+
+ ) : ( + data?.uniqueIps ? data?.uniqueIps : 0 + )} +
Уникальных IP @@ -70,7 +101,17 @@ export function TrackingStatistic() {
- {data?.uniqueCountryCount ? data?.uniqueCountryCount : 0} +
+ {isLoading ? ( +
+
+
+ ) : ( + data?.uniqueCountryCount ? data?.uniqueCountryCount : 0 + )} +
Уникальных стран @@ -81,7 +122,17 @@ export function TrackingStatistic() {
- {data?.uniqueCountryCount ? data?.uniqueCountryCount : 0} +
+ {isLoading ? ( +
+
+
+ ) : ( + data?.uniqueCountryCount ? data?.uniqueCountryCount : 0 + )} +
Уникальных городов