1a195a96bd
- Merge origin/main into branch (resolve conflict in integrations_dashboard.html) - Add defensive JSON parsing with try/except for integration.config - Wrap tester() call in try/except to prevent 500 errors from bad config - Add i18n key integrations.connection_test_failed_fallback in en.json - Reference i18n key in template JS fallback message - Update SECURITY_AUDIT.md: add fix date (2026-03-23), update doc date - Remove accidental revert.sh file - Fix missing MagicMock/patch imports in test file - Add tests for invalid JSON config and tester exception error paths Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com> Agent-Logs-Url: https://github.com/christianlouis/DocuElevate/sessions/daebb70e-059a-4601-8864-88eef49f99cf
87 lines
2.6 KiB
TypeScript
87 lines
2.6 KiB
TypeScript
/**
|
||
* Tab navigator layout for authenticated users.
|
||
*
|
||
* Registers three tabs: Upload (default), Files, and Profile.
|
||
* Push notifications are initialised here so they activate as soon as the
|
||
* user enters the authenticated area.
|
||
*/
|
||
|
||
import { Tabs } from "expo-router";
|
||
import { Ionicons } from "@expo/vector-icons";
|
||
import React from "react";
|
||
import { usePushNotifications } from "../../src/hooks/usePushNotifications";
|
||
import { useAuth } from "../../src/context/AuthContext";
|
||
import { useLocale, t } from "../../src/i18n";
|
||
|
||
export default function TabLayout() {
|
||
const { isAuthenticated } = useAuth();
|
||
usePushNotifications(isAuthenticated);
|
||
// Subscribe to language changes so tab labels re-render when the language
|
||
// is switched. The `lang` variable is intentionally unused – its only
|
||
// purpose is to make this component a consumer of LocaleContext.
|
||
useLocale();
|
||
|
||
return (
|
||
<Tabs
|
||
screenOptions={{
|
||
tabBarActiveTintColor: "#1e40af",
|
||
tabBarInactiveTintColor: "#9ca3af",
|
||
tabBarStyle: {
|
||
borderTopColor: "#e5e7eb",
|
||
backgroundColor: "#ffffff",
|
||
},
|
||
headerStyle: {
|
||
backgroundColor: "#1e40af",
|
||
},
|
||
headerTintColor: "#ffffff",
|
||
headerTitleStyle: {
|
||
fontWeight: "700",
|
||
},
|
||
}}
|
||
>
|
||
<Tabs.Screen
|
||
name="index"
|
||
options={{
|
||
title: t("tabs.upload"),
|
||
tabBarLabel: t("tabs.upload"),
|
||
tabBarIcon: ({ color, size }) => (
|
||
<Ionicons name="cloud-upload-outline" size={size} color={color} />
|
||
),
|
||
headerTitle: "DocuElevate",
|
||
}}
|
||
/>
|
||
<Tabs.Screen
|
||
name="files"
|
||
options={{
|
||
title: t("tabs.files"),
|
||
tabBarLabel: t("tabs.files"),
|
||
tabBarIcon: ({ color, size }) => (
|
||
<Ionicons name="document-text-outline" size={size} color={color} />
|
||
),
|
||
headerTitle: t("files.title"),
|
||
}}
|
||
/>
|
||
<Tabs.Screen
|
||
name="profile"
|
||
options={{
|
||
title: t("tabs.profile"),
|
||
tabBarLabel: t("tabs.profile"),
|
||
tabBarIcon: ({ color, size }) => (
|
||
<Ionicons name="person-circle-outline" size={size} color={color} />
|
||
),
|
||
headerTitle: t("tabs.profile"),
|
||
}}
|
||
/>
|
||
{/* File detail screen – hidden from tab bar, accessed via navigation */}
|
||
<Tabs.Screen
|
||
name="file-detail"
|
||
options={{
|
||
href: null,
|
||
title: t("file_detail.title"),
|
||
headerTitle: t("file_detail.title"),
|
||
}}
|
||
/>
|
||
</Tabs>
|
||
);
|
||
}
|