fix: empty analytics
This commit is contained in:
parent
53aa64e9ea
commit
b0c15ff98f
@ -5,7 +5,8 @@ import {
|
||||
Typography,
|
||||
useTheme,
|
||||
} from "@mui/material";
|
||||
import { FC } from "react";
|
||||
|
||||
import type { FC } from "react";
|
||||
|
||||
type ResultProps = {
|
||||
title: string;
|
||||
@ -17,12 +18,6 @@ type ResultsProps = {
|
||||
data: Record<string, number> | null;
|
||||
};
|
||||
|
||||
const RESULTS_MOCK: Record<string, number> = {
|
||||
"Заголовок результата": 100,
|
||||
"Результат пропущен": 7,
|
||||
Другое: 27,
|
||||
};
|
||||
|
||||
const Result = ({ title, percent, highlight }: ResultProps) => {
|
||||
const theme = useTheme();
|
||||
|
||||
@ -76,12 +71,13 @@ const Result = ({ title, percent, highlight }: ResultProps) => {
|
||||
export const Results: FC<ResultsProps> = ({ data }) => {
|
||||
const theme = useTheme();
|
||||
|
||||
if (!data)
|
||||
if (!data || !Object.keys(data).length)
|
||||
return (
|
||||
<Typography margin="20px 0 0 0" textAlign="center" m="10px 0">
|
||||
нет данных о результатах
|
||||
</Typography>
|
||||
);
|
||||
|
||||
return (
|
||||
<Box>
|
||||
<Typography
|
||||
|
@ -22,7 +22,7 @@ const COLORS: Record<number, string> = {
|
||||
|
||||
const Device = ({ title, devices }: DeviceProps) => {
|
||||
const theme = useTheme();
|
||||
if (!devices) {
|
||||
if (!devices || !Object.keys(devices ?? {}).length) {
|
||||
return <Typography>{title} - нет данных</Typography>;
|
||||
}
|
||||
|
||||
|
26
yarn.lock
26
yarn.lock
@ -1517,13 +1517,16 @@
|
||||
immer "^10.0.2"
|
||||
reconnecting-eventsource "^1.6.2"
|
||||
|
||||
"@frontend/squzanswerer@^1.0.6":
|
||||
version "1.0.6"
|
||||
resolved "https://penahub.gitlab.yandexcloud.net/api/v4/projects/43/packages/npm/@frontend/squzanswerer/-/@frontend/squzanswerer-1.0.6.tgz#4de9d9f8f4da5992679f9f4069a88bd7c3c2c359"
|
||||
integrity sha1-TenZ+PTaWZJnn59AaaiL18PCw1k=
|
||||
"@frontend/squzanswerer@^1.0.17":
|
||||
version "1.0.18"
|
||||
resolved "https://penahub.gitlab.yandexcloud.net/api/v4/projects/43/packages/npm/@frontend/squzanswerer/-/@frontend/squzanswerer-1.0.18.tgz#9a191317ccf7b396af4e85e8c9f1f52cc5243f96"
|
||||
integrity sha1-mhkTF8z3s5avToXoyfH1LMUkP5Y=
|
||||
dependencies:
|
||||
bowser "1.9.4"
|
||||
country-flag-emoji-polyfill "^0.1.8"
|
||||
current-device "^0.10.2"
|
||||
hex-rgb "^5.0.0"
|
||||
mobile-detect "^1.4.5"
|
||||
|
||||
"@humanwhocodes/config-array@^0.11.13":
|
||||
version "0.11.14"
|
||||
@ -3707,6 +3710,11 @@ boolbase@^1.0.0, boolbase@~1.0.0:
|
||||
resolved "https://registry.yarnpkg.com/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e"
|
||||
integrity sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==
|
||||
|
||||
bowser@1.9.4:
|
||||
version "1.9.4"
|
||||
resolved "https://registry.yarnpkg.com/bowser/-/bowser-1.9.4.tgz#890c58a2813a9d3243704334fa81b96a5c150c9a"
|
||||
integrity sha512-9IdMmj2KjigRq6oWhmwv1W36pDuA4STQZ8q6YO9um+x07xgYNCD3Oou+WP/3L1HNz7iqythGet3/p4wvc8AAwQ==
|
||||
|
||||
brace-expansion@^1.1.7:
|
||||
version "1.1.11"
|
||||
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"
|
||||
@ -4482,6 +4490,11 @@ csstype@^3.0.2, csstype@^3.1.3:
|
||||
resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.3.tgz#d80ff294d114fb0e6ac500fbf85b60137d7eff81"
|
||||
integrity sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==
|
||||
|
||||
current-device@^0.10.2:
|
||||
version "0.10.2"
|
||||
resolved "https://registry.yarnpkg.com/current-device/-/current-device-0.10.2.tgz#1e40176bee7da655383ab7245b853fae7d2dfc8e"
|
||||
integrity sha512-FN223n2Cp1fRI/gyjJEAdagHhJ/2Z2STz3tUg1t4F259BhmVRCChkmxcgFtjYJsWuIacQEs7bqJpnAczIXIkWw==
|
||||
|
||||
cypress-file-upload@^5.0.8:
|
||||
version "5.0.8"
|
||||
resolved "https://registry.yarnpkg.com/cypress-file-upload/-/cypress-file-upload-5.0.8.tgz#d8824cbeaab798e44be8009769f9a6c9daa1b4a1"
|
||||
@ -8138,6 +8151,11 @@ mkdirp@~0.5.1:
|
||||
dependencies:
|
||||
minimist "^1.2.6"
|
||||
|
||||
mobile-detect@^1.4.5:
|
||||
version "1.4.5"
|
||||
resolved "https://registry.yarnpkg.com/mobile-detect/-/mobile-detect-1.4.5.tgz#da393c3c413ca1a9bcdd9ced653c38281c0fb6ad"
|
||||
integrity sha512-yc0LhH6tItlvfLBugVUEtgawwFU2sIe+cSdmRJJCTMZ5GEJyLxNyC/NIOAOGk67Fa8GNpOttO3Xz/1bHpXFD/g==
|
||||
|
||||
moment@^2.30.1:
|
||||
version "2.30.1"
|
||||
resolved "https://registry.yarnpkg.com/moment/-/moment-2.30.1.tgz#f8c91c07b7a786e30c59926df530b4eac96974ae"
|
||||
|
Loading…
Reference in New Issue
Block a user