diff --git a/app/(app)/_layout.tsx b/app/(app)/_layout.tsx index 5df1f81..a49528b 100644 --- a/app/(app)/_layout.tsx +++ b/app/(app)/_layout.tsx @@ -1,25 +1,22 @@ -import { DynamicColorIOS, Platform } from "react-native"; +import { Platform } from "react-native"; import { NativeTabs } from "expo-router/unstable-native-tabs"; import { AppLockOverlay } from "@/components/AppLockOverlay"; import { useAppTheme } from "@/contexts/ThemeContext"; -import { mutedForeground, primary } from "@/lib/beenvoice-theme"; import { AppLockProvider } from "@/contexts/AppLockContext"; export default function AppLayout() { - const { colors } = useAppTheme(); + const { colors, isDark } = useAppTheme(); - const tintColor = + const tintColor = colors.primary; + const labelColor = colors.mutedForeground; + const tabContentStyle = { backgroundColor: colors.background }; + const tabBarBlur = Platform.OS === "ios" - ? DynamicColorIOS({ light: primary, dark: "#FAFAFA" }) - : colors.primary; - - const labelColor = - Platform.OS === "ios" - ? DynamicColorIOS({ light: mutedForeground, dark: "#A1A1AA" }) - : colors.mutedForeground; - - const tabContentStyle = { backgroundColor: "transparent" as const }; + ? isDark + ? "systemChromeMaterialDark" + : "systemChromeMaterialLight" + : undefined; return ( @@ -30,6 +27,9 @@ export default function AppLayout() { selected: tintColor, }} labelStyle={{ color: labelColor }} + blurEffect={tabBarBlur} + disableTransparentOnScrollEdge + backgroundColor={Platform.OS === "android" ? colors.background : undefined} > Timer + + + Entities + + + + + + + + + + + ); +} diff --git a/app/(app)/entities/businesses/[id].tsx b/app/(app)/entities/businesses/[id].tsx new file mode 100644 index 0000000..04f0755 --- /dev/null +++ b/app/(app)/entities/businesses/[id].tsx @@ -0,0 +1,186 @@ +import { router, Stack, useLocalSearchParams } from "expo-router"; +import { Alert, ScrollView, StyleSheet, Text, View } from "react-native"; + +import { AppBackground } from "@/components/AppBackground"; +import { LoadingScreen } from "@/components/LoadingScreen"; +import { Button } from "@/components/ui/Button"; +import { Card } from "@/components/ui/Card"; +import { fonts, spacing } from "@/constants/theme"; +import { useAppTheme } from "@/contexts/ThemeContext"; +import { useTabBarScrollPadding } from "@/lib/tab-bar-insets"; +import type { ThemeColors } from "@/lib/theme-palette"; +import { useThemedStyles } from "@/lib/use-themed-styles"; +import { api } from "@/lib/trpc"; + +export default function BusinessDetailScreen() { + const { colors } = useAppTheme(); + const styles = useThemedStyles(createBusinessDetailStyles); + const { id } = useLocalSearchParams<{ id: string }>(); + const scrollPadding = useTabBarScrollPadding(); + const utils = api.useUtils(); + + const businessQuery = api.businesses.getById.useQuery( + { id: id ?? "" }, + { enabled: Boolean(id) }, + ); + + const setDefault = api.businesses.setDefault.useMutation({ + onSuccess: () => { + void utils.businesses.getAll.invalidate(); + if (id) void utils.businesses.getById.invalidate({ id }); + Alert.alert("Default updated", "This business is now your default."); + }, + onError: (err) => Alert.alert("Could not set default", err.message), + }); + + if (!id) { + return ; + } + + if (businessQuery.isLoading) { + return ; + } + + const business = businessQuery.data; + if (!business) { + return ; + } + + return ( + + + + + + {business.name} + {business.isDefault ? Default : null} + + {business.nickname ? {business.nickname} : null} + {business.email ? {business.email} : null} + {business.phone ? {business.phone} : null} + {business.website ? {business.website} : null} + + + + {business.taxId ? ( + + ) : null} + + + + {(business.addressLine1 || business.city || business.state) && ( + + {business.addressLine1 ? ( + {business.addressLine1} + ) : null} + {business.addressLine2 ? ( + {business.addressLine2} + ) : null} + {(business.city || business.state || business.postalCode) && ( + + {[business.city, business.state, business.postalCode].filter(Boolean).join(", ")} + + )} + {business.country ? {business.country} : null} + + )} + + +