Skip to content

Commit b81e7ca

Browse files
NicL9923claude
andcommitted
fix(mobile): pick the schedule type from a menu row
Five equal segments left about 64 pt each on an iPhone SE, so "Interval" and "On webhook" broke mid-word. Even the Pro broke "webhook". The type is now a menu row like "Runs go to" and "Repeat" on the same screen, which also leaves room for more types. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 373d7d4 commit b81e7ca

1 file changed

Lines changed: 46 additions & 40 deletions

File tree

‎apps/mobile/src/features/settings/SettingsScheduledTasksRouteScreen.tsx‎

Lines changed: 46 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ import {
5555
import { Menu } from "../../components/ui/Menu";
5656
import type { ComposerEditorSelection } from "../../components/ComposerEditor";
5757
import { ScreenScrollView as ScrollView } from "../../components/ui/ScreenScrollView";
58-
import { SegmentedControl } from "../../components/ui/SegmentedControl";
5958
import { ThemedSwitch } from "../../components/ui/ThemedSwitch";
6059
import { webhookAddress } from "@t3tools/client-runtime/webhook-address";
6160
import { tryCopyTextWithHaptic } from "../../lib/copyTextWithHaptic";
@@ -713,6 +712,20 @@ function TaskForm({
713712
config?.environment.capabilities.cronSchedules === true || draft.task?.schedule.type === "cron";
714713
const cronError =
715714
draft.schedule.mode === "cron" ? scheduledTaskCronError(draft.schedule.cronExpression) : null;
715+
const scheduleModes = [
716+
{ value: "fixed_time" as const, label: "At a time" },
717+
// Older servers reject one-time schedules on save.
718+
...(offersOnce || draft.schedule.mode === "once"
719+
? [{ value: "once" as const, label: "Once" }]
720+
: []),
721+
{ value: "interval" as const, label: "Interval" },
722+
...(offersCron || draft.schedule.mode === "cron"
723+
? [{ value: "cron" as const, label: "Cron" }]
724+
: []),
725+
...(webhookDenial === undefined || draft.schedule.mode === "webhook"
726+
? [{ value: "webhook" as const, label: "On webhook" }]
727+
: []),
728+
];
716729
const offersThreadModes = config?.environment.capabilities.scheduledTaskThreadModes === true;
717730
const save = async () => {
718731
if (
@@ -1045,45 +1058,38 @@ function TaskForm({
10451058
</SettingsSection>
10461059

10471060
<SettingsSection title="Schedule">
1048-
<View className="px-4 py-3">
1049-
<SegmentedControl
1050-
variant="card"
1051-
options={[
1052-
{ value: "fixed_time", label: "At a time" },
1053-
// Older servers reject one-time schedules on save.
1054-
...(offersOnce || draft.schedule.mode === "once"
1055-
? [{ value: "once" as const, label: "Once" }]
1056-
: []),
1057-
{ value: "interval", label: "Interval" },
1058-
...(offersCron || draft.schedule.mode === "cron"
1059-
? [{ value: "cron" as const, label: "Cron" }]
1060-
: []),
1061-
...(webhookDenial === undefined || draft.schedule.mode === "webhook"
1062-
? [{ value: "webhook" as const, label: "On webhook" }]
1063-
: []),
1064-
]}
1065-
selected={draft.schedule.mode}
1066-
onSelect={(mode) => {
1067-
setTimePickerOpen(false);
1068-
setRunAtPicker(null);
1069-
setDraft({
1070-
...draft,
1071-
prompt:
1072-
mode === "webhook" && !draft.prompt.trim()
1073-
? DEFAULT_WEBHOOK_PROMPT
1074-
: draft.prompt,
1075-
schedule: {
1076-
...draft.schedule,
1077-
mode,
1078-
runAt:
1079-
mode === "once" && !draft.schedule.runAt
1080-
? new Date(Math.ceil(Date.now() / 3_600_000) * 3_600_000).toISOString()
1081-
: draft.schedule.runAt,
1082-
},
1083-
});
1084-
}}
1085-
/>
1086-
</View>
1061+
<SelectRow
1062+
label="Type"
1063+
value={
1064+
scheduleModes.find((option) => option.value === draft.schedule.mode)?.label ?? ""
1065+
}
1066+
actions={scheduleModes.map((option) => ({
1067+
id: option.value,
1068+
title: option.label,
1069+
state: option.value === draft.schedule.mode ? "on" : undefined,
1070+
}))}
1071+
onSelect={(id) => {
1072+
const mode = scheduleModes.find((option) => option.value === id)?.value;
1073+
if (mode === undefined) return;
1074+
setTimePickerOpen(false);
1075+
setRunAtPicker(null);
1076+
setDraft({
1077+
...draft,
1078+
prompt:
1079+
mode === "webhook" && !draft.prompt.trim()
1080+
? DEFAULT_WEBHOOK_PROMPT
1081+
: draft.prompt,
1082+
schedule: {
1083+
...draft.schedule,
1084+
mode,
1085+
runAt:
1086+
mode === "once" && !draft.schedule.runAt
1087+
? new Date(Math.ceil(Date.now() / 3_600_000) * 3_600_000).toISOString()
1088+
: draft.schedule.runAt,
1089+
},
1090+
});
1091+
}}
1092+
/>
10871093
{draft.schedule.mode === "fixed_time" ? (
10881094
<>
10891095
<Pressable

0 commit comments

Comments
 (0)