-
- Query time override
-
+
}
/>
+
+ If the query contains a time filter, it overrides the selected time range.
+
);
};
export default QueryTimeOverride;
+
+const OverrideTimeLabel: FC = () => (
+
+ Override time picker with query time filter
+
+);
diff --git a/app/vmui/packages/vmui/src/components/Configurators/GlobalSettings/QueryTimeOverride/style.scss b/app/vmui/packages/vmui/src/components/Configurators/GlobalSettings/QueryTimeOverride/style.scss
new file mode 100644
index 0000000000..972ff0c18e
--- /dev/null
+++ b/app/vmui/packages/vmui/src/components/Configurators/GlobalSettings/QueryTimeOverride/style.scss
@@ -0,0 +1,19 @@
+@use "src/styles/variables" as *;
+
+.vm-time-override-controller {
+ background-color: $color-hover-black;
+ border-radius: $border-radius-medium;
+ padding: $padding-large;
+ border: $border-divider;
+
+ .vm-server-configurator__title {
+ margin: 0;
+ }
+
+ &__description {
+ padding-top: $padding-global;
+ font-size: $font-size-small;
+ line-height: 1.3;
+ text-wrap: pretty;
+ }
+}
diff --git a/app/vmui/packages/vmui/src/components/Configurators/GlobalSettings/Timezones/TimezonesPicker.tsx b/app/vmui/packages/vmui/src/components/Configurators/GlobalSettings/Timezones/TimezonesPicker.tsx
index 16992bd8ff..2149cb7513 100644
--- a/app/vmui/packages/vmui/src/components/Configurators/GlobalSettings/Timezones/TimezonesPicker.tsx
+++ b/app/vmui/packages/vmui/src/components/Configurators/GlobalSettings/Timezones/TimezonesPicker.tsx
@@ -1,4 +1,4 @@
-import { FC, forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState } from "preact/compat";
+import { FC, useEffect, useMemo, useRef, useState } from "preact/compat";
import { getUTCByTimezone } from "../../../../utils/time";
import { ArrowDropDownIcon } from "../../../Main/Icons";
import classNames from "classnames";
@@ -10,7 +10,7 @@ import TimezonesList from "./TimezonesList";
import Popper from "../../../Main/Popper/Popper";
import useDeviceDetect from "../../../../hooks/useDeviceDetect";
-const TimezonesPicker: FC = forwardRef((_props, ref) => {
+const TimezonesPicker: FC = () => {
const { isMobile } = useDeviceDetect();
const { timezone: stateTimezone } = useTimeState();
const timeDispatch = useTimeDispatch();
@@ -30,7 +30,7 @@ const TimezonesPicker: FC = forwardRef((_props, ref) => {
}), [timezone]);
const handleSetTimezone = (tz: Timezone) => {
- setTimezone(tz.region);
+ timeDispatch({ type: "SET_TIMEZONE", payload: tz.region });
handleCloseList();
};
@@ -38,12 +38,6 @@ const TimezonesPicker: FC = forwardRef((_props, ref) => {
setTimezone(stateTimezone);
}, [stateTimezone]);
- useImperativeHandle(ref, () => ({
- handleApply: () => {
- timeDispatch({ type: "SET_TIMEZONE", payload: timezone });
- }
- }), [timezone]);
-
return (
@@ -77,6 +71,6 @@ const TimezonesPicker: FC = forwardRef((_props, ref) => {
);
-});
+};
export default TimezonesPicker;
diff --git a/app/vmui/packages/vmui/src/components/Configurators/GlobalSettings/Timezones/style.scss b/app/vmui/packages/vmui/src/components/Configurators/GlobalSettings/Timezones/style.scss
index e0d6f4e742..774edd634d 100644
--- a/app/vmui/packages/vmui/src/components/Configurators/GlobalSettings/Timezones/style.scss
+++ b/app/vmui/packages/vmui/src/components/Configurators/GlobalSettings/Timezones/style.scss
@@ -16,6 +16,7 @@
}
&__title {
+ flex-grow: 1;
display: flex;
align-items: center;
gap: $padding-small;
@@ -34,6 +35,7 @@
background-color: $color-hover-black;
padding: calc($padding-small/2);
border-radius: $border-radius-small;
+ font-size: $font-size-small;
}
&__icon {
diff --git a/app/vmui/packages/vmui/src/components/Configurators/GlobalSettings/style.scss b/app/vmui/packages/vmui/src/components/Configurators/GlobalSettings/style.scss
index 57244eac6d..6c9516b0a6 100644
--- a/app/vmui/packages/vmui/src/components/Configurators/GlobalSettings/style.scss
+++ b/app/vmui/packages/vmui/src/components/Configurators/GlobalSettings/style.scss
@@ -4,9 +4,10 @@
display: flex;
flex-direction: column;
align-items: center;
- gap: $padding-large;
+ gap: calc($padding-global * 2);
width: 600px;
- padding-bottom: $padding-medium;
+ padding-inline: $padding-large;
+ padding-bottom: calc($padding-large * 2);
&_mobile {
grid-auto-rows: min-content;
@@ -55,17 +56,4 @@
margin-top: $padding-small;
}
}
-
- &-footer {
- display: flex;
- align-items: center;
- justify-content: flex-end;
- gap: $padding-small;
- width: 100%;
- }
-
- &_mobile &-footer {
- display: grid;
- grid-template-columns: 1fr 1fr;
- }
}
diff --git a/app/vmui/packages/vmui/src/components/Configurators/ThemeControl/ThemeControl.tsx b/app/vmui/packages/vmui/src/components/Configurators/ThemeControl/ThemeControl.tsx
index 90099f2d89..cb137a445e 100644
--- a/app/vmui/packages/vmui/src/components/Configurators/ThemeControl/ThemeControl.tsx
+++ b/app/vmui/packages/vmui/src/components/Configurators/ThemeControl/ThemeControl.tsx
@@ -5,8 +5,20 @@ import useDeviceDetect from "../../../hooks/useDeviceDetect";
import classNames from "classnames";
import { FC } from "preact/compat";
import { useAppDispatch, useAppState } from "../../../state/common/StateContext";
+import { DarkIcon, LightIcon, SystemIcon } from "../../Main/Icons";
+
+const themeIcons = {
+ [Theme.system]:
,
+ [Theme.light]:
,
+ [Theme.dark]:
,
+};
+
+const options = Object.values(Theme).map(value => ({
+ title: value,
+ value,
+ icon: themeIcons[value],
+}));
-const options = Object.values(Theme).map(value => ({ title: value, value }));
const ThemeControl: FC = () => {
const { isMobile } = useDeviceDetect();
const dispatch = useAppDispatch();
@@ -25,13 +37,14 @@ const ThemeControl: FC = () => {
})}
>
- Theme preferences
+ Theme
(
/>
);
+
+export const SystemIcon = () => (
+
+);
+
+export const LightIcon = () => (
+
+);
+
+export const DarkIcon = () => (
+
+);
diff --git a/app/vmui/packages/vmui/src/components/Main/Switch/Switch.tsx b/app/vmui/packages/vmui/src/components/Main/Switch/Switch.tsx
index eb15df28fd..8f3e836b07 100644
--- a/app/vmui/packages/vmui/src/components/Main/Switch/Switch.tsx
+++ b/app/vmui/packages/vmui/src/components/Main/Switch/Switch.tsx
@@ -4,7 +4,7 @@ import "./style.scss";
interface SwitchProps {
value: boolean
- color?: "primary" | "secondary" | "error"
+ color?: "primary" | "secondary" | "error" | "neutral"
disabled?: boolean
label?: string | ReactNode
fullWidth?: boolean
diff --git a/app/vmui/packages/vmui/src/components/Main/Switch/style.scss b/app/vmui/packages/vmui/src/components/Main/Switch/style.scss
index f18686b452..1773d6a51f 100644
--- a/app/vmui/packages/vmui/src/components/Main/Switch/style.scss
+++ b/app/vmui/packages/vmui/src/components/Main/Switch/style.scss
@@ -32,6 +32,10 @@ $switch-border-radius: $switch-handle-size + ($switch-padding * 2);
background-color: $color-secondary;
}
+ &_neutral_active &-track {
+ background-color: $color-text;
+ }
+
&_primary_active &-track {
background-color: $color-primary;
}
diff --git a/app/vmui/packages/vmui/src/components/Main/Toggle/Toggle.tsx b/app/vmui/packages/vmui/src/components/Main/Toggle/Toggle.tsx
index 786641a44a..65b1841cf7 100644
--- a/app/vmui/packages/vmui/src/components/Main/Toggle/Toggle.tsx
+++ b/app/vmui/packages/vmui/src/components/Main/Toggle/Toggle.tsx
@@ -3,19 +3,19 @@ import classNames from "classnames";
import "./style.scss";
interface ToggleProps {
- options: {value: string, title?: string, icon?: ReactNode}[]
+ options: { value: string, title?: string, icon?: ReactNode }[]
value: string
onChange: (val: string) => void
label?: string
+ size?: "medium" | "large"
}
-const Toggle: FC = ({ options, value, label, onChange }) => {
+const Toggle: FC = ({ options, value, label, size = "medium", onChange }) => {
const activeRef = useRef(null);
const [position, setPosition] = useState({
width: "0px",
left: "0px",
- borderRadius: "0px"
});
const createHandlerChange = (value: string) => () => {
@@ -27,7 +27,6 @@ const Toggle: FC = ({ options, value, label, onChange }) => {
setPosition({
width: "0px",
left: "0px",
- borderRadius: "0px"
});
return;
}
@@ -36,13 +35,9 @@ const Toggle: FC = ({ options, value, label, onChange }) => {
let width = widthRect;
let left = index * width;
- let borderRadius = "0";
- if (index === 0) borderRadius = "16px 0 0 16px";
if (index === options.length - 1) {
- borderRadius = "10px";
left -= 1;
- borderRadius = "0 16px 16px 0";
}
if (index !== 0 && (index !== options.length - 1)) {
@@ -51,11 +46,16 @@ const Toggle: FC = ({ options, value, label, onChange }) => {
}
- setPosition({ width: `${width}px`, left: `${left}px`, borderRadius });
+ setPosition({ width: `${width}px`, left: `${left}px` });
}, [activeRef, value, options]);
return (
-
+
{label && (