65 lines
2.9 KiB
TypeScript
65 lines
2.9 KiB
TypeScript
import ButtonBackHeader from "@/components/buttonBackHeader";
|
|
import HeaderDiscussionGeneral from "@/components/discussion_general/headerDiscussionGeneral";
|
|
import HeaderRightDivisionList from "@/components/division/headerDivisionList";
|
|
import HeaderMemberList from "@/components/member/headerMemberList";
|
|
import HeaderRightProjectList from "@/components/project/headerProjectList";
|
|
import { Headers } from "@/constants/Headers";
|
|
import store from "@/lib/store";
|
|
import { useAuthSession } from "@/providers/AuthProvider";
|
|
import { Redirect, router, Stack } from "expo-router";
|
|
import { StatusBar } from 'expo-status-bar';
|
|
import { Text } from "react-native";
|
|
import { Provider } from "react-redux";
|
|
|
|
export default function RootLayout() {
|
|
const { token, isLoading } = useAuthSession()
|
|
|
|
if (isLoading) {
|
|
return <Text>Loading...</Text>;
|
|
}
|
|
|
|
if (!token?.current) {
|
|
return <Redirect href="/" />;
|
|
}
|
|
|
|
return (
|
|
<Provider store={store}>
|
|
<Stack screenOptions={Headers.shadow}>
|
|
<Stack.Screen name="home" options={{ title: 'Home' }} />
|
|
<Stack.Screen name="feature" options={{ title: 'Fitur' }} />
|
|
<Stack.Screen name="search" options={{ title: 'Pencarian' }} />
|
|
<Stack.Screen name="notification" options={{ title: 'Notifikasi' }} />
|
|
<Stack.Screen name="profile" options={{ title: 'Profile' }} />
|
|
<Stack.Screen name="group" options={{ title: 'Lembaga Desa', headerShown: false }} />
|
|
<Stack.Screen name="position" options={{ title: 'Jabatan', headerShown: false }} />
|
|
<Stack.Screen name="member/index" options={{
|
|
headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
|
title: 'Anggota',
|
|
headerTitleAlign: 'center',
|
|
headerRight: () => <HeaderMemberList />
|
|
}} />
|
|
<Stack.Screen name="discussion/index" options={{
|
|
headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
|
title: 'Diskusi Umum',
|
|
headerTitleAlign: 'center',
|
|
headerRight: () => <HeaderDiscussionGeneral />
|
|
}} />
|
|
<Stack.Screen name="project/index" options={{
|
|
headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
|
title: 'Kegiatan',
|
|
headerTitleAlign: 'center',
|
|
headerRight: () => <HeaderRightProjectList />
|
|
}} />
|
|
<Stack.Screen name="division/index" options={{
|
|
headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
|
title: 'Divisi',
|
|
headerTitleAlign: 'center',
|
|
headerRight: () => <HeaderRightDivisionList />
|
|
}} />
|
|
<Stack.Screen name="division/[id]/(fitur-division)" options={{ headerShown: false }} />
|
|
</Stack>
|
|
<StatusBar style="light" />
|
|
</Provider>
|
|
)
|
|
}
|