import React from 'react' import { useQuery } from '@tanstack/react-query' import { topBar } from '../../services/services' import queryKeys from '../../services/queryKeys' export default function TopBar() { const {data, isFetching, isError, error} = useQuery({ queryKey: queryKeys.topBar, queryFn: () => topBar() }) const topData = data?.data?.bar_data?.top_bar console.log('topData', topData) return ( <> {isFetching ? <>

Loading...

: isError ?

{error.message}

: <> {topData && topData?.map((item, index)=>{ let textColor = item?.description == 'Contacts' ? 'text-danger' : item?.description == 'Site Traffic' ? 'text-primary' : item?.description == 'Appointments' ? 'text-orange' : 'text-success' return (

{item?.value || 0}

{item?.data_span}
{item?.description}
N/A
) })} } ) }