refactor: add timezone field comments from jiggler options

This commit is contained in:
Adam Shiervani 2025-08-19 12:41:18 +02:00
parent 2f069ed884
commit b3a7eabedf
1 changed files with 16 additions and 9 deletions

View File

@ -33,6 +33,8 @@ const jigglerOptions = [
inactivity_limit_seconds: 30, inactivity_limit_seconds: 30,
jitter_percentage: 25, jitter_percentage: 25,
schedule_cron_tab: "*/30 * * * * *", schedule_cron_tab: "*/30 * * * * *",
// We don't care about the timezone for this preset
// timezone: "UTC",
}, },
}, },
{ {
@ -42,6 +44,8 @@ const jigglerOptions = [
inactivity_limit_seconds: 60, inactivity_limit_seconds: 60,
jitter_percentage: 25, jitter_percentage: 25,
schedule_cron_tab: "0 * * * * *", schedule_cron_tab: "0 * * * * *",
// We don't care about the timezone for this preset
// timezone: "UTC",
}, },
}, },
{ {
@ -51,6 +55,8 @@ const jigglerOptions = [
inactivity_limit_seconds: 300, inactivity_limit_seconds: 300,
jitter_percentage: 25, jitter_percentage: 25,
schedule_cron_tab: "0 */5 * * * *", schedule_cron_tab: "0 */5 * * * *",
// We don't care about the timezone for this preset
// timezone: "UTC",
}, },
}, },
] as const; ] as const;
@ -69,8 +75,9 @@ export default function SettingsMouseRoute() {
const [selectedJigglerOption, setSelectedJigglerOption] = const [selectedJigglerOption, setSelectedJigglerOption] =
useState<JigglerValues | null>(null); useState<JigglerValues | null>(null);
const [currentJigglerConfig, setCurrentJigglerConfig] = const [currentJigglerConfig, setCurrentJigglerConfig] = useState<JigglerConfig | null>(
useState<JigglerConfig | null>(null); null,
);
const scrollThrottlingOptions = [ const scrollThrottlingOptions = [
{ value: "0", label: "Off" }, { value: "0", label: "Off" },
@ -127,9 +134,13 @@ export default function SettingsMouseRoute() {
const errorMsg = resp.error.data || "Unknown error"; const errorMsg = resp.error.data || "Unknown error";
// Check for cron syntax errors and provide user-friendly message // Check for cron syntax errors and provide user-friendly message
if (errorMsg.includes("invalid syntax") || errorMsg.includes("parse failure") || errorMsg.includes("invalid cron")) { if (
errorMsg.includes("invalid syntax") ||
errorMsg.includes("parse failure") ||
errorMsg.includes("invalid cron")
) {
return notifications.error( return notifications.error(
"Invalid cron expression. Please check your schedule format (e.g., '0 * * * * *' for every minute)." "Invalid cron expression. Please check your schedule format (e.g., '0 * * * * *' for every minute).",
); );
} }
@ -205,10 +216,7 @@ export default function SettingsMouseRoute() {
/> />
</SettingsItem> </SettingsItem>
<SettingsItem <SettingsItem title="Jiggler" description="Simulate movement of a computer mouse">
title="Jiggler"
description="Simulate movement of a computer mouse"
>
<SelectMenuBasic <SelectMenuBasic
size="SM" size="SM"
label="" label=""
@ -225,7 +233,6 @@ export default function SettingsMouseRoute() {
e.target.value as (typeof jigglerOptions)[number]["value"], e.target.value as (typeof jigglerOptions)[number]["value"],
); );
}} }}
/> />
</SettingsItem> </SettingsItem>