mirror of
https://github.com/urosran/cally.git
synced 2025-11-26 08:24:55 +00:00
fixed tablet view / spelling
This commit is contained in:
@ -50,7 +50,7 @@ export default function TabLayout() {
|
|||||||
},
|
},
|
||||||
headerStyle: { height: Device.deviceType === DeviceType.TABLET ? 100 : undefined},
|
headerStyle: { height: Device.deviceType === DeviceType.TABLET ? 100 : undefined},
|
||||||
drawerStyle: {
|
drawerStyle: {
|
||||||
width: "90%",
|
width: Device.deviceType === DeviceType.TABLET ? "50%" : "90%",
|
||||||
backgroundColor: "#f9f8f7",
|
backgroundColor: "#f9f8f7",
|
||||||
height: "100%",
|
height: "100%",
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,169 +1,229 @@
|
|||||||
import {SafeAreaView} from "react-native-safe-area-context";
|
import { SafeAreaView } from "react-native-safe-area-context";
|
||||||
import {Button, Colors, Dialog, LoaderScreen, Text, View} from "react-native-ui-lib";
|
import {
|
||||||
import React, {useCallback, useState} from "react";
|
Button,
|
||||||
import {useRouter} from "expo-router";
|
Colors,
|
||||||
|
Dialog,
|
||||||
|
LoaderScreen,
|
||||||
|
Text,
|
||||||
|
View,
|
||||||
|
} from "react-native-ui-lib";
|
||||||
|
import React, { useCallback, useEffect, useState } from "react";
|
||||||
|
import { useRouter } from "expo-router";
|
||||||
import QRIcon from "@/assets/svgs/QRIcon";
|
import QRIcon from "@/assets/svgs/QRIcon";
|
||||||
import {Camera, CameraView} from "expo-camera";
|
import { Camera, CameraView } from "expo-camera";
|
||||||
import {useLoginWithQrCode} from "@/hooks/firebase/useLoginWithQrCode";
|
import { useLoginWithQrCode } from "@/hooks/firebase/useLoginWithQrCode";
|
||||||
import {useAuthContext} from "@/contexts/AuthContext";
|
import { useAuthContext } from "@/contexts/AuthContext";
|
||||||
import debounce from "debounce";
|
import debounce from "debounce";
|
||||||
|
import * as Device from "expo-device";
|
||||||
|
import { DeviceType } from "expo-device";
|
||||||
|
import { Dimensions } from "react-native";
|
||||||
|
|
||||||
export default function Screen() {
|
export default function Screen() {
|
||||||
const router = useRouter()
|
const router = useRouter();
|
||||||
const {setRedirectOverride} = useAuthContext()
|
const { setRedirectOverride } = useAuthContext();
|
||||||
const [hasPermission, setHasPermission] = useState<boolean | null>(null);
|
const [hasPermission, setHasPermission] = useState<boolean | null>(null);
|
||||||
const [showCameraDialog, setShowCameraDialog] = useState<boolean>(false);
|
const [showCameraDialog, setShowCameraDialog] = useState<boolean>(false);
|
||||||
|
|
||||||
const {mutateAsync: signInWithQrCode, isLoading} = useLoginWithQrCode();
|
const isTablet: boolean = Device.deviceType === DeviceType.TABLET;
|
||||||
|
const [isPortrait, setIsPortrait] = useState(() => {
|
||||||
|
const dim = Dimensions.get('screen');
|
||||||
|
return dim.height >= dim.width;
|
||||||
|
});
|
||||||
|
|
||||||
const debouncedRouterReplace = useCallback(
|
useEffect(() => {
|
||||||
debounce(() => {
|
const subscription = Dimensions.addEventListener('change', ({ screen }) => {
|
||||||
router.push("/(unauth)/cal_sync");
|
setIsPortrait(screen.height >= screen.width);
|
||||||
}, 300),
|
});
|
||||||
[]
|
|
||||||
);
|
|
||||||
|
|
||||||
const handleQrCodeScanned = async ({data}: { data: string }) => {
|
return () => subscription.remove();
|
||||||
setShowCameraDialog(false);
|
}, []);
|
||||||
setRedirectOverride(true);
|
|
||||||
try {
|
|
||||||
await signInWithQrCode({userId: data});
|
|
||||||
debouncedRouterReplace()
|
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const getCameraPermissions = async (callback: () => void) => {
|
const getTopPadding = () => {
|
||||||
const {status} = await Camera.requestCameraPermissionsAsync();
|
if (Device.deviceType === DeviceType.TABLET) {
|
||||||
setHasPermission(status === "granted");
|
return isPortrait ? "50%" : "15%";
|
||||||
if (status === "granted") {
|
|
||||||
callback();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleOpenQrCodeDialog = () => {
|
|
||||||
getCameraPermissions(() => setShowCameraDialog(true));
|
|
||||||
}
|
}
|
||||||
|
return "20%"; // non-tablet case, regardless of orientation
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
const { mutateAsync: signInWithQrCode, isLoading } = useLoginWithQrCode();
|
||||||
<SafeAreaView style={{flex: 1}}>
|
|
||||||
<View style={{flex: 1, padding: 21, paddingBottom: 45, paddingTop: "20%", alignItems: "center"}}>
|
|
||||||
<View center>
|
|
||||||
<Text style={{fontSize: 30, fontFamily: 'Manrope_600SemiBold'}}>
|
|
||||||
Get started with Cally
|
|
||||||
</Text>
|
|
||||||
</View>
|
|
||||||
|
|
||||||
<View width={"100%"} gap-30>
|
const debouncedRouterReplace = useCallback(
|
||||||
<View>
|
debounce(() => {
|
||||||
<Button
|
router.push("/(unauth)/cal_sync");
|
||||||
label="Scan QR Code"
|
}, 300),
|
||||||
marginT-50
|
[]
|
||||||
labelStyle={{
|
);
|
||||||
fontFamily: "PlusJakartaSans_400Regular",
|
|
||||||
fontSize: 16,
|
|
||||||
marginLeft: 10
|
|
||||||
}}
|
|
||||||
iconSource={() => <QRIcon color={"#07B8C7"}/>}
|
|
||||||
onPress={handleOpenQrCodeDialog}
|
|
||||||
style={{height: 50}}
|
|
||||||
color={Colors.black}
|
|
||||||
backgroundColor={Colors.white}
|
|
||||||
/>
|
|
||||||
{/* GOOGLE LOGIN HERE */}
|
|
||||||
</View>
|
|
||||||
|
|
||||||
<View row center gap-20>
|
const handleQrCodeScanned = async ({ data }: { data: string }) => {
|
||||||
<View flexG style={{backgroundColor: "#E2E2E2", height: 2}}/>
|
setShowCameraDialog(false);
|
||||||
<Text style={{fontSize: 16, fontFamily: 'PlusJakartaSans_300Light', color: "#7A7A7A"}}>
|
setRedirectOverride(true);
|
||||||
or
|
try {
|
||||||
</Text>
|
await signInWithQrCode({ userId: data });
|
||||||
<View flexG style={{backgroundColor: "#E2E2E2", height: 2}}/>
|
debouncedRouterReplace();
|
||||||
</View>
|
} catch (err) {
|
||||||
|
console.log(err);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
<View>
|
const getCameraPermissions = async (callback: () => void) => {
|
||||||
<Button
|
const { status } = await Camera.requestCameraPermissionsAsync();
|
||||||
label="Contine with Email"
|
setHasPermission(status === "granted");
|
||||||
labelStyle={{
|
if (status === "granted") {
|
||||||
fontFamily: "PlusJakartaSans_400Regular",
|
callback();
|
||||||
fontSize: 16,
|
}
|
||||||
marginLeft: 10
|
};
|
||||||
}}
|
|
||||||
onPress={() => router.push("/(unauth)/sign_up")}
|
|
||||||
style={{height: 50, borderStyle: "solid", borderColor: "#E2E2E2", borderWidth: 2}}
|
|
||||||
color={Colors.black}
|
|
||||||
backgroundColor={"transparent"}
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
|
|
||||||
|
const handleOpenQrCodeDialog = () => {
|
||||||
|
getCameraPermissions(() => setShowCameraDialog(true));
|
||||||
|
};
|
||||||
|
|
||||||
<View flexG/>
|
return (
|
||||||
|
<SafeAreaView style={{ flex: 1, alignItems: "center" }}>
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
flex: 1,
|
||||||
|
padding: 21,
|
||||||
|
paddingBottom: 45,
|
||||||
|
paddingTop: isLoading ? "20%" : getTopPadding(),
|
||||||
|
width: isTablet ? 629 : '100%'
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<View center>
|
||||||
|
<Text style={{ fontSize: 30, fontFamily: "Manrope_600SemiBold" }}>
|
||||||
|
Get started with Cally
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
|
||||||
<View row centerH gap-5>
|
<View width={"100%"} gap-30>
|
||||||
<Text style={{
|
<View>
|
||||||
fontFamily: "PlusJakartaSans_300Light",
|
<Button
|
||||||
fontSize: 16,
|
label="Scan QR Code"
|
||||||
color: "#484848"
|
marginT-50
|
||||||
}} center>
|
labelStyle={{
|
||||||
Already have an account?
|
fontFamily: "PlusJakartaSans_400Regular",
|
||||||
</Text>
|
fontSize: 16,
|
||||||
|
marginLeft: 10,
|
||||||
|
}}
|
||||||
|
iconSource={() => <QRIcon color={"#07B8C7"} />}
|
||||||
|
onPress={handleOpenQrCodeDialog}
|
||||||
|
style={{ height: 50 }}
|
||||||
|
color={Colors.black}
|
||||||
|
backgroundColor={Colors.white}
|
||||||
|
/>
|
||||||
|
{/* GOOGLE LOGIN HERE */}
|
||||||
|
</View>
|
||||||
|
|
||||||
<Button
|
<View row center gap-20>
|
||||||
label="Log in"
|
<View flexG style={{ backgroundColor: "#E2E2E2", height: 2 }} />
|
||||||
link
|
<Text
|
||||||
onPress={() => router.push("/(unauth)/sign_in")}
|
style={{
|
||||||
labelStyle={[
|
fontSize: 16,
|
||||||
{
|
fontFamily: "PlusJakartaSans_300Light",
|
||||||
fontFamily: "PlusJakartaSans_500Medium",
|
color: "#7A7A7A",
|
||||||
fontSize: 16,
|
}}
|
||||||
color: "#919191",
|
|
||||||
},
|
|
||||||
{fontSize: 16, textDecorationLine: "none", color: "#fd1775"},
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
|
|
||||||
{/* Legacy, move into separate component */}
|
|
||||||
{/* Camera Dialog */}
|
|
||||||
<Dialog
|
|
||||||
visible={showCameraDialog}
|
|
||||||
onDismiss={() => setShowCameraDialog(false)}
|
|
||||||
bottom
|
|
||||||
width="100%"
|
|
||||||
height="70%"
|
|
||||||
containerStyle={{padding: 15, backgroundColor: "white"}}
|
|
||||||
>
|
>
|
||||||
<Text center style={{fontSize: 16}} marginB-15>
|
or
|
||||||
Scan a QR code presented from your family member of provider.
|
</Text>
|
||||||
</Text>
|
<View flexG style={{ backgroundColor: "#E2E2E2", height: 2 }} />
|
||||||
{hasPermission === null ? (
|
</View>
|
||||||
<Text>Requesting camera permissions...</Text>
|
|
||||||
) : !hasPermission ? (
|
|
||||||
<Text>No access to camera</Text>
|
|
||||||
) : (
|
|
||||||
<CameraView
|
|
||||||
style={{flex: 1, borderRadius: 15}}
|
|
||||||
onBarcodeScanned={handleQrCodeScanned}
|
|
||||||
barcodeScannerSettings={{
|
|
||||||
barcodeTypes: ["qr"],
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
<Button
|
|
||||||
label="Cancel"
|
|
||||||
onPress={() => setShowCameraDialog(false)}
|
|
||||||
backgroundColor="#fd1775"
|
|
||||||
style={{margin: 10, marginBottom: 30}}
|
|
||||||
/>
|
|
||||||
</Dialog>
|
|
||||||
|
|
||||||
|
<View>
|
||||||
|
<Button
|
||||||
|
label="Continue with Email"
|
||||||
|
labelStyle={{
|
||||||
|
fontFamily: "PlusJakartaSans_400Regular",
|
||||||
|
fontSize: 16,
|
||||||
|
marginLeft: 10,
|
||||||
|
}}
|
||||||
|
onPress={() => router.push("/(unauth)/sign_up")}
|
||||||
|
style={{
|
||||||
|
height: 50,
|
||||||
|
borderStyle: "solid",
|
||||||
|
borderColor: "#E2E2E2",
|
||||||
|
borderWidth: 2,
|
||||||
|
}}
|
||||||
|
color={Colors.black}
|
||||||
|
backgroundColor={"transparent"}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
|
||||||
{isLoading && (
|
{isTablet ? (
|
||||||
<LoaderScreen overlay message={"Signing in..."} backgroundColor={Colors.white} color={Colors.grey40}/>
|
<View marginT-30 />
|
||||||
)}
|
) : (
|
||||||
</SafeAreaView>
|
<View flexG />
|
||||||
)
|
)}
|
||||||
|
|
||||||
|
<View row centerH gap-5>
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
fontFamily: "PlusJakartaSans_300Light",
|
||||||
|
fontSize: 16,
|
||||||
|
color: "#484848",
|
||||||
|
}}
|
||||||
|
center
|
||||||
|
>
|
||||||
|
Already have an account?
|
||||||
|
</Text>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
label="Log in"
|
||||||
|
link
|
||||||
|
onPress={() => router.push("/(unauth)/sign_in")}
|
||||||
|
labelStyle={[
|
||||||
|
{
|
||||||
|
fontFamily: "PlusJakartaSans_500Medium",
|
||||||
|
fontSize: 16,
|
||||||
|
color: "#919191",
|
||||||
|
},
|
||||||
|
{ fontSize: 16, textDecorationLine: "none", color: "#fd1775" },
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
{/* Legacy, move into separate component */}
|
||||||
|
{/* Camera Dialog */}
|
||||||
|
<Dialog
|
||||||
|
visible={showCameraDialog}
|
||||||
|
onDismiss={() => setShowCameraDialog(false)}
|
||||||
|
bottom
|
||||||
|
width="100%"
|
||||||
|
height="70%"
|
||||||
|
containerStyle={{ padding: 15, backgroundColor: "white" }}
|
||||||
|
>
|
||||||
|
<Text center style={{ fontSize: 16 }} marginB-15>
|
||||||
|
Scan a QR code presented from your family member of provider.
|
||||||
|
</Text>
|
||||||
|
{hasPermission === null ? (
|
||||||
|
<Text>Requesting camera permissions...</Text>
|
||||||
|
) : !hasPermission ? (
|
||||||
|
<Text>No access to camera</Text>
|
||||||
|
) : (
|
||||||
|
<CameraView
|
||||||
|
style={{ flex: 1, borderRadius: 15 }}
|
||||||
|
onBarcodeScanned={handleQrCodeScanned}
|
||||||
|
barcodeScannerSettings={{
|
||||||
|
barcodeTypes: ["qr"],
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
<Button
|
||||||
|
label="Cancel"
|
||||||
|
onPress={() => setShowCameraDialog(false)}
|
||||||
|
backgroundColor="#fd1775"
|
||||||
|
style={{ margin: 10, marginBottom: 30 }}
|
||||||
|
/>
|
||||||
|
</Dialog>
|
||||||
|
|
||||||
|
{isLoading && (
|
||||||
|
<LoaderScreen
|
||||||
|
overlay
|
||||||
|
message={"Signing in..."}
|
||||||
|
backgroundColor={Colors.white}
|
||||||
|
color={Colors.grey40}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</SafeAreaView>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import { AntDesign } from "@expo/vector-icons";
|
|||||||
import { IToDo } from "@/hooks/firebase/types/todoData";
|
import { IToDo } from "@/hooks/firebase/types/todoData";
|
||||||
import ToDoItem from "../../todos/ToDoItem";
|
import ToDoItem from "../../todos/ToDoItem";
|
||||||
import { UserProfile } from "@/hooks/firebase/types/profileTypes";
|
import { UserProfile } from "@/hooks/firebase/types/profileTypes";
|
||||||
|
import { ScrollView } from "react-native-gesture-handler";
|
||||||
|
|
||||||
const groupToDosByDate = (toDos: IToDo[]) => {
|
const groupToDosByDate = (toDos: IToDo[]) => {
|
||||||
let sortedTodos = toDos.sort((a, b) => a.date - b.date);
|
let sortedTodos = toDos.sort((a, b) => a.date - b.date);
|
||||||
@ -77,9 +78,7 @@ const groupToDosByDate = (toDos: IToDo[]) => {
|
|||||||
|
|
||||||
const filterToDosByUser = (toDos: IToDo[], uid: string | undefined) => {
|
const filterToDosByUser = (toDos: IToDo[], uid: string | undefined) => {
|
||||||
if (!uid) return [];
|
if (!uid) return [];
|
||||||
return toDos.filter((todo) =>
|
return toDos.filter((todo) => todo.assignees?.includes(uid));
|
||||||
todo.assignees?.includes(uid)
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const SingleUserChoreList = ({ user }: { user: UserProfile }) => {
|
const SingleUserChoreList = ({ user }: { user: UserProfile }) => {
|
||||||
@ -236,34 +235,36 @@ const SingleUserChoreList = ({ user }: { user: UserProfile }) => {
|
|||||||
style={{ minHeight: 800, borderRadius: 9.11 }}
|
style={{ minHeight: 800, borderRadius: 9.11 }}
|
||||||
width={355}
|
width={355}
|
||||||
>
|
>
|
||||||
{noDateToDos.length > 0 && (
|
<ScrollView>
|
||||||
<View key="No Date">
|
{noDateToDos.length > 0 && (
|
||||||
<View row spread paddingH-19 marginB-12>
|
<View key="No Date">
|
||||||
<Text
|
<View row spread paddingH-19 marginB-12>
|
||||||
text70
|
<Text
|
||||||
style={{
|
text70
|
||||||
fontWeight: "bold",
|
style={{
|
||||||
}}
|
fontWeight: "bold",
|
||||||
>
|
}}
|
||||||
Unscheduled
|
>
|
||||||
</Text>
|
Unscheduled
|
||||||
<AntDesign
|
</Text>
|
||||||
name={expandNoDate ? "caretdown" : "caretright"}
|
<AntDesign
|
||||||
size={24}
|
name={expandNoDate ? "caretdown" : "caretright"}
|
||||||
color="#fd1575"
|
size={24}
|
||||||
onPress={() => {
|
color="#fd1575"
|
||||||
setExpandNoDate(!expandNoDate);
|
onPress={() => {
|
||||||
}}
|
setExpandNoDate(!expandNoDate);
|
||||||
/>
|
}}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
{expandNoDate &&
|
||||||
|
noDateToDos
|
||||||
|
.sort((a, b) => Number(a.done) - Number(b.done))
|
||||||
|
.map((item) => <ToDoItem key={item.id} item={item} />)}
|
||||||
</View>
|
</View>
|
||||||
{expandNoDate &&
|
)}
|
||||||
noDateToDos
|
|
||||||
.sort((a, b) => Number(a.done) - Number(b.done))
|
|
||||||
.map((item) => <ToDoItem key={item.id} item={item} />)}
|
|
||||||
</View>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{datedToDos.map(renderTodoGroup)}
|
{datedToDos.map(renderTodoGroup)}
|
||||||
|
</ScrollView>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -34,6 +34,7 @@ const styles = StyleSheet.create({
|
|||||||
flex: 1,
|
flex: 1,
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
borderTopColor: "#a9a9a9",
|
borderTopColor: "#a9a9a9",
|
||||||
|
width: '80%',
|
||||||
borderTopWidth: 1,
|
borderTopWidth: 1,
|
||||||
},
|
},
|
||||||
calendarContainer: {
|
calendarContainer: {
|
||||||
|
|||||||
@ -9,13 +9,15 @@ import {
|
|||||||
TextFieldRef,
|
TextFieldRef,
|
||||||
View,
|
View,
|
||||||
} from "react-native-ui-lib";
|
} from "react-native-ui-lib";
|
||||||
import React, { useRef, useState } from "react";
|
import React, { useEffect, useRef, useState } from "react";
|
||||||
import { useSignIn } from "@/hooks/firebase/useSignIn";
|
import { useSignIn } from "@/hooks/firebase/useSignIn";
|
||||||
import { KeyboardAvoidingView, Platform, StyleSheet } from "react-native";
|
import { Dimensions, KeyboardAvoidingView, Platform, StyleSheet } from "react-native";
|
||||||
import Toast from "react-native-toast-message";
|
import Toast from "react-native-toast-message";
|
||||||
import KeyboardManager from "react-native-keyboard-manager";
|
import KeyboardManager from "react-native-keyboard-manager";
|
||||||
import { SafeAreaView } from "react-native-safe-area-context";
|
import { SafeAreaView } from "react-native-safe-area-context";
|
||||||
import { useRouter } from "expo-router";
|
import { useRouter } from "expo-router";
|
||||||
|
import * as Device from "expo-device";
|
||||||
|
import { DeviceType } from "expo-device";
|
||||||
|
|
||||||
if (Platform.OS === "ios") KeyboardManager.setEnableAutoToolbar(true);
|
if (Platform.OS === "ios") KeyboardManager.setEnableAutoToolbar(true);
|
||||||
|
|
||||||
@ -24,6 +26,27 @@ const SignInPage = () => {
|
|||||||
const [password, setPassword] = useState<string>("");
|
const [password, setPassword] = useState<string>("");
|
||||||
const passwordRef = useRef<TextFieldRef>(null);
|
const passwordRef = useRef<TextFieldRef>(null);
|
||||||
|
|
||||||
|
const isTablet: boolean = Device.deviceType === DeviceType.TABLET;
|
||||||
|
const [isPortrait, setIsPortrait] = useState(() => {
|
||||||
|
const dim = Dimensions.get('screen');
|
||||||
|
return dim.height >= dim.width;
|
||||||
|
});
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const subscription = Dimensions.addEventListener('change', ({ screen }) => {
|
||||||
|
setIsPortrait(screen.height >= screen.width);
|
||||||
|
});
|
||||||
|
|
||||||
|
return () => subscription.remove();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const getTopPadding = () => {
|
||||||
|
if (Device.deviceType === DeviceType.TABLET) {
|
||||||
|
return isPortrait ? "50%" : "15%";
|
||||||
|
}
|
||||||
|
return "20%"; // non-tablet case, regardless of orientation
|
||||||
|
};
|
||||||
|
|
||||||
const { mutateAsync: signIn, error, isError, isLoading } = useSignIn();
|
const { mutateAsync: signIn, error, isError, isLoading } = useSignIn();
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@ -45,13 +68,19 @@ const SignInPage = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView style={{ flex: 1 }}>
|
<SafeAreaView style={{ flex: 1, alignItems: isTablet ? "center" : undefined}}>
|
||||||
<KeyboardAwareScrollView
|
<KeyboardAwareScrollView
|
||||||
contentContainerStyle={{ flexGrow: 1 }}
|
contentContainerStyle={{ flexGrow: 1 }}
|
||||||
enableOnAndroid
|
enableOnAndroid
|
||||||
>
|
>
|
||||||
<View
|
<View
|
||||||
style={{ flex: 1, padding: 21, paddingBottom: 45, paddingTop: "20%" }}
|
style={{
|
||||||
|
flex: 1,
|
||||||
|
padding: 21,
|
||||||
|
paddingBottom: 45,
|
||||||
|
paddingTop: isLoading ? "20%" : getTopPadding(),
|
||||||
|
width: isLoading ? '100%' : (isTablet ? 629 : undefined),
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<View gap-13 width={"100%"} marginB-20>
|
<View gap-13 width={"100%"} marginB-20>
|
||||||
<Text style={{ fontSize: 40, fontFamily: "Manrope_600SemiBold" }}>
|
<Text style={{ fontSize: 40, fontFamily: "Manrope_600SemiBold" }}>
|
||||||
@ -95,7 +124,7 @@ const SignInPage = () => {
|
|||||||
/>
|
/>
|
||||||
</KeyboardAvoidingView>
|
</KeyboardAvoidingView>
|
||||||
|
|
||||||
<View flexG />
|
{isTablet ? <View /> : <View flexG />}
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
label="Log in"
|
label="Log in"
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import React, { useRef, useState } from "react";
|
import React, { useEffect, useRef, useState } from "react";
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
ButtonSize,
|
ButtonSize,
|
||||||
@ -13,11 +13,18 @@ import {
|
|||||||
View,
|
View,
|
||||||
} from "react-native-ui-lib";
|
} from "react-native-ui-lib";
|
||||||
import { useSignUp } from "@/hooks/firebase/useSignUp";
|
import { useSignUp } from "@/hooks/firebase/useSignUp";
|
||||||
import { KeyboardAvoidingView, Platform, StyleSheet } from "react-native";
|
import {
|
||||||
|
Dimensions,
|
||||||
|
KeyboardAvoidingView,
|
||||||
|
Platform,
|
||||||
|
StyleSheet,
|
||||||
|
} from "react-native";
|
||||||
import { AntDesign } from "@expo/vector-icons";
|
import { AntDesign } from "@expo/vector-icons";
|
||||||
import KeyboardManager from "react-native-keyboard-manager";
|
import KeyboardManager from "react-native-keyboard-manager";
|
||||||
import { SafeAreaView } from "react-native-safe-area-context";
|
import { SafeAreaView } from "react-native-safe-area-context";
|
||||||
import { useRouter } from "expo-router";
|
import { useRouter } from "expo-router";
|
||||||
|
import * as Device from "expo-device";
|
||||||
|
import { DeviceType } from "expo-device";
|
||||||
|
|
||||||
if (Platform.OS === "ios") KeyboardManager.setEnableAutoToolbar(true);
|
if (Platform.OS === "ios") KeyboardManager.setEnableAutoToolbar(true);
|
||||||
|
|
||||||
@ -36,6 +43,27 @@ const SignUpPage = () => {
|
|||||||
const emailRef = useRef<TextFieldRef>(null);
|
const emailRef = useRef<TextFieldRef>(null);
|
||||||
const passwordRef = useRef<TextFieldRef>(null);
|
const passwordRef = useRef<TextFieldRef>(null);
|
||||||
|
|
||||||
|
const isTablet: boolean = Device.deviceType === DeviceType.TABLET;
|
||||||
|
const [isPortrait, setIsPortrait] = useState(() => {
|
||||||
|
const dim = Dimensions.get("screen");
|
||||||
|
return dim.height >= dim.width;
|
||||||
|
});
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const subscription = Dimensions.addEventListener("change", ({ screen }) => {
|
||||||
|
setIsPortrait(screen.height >= screen.width);
|
||||||
|
});
|
||||||
|
|
||||||
|
return () => subscription.remove();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const getTopPadding = () => {
|
||||||
|
if (Device.deviceType === DeviceType.TABLET) {
|
||||||
|
return isPortrait ? "50%" : "15%";
|
||||||
|
}
|
||||||
|
return "20%"; // non-tablet case, regardless of orientation
|
||||||
|
};
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const handleSignUp = async () => {
|
const handleSignUp = async () => {
|
||||||
@ -44,13 +72,25 @@ const SignUpPage = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView style={{ flex: 1 }}>
|
<SafeAreaView
|
||||||
|
style={{
|
||||||
|
flex: 1,
|
||||||
|
alignItems: isTablet ? "center" : undefined,
|
||||||
|
width: "100%",
|
||||||
|
}}
|
||||||
|
>
|
||||||
<KeyboardAwareScrollView
|
<KeyboardAwareScrollView
|
||||||
contentContainerStyle={{ flexGrow: 1 }}
|
contentContainerStyle={{ flexGrow: 1 }}
|
||||||
enableOnAndroid
|
enableOnAndroid
|
||||||
>
|
>
|
||||||
<View
|
<View
|
||||||
style={{ flex: 1, padding: 21, paddingBottom: 45, paddingTop: "20%" }}
|
style={{
|
||||||
|
flex: 1,
|
||||||
|
padding: 21,
|
||||||
|
paddingBottom: 45,
|
||||||
|
paddingTop: isLoading ? "20%" : getTopPadding(),
|
||||||
|
width: isLoading ? undefined : (isTablet ? 629 : undefined),
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<View gap-13 width={"100%"} marginB-20>
|
<View gap-13 width={"100%"} marginB-20>
|
||||||
<Text style={{ fontSize: 40, fontFamily: "Manrope_600SemiBold" }}>
|
<Text style={{ fontSize: 40, fontFamily: "Manrope_600SemiBold" }}>
|
||||||
@ -150,7 +190,7 @@ const SignUpPage = () => {
|
|||||||
size={18}
|
size={18}
|
||||||
borderRadius={3}
|
borderRadius={3}
|
||||||
value={allowFaceID}
|
value={allowFaceID}
|
||||||
containerStyle={{borderRadius: 3, width: 18, height: 18}}
|
containerStyle={{ borderRadius: 3, width: 18, height: 18 }}
|
||||||
onValueChange={(value) => {
|
onValueChange={(value) => {
|
||||||
setAllowFaceID(value);
|
setAllowFaceID(value);
|
||||||
}}
|
}}
|
||||||
@ -167,7 +207,7 @@ const SignUpPage = () => {
|
|||||||
]}
|
]}
|
||||||
color="#919191"
|
color="#919191"
|
||||||
size={18}
|
size={18}
|
||||||
containerStyle={{borderRadius: 3, width: 18, height: 18}}
|
containerStyle={{ borderRadius: 3, width: 18, height: 18 }}
|
||||||
borderRadius={3}
|
borderRadius={3}
|
||||||
value={acceptTerms}
|
value={acceptTerms}
|
||||||
onValueChange={(value) => setAcceptTerms(value)}
|
onValueChange={(value) => setAcceptTerms(value)}
|
||||||
@ -191,7 +231,11 @@ const SignUpPage = () => {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View flexG style={{ minHeight: 50 }} />
|
{isTablet ? (
|
||||||
|
<View height={50} />
|
||||||
|
) : (
|
||||||
|
<View flexG style={{ minHeight: 50 }} />
|
||||||
|
)}
|
||||||
|
|
||||||
<View>
|
<View>
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { StyleSheet } from "react-native";
|
import { StyleSheet } from "react-native";
|
||||||
import { Button, View, Text } from "react-native-ui-lib";
|
import { Button, View, Text } from "react-native-ui-lib";
|
||||||
|
import * as Device from "expo-device";
|
||||||
|
import { DeviceType } from "expo-device";
|
||||||
|
|
||||||
interface IDrawerButtonProps {
|
interface IDrawerButtonProps {
|
||||||
bgColor: string;
|
bgColor: string;
|
||||||
@ -11,6 +13,17 @@ interface IDrawerButtonProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const DrawerButton = (props: IDrawerButtonProps) => {
|
const DrawerButton = (props: IDrawerButtonProps) => {
|
||||||
|
const isTablet: boolean = Device.deviceType === DeviceType.TABLET;
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
iconContainer: {
|
||||||
|
width: "70%",
|
||||||
|
aspectRatio: 1,
|
||||||
|
borderRadius: 50,
|
||||||
|
},
|
||||||
|
labelStyle: { fontSize: 15, fontFamily: "Poppins_400Regular" },
|
||||||
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
onPress={props.pressFunc}
|
onPress={props.pressFunc}
|
||||||
@ -40,12 +53,3 @@ const DrawerButton = (props: IDrawerButtonProps) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default DrawerButton;
|
export default DrawerButton;
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
|
||||||
iconContainer: {
|
|
||||||
width: "70%",
|
|
||||||
aspectRatio: 1,
|
|
||||||
borderRadius: 50,
|
|
||||||
},
|
|
||||||
labelStyle: { fontSize: 15, fontFamily: "Poppins_400Regular" },
|
|
||||||
});
|
|
||||||
|
|||||||
Reference in New Issue
Block a user