diff --git a/packages/app/src/usage/usage-screen.tsx b/packages/app/src/usage/usage-screen.tsx
index 8fc4c429db..b37c377c8d 100644
--- a/packages/app/src/usage/usage-screen.tsx
+++ b/packages/app/src/usage/usage-screen.tsx
@@ -1,36 +1,39 @@
import { useCallback } from "react";
-import { ScrollView, View } from "react-native";
import { useIsFocused } from "@react-navigation/native";
-import { useSafeAreaInsets } from "react-native-safe-area-context";
-import { StyleSheet } from "react-native-unistyles";
-import { MenuHeader } from "@/components/headers/menu-header";
+import { router } from "expo-router";
+import { PageLayout } from "@/components/page-layout";
import { usageCopy } from "./copy";
import type { UsageHostGroup } from "./model";
import { useUsageByHost } from "./queries";
import { UsageMessage, UsageSection } from "./usage-section";
+// The screen is reachable by URL, so there may be no history to go back to.
+function leaveUsage(): void {
+ if (router.canGoBack()) {
+ router.back();
+ return;
+ }
+ router.replace("/");
+}
+
export function UsageScreen() {
const isFocused = useIsFocused();
return (
-
-
+
{isFocused ? : null}
-
+
);
}
function UsageScreenContent() {
- const insets = useSafeAreaInsets();
const { groups, refresh } = useUsageByHost();
return (
-
-
- {groups.length === 0 ? : null}
- {groups.map((group) => (
-
- ))}
-
-
+ <>
+ {groups.length === 0 ? : null}
+ {groups.map((group) => (
+
+ ))}
+ >
);
}
@@ -51,20 +54,3 @@ function HostUsageGroup({
/>
);
}
-
-const styles = StyleSheet.create((theme) => ({
- container: {
- flex: 1,
- backgroundColor: theme.colors.surface0,
- },
- scroll: {
- flex: 1,
- },
- content: {
- padding: theme.spacing[4],
- paddingTop: theme.spacing[6],
- width: "100%",
- maxWidth: 720,
- alignSelf: "center",
- },
-}));