diff --git a/ArtisanConnect/app/(tabs)/login.jsx b/ArtisanConnect/app/(auth)/login.jsx similarity index 95% rename from ArtisanConnect/app/(tabs)/login.jsx rename to ArtisanConnect/app/(auth)/login.jsx index 0fbbf82..a494ec1 100644 --- a/ArtisanConnect/app/(tabs)/login.jsx +++ b/ArtisanConnect/app/(auth)/login.jsx @@ -51,13 +51,13 @@ export default function Login() { Logowanie - - - + {/* */} diff --git a/ArtisanConnect/app/(tabs)/_layout.jsx b/ArtisanConnect/app/(tabs)/_layout.jsx index 3ff6e26..7f9d212 100644 --- a/ArtisanConnect/app/(tabs)/_layout.jsx +++ b/ArtisanConnect/app/(tabs)/_layout.jsx @@ -48,21 +48,10 @@ export default function TabLayout() { ), }} /> - ( - - ), - }} - /> ( diff --git a/ArtisanConnect/app/(tabs)/index.jsx b/ArtisanConnect/app/(tabs)/index.jsx index 6054802..f8d6111 100644 --- a/ArtisanConnect/app/(tabs)/index.jsx +++ b/ArtisanConnect/app/(tabs)/index.jsx @@ -5,8 +5,24 @@ import { NoticeSection } from "@/components/NoticeSection"; import { UserSection } from "@/components/UserSection"; import { SearchSection } from "@/components/SearchSection"; import { FlatList } from 'react-native'; - +import { useAuthStore } from "@/store/authStore"; +import { useRouter } from "expo-router"; +import { useEffect, useState } from "react"; export default function Home() { +const token = useAuthStore((state) => state.token); + const router = useRouter(); + const [isReady, setIsReady] = useState(false); + + useEffect(() => { + setIsReady(true); + }, []); + + useEffect(() => { + if (isReady && !token) { + router.replace("/login"); + } + }, [isReady, token, router]); + const notices = useNoticesStore((state) => state.notices); const latestNotices = [...notices] .sort((a, b) => new Date(b.publishDate) - new Date(a.publishDate)) @@ -14,6 +30,7 @@ export default function Home() { const recomendedNotices = [...notices] .sort(() => Math.random() - 0.5) .slice(0, 6); + return ( diff --git a/ArtisanConnect/app/_layout.jsx b/ArtisanConnect/app/_layout.jsx index 7581fc8..4569df8 100644 --- a/ArtisanConnect/app/_layout.jsx +++ b/ArtisanConnect/app/_layout.jsx @@ -1,9 +1,9 @@ -import { Stack } from "expo-router"; +import { Stack, Redirect } from "expo-router"; import "@/global.css"; import { GluestackUIProvider } from "@/components/ui/gluestack-ui-provider"; import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; -import { useEffect } from "react"; -import { useNoticesStore } from "@/store/noticesStore"; +import { useEffect, useState } from "react"; +import { useNoticesStore } from "@/store/noticesStore"; const queryClient = new QueryClient(); export default function RootLayout() { @@ -12,9 +12,11 @@ export default function RootLayout() { useEffect(() => { fetchNotices(); }, []); - return ( + +return ( + + + diff --git a/ArtisanConnect/app/registration.jsx b/ArtisanConnect/app/registration.jsx index 555750c..4011ca7 100644 --- a/ArtisanConnect/app/registration.jsx +++ b/ArtisanConnect/app/registration.jsx @@ -4,11 +4,13 @@ import {useAuthStore} from '@/store/authStore'; import {useRouter} from 'expo-router'; import {Box} from "@/components/ui/box" -import {Button, ButtonText} from "@/components/ui/button" +import {Button, ButtonText,ButtonIcon} from "@/components/ui/button" +import {ArrowRightIcon} from "@/components/ui/icon" import {Center} from "@/components/ui/center" import {Heading} from "@/components/ui/heading" import {Input, InputField} from "@/components/ui/input" import {VStack} from "@/components/ui/vstack" +import {Link} from "expo-router" export default function Registration() { const [email, setEmail] = useState(''); @@ -44,9 +46,18 @@ export default function Registration() { return (
+ Rejestracja + + {/* */} + + {/* */} + @@ -69,6 +80,7 @@ export default function Registration() { +
); @@ -93,4 +105,8 @@ const styles = StyleSheet.create({ color: 'red', marginBottom: 10, }, + signupbutton: { + fontWeight: '300', + textAlign: 'left', + }, }); \ No newline at end of file