fix(ui): пояснять отсутствие отдельного направления трафика
This commit is contained in:
1 parent
ec8e28d15d
commit
ccbc1aa029
3 files changed
+36
-7
No files matched your search
@@ -82,11 +82,14 @@ export function TrafficRxTxChart({
|
||||
const data = toChartData(rx, tx, rangeMinutes)
|
||||
const tickEvery = Math.max(1, Math.ceil(data.length / 6))
|
||||
|
||||
const hasData = data.some(point => point.rx !== null || point.tx !== null)
|
||||
const hasRx = data.some(point => point.rx !== null)
|
||||
const hasTx = data.some(point => point.tx !== null)
|
||||
const hasData = hasRx || hasTx
|
||||
const chart = !hasData ? (
|
||||
<p role="status" className="flex min-h-[220px] items-center justify-center text-sm text-muted-foreground">Нет исторических измерений за выбранный период</p>
|
||||
) : (
|
||||
<div role="region" aria-label="История RX/TX" className="flex flex-col gap-4">
|
||||
{(!hasRx || !hasTx) && <p role="status" className="text-sm text-muted-foreground">{!hasRx ? "Нет измерений RX за выбранный период" : "Нет измерений TX за выбранный период"}</p>}
|
||||
<ChartContainer config={chartConfig} className="-ms-4 aspect-auto h-[220px] w-full">
|
||||
<LineChart data={data} margin={{ top: 5, right: 5, left: 5, bottom: 5 }}>
|
||||
<CartesianGrid
|
||||
@@ -111,20 +114,20 @@ export function TrafficRxTxChart({
|
||||
width={72}
|
||||
/>
|
||||
<ChartTooltip content={<CustomTooltip />} />
|
||||
<Line
|
||||
{hasRx && <Line
|
||||
dataKey="rx"
|
||||
type="monotone"
|
||||
stroke="var(--chart-rx)"
|
||||
strokeWidth={2}
|
||||
dot={false}
|
||||
/>
|
||||
<Line
|
||||
/>}
|
||||
{hasTx && <Line
|
||||
dataKey="tx"
|
||||
type="monotone"
|
||||
stroke="var(--chart-tx)"
|
||||
strokeWidth={2}
|
||||
dot={false}
|
||||
/>
|
||||
/>}
|
||||
</LineChart>
|
||||
</ChartContainer>
|
||||
<div className="mb-1 flex items-center justify-center gap-6">
|
||||
|
||||
Reference in new issue
Block a user