Skip to content

Commit 074e37d

Browse files
authored
Merge pull request #2 from bagusok/auth-test
Auth test
2 parents 11331fa + c16421e commit 074e37d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+3481
-1209
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,6 @@ expo-env.d.ts
2222
.env
2323
android
2424
android/*
25-
keykey/*
25+
keykey/*
26+
27+
google-services.json

app.config.js

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
export default {
2+
name: "Miramine",
3+
slug: "anime-stream",
4+
version: "1.0.0",
5+
orientation: "portrait",
6+
icon: "./assets/images/icon.png",
7+
scheme: "myapp",
8+
userInterfaceStyle: "automatic",
9+
splash: {
10+
image: "./assets/images/splash.png",
11+
resizeMode: "contain",
12+
backgroundColor: "#ffffff",
13+
},
14+
ios: {
15+
supportsTablet: true,
16+
},
17+
android: {
18+
adaptiveIcon: {
19+
foregroundImage: "./assets/images/adaptive-icon.png",
20+
backgroundColor: "#ffffff",
21+
},
22+
googleServicesFile: process.env.GOOGLE_SERVICES_JSON,
23+
package: "com.bagusok.animestream",
24+
},
25+
web: {
26+
bundler: "metro",
27+
output: "static",
28+
favicon: "./assets/images/favicon.png",
29+
},
30+
plugins: [
31+
"expo-router",
32+
"expo-font",
33+
"expo-secure-store",
34+
[
35+
"expo-screen-orientation",
36+
{
37+
initialOrientation: "DEFAULT",
38+
},
39+
],
40+
[
41+
"@react-native-google-signin/google-signin",
42+
{
43+
iosUrlScheme: "com.googleusercontent.apps._some_id_here_",
44+
},
45+
],
46+
],
47+
experiments: {
48+
typedRoutes: true,
49+
},
50+
extra: {
51+
router: {
52+
origin: false,
53+
},
54+
eas: {
55+
projectId: "b5f26acf-eff2-492d-8062-7e3d7e82b6b7",
56+
},
57+
},
58+
};

app.json

Lines changed: 0 additions & 59 deletions
This file was deleted.

app/(home)/_layout.tsx

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
11
import { Tabs } from "expo-router";
22
import React from "react";
3-
4-
import { Colors } from "@/constants/Colors";
53
import { useColors } from "@/hooks/useColors";
6-
import { AntDesign, Feather } from "@expo/vector-icons";
4+
import { Feather } from "@expo/vector-icons";
5+
import { useAtom } from "jotai";
6+
import { userAtom } from "@/store/auth";
7+
import LoadingPage from "@/components/LoadingPage";
8+
import ErrorPage from "@/components/ErrorPage";
79

810
export default function TabLayout() {
911
const colors = useColors();
1012

13+
const [user, setUser] = useAtom(userAtom);
14+
15+
if (user.isLoading) {
16+
return <LoadingPage />;
17+
}
18+
19+
if (user.error) {
20+
return <ErrorPage message={user?.error?.message} />;
21+
}
1122
return (
1223
<Tabs
1324
screenOptions={{
@@ -16,6 +27,8 @@ export default function TabLayout() {
1627
tabBarStyle: {
1728
backgroundColor: colors.background,
1829
borderTopColor: colors.border,
30+
height: 60,
31+
paddingTop: 8,
1932
},
2033
}}
2134
>
@@ -28,6 +41,15 @@ export default function TabLayout() {
2841
),
2942
}}
3043
/>
44+
<Tabs.Screen
45+
name="schedule"
46+
options={{
47+
title: "Schedule",
48+
tabBarIcon: ({ color, focused }) => (
49+
<Feather name="calendar" size={24} color={color} />
50+
),
51+
}}
52+
/>
3153
<Tabs.Screen
3254
name="all-anime"
3355
options={{
@@ -37,12 +59,13 @@ export default function TabLayout() {
3759
),
3860
}}
3961
/>
62+
4063
<Tabs.Screen
41-
name="schedule"
64+
name="bookmark"
4265
options={{
43-
title: "Schedule",
66+
title: "Bookmark",
4467
tabBarIcon: ({ color, focused }) => (
45-
<Feather name="calendar" size={24} color={color} />
68+
<Feather name="bookmark" size={24} color={color} />
4669
),
4770
}}
4871
/>

app/(home)/all-anime.tsx

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import ErrorPage from "@/components/ErrorPage";
12
import LoadingPage from "@/components/LoadingPage";
23
import SafeAreaWrapper from "@/components/SafeAreaWrapper";
34
import { CustomText } from "@/components/ui";
@@ -6,10 +7,18 @@ import { ThemeColors } from "@/constants/Colors";
67
import { API_URL } from "@/constants/Strings";
78
import { useColors } from "@/hooks/useColors";
89
import { axiosIn } from "@/utils/axios";
10+
import { Feather } from "@expo/vector-icons";
911

1012
import { useInfiniteQuery } from "@tanstack/react-query";
13+
import { router } from "expo-router";
1114
import { useMemo } from "react";
12-
import { ActivityIndicator, StyleSheet, View } from "react-native";
15+
import {
16+
ActivityIndicator,
17+
StyleSheet,
18+
Touchable,
19+
TouchableOpacity,
20+
View,
21+
} from "react-native";
1322
import { FlatList } from "react-native-gesture-handler";
1423
import { SafeAreaView } from "react-native-safe-area-context";
1524

@@ -24,7 +33,10 @@ export default function AllAnime() {
2433
axiosIn
2534
.get(`${API_URL}/anime?page=${pageParam}`)
2635
.then((res) => res.data)
27-
.catch((err) => err),
36+
.catch((err) => {
37+
console.error(err);
38+
throw new Error(err);
39+
}),
2840
getNextPageParam: (lastPage) => {
2941
const nextPage = lastPage.pagination.page + 1;
3042
return nextPage <= lastPage.pagination.totalPage ? nextPage : null;
@@ -40,19 +52,32 @@ export default function AllAnime() {
4052
return <LoadingPage />;
4153
}
4254

55+
if (allAnime.isError) {
56+
return <ErrorPage />;
57+
}
58+
4359
return (
4460
<SafeAreaView>
4561
<View style={style.header}>
46-
<CustomText fontStyle="semibold" size={16}>
62+
<CustomText fontStyle="semibold" size={18}>
4763
All Anime
4864
</CustomText>
65+
<TouchableOpacity
66+
onPress={() =>
67+
router.push({
68+
pathname: "/pages/search",
69+
})
70+
}
71+
>
72+
<Feather name="search" size={20} color={colors.text} />
73+
</TouchableOpacity>
4974
</View>
5075
<View style={style.container}>
5176
<FlatList
5277
data={flatData}
5378
keyExtractor={(item) => item.id}
5479
renderItem={({ item }) => <CardAllAnime key={item.id} item={item} />}
55-
ItemSeparatorComponent={() => <View style={{ height: 16 }} />}
80+
ItemSeparatorComponent={() => <View style={{ height: 24 }} />}
5681
onEndReached={() => {
5782
if (allAnime.hasNextPage) {
5883
allAnime.fetchNextPage();
@@ -77,7 +102,7 @@ export default function AllAnime() {
77102
const createStyles = (colors: ThemeColors) =>
78103
StyleSheet.create({
79104
header: {
80-
height: 50,
105+
height: 60,
81106
paddingHorizontal: 14,
82107
flexDirection: "row",
83108
justifyContent: "space-between",

0 commit comments

Comments
 (0)