Skip to content

Commit ee401b6

Browse files
committed
Fix zooming issues
1 parent 1bd9ac1 commit ee401b6

File tree

6 files changed

+24
-17
lines changed

6 files changed

+24
-17
lines changed

src/client/apps/contwatch-client/app/[lang]/inspector/components/InspectorChart/InspectorChart.tsx

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,17 @@ export const InspectorChart: FC<InspectorChartProps> = ({ attributes = [], date,
8282
};
8383
}, []);
8484

85+
options.scales = {
86+
...options.scales,
87+
x: {
88+
...options.scales?.x,
89+
time: {
90+
unit: "hour",
91+
tooltipFormat: lng === "cs" ? "d.MM.yyyy HH:mm:ss" : "",
92+
},
93+
},
94+
};
95+
8596
const data = {
8697
datasets:
8798
attributeChartData?.map((attributeChart) => ({
@@ -129,22 +140,7 @@ export const InspectorChart: FC<InspectorChartProps> = ({ attributes = [], date,
129140
</Flex>
130141
<div className={bem("chart")}>
131142
<Line
132-
{...{
133-
options: {
134-
...options,
135-
scales: {
136-
...options.scales,
137-
x: {
138-
...options.scales.x,
139-
time: {
140-
...options.scales.x.time,
141-
tooltipFormat: lng === "cs" ? "d.MM.yyyy HH:mm:ss" : undefined,
142-
},
143-
},
144-
},
145-
} as ChartOptions<"line">,
146-
data,
147-
}}
143+
{...{ options: options as ChartOptions<"line">, data }}
148144
ref={(ref) => setRef(ref as unknown as Chart)}
149145
onWheel={() => setZoomLevel(ref?.getZoomLevel?.() ?? 1)}
150146
onTouchEnd={() => setZoomLevel(ref?.getZoomLevel?.() ?? 1)}

src/client/apps/contwatch-client/app/[lang]/inspector/components/InspectorChart/chartOptions.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export const options = {
1414
type: "time",
1515
time: {
1616
unit: "hour",
17+
tooltipFormat: "",
1718
},
1819
beginAtZero: true,
1920
},
Lines changed: 3 additions & 0 deletions
Loading

src/client/packages/types/src/IconType.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ export type IconType =
66
| "arrow-right-up"
77
| "arrow-up-square"
88
| "branch-horizontal"
9-
| "circle"
109
| "chart-square"
10+
| "chevron-down"
11+
| "circle"
1112
| "cross-small"
1213
| "edit-square"
1314
| "grid-mixed"

src/client/packages/ui/src/components/Input/Input.module.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@
9595
&__icon {
9696
position: absolute;
9797
right: 1.2rem;
98+
pointer-events: none;
99+
user-select: none;
98100
}
99101

100102
&--hasIcon {

src/client/packages/ui/src/components/Input/Input.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ export const Input: FC<InputProps> = ({
5757
onValueChange,
5858
onNumberChange,
5959
}) => {
60+
if (type === "pick" && !icon) {
61+
icon = "chevron-down";
62+
}
63+
6064
const offsetValue = (offset: number) => {
6165
return processValue(
6266
parseLocalizedFloat(valueState !== "" ? valueState : "0", currentLocale) + offset,

0 commit comments

Comments
 (0)