diff --git a/src/alerts/acknowledgement.tsx b/src/alerts/acknowledgement.tsx
index 35482f1..104a37c 100644
--- a/src/alerts/acknowledgement.tsx
+++ b/src/alerts/acknowledgement.tsx
@@ -132,7 +132,8 @@ const styles = StyleSheet.create({
alignItems: 'center',
justifyContent: 'space-between',
gap: space.m,
- minHeight: 44,
+ // The Acknowledge button's height, so taking it on or undoing it doesn't move what's under it.
+ minHeight: 50,
paddingHorizontal: space.xxs,
},
text: {
diff --git a/src/alerts/activity-card.tsx b/src/alerts/activity-card.tsx
index 8f08052..ac61c86 100644
--- a/src/alerts/activity-card.tsx
+++ b/src/alerts/activity-card.tsx
@@ -93,18 +93,17 @@ export function ActivityCard({ organizationId, monitors, onSetUp }: Props) {
))}
Today
- {firedLevels.length > 0 && (
-
- {firedLevels.map((level) => (
-
-
-
- {severityLabels[level]} {levels[level]}
-
-
- ))}
-
- )}
+ {/* Always there, a line tall while the days load, so the card doesn't grow under what follows it. */}
+
+ {firedLevels.map((level) => (
+
+
+
+ {severityLabels[level]} {levels[level]}
+
+
+ ))}
+
);
}
@@ -132,8 +131,11 @@ const styles = StyleSheet.create({
},
date: {
fontSize: 12,
+ lineHeight: 16,
+ fontVariant: ['tabular-nums'],
},
legend: {
+ minHeight: 16,
flexDirection: 'row',
flexWrap: 'wrap',
columnGap: space.l,
diff --git a/src/alerts/history.tsx b/src/alerts/history.tsx
index 24a37b2..30ad90c 100644
--- a/src/alerts/history.tsx
+++ b/src/alerts/history.tsx
@@ -37,10 +37,13 @@ export function AlertHistory({
staleTime: 5 * 60_000,
});
- if (!alert.metric || history.isError || projects.isError || (projects.data !== undefined && project === undefined)) {
+ if (!alert.metric) {
return null;
}
- const points = history.data ?? [];
+ // The card stays, at the chart's height, when the readings can't load: it said it was loading them, and taking it
+ // away would pull everything under it up.
+ const failed = history.isError || projects.isError || (projects.data !== undefined && project === undefined);
+ const points = failed ? [] : (history.data ?? []);
return (
@@ -54,7 +57,8 @@ export function AlertHistory({
points={points}
format={(value) => formatValue(alert, value)}
onSelect={setSelected}
- loading={history.data === undefined}
+ loading={!failed && history.data === undefined}
+ empty={failed ? 'Couldn’t load the readings around this alert.' : undefined}
/>
);
diff --git a/src/alerts/threshold-chart.tsx b/src/alerts/threshold-chart.tsx
index 8a4bbc1..27be70d 100644
--- a/src/alerts/threshold-chart.tsx
+++ b/src/alerts/threshold-chart.tsx
@@ -23,7 +23,7 @@ import { usePalette } from '@/theme/use-palette';
const axisFont = require('@/assets/fonts/Inter-Regular.ttf');
const labelFont = require('@/assets/fonts/Inter-Medium.ttf');
-const height = 170;
+export const height = 170;
/** Room above the top gridline for its value, and below the plot for the dates. */
const top = 10;
const bottom = 24;
diff --git a/src/app/(app)/(tabs)/(home)/index.tsx b/src/app/(app)/(tabs)/(home)/index.tsx
index 604bfec..213b4be 100644
--- a/src/app/(app)/(tabs)/(home)/index.tsx
+++ b/src/app/(app)/(tabs)/(home)/index.tsx
@@ -23,6 +23,7 @@ import { OrganizationPicker, ScreenToolbar } from '@/organizations/header';
import { projectsQuery } from '@/projects/api';
import { ProjectCard, ProjectLine, ProjectRow } from '@/projects/project-row';
import { SnoozeCard } from '@/settings/snooze-card';
+import { prefsQuery } from '@/settings/use-prefs';
import { SetupCard } from '@/setup/setup-card';
import { statusLabel, statusQuery } from '@/status/api';
import { fonts, space } from '@/theme/tokens';
@@ -48,6 +49,7 @@ export default function Home() {
const status = useQuery(statusQuery);
const projects = useQuery(projectsQuery(organizationId));
const updates = useQuery(updatesQuery);
+ const prefs = useQuery(prefsQuery);
const { isUnread } = useUnread();
const session = useSession();
@@ -82,6 +84,9 @@ export default function Home() {
const failed = 'Couldn’t load alerts. Pull to retry.';
const note = alerts.isError ? failed : 'Loading alerts…';
const incident = status.data?.incidents[0];
+ // The snooze card shows from the alerts and prefs, above everything else, so what's under it waits for both rather
+ // than drawing and then being pushed down when the card turns up.
+ const decided = (alerts.data !== undefined || alerts.isError) && (prefs.data !== undefined || prefs.isError);
const firingIn = (projectId: string) => firing.filter((alert) => projectOf(alert) === projectId).length;
// Firing projects first, then the Projects tab's own order, so Home and the tab agree.
@@ -171,12 +176,11 @@ export default function Home() {
: `${firing.length} firing`}
- {/* Under the count rather than beside it, so it has the card's width; past that it wraps rather than hiding a level. */}
- {(pending || detail !== '') && (
-
- {pending ? note : detail}
-
- )}
+ {/* Under the count rather than beside it, so it has the card's width; past that it wraps rather than hiding a level.
+ Kept a line tall when there's nothing to add, as "Loading alerts…" was, so the card keeps its height. */}
+
+ {pending ? note : detail === '' ? ' ' : detail}
+
-
-
+ {decided && }
+ {decided && }
- {layout.wide ? (
+ {!decided ? null : layout.wide ? (
// Two columns that each flow on their own, so a long list on one side leaves no gap on the other.
diff --git a/src/app/(app)/(tabs)/alerts/[id].tsx b/src/app/(app)/(tabs)/alerts/[id].tsx
index 1ce0193..320e1b3 100644
--- a/src/app/(app)/(tabs)/alerts/[id].tsx
+++ b/src/app/(app)/(tabs)/alerts/[id].tsx
@@ -29,7 +29,7 @@ import { consoleUrl, isTrusted } from '@/appwrite/urls';
import { Button } from '@/components/button';
import { AlertEscalationSection } from '@/escalations/alert-escalation';
import { escalationOf, formatEffect } from '@/escalations/model';
-import { escalationsQuery } from '@/escalations/queries';
+import { escalationsQuery, membersQuery } from '@/escalations/queries';
import { Row, Section } from '@/components/section';
import { StatusPill } from '@/components/status-pill';
import { fonts, radius, space } from '@/theme/tokens';
@@ -86,6 +86,11 @@ export default function AlertDetail() {
...escalationsQuery(organizationId || null),
enabled: organizationId !== '' && !!read.data?.escalationId,
});
+ // Its steps name the people they notified.
+ const members = useQuery({
+ ...membersQuery(organizationId || null),
+ enabled: organizationId !== '' && !!read.data?.escalationId,
+ });
if (alert === null) {
return (
@@ -113,6 +118,12 @@ export default function AlertDetail() {
escalation === null
? null
: formatEffect(escalation, escalations.data?.find((entry) => entry.$id === escalation.escalationId)?.steps);
+ // The monitor decides the probe's check and the note under the threshold, and the escalation and its members the
+ // steps and what acknowledging does, so the screen under the title waits for them rather than growing as each lands.
+ const settled =
+ (monitors.data !== undefined || monitors.isError) &&
+ (!alert.escalationId ||
+ ((escalations.data !== undefined || escalations.isError) && (members.data !== undefined || members.isError)));
// The list shows the same alert, so it changes with this screen. A read already on its way would undo the change
// when it lands, so it's dropped; the acknowledgement asks for a fresh one once the server has answered.
@@ -176,137 +187,148 @@ export default function AlertDetail() {
{location}
- {probe ? (
- // A probe compares no metric with a threshold: the reading is what its check found, and the latency.
-
- {firing ? 'Failing' : 'Failed'}
-
- {resultLabel(alert.result)}
-
-
- {[
- ...(firing ? [code, formatLatency(alert.value)] : ['Passing again']),
- // When the probe last ran, which the monitor keeps: the alert itself only knows when it opened.
- monitor?.evaluatedAt ? `checked ${formatAgo(monitor.evaluatedAt)}` : '',
- ]
- .filter(Boolean)
- .join(' · ')}
-
-
- ) : (
-
-
- {firing ? 'Now' : 'Latest'} · {metricLabel(alert)}
-
-
- {formatValue(alert, alert.value)}
-
-
- peak {formatValue(alert, alert.peak)}
-
-
+ {settled && (
+ <>
+ {probe ? (
+ // A probe compares no metric with a threshold: the reading is what its check found, and the latency.
-
-
-
-
- )}
+ style={[styles.reading, { backgroundColor: palette.surface.card, borderColor: palette.surface.edge }]}>
+
+ {firing ? 'Failing' : 'Failed'}
+
+
+ {resultLabel(alert.result)}
+
+
+ {[
+ ...(firing ? [code, formatLatency(alert.value)] : ['Passing again']),
+ // When the probe last ran, which the monitor keeps: the alert itself only knows when it opened.
+ monitor?.evaluatedAt ? `checked ${formatAgo(monitor.evaluatedAt)}` : '',
+ ]
+ .filter(Boolean)
+ .join(' · ')}
+
+
+ ) : (
+
+
+ {firing ? 'Now' : 'Latest'} · {metricLabel(alert)}
+
+
+ {formatValue(alert, alert.value)}
+
+
+ peak {formatValue(alert, alert.peak)}
+
+
+
+
+
+
+
+ )}
- {probe && monitor !== undefined && }
+ {probe && monitor !== undefined && }
- {/* What fired comes first; then taking it on, and who else hears about it. */}
-
+ {/* What fired comes first; then taking it on, and who else hears about it. */}
+
-
+
- {project !== '' && !probe && }
+ {project !== '' && !probe && }
-
-
- {!budget && project !== '' &&
}
-
- {!firing && alert.acknowledgedAt && (
-
- )}
- {firing &&
}
- {alert.resolvedAt != null &&
}
- {alert.resolvedAt != null && (
-
- )}
-
-
+
+
+ {!budget && project !== '' &&
}
+
+ {!firing && alert.acknowledgedAt && (
+
+ )}
+ {firing &&
}
+ {alert.resolvedAt != null &&
}
+ {alert.resolvedAt != null && (
+
+ )}
+
+
-
- {project !== '' && (
-
-
- {probe ? (
-
- ) : usage && (history.data?.length ?? 0) > 1 ? (
-
- formatShort(conditionOf(monitor), reading)}
- />
-
- ) : null}
- {!probe && (
- alert.status === 'firing')}
- status="success"
- organizationId={organizationId}
- path="/monitors/:id"
- />
- )}
-
-
- {!budget && (
-
- (pausing ? undefined : togglePause(monitor))}
- accessory={pausing ? : null}
- />
- {escalates && (
-
- router.push({
- pathname: '/escalations/assign',
- params: { organizationId, monitorId: monitor.$id, projectId: monitor.projectId },
- })
- }
- />
- )}
-
- )}
+ {settled && (
+ <>
+
+ {probe ? (
+
+ ) : usage ? (
+ // The chart's height from the start, as its readings load after the monitor and its project.
+
+ {(history.data?.length ?? 0) > 1 ? (
+ formatShort(conditionOf(monitor), reading)}
+ />
+ ) : (
+ history.fetchStatus === 'idle' && (
+
+ {history.isError ? 'Couldn’t load the readings.' : 'Not enough readings to chart yet.'}
+
+ )
+ )}
+
+ ) : null}
+ {!probe && (
+ alert.status === 'firing')}
+ status="success"
+ organizationId={organizationId}
+ path="/monitors/:id"
+ />
+ )}
+
-
- {alerts.length === 0 ? (
-
- ) : (
- alerts
- .slice(0, listed)
- .map((alert) => (
+ {!budget && (
+
router.push({ pathname: '/alerts/[id]', params: { id: alert.$id, organizationId } })}
+ title={monitor.enabled ? 'Pause monitor' : 'Resume monitor'}
+ icon={
+ monitor.enabled
+ ? { ios: 'pause.fill', android: 'pause' }
+ : { ios: 'play.fill', android: 'play_arrow' }
+ }
+ onPress={() => (pausing ? undefined : togglePause(monitor))}
+ accessory={pausing ? : null}
/>
- ))
- )}
-
+ {escalates && (
+
+ router.push({
+ pathname: '/escalations/assign',
+ params: { organizationId, monitorId: monitor.$id, projectId: monitor.projectId },
+ })
+ }
+ />
+ )}
+
+ )}
- {probe && }
- {!budget && (
-
- {usage &&
- (isGauge(conditionOf(monitor).metric) || monitor.window <= 0 ? (
-
+
+ {alerts.length === 0 ? (
+
) : (
-
- ))}
- {escalation === null ? (
-
- ) : (
-
+ alerts
+ .slice(0, listed)
+ .map((alert) => (
+ router.push({ pathname: '/alerts/[id]', params: { id: alert.$id, organizationId } })}
+ />
+ ))
+ )}
+
+
+ {probe && }
+ {!budget && (
+
+ {usage &&
+ (isGauge(conditionOf(monitor).metric) || monitor.window <= 0 ? (
+
+ ) : (
+
+ ))}
+ {escalation === null ? (
+
+ ) : (
+
+ )}
+
+
)}
-
-
- )}
-
- {budget && (
-
- Budget alerts come from your billing settings.
-
- )}
- openConsole(monitorConsoleUrl(monitor, organizationId))}
- style={({ pressed }) => pressed && styles.pressed}>
-
- {budget ? 'Change them in billing' : 'Edit in console'}
-
-
-
+
+ {budget && (
+
+ Budget alerts come from your billing settings.
+
+ )}
+ openConsole(monitorConsoleUrl(monitor, organizationId))}
+ style={({ pressed }) => pressed && styles.pressed}>
+
+ {budget ? 'Change them in billing' : 'Edit in console'}
+
+
+
+ >
+ )}
);
}
@@ -371,6 +392,11 @@ const styles = StyleSheet.create({
},
chart: {
marginTop: space.l,
+ justifyContent: 'center',
+ },
+ empty: {
+ fontSize: 13,
+ textAlign: 'center',
},
footer: {
alignItems: 'center',
diff --git a/src/app/(app)/(tabs)/projects/[id].tsx b/src/app/(app)/(tabs)/projects/[id].tsx
index e2d59b5..73ff55d 100644
--- a/src/app/(app)/(tabs)/projects/[id].tsx
+++ b/src/app/(app)/(tabs)/projects/[id].tsx
@@ -141,7 +141,13 @@ export default function ProjectDetail() {
]}>
-
+ {/* A tile keeps its width as its figure loads, shrinking a long one to fit, so the tiles after it
+ don't slide along the rail on opening or on each change of range. */}
+
{reading !== undefined ? formatUnit(entry.unit, reading.value) : usage.isError ? '—' : ' '}
{reading?.change != null && (
@@ -236,36 +242,41 @@ export default function ProjectDetail() {
)}
- {projectAlerts.length > 0 && (
-
- Alerts
-
- {projectAlerts.map((alert) => (
-
- // With the anchor, the Alerts tab keeps its list under the alert: Back and the tab lead to it.
- router.navigate(
- { pathname: '/alerts/[id]', params: { id: alert.$id, organizationId: organizationId ?? '' } },
- { withAnchor: true },
- )
- }
- />
- ))}
-
-
- )}
+ {/* Under the alerts, which turn up on their own, so what follows waits for them rather than being pushed. */}
+ {alerts.data === undefined && alerts.fetchStatus !== 'idle' ? null : (
+ <>
+ {projectAlerts.length > 0 && (
+
+ Alerts
+
+ {projectAlerts.map((alert) => (
+
+ // With the anchor, the Alerts tab keeps its list under the alert: Back and the tab lead to it.
+ router.navigate(
+ { pathname: '/alerts/[id]', params: { id: alert.$id, organizationId: organizationId ?? '' } },
+ { withAnchor: true },
+ )
+ }
+ />
+ ))}
+
+
+ )}
-
- {project === null ? ' ' : `${regionName(project.region)} · ${project.id}`}
-
- openConsole(`${consoleUrl}/project-${project?.region ?? ''}-${id}`)}
- />
+
+ {project === null ? ' ' : `${regionName(project.region)} · ${project.id}`}
+
+ openConsole(`${consoleUrl}/project-${project?.region ?? ''}-${id}`)}
+ />
+ >
+ )}
);
}
@@ -289,12 +300,13 @@ const styles = StyleSheet.create({
},
metricWide: {
flex: 1,
+ width: 'auto',
},
metric: {
paddingHorizontal: space.l,
paddingVertical: space.m,
gap: 2,
- minWidth: 152,
+ width: 168,
borderRadius: radius.l,
borderCurve: 'continuous',
borderWidth: 1.5,
@@ -311,10 +323,13 @@ const styles = StyleSheet.create({
fontWeight: '500',
fontSize: 22,
letterSpacing: -0.3,
+ fontVariant: ['tabular-nums'],
},
metricChange: {
+ flexShrink: 0,
fontSize: 14,
fontWeight: '500',
+ fontVariant: ['tabular-nums'],
},
chart: {
padding: space.xl,
diff --git a/src/app/(app)/(tabs)/projects/index.tsx b/src/app/(app)/(tabs)/projects/index.tsx
index c7224fb..01a58d9 100644
--- a/src/app/(app)/(tabs)/projects/index.tsx
+++ b/src/app/(app)/(tabs)/projects/index.tsx
@@ -45,7 +45,11 @@ export default function Projects() {
const firing = (id: string) =>
(alerts.data ?? []).filter((alert) => isUnhandled(alert) && projectOf(alert) === id).length;
- const kept = (selection: ProjectFilter) => filterProjects(projects.data ?? [], selection, search, firing);
+ // Firing projects are pinned above the rest, so the list waits for the alerts that say which ones they are rather
+ // than drawing and then reshuffling under a Firing group that turns up on top of it.
+ const settled = alerts.data !== undefined || alerts.isError;
+ const listed = settled ? (projects.data ?? []) : [];
+ const kept = (selection: ProjectFilter) => filterProjects(listed, selection, search, firing);
const shown = kept(filter);
const active = activeFilters(filter, allProjects);
const groups = useMemo(
@@ -78,7 +82,7 @@ export default function Projects() {
const message =
failure?.message ??
((search.trim() !== '' || active > 0) && projects.data !== undefined ? 'No projects match.' : null) ??
- (projects.data === undefined && (!loaded || organizationId !== null)
+ ((projects.data === undefined || !settled) && (!loaded || organizationId !== null)
? 'Loading projects…'
: 'No projects in this organization yet.');
diff --git a/src/app/(app)/escalations/[id].tsx b/src/app/(app)/escalations/[id].tsx
index 01a86e1..2dc9271 100644
--- a/src/app/(app)/escalations/[id].tsx
+++ b/src/app/(app)/escalations/[id].tsx
@@ -66,13 +66,19 @@ export default function EscalationEditor() {
const [saving, setSaving] = useState(false);
const [deleting, setDeleting] = useState(false);
- if (!creating && escalation === undefined) {
+ // Whether the role can edit, the monitors that use it and the members' names each change the layout, so the editor
+ // waits for all of them rather than growing controls, sections and lines as each lands.
+ const pending =
+ canManage === null ||
+ (monitors.data === undefined && !monitors.isError) ||
+ (members.data === undefined && !members.isError);
+ if ((!creating && escalation === undefined) || pending) {
return (
{escalations.isError
? escalations.error.message
- : escalations.isLoading
+ : escalations.isLoading || pending
? 'Loading escalation…'
: 'This escalation no longer exists.'}
diff --git a/src/app/(app)/escalations/assign.tsx b/src/app/(app)/escalations/assign.tsx
index 3c797b1..3ea8d7d 100644
--- a/src/app/(app)/escalations/assign.tsx
+++ b/src/app/(app)/escalations/assign.tsx
@@ -87,14 +87,18 @@ export default function AssignEscalation() {
}
}
- const mark = (escalationId: string) =>
- saving === escalationId ? (
-
- ) : escalationId === selected ? (
-
- ) : (
-
- );
+ // One width for the spinner, the check and neither, so picking doesn't narrow the row's text and rewrap it.
+ const mark = (escalationId: string) => (
+
+ {saving === escalationId ? (
+
+ ) : (
+ escalationId === selected && (
+
+ )
+ )}
+
+ );
const listed = escalations.data ?? [];
// An escalation the list doesn't have, such as one this role can't read, still shows as the current pick.
@@ -162,4 +166,8 @@ const styles = StyleSheet.create({
padding: space.l,
gap: space.xxl,
},
+ mark: {
+ width: 22,
+ alignItems: 'center',
+ },
});
diff --git a/src/app/(app)/escalations/index.tsx b/src/app/(app)/escalations/index.tsx
index 5f7eae6..86056ff 100644
--- a/src/app/(app)/escalations/index.tsx
+++ b/src/app/(app)/escalations/index.tsx
@@ -7,7 +7,7 @@ import { monitorsQuery } from '@/alerts/queries';
import { isForbidden, isUnavailable } from '@/appwrite/client';
import { Row, Section } from '@/components/section';
import { formatSummary } from '@/escalations/model';
-import { escalationsQuery } from '@/escalations/queries';
+import { escalationsQuery, membersQuery } from '@/escalations/queries';
import { useCanManageEscalations, useMemberName } from '@/escalations/use-escalations';
import { useOrganization } from '@/organizations/context';
import { space } from '@/theme/tokens';
@@ -31,6 +31,7 @@ export default function Escalations() {
const monitors = useQuery(monitorsQuery(organizationId));
const canManage = useCanManageEscalations(organizationId);
const memberName = useMemberName(organizationId);
+ const members = useQuery(membersQuery(organizationId));
const usedBy = (escalationId: string) =>
(monitors.data ?? []).filter((monitor) => monitor.escalationId === escalationId).length;
@@ -61,9 +62,14 @@ export default function Escalations() {
/>
);
- } else if (escalations.data === undefined) {
+ } else if (
+ escalations.data === undefined ||
+ // The counts of monitors and the members' names fill in the rows, so they're waited for rather than rewrapping them.
+ (monitors.data === undefined && !monitors.isError) ||
+ (members.data === undefined && !members.isError)
+ ) {
body = (
-
+
);
diff --git a/src/app/(app)/organizations.tsx b/src/app/(app)/organizations.tsx
index 6fa1ede..a486df6 100644
--- a/src/app/(app)/organizations.tsx
+++ b/src/app/(app)/organizations.tsx
@@ -32,7 +32,7 @@ export default function Organizations() {
tintColor={palette.foreground.accent}
/>
) : (
-
+
)
}
onPress={() => {
@@ -61,4 +61,8 @@ const styles = StyleSheet.create({
padding: space.l,
gap: space.xxl,
},
+ mark: {
+ width: 22,
+ alignItems: 'center',
+ },
});
diff --git a/src/app/(app)/settings/index.tsx b/src/app/(app)/settings/index.tsx
index bf04e1d..77e3d55 100644
--- a/src/app/(app)/settings/index.tsx
+++ b/src/app/(app)/settings/index.tsx
@@ -16,12 +16,13 @@ import { Row, Section } from '@/components/section';
import { Toggle } from '@/components/toggle';
import { labels as criticalLabels } from '@/critical/labels';
import { type Critical, getCritical } from '@/critical/permission';
+import { projectsQuery } from '@/projects/api';
import { useProjectNames } from '@/projects/use-names';
import { getAccess, getPermission, type Permission, registerDevice } from '@/push/device';
import { snoozeOf } from '@/settings/prefs';
import { open as openSetup } from '@/setup/flow';
import { formatUntil } from '@/settings/snooze';
-import { toggle, usePrefs } from '@/settings/use-prefs';
+import { prefsQuery, toggle, usePrefs } from '@/settings/use-prefs';
import { useSnooze } from '@/settings/use-snooze';
import { deviceName, settingsName } from '@/theme/platform';
import { space } from '@/theme/tokens';
@@ -69,8 +70,17 @@ export default function Settings() {
return () => subscription.remove();
}, []);
- // The tabs keep this loaded, so the section is there on opening and doesn't push Account down.
const alerts = useQuery(alertsQuery(organization?.$id ?? null));
+ const loaded = useQuery(prefsQuery);
+ const catalog = useQuery(projectsQuery(organization?.$id ?? null));
+ // The prefs fill in the toggles and snooze lines, the alerts decide the Projects section and the projects the names
+ // in it, and the permission the footer above them, so everything under the first section waits for all four rather
+ // than growing as each lands. An idle query has answered, failed for good or has nothing to ask.
+ const settled =
+ permission !== null &&
+ (loaded.data !== undefined || loaded.fetchStatus === 'idle') &&
+ (alerts.data !== undefined || alerts.fetchStatus === 'idle') &&
+ (catalog.data !== undefined || catalog.fetchStatus === 'idle');
const names = useProjectNames(organization?.$id ?? null);
const projects = useMemo(() => projectsOf(alerts.data ?? [], names), [alerts.data, names]);
@@ -166,120 +176,124 @@ export default function Settings() {
/>
-
- router.push('/snooze')}
- />
- saveUpdates.mutate(enabled)}
+ {settled && (
+ <>
+
+ router.push('/snooze')}
/>
- }
- />
- void update((current) => ({ ...current, resolved }))}
+ saveUpdates.mutate(enabled)}
+ />
+ }
/>
- }
- />
-
-
-
- {organizations.map((entry) => (
-
- void update((current) => ({
- ...current,
- mutedOrganizationIds: toggle(current.mutedOrganizationIds, entry.$id, !on),
- }))
- }
- />
- }
- />
- ))}
-
-
- {listed.length > 0 && (
-
- {listed.map((project) => (
- void update((current) => ({
- ...current,
- mutedProjectIds: toggle(current.mutedProjectIds, project.id, !on),
- }))
- }
+ value={prefs?.resolved ?? true}
+ onValueChange={(resolved) => void update((current) => ({ ...current, resolved }))}
/>
}
/>
- ))}
-
- )}
+
-
+
+ {organizations.map((entry) => (
+
+ void update((current) => ({
+ ...current,
+ mutedOrganizationIds: toggle(current.mutedOrganizationIds, entry.$id, !on),
+ }))
+ }
+ />
+ }
+ />
+ ))}
+
-
- {
- setSharing(on);
- setShared(on);
- }}
+ {listed.length > 0 && (
+
+ {listed.map((project) => (
+
+ void update((current) => ({
+ ...current,
+ mutedProjectIds: toggle(current.mutedProjectIds, project.id, !on),
+ }))
+ }
+ />
+ }
+ />
+ ))}
+
+ )}
+
+
+
+
+ {
+ setSharing(on);
+ setShared(on);
+ }}
+ />
+ }
/>
- }
- />
- void WebBrowser.openBrowserAsync(privacyPolicy)} />
-
+ void WebBrowser.openBrowserAsync(privacyPolicy)} />
+
-
-
- router.push('/settings/font-licenses')} />
-
+
+
+ router.push('/settings/font-licenses')} />
+
+ >
+ )}
);
}
diff --git a/src/app/(app)/snooze.tsx b/src/app/(app)/snooze.tsx
index 2a81c5f..2ab6ad1 100644
--- a/src/app/(app)/snooze.tsx
+++ b/src/app/(app)/snooze.tsx
@@ -1,3 +1,4 @@
+import { useQuery } from '@tanstack/react-query';
import { router } from 'expo-router';
import { SymbolView } from 'expo-symbols';
import { useState } from 'react';
@@ -7,6 +8,7 @@ import { Row, Section } from '@/components/section';
import { useOrganization } from '@/organizations/context';
import { durations, formatUntil } from '@/settings/snooze';
import { useSnooze } from '@/settings/use-snooze';
+import { prefsQuery } from '@/settings/use-prefs';
import { deviceName } from '@/theme/platform';
import { space } from '@/theme/tokens';
import { useLayout } from '@/theme/use-layout';
@@ -21,6 +23,10 @@ export default function SnoozeSheet() {
const layout = useLayout();
const { organizations } = useOrganization();
const { organization, snooze, start, resume, ready } = useSnooze();
+ const loaded = useQuery(prefsQuery);
+ // Prefs say whether a snooze is on, and its section goes on top, so the sheet waits for them. If they fail to load,
+ // it still shows the durations, which stay disabled, under the alert that says so.
+ const settled = ready || loaded.fetchStatus === 'idle';
const [everywhere, setEverywhere] = useState(false);
const [now] = useState(() => new Date());
const name = organization?.name ?? 'This organization';
@@ -29,7 +35,7 @@ export default function SnoozeSheet() {
on ? (
) : (
-
+
);
return (
@@ -37,7 +43,7 @@ export default function SnoozeSheet() {
contentInsetAdjustmentBehavior="automatic"
style={{ backgroundColor: palette.background.default }}
contentContainerStyle={[styles.content, layout.reading]}>
- {snooze !== null && (
+ {settled && snooze !== null && (
@@ -52,7 +58,7 @@ export default function SnoozeSheet() {
)}
- {organizations.length > 1 && (
+ {settled && organizations.length > 1 && (
)}
- 1 ? 'For' : `Snooze ${name} for`}
- footer={`No notifications from ${everywhere ? 'any organization' : name} until then, critical alerts included, on all your devices. Alerts still fire and show here, in the console and in email. This ${deviceName} tells you when the snooze ends.`}>
- {durations.map((duration) => (
- {
- start(everywhere, duration.minutes);
- router.back();
- }
- : undefined
- }
- />
- ))}
-
+ {settled && (
+ 1 ? 'For' : `Snooze ${name} for`}
+ footer={`No notifications from ${everywhere ? 'any organization' : name} until then, critical alerts included, on all your devices. Alerts still fire and show here, in the console and in email. This ${deviceName} tells you when the snooze ends.`}>
+ {durations.map((duration) => (
+ {
+ start(everywhere, duration.minutes);
+ router.back();
+ }
+ : undefined
+ }
+ />
+ ))}
+
+ )}
);
}
@@ -98,4 +106,8 @@ const styles = StyleSheet.create({
gap: space.xxl,
paddingBottom: space.xxl * 2,
},
+ mark: {
+ width: 22,
+ alignItems: 'center',
+ },
});
diff --git a/src/app/(app)/threshold.tsx b/src/app/(app)/threshold.tsx
index 4d52c9b..d992674 100644
--- a/src/app/(app)/threshold.tsx
+++ b/src/app/(app)/threshold.tsx
@@ -48,7 +48,6 @@ export default function Threshold() {
const [picked, setPicked] = useState(null);
const [text, setText] = useState(null);
const [saving, setSaving] = useState(false);
- const [forbidden, setForbidden] = useState(false);
const points = history.data ?? [];
const current = condition?.threshold ?? 0;
@@ -108,14 +107,14 @@ export default function Threshold() {
return;
}
setSaving(true);
- setForbidden(false);
try {
await update(monitor, thresholdChange(monitor, value));
track('threshold_changed', { path: '/threshold', props: { direction: value > current ? 'up' : 'down' } });
router.back();
} catch (caught) {
+ // Said in a dialog, as on the monitor's screen, rather than in a box that would grow the sheet and move Save.
if (isForbidden(caught)) {
- setForbidden(true);
+ Dialog.alert('You can’t edit monitors', `Ask an owner of ${project?.name ?? 'the project'} to change it.`);
} else {
Dialog.alert('Couldn’t change the threshold', caught instanceof Error ? caught.message : String(caught));
}
@@ -202,14 +201,6 @@ export default function Threshold() {
format={(reading) => formatShort(condition, reading)}
/>
- {forbidden && (
-
- You can’t edit monitors
-
- Ask an owner of {project?.name ?? 'the project'} to change it.
-
-
- )}
{android && (
-
- {factor !== null ? hints[factor] : failure === null ? 'Loading…' : ''}
+ {/* A failure takes the hint's place, which holds two lines, rather than going in above the field. */}
+
+ {failure ?? (factor !== null ? hints[factor] : 'Loading…')}
- {failure !== null && (
-
- {failure}
-
-
- )}
submit()}
/>
- {factors !== null && (
-
- {others.map((other) => (
- start(other)} />
- ))}
-
+ {/* The other methods come with the list of them, so what's under them waits for it rather than being pushed. */}
+ {(factors !== null || failure !== null) && (
+ <>
+
+ {failure !== null && }
+ {others.map((other) => (
+ start(other)} />
+ ))}
+
+
+ [styles.leave, pressed && { backgroundColor: palette.overlay.pressed }]}>
+ Use another account
+
+ >
)}
-
- [styles.leave, pressed && { backgroundColor: palette.overlay.pressed }]}>
- Use another account
-
);
}
@@ -193,12 +193,6 @@ const styles = StyleSheet.create({
// Two lines, the longest hint, so the field doesn't move when "Loading…" is replaced.
minHeight: 48,
},
- failure: {
- gap: space.m,
- },
- failureText: {
- fontSize: 15,
- },
others: {
marginTop: space.l,
gap: space.m,
diff --git a/src/components/filter-bar.tsx b/src/components/filter-bar.tsx
index 8b5ae5e..b641f6e 100644
--- a/src/components/filter-bar.tsx
+++ b/src/components/filter-bar.tsx
@@ -53,17 +53,22 @@ export function FilterBar({ search, onSearch, placeholder, active, onFilters, st
borderColor: palette.border.strong,
},
]}>
-
+ {/* The count takes the icon's place rather than adding to the button, so turning a filter on or off doesn't
+ resize the button and the search field beside it. */}
+
+ {active > 0 ? (
+
+ {active}
+
+ ) : (
+
+ )}
+
Filters
- {active > 0 && (
-
- {active}
-
- )}
);
@@ -107,6 +112,12 @@ const styles = StyleSheet.create({
fontSize: 15,
fontWeight: '500',
},
+ slot: {
+ minWidth: 18,
+ height: 18,
+ alignItems: 'center',
+ justifyContent: 'center',
+ },
count: {
minWidth: 18,
height: 18,
@@ -118,5 +129,6 @@ const styles = StyleSheet.create({
number: {
fontSize: 12,
fontWeight: '600',
+ fontVariant: ['tabular-nums'],
},
});
diff --git a/src/components/segments.tsx b/src/components/segments.tsx
index 1295ef2..54895f1 100644
--- a/src/components/segments.tsx
+++ b/src/components/segments.tsx
@@ -28,9 +28,17 @@ export function Segments({ options, value, onChange }: Props
+ {/* The bold copy, unseen, sets the width either way, so picking a segment doesn't widen it and nudge the rest. */}
+
+ {option.label}
+
@@ -63,4 +71,11 @@ const styles = StyleSheet.create({
selected: {
fontWeight: '600',
},
+ sizer: {
+ opacity: 0,
+ },
+ shown: {
+ position: 'absolute',
+ textAlign: 'center',
+ },
});
diff --git a/src/escalations/alert-escalation.tsx b/src/escalations/alert-escalation.tsx
index b8dac80..91b9354 100644
--- a/src/escalations/alert-escalation.tsx
+++ b/src/escalations/alert-escalation.tsx
@@ -45,7 +45,8 @@ export function AlertEscalationSection({ alert, escalations, organizationId }: P
diff --git a/src/escalations/step-sheet.tsx b/src/escalations/step-sheet.tsx
index 1fc9174..1209ae8 100644
--- a/src/escalations/step-sheet.tsx
+++ b/src/escalations/step-sheet.tsx
@@ -116,7 +116,8 @@ export function StepSheet({
onDone={() => delay !== null && onDone({ ...draft, delay })}>
+ // A line held for the problem, so it doesn't push the roles down under the finger that unticked the last one.
+ footer={problem ?? ' '}>
{delayPresets.map((seconds) => (
diff --git a/src/escalations/use-escalations.ts b/src/escalations/use-escalations.ts
index aed2473..aa1a216 100644
--- a/src/escalations/use-escalations.ts
+++ b/src/escalations/use-escalations.ts
@@ -4,16 +4,20 @@ import { useCallback } from 'react';
import { membersQuery, scopesQuery } from '@/escalations/queries';
/**
- * Whether the member's role may change the organization's escalations. Until the server says, controls stay hidden;
- * when it can't say, they show and the server decides.
+ * Whether the member's role may change the organization's escalations: null until the server says, so a screen can
+ * wait rather than lay out read-only and then add its controls; when it can't say, they show and the server decides.
*/
-export function useCanManageEscalations(organizationId: string | null): boolean {
+export function useCanManageEscalations(organizationId: string | null): boolean | null {
const scopes = useQuery(scopesQuery(organizationId));
if (scopes.data !== undefined) {
// Newer servers give escalations a scope of their own, and still accept `monitors.write` for them.
return scopes.data.includes('escalations.write') || scopes.data.includes('monitors.write');
}
- return scopes.isError;
+ if (scopes.isError) {
+ return true;
+ }
+ // Without an organization nothing is asked, so there's nothing to wait for.
+ return organizationId === null || organizationId === '' ? false : null;
}
/** A member's name by their user ID, or the ID for someone who left or can't be read. */
diff --git a/src/projects/project-row.tsx b/src/projects/project-row.tsx
index 312f2bc..31611ef 100644
--- a/src/projects/project-row.tsx
+++ b/src/projects/project-row.tsx
@@ -66,7 +66,8 @@ export function ProjectCard({
{firing > 0 && }
- {value !== undefined && {value}}
+ {/* A blank while loading, so the row is as tall as it will be with the figure. */}
+ {value ?? ' '}
diff --git a/src/setup/watch.tsx b/src/setup/watch.tsx
index 3599104..a379055 100644
--- a/src/setup/watch.tsx
+++ b/src/setup/watch.tsx
@@ -86,7 +86,11 @@ export function Watch() {
);
}
- const ready = loaded && mutedOrganizations !== null;
+ // The rows, their Firing badges and the line naming a single organization all come from these, so the screen shows
+ // a spinner until every one has answered rather than drawing an empty card and growing it as each lands.
+ const settled = (query: { data: unknown; fetchStatus: string }) =>
+ query.data !== undefined || query.fetchStatus === 'idle';
+ const ready = loaded && mutedOrganizations !== null && projects.every(settled) && alerts.every(settled);
const watched = (projectId: string) => !mutedProjects.includes(projectId);
function projectRows(index: number, nested: boolean) {
@@ -113,7 +117,11 @@ export function Watch() {
return (
}>
{!ready ? (
diff --git a/tests/integration/alert-detail.test.tsx b/tests/integration/alert-detail.test.tsx
index 8343fd3..7e60920 100644
--- a/tests/integration/alert-detail.test.tsx
+++ b/tests/integration/alert-detail.test.tsx
@@ -66,6 +66,10 @@ function serveEscalating(fields: Parameters[0]) {
if (call.path === '/organization/escalations') {
return { body: { total: 1, escalations: [onCall] } };
}
+ // The steps name the people they notified, so the screen waits for the members too.
+ if (call.path === '/teams/acme/memberships') {
+ return { body: { memberships: [] } };
+ }
if (call.path !== '/organizations/acme/alerts/alert-1') {
return undefined;
}
@@ -210,6 +214,9 @@ describe('alert detail', () => {
if (call.path === '/organization/escalations') {
return { status: 404, body: { message: 'Route not found.', code: 404, type: 'general_route_not_found' } };
}
+ if (call.path === '/teams/acme/memberships') {
+ return { body: { memberships: [] } };
+ }
return call.path === '/organizations/acme/alerts/alert-1'
? {
body: alert({