mirror of
https://github.com/urosran/cally.git
synced 2025-11-26 00:24:53 +00:00
Merge branch 'dev'
# Conflicts: # app/_layout.tsx # firebase/functions/index.js
This commit is contained in:
87
app/(unauth)/household_page.tsx
Normal file
87
app/(unauth)/household_page.tsx
Normal file
@ -0,0 +1,87 @@
|
||||
import { SafeAreaView } from "react-native-safe-area-context";
|
||||
import { Button, Text, View, TextField } from "react-native-ui-lib";
|
||||
import React, { useState } from "react";
|
||||
import { useRouter } from "expo-router";
|
||||
import { StyleSheet } from "react-native";
|
||||
import { useAuthContext } from "@/contexts/AuthContext";
|
||||
import { useUpdateHouseholdName } from "@/hooks/firebase/useUpdateHouseholdName";
|
||||
|
||||
export default function NewHouseholdScreen() {
|
||||
const router = useRouter();
|
||||
const { user, profileData } = useAuthContext();
|
||||
const [householdName, setHouseholdName] = useState("");
|
||||
const { mutateAsync: newHousehold } = useUpdateHouseholdName();
|
||||
|
||||
const handleContinue = async () => {
|
||||
try {
|
||||
if(profileData?.familyId)
|
||||
newHousehold({familyId: profileData?.familyId, name: householdName}).then(() => router.push("/(unauth)/cal_sync"));
|
||||
} catch (error) {
|
||||
console.error("Error saving household name:", error);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<SafeAreaView style={{ flex: 1 }}>
|
||||
<View
|
||||
style={{
|
||||
flex: 1,
|
||||
padding: 21,
|
||||
paddingBottom: 45,
|
||||
paddingTop: "20%",
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<View gap-13 width={"100%"} marginB-20>
|
||||
<Text style={{ fontSize: 40, fontFamily: "Manrope_600SemiBold" }}>
|
||||
Name your household
|
||||
</Text>
|
||||
<Text color={"#919191"} style={{ fontSize: 20 }}>
|
||||
Give your family group a unique name!
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
<View width={"100%"} flexG>
|
||||
<TextField
|
||||
value={householdName}
|
||||
onChangeText={setHouseholdName}
|
||||
placeholder="Enter household name"
|
||||
style={styles.textfield}
|
||||
textAlign="center"
|
||||
/>
|
||||
</View>
|
||||
|
||||
<View flexG />
|
||||
|
||||
<View width={"100%"}>
|
||||
<Button
|
||||
label="Continue"
|
||||
onPress={handleContinue}
|
||||
style={{
|
||||
height: 50,
|
||||
}}
|
||||
backgroundColor="#fd1775"
|
||||
labelStyle={{
|
||||
fontFamily: "PlusJakartaSans_600SemiBold",
|
||||
fontSize: 16,
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
</SafeAreaView>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
textfield: {
|
||||
backgroundColor: "white",
|
||||
marginVertical: 100,
|
||||
padding: 30,
|
||||
height: 44,
|
||||
borderRadius: 50,
|
||||
fontFamily: "PlusJakartaSans_300Light",
|
||||
fontSize: 15,
|
||||
color: "#919191",
|
||||
alignContent: "center",
|
||||
},
|
||||
});
|
||||
@ -55,6 +55,9 @@ import {Platform} from 'react-native';
|
||||
import KeyboardManager from 'react-native-keyboard-manager';
|
||||
import {enableScreens, enableFreeze} from 'react-native-screens';
|
||||
import {PersistQueryClientProvider} from "@/contexts/PersistQueryClientProvider";
|
||||
import auth from "@react-native-firebase/auth";
|
||||
import firestore from '@react-native-firebase/firestore';
|
||||
import functions from '@react-native-firebase/functions';
|
||||
|
||||
enableScreens(true)
|
||||
enableFreeze(true)
|
||||
|
||||
Reference in New Issue
Block a user