|
1 | 1 | import * as Tabs from "@radix-ui/react-tabs"; |
2 | | -import { LinkIcon, SquareArrowOutUpRightIcon, ZoomIn } from "lucide-react"; |
| 2 | +import { LinkIcon, SquareArrowOutUpRightIcon } from "lucide-react"; |
3 | 3 | import styles from "./dimensions.module.css"; |
4 | 4 |
|
5 | | -import { |
6 | | - type DateRange, |
7 | | - type Dimension, |
8 | | - type DimensionTableRow, |
9 | | - type Metric, |
10 | | - type ProjectResponse, |
11 | | - dimensionNames, |
12 | | - metricNames, |
13 | | - useDimension, |
14 | | -} from "../../api"; |
| 5 | +import { type Dimension, type DimensionTableRow, dimensionNames, metricNames, useDimension } from "../../api"; |
15 | 6 |
|
16 | 7 | import { BrowserIcon, MobileDeviceIcon, OSIcon, ReferrerIcon } from "../icons"; |
17 | | -import { countryCodeToFlag, formatFullUrl, formatHost, formatPath, getHref, tryParseUrl } from "../../utils"; |
| 8 | +import { cls, countryCodeToFlag, formatHost, formatPath, getHref, tryParseUrl } from "../../utils"; |
18 | 9 | import { DetailsModal } from "./modal"; |
19 | 10 | import { formatMetricVal } from "../../utils"; |
20 | 11 | import type { ProjectQuery } from "../project"; |
@@ -85,11 +76,15 @@ export const DimensionTabs = ({ |
85 | 76 |
|
86 | 77 | export const DimensionTable = (props: DimensionProps) => { |
87 | 78 | const { data, biggest, order, isLoading } = useDimension({ dimension: props.dimension, ...props.query }); |
88 | | - |
89 | 79 | const dataTruncated = data?.slice(0, 6); |
| 80 | + |
90 | 81 | return ( |
91 | 82 | <> |
92 | | - <div className={styles.dimensionTable} style={{ "--count": 6 } as React.CSSProperties}> |
| 83 | + <div |
| 84 | + className={cls(styles.dimensionTable, isLoading && styles.loading)} |
| 85 | + style={{ "--count": 6 } as React.CSSProperties} |
| 86 | + > |
| 87 | + {isLoading && <div className={cls("loading-spinner", styles.spinner)} />} |
93 | 88 | {dataTruncated?.map((d) => { |
94 | 89 | return ( |
95 | 90 | <div |
|
0 commit comments