-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from Delemangi/feat/faq
Implement FAQ and proper routing
- Loading branch information
Showing
19 changed files
with
374 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { useLogoutUser } from "@auth/hooks"; | ||
import LoadingSpinner from "@components/LoadingSpinner"; | ||
import { useUserStore } from "@stores/userStore"; | ||
import { Redirect } from "expo-router"; | ||
import { useEffect } from "react"; | ||
|
||
const Logout = () => { | ||
const { logout } = useLogoutUser(); | ||
const user = useUserStore((state) => state.user); | ||
|
||
useEffect(() => { | ||
logout(); | ||
}, []); | ||
|
||
if (!user) { | ||
return <Redirect href="/auth/login" />; | ||
} | ||
|
||
return <LoadingSpinner size="large" />; | ||
}; | ||
|
||
export default Logout; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { useGetPosts } from "@api/hooks"; | ||
import LoadingSpinner from "@components/LoadingSpinner"; | ||
import PostCard from "@components/PostCard"; | ||
import PostsHeader from "@components/PostsHeader"; | ||
import { makeStyles } from "@rneui/themed"; | ||
import { usePostStore } from "@stores/postStore"; | ||
import { useUserStore } from "@stores/userStore"; | ||
import { ScrollView, View, Text } from "react-native"; | ||
|
||
const useStyles = makeStyles((theme) => ({ | ||
container: { | ||
backgroundColor: theme.colors.background, | ||
height: "100%", | ||
}, | ||
postContainer: { | ||
display: "flex", | ||
justifyContent: "center", | ||
alignItems: "center", | ||
marginTop: 20, | ||
}, | ||
text: { | ||
color: theme.colors.white, | ||
}, | ||
loadingSpinner: { | ||
marginTop: 20, | ||
}, | ||
})); | ||
|
||
const Posts = () => { | ||
const styles = useStyles(); | ||
const postsType = usePostStore((state) => state.type); | ||
const user = useUserStore((state) => state.user); | ||
const { data } = useGetPosts(postsType); | ||
|
||
return ( | ||
<View style={styles.container}> | ||
<PostsHeader /> | ||
<ScrollView> | ||
{postsType && | ||
data && | ||
data.map((post) => <PostCard key={post.url} post={post} />)} | ||
|
||
{postsType && !data && ( | ||
<View style={styles.loadingSpinner}> | ||
<LoadingSpinner size="large" /> | ||
</View> | ||
)} | ||
|
||
{!postsType && user && ( | ||
<View style={styles.postContainer}> | ||
<Text style={styles.text}>Please select a type!</Text> | ||
</View> | ||
)} | ||
</ScrollView> | ||
</View> | ||
); | ||
}; | ||
|
||
export default Posts; |
Oops, something went wrong.