fix loading
This commit is contained in:
@@ -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 (
|
||||
<div
|
||||
@@ -27,7 +27,17 @@ export function TrackingStatistic() {
|
||||
<IconDocument />
|
||||
</div>
|
||||
<div className="general-statistic-item-val">
|
||||
{data?.documentsCount ? data?.documentsCount : 0}
|
||||
<div
|
||||
className="loading-placeholder start"
|
||||
>
|
||||
{isLoading ? (
|
||||
<div className="loading-animation">
|
||||
<div className="global-spinner" />
|
||||
</div>
|
||||
) : (
|
||||
data?.documentsCount ? data?.documentsCount : 0
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="general-statistic-item-lbl">
|
||||
Документов
|
||||
@@ -36,14 +46,25 @@ export function TrackingStatistic() {
|
||||
<div className="general-statistic-item">
|
||||
<div className="general-statistic-item-ico">
|
||||
<IconLink />
|
||||
</div><div className="general-statistic-item-val">
|
||||
{data?.totalViews? data?.totalViews : 0}
|
||||
</div>
|
||||
<div className="general-statistic-item-val">
|
||||
<div
|
||||
className="loading-placeholder start"
|
||||
>
|
||||
{isLoading ? (
|
||||
<div className="loading-animation">
|
||||
<div className="global-spinner" />
|
||||
</div>
|
||||
) : (
|
||||
data?.totalViews ? data?.totalViews : 0
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="general-statistic-item-lbl">
|
||||
Открытий
|
||||
</div>
|
||||
</div>
|
||||
{/* <div className="general-statistic-item">
|
||||
{/* <div className="general-statistic-item">
|
||||
<div className="general-statistic-item-ico">
|
||||
<IconCheck />
|
||||
</div>
|
||||
@@ -59,7 +80,17 @@ export function TrackingStatistic() {
|
||||
<IconPerson />
|
||||
</div>
|
||||
<div className="general-statistic-item-val">
|
||||
{data?.uniqueIps ? data?.uniqueIps : 0}
|
||||
<div
|
||||
className="loading-placeholder start"
|
||||
>
|
||||
{isLoading ? (
|
||||
<div className="loading-animation">
|
||||
<div className="global-spinner" />
|
||||
</div>
|
||||
) : (
|
||||
data?.uniqueIps ? data?.uniqueIps : 0
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="general-statistic-item-lbl">
|
||||
Уникальных IP
|
||||
@@ -70,7 +101,17 @@ export function TrackingStatistic() {
|
||||
<IconGlobe />
|
||||
</div>
|
||||
<div className="general-statistic-item-val">
|
||||
{data?.uniqueCountryCount ? data?.uniqueCountryCount : 0}
|
||||
<div
|
||||
className="loading-placeholder start"
|
||||
>
|
||||
{isLoading ? (
|
||||
<div className="loading-animation">
|
||||
<div className="global-spinner" />
|
||||
</div>
|
||||
) : (
|
||||
data?.uniqueCountryCount ? data?.uniqueCountryCount : 0
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="general-statistic-item-lbl">
|
||||
Уникальных стран
|
||||
@@ -81,7 +122,17 @@ export function TrackingStatistic() {
|
||||
<IconCity />
|
||||
</div>
|
||||
<div className="general-statistic-item-val">
|
||||
{data?.uniqueCountryCount ? data?.uniqueCountryCount : 0}
|
||||
<div
|
||||
className="loading-placeholder start"
|
||||
>
|
||||
{isLoading ? (
|
||||
<div className="loading-animation">
|
||||
<div className="global-spinner" />
|
||||
</div>
|
||||
) : (
|
||||
data?.uniqueCountryCount ? data?.uniqueCountryCount : 0
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="general-statistic-item-lbl">
|
||||
Уникальных городов
|
||||
|
||||
Reference in New Issue
Block a user