Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions apps/mobile/src/components/ui/AppBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ export function AppBar(props: AppBarProps) {
const rootBack =
!layout.usesSplitView && props.onBackToList && navigation?.canGoBack() === false
? props.onBackToList
: props.guardBack && props.onBack
? props.onBack
: null;
: null;
const compose =
layout.usesSplitView && !(usesNativeWorkspaceColumns && isDuoDevice(deviceType))
? props.onCompose
Expand Down Expand Up @@ -100,9 +98,7 @@ export function AppBar(props: AppBarProps) {
headerBackVisible:
props.onClose === undefined &&
splitBack === null &&
!(layout.usesSplitView && props.onBackToList) &&
!(props.guardBack && props.onBack),
...(props.guardBack ? { gestureEnabled: false } : undefined),
!(layout.usesSplitView && props.onBackToList),
title: props.title,
unstable_headerSubtitle: props.subtitle || undefined,
...(props.matchSearchSurface
Expand Down
2 changes: 0 additions & 2 deletions apps/mobile/src/components/ui/AppBar.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ export interface AppBarProps {
readonly menus?: ReadonlyArray<AppBarMenu>;
readonly search?: AppBarSearch;
readonly onBack?: () => void;
/** Back runs `onBack` and swipe-back is off, so a `usePreventRemove` guard sees it first. */
readonly guardBack?: boolean;
/**
* Back for a page whose parent is the workspace list. Hidden in split view, where the list is
* beside the page; shown even when the page opened with nothing beneath it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -728,11 +728,7 @@ function SettingsScheduledTaskEditorScreen({ title }: { readonly title: string }
]);
});
return (
<SettingsScreen
title={title}
// Native Back pops before removal guards; a bar action lets the guard run first.
guardBack={preventRemove}
>
<SettingsScreen title={title}>
<ScrollView
keyboardShouldPersistTaps="handled"
keyboardDismissMode="on-drag"
Expand Down Expand Up @@ -1232,7 +1228,7 @@ function TaskForm({

<SettingsSection title="Schedule">
<SelectRow
label="Runs"
label="Type"
value={SCHEDULE_MODE_LABELS[draft.schedule.mode]}
actions={[
"fixed_time" as const,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ import {
export { SettingsScreenContent };

export function SettingsScreen(
props: Pick<
AppBarProps,
"title" | "actions" | "refresh" | "trailing" | "search" | "menus" | "guardBack"
> & {
props: Pick<AppBarProps, "title" | "actions" | "refresh" | "trailing" | "search" | "menus"> & {
readonly children: ReactNode;
readonly workspaceRoot?: boolean;
},
Expand All @@ -46,7 +43,6 @@ export function SettingsScreen(
trailing={props.trailing}
menus={props.menus}
onBack={workspaceRoot ? undefined : back}
guardBack={props.guardBack}
hideBottomBorder
/>
<ScreenScrollViewBottomInset value={deviceType === "pad" || compactTabs ? 80 : 0}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ export function formatNextScheduledTaskRun(nextRunAt: string, now: number): stri

const time = next.toLocaleTimeString([], { hour: "numeric", minute: "2-digit" });
if (days === 1) return `Next run tomorrow at ${time}`;
if (days <= 7) {
return `Next run next ${next.toLocaleDateString([], { weekday: "long" })} at ${time}`;
// A week out repeats today's weekday, so it falls through to the date instead.
if (days < 7) {
return `Next run ${next.toLocaleDateString([], { weekday: "long" })} at ${time}`;
}
const date = next.toLocaleDateString([], {
month: "short",
Expand Down
3 changes: 2 additions & 1 deletion packages/client-runtime/src/scheduledTaskTimeZone.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ it("uses short names instead of full IANA zones", () => {
expect(scheduleTimeZoneLabel(undefined)).toBeUndefined();
expect(scheduleTimeZoneLabel("Unsupported/Zone")).toBeUndefined();
expect(scheduleTimeZoneLabel("Etc/UTC")).toBe("UTC");
expect(scheduleTimeZoneLabel("America/Los_Angeles")).toMatch(/^(PT|Los Angeles Time)$/);
expect(scheduleTimeZoneLabel("America/Los_Angeles")).toMatch(/^P[DS]T$/);
expect(scheduleTimeZoneLabel("Asia/Bangkok")).toBe("GMT+7");
expect(scheduleTimeZoneLabel("America/Los_Angeles", "2027-01-15T17:00:00Z")).toBe("PST");
expect(scheduleTimeZoneLabel("America/Los_Angeles", "2027-07-15T16:00:00Z")).toBe("PDT");
});
Expand Down
6 changes: 3 additions & 3 deletions packages/client-runtime/src/scheduledTaskTimeZone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ function offsetLabel(minutes: number): string {
}

/**
* Short label for the server zone a fixed-time schedule runs in. With a run time it names
* that instant's offset (PST/PDT); without one it uses the generic name (PT).
* Short label for the server zone a fixed-time schedule runs in (PST/PDT, GMT+7), at the run
* time when there is one and now otherwise, so the editor and the list name it the same way.
*/
export function scheduleTimeZoneLabel(
timeZone: string | undefined,
Expand All @@ -49,7 +49,7 @@ export function scheduleTimeZoneLabel(
: DateTime.toEpochMillis(DateTime.nowUnsafe());
const name = new Intl.DateTimeFormat("en-US", {
timeZone,
timeZoneName: runAt ? "short" : "shortGeneric",
timeZoneName: "short",
})
.formatToParts(at)
.find((part) => part.type === "timeZoneName")?.value;
Expand Down
Loading