mirror of
https://github.com/urosran/cally.git
synced 2025-11-26 00:24:53 +00:00
user creation flow fix
This commit is contained in:
@ -48,7 +48,7 @@ export const EventCalendar: React.FC<EventCalendarProps> = React.memo(({calendar
|
|||||||
}, [events, mode]);
|
}, [events, mode]);
|
||||||
|
|
||||||
const handlePressEvent = useCallback((event: CalendarEvent) => {
|
const handlePressEvent = useCallback((event: CalendarEvent) => {
|
||||||
if (mode === "day") {
|
if (mode === "day" || mode === "week") {
|
||||||
setEditVisible(true);
|
setEditVisible(true);
|
||||||
console.log({event})
|
console.log({event})
|
||||||
setEventForEdit(event);
|
setEventForEdit(event);
|
||||||
@ -60,7 +60,7 @@ export const EventCalendar: React.FC<EventCalendarProps> = React.memo(({calendar
|
|||||||
|
|
||||||
const handlePressCell = useCallback(
|
const handlePressCell = useCallback(
|
||||||
(date: Date) => {
|
(date: Date) => {
|
||||||
if (mode === "day") {
|
if (mode === "day" || mode === "week") {
|
||||||
setSelectedNewEndDate(date);
|
setSelectedNewEndDate(date);
|
||||||
} else {
|
} else {
|
||||||
setMode("day")
|
setMode("day")
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import ProfileIcon from "@/assets/svgs/ProfileIcon";
|
|||||||
import CalendarIcon from "@/assets/svgs/CalendarIcon";
|
import CalendarIcon from "@/assets/svgs/CalendarIcon";
|
||||||
import PrivacyPolicyIcon from "@/assets/svgs/PrivacyPolicyIcon";
|
import PrivacyPolicyIcon from "@/assets/svgs/PrivacyPolicyIcon";
|
||||||
import ArrowRightIcon from "@/assets/svgs/ArrowRightIcon";
|
import ArrowRightIcon from "@/assets/svgs/ArrowRightIcon";
|
||||||
|
import {ProfileType, useAuthContext} from "@/contexts/AuthContext";
|
||||||
|
|
||||||
const pageIndex = {
|
const pageIndex = {
|
||||||
main: 0,
|
main: 0,
|
||||||
@ -19,18 +20,22 @@ const pageIndex = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const SettingsPage = () => {
|
const SettingsPage = () => {
|
||||||
|
const {profileData} = useAuthContext()
|
||||||
|
const isntParent = profileData?.userType !== ProfileType.PARENT
|
||||||
|
|
||||||
const [selectedPage, setSelectedPage] = useState<number>(0);
|
const [selectedPage, setSelectedPage] = useState<number>(0);
|
||||||
return (
|
return (
|
||||||
<View flexG>
|
<View flexG>
|
||||||
{selectedPage == 0 && (
|
{selectedPage == 0 && (
|
||||||
<View flexG centerH marginH-30 marginT-30>
|
<View flexG centerH marginH-30 marginT-30>
|
||||||
<Button
|
<Button
|
||||||
|
disabled={isntParent}
|
||||||
backgroundColor="white"
|
backgroundColor="white"
|
||||||
style={styles.mainBtn}
|
style={styles.mainBtn}
|
||||||
children={
|
children={
|
||||||
<View row centerV width={"100%"}>
|
<View row centerV width={"100%"}>
|
||||||
<ProfileIcon style={{marginRight: 10}} color="#07b9c8"/>
|
<ProfileIcon style={{marginRight: 10}} color="#07b9c8"/>
|
||||||
<Text style={styles.label} color="#07b8c7">
|
<Text style={[styles.label, isntParent && styles.disabledText]}>
|
||||||
Manage My Profile
|
Manage My Profile
|
||||||
</Text>
|
</Text>
|
||||||
<ArrowRightIcon style={{marginLeft: "auto"}}/>
|
<ArrowRightIcon style={{marginLeft: "auto"}}/>
|
||||||
@ -39,12 +44,13 @@ const SettingsPage = () => {
|
|||||||
onPress={() => setSelectedPage(pageIndex.user)}
|
onPress={() => setSelectedPage(pageIndex.user)}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
|
disabled={isntParent}
|
||||||
backgroundColor="white"
|
backgroundColor="white"
|
||||||
style={styles.mainBtn}
|
style={styles.mainBtn}
|
||||||
children={
|
children={
|
||||||
<View row centerV width={"100%"}>
|
<View row centerV width={"100%"}>
|
||||||
<CalendarIcon style={{marginRight: 10}}/>
|
<CalendarIcon style={{marginRight: 10}}/>
|
||||||
<Text style={styles.label} color="#fd1775">
|
<Text style={[styles.label, isntParent && styles.disabledText]}>
|
||||||
Calendar Settings
|
Calendar Settings
|
||||||
</Text>
|
</Text>
|
||||||
<ArrowRightIcon style={{marginLeft: "auto"}}/>
|
<ArrowRightIcon style={{marginLeft: "auto"}}/>
|
||||||
@ -55,6 +61,7 @@ const SettingsPage = () => {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
|
disabled={isntParent}
|
||||||
backgroundColor="white"
|
backgroundColor="white"
|
||||||
style={styles.mainBtn}
|
style={styles.mainBtn}
|
||||||
children={
|
children={
|
||||||
@ -65,7 +72,7 @@ const SettingsPage = () => {
|
|||||||
color="#ff9900"
|
color="#ff9900"
|
||||||
style={{marginRight: 10}}
|
style={{marginRight: 10}}
|
||||||
/>
|
/>
|
||||||
<Text style={styles.label} color="#ff9900">
|
<Text style={[styles.label, isntParent && styles.disabledText]}>
|
||||||
To-Do Reward Settings
|
To-Do Reward Settings
|
||||||
</Text>
|
</Text>
|
||||||
<ArrowRightIcon style={{marginLeft: "auto"}}/>
|
<ArrowRightIcon style={{marginLeft: "auto"}}/>
|
||||||
@ -79,7 +86,7 @@ const SettingsPage = () => {
|
|||||||
children={
|
children={
|
||||||
<View row centerV width={"100%"}>
|
<View row centerV width={"100%"}>
|
||||||
<PrivacyPolicyIcon style={{marginRight: 10}}/>
|
<PrivacyPolicyIcon style={{marginRight: 10}}/>
|
||||||
<Text style={styles.label} color="#6c645b">
|
<Text style={styles.label}>
|
||||||
Cally Privacy Policy
|
Cally Privacy Policy
|
||||||
</Text>
|
</Text>
|
||||||
<ArrowRightIcon style={{marginLeft: "auto"}}/>
|
<ArrowRightIcon style={{marginLeft: "auto"}}/>
|
||||||
@ -115,4 +122,7 @@ const styles = StyleSheet.create({
|
|||||||
fontSize: 14.71,
|
fontSize: 14.71,
|
||||||
textAlignVertical: "center",
|
textAlignVertical: "center",
|
||||||
},
|
},
|
||||||
});
|
disabledText: {
|
||||||
|
color: '#A9A9A9', // Example of a gray color for disabled text
|
||||||
|
},
|
||||||
|
});
|
||||||
@ -43,7 +43,7 @@ const MyGroup = () => {
|
|||||||
const lNameRef = useRef<TextFieldRef>(null);
|
const lNameRef = useRef<TextFieldRef>(null);
|
||||||
const emailRef = useRef<TextFieldRef>(null);
|
const emailRef = useRef<TextFieldRef>(null);
|
||||||
|
|
||||||
const [showQRCodeDialog, setShowQRCodeDialog] = useState("");
|
const [showQRCodeDialog, setShowQRCodeDialog] = useState<string | boolean>(false);
|
||||||
|
|
||||||
const {mutateAsync: createSubUser, isLoading, isError} = useCreateSubUser();
|
const {mutateAsync: createSubUser, isLoading, isError} = useCreateSubUser();
|
||||||
const {data: familyMembers} = useGetFamilyMembers(true);
|
const {data: familyMembers} = useGetFamilyMembers(true);
|
||||||
@ -149,7 +149,7 @@ const MyGroup = () => {
|
|||||||
<View flex-1/>
|
<View flex-1/>
|
||||||
|
|
||||||
<UserMenu
|
<UserMenu
|
||||||
setShowQRCodeDialog={(val) => setShowQRCodeDialog("")}
|
setShowQRCodeDialog={(val) => setShowQRCodeDialog(val)}
|
||||||
showQRCodeDialog={showQRCodeDialog === member?.uid}
|
showQRCodeDialog={showQRCodeDialog === member?.uid}
|
||||||
userId={member?.uid!}
|
userId={member?.uid!}
|
||||||
/>
|
/>
|
||||||
@ -187,8 +187,10 @@ const MyGroup = () => {
|
|||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
|
<View flex-1/>
|
||||||
|
|
||||||
<UserMenu
|
<UserMenu
|
||||||
setShowQRCodeDialog={(val) => setShowQRCodeDialog("")}
|
setShowQRCodeDialog={(val) => setShowQRCodeDialog(val)}
|
||||||
showQRCodeDialog={showQRCodeDialog === member?.uid}
|
showQRCodeDialog={showQRCodeDialog === member?.uid}
|
||||||
userId={member?.uid!}
|
userId={member?.uid!}
|
||||||
/>
|
/>
|
||||||
@ -224,8 +226,10 @@ const MyGroup = () => {
|
|||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
|
<View flex-1/>
|
||||||
|
|
||||||
<UserMenu
|
<UserMenu
|
||||||
setShowQRCodeDialog={(val) => setShowQRCodeDialog("")}
|
setShowQRCodeDialog={(val) => setShowQRCodeDialog(val)}
|
||||||
showQRCodeDialog={showQRCodeDialog === member?.uid}
|
showQRCodeDialog={showQRCodeDialog === member?.uid}
|
||||||
userId={member?.uid!}
|
userId={member?.uid!}
|
||||||
/>
|
/>
|
||||||
@ -242,7 +246,7 @@ const MyGroup = () => {
|
|||||||
visible
|
visible
|
||||||
button={{
|
button={{
|
||||||
label: "+ Add a user device",
|
label: "+ Add a user device",
|
||||||
onPress: () => setShowAddUserDialog(true),
|
onPress: () => setShowNewUserInfoDialog(true),
|
||||||
style: styles.bottomButton,
|
style: styles.bottomButton,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
import React, {useState} from 'react';
|
import React from 'react';
|
||||||
import {Button, Card, Colors, Dialog, Hint, ListItem, Text, View} from 'react-native-ui-lib';
|
import {Button, Card, Dialog, Text, TouchableOpacity} from 'react-native-ui-lib';
|
||||||
import QRCode from 'react-native-qrcode-svg';
|
import QRCode from 'react-native-qrcode-svg';
|
||||||
import {PanningDirectionsEnum} from "react-native-ui-lib/src/components/panningViews/panningProvider";
|
import {PanningDirectionsEnum} from "react-native-ui-lib/src/components/panningViews/panningProvider";
|
||||||
|
import Ionicons from "@expo/vector-icons/Ionicons";
|
||||||
|
|
||||||
const UserMenu = ({
|
const UserMenu = ({
|
||||||
userId,
|
userId,
|
||||||
@ -10,40 +11,20 @@ const UserMenu = ({
|
|||||||
}: {
|
}: {
|
||||||
userId: string,
|
userId: string,
|
||||||
showQRCodeDialog: boolean,
|
showQRCodeDialog: boolean,
|
||||||
setShowQRCodeDialog: (value: boolean) => void
|
setShowQRCodeDialog: (value: string | boolean) => void
|
||||||
}) => {
|
}) => {
|
||||||
const [showHint, setShowHint] = useState(false);
|
|
||||||
|
|
||||||
const handleShowQRCode = () => {
|
const handleShowQRCode = () => {
|
||||||
setShowHint(false);
|
setShowQRCodeDialog(userId);
|
||||||
setTimeout(() => {
|
|
||||||
setShowQRCodeDialog(true);
|
|
||||||
}, 500);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Hint
|
<TouchableOpacity
|
||||||
onBackgroundPress={() => setShowHint(false)}
|
onPress={handleShowQRCode}
|
||||||
onPress={() => setShowHint(true)}
|
|
||||||
color={Colors.white}
|
|
||||||
customContent={
|
|
||||||
<View height={18}>
|
|
||||||
<ListItem onPress={handleShowQRCode}>
|
|
||||||
<Text style={{fontFamily: "Manrope_500Medium"}}>Show Login QR Code</Text>
|
|
||||||
</ListItem>
|
|
||||||
</View>
|
|
||||||
}
|
|
||||||
enableShadow
|
|
||||||
visible={showHint}
|
|
||||||
backdropColor="transparent"
|
|
||||||
>
|
>
|
||||||
<View>
|
<Ionicons name="qr-code-outline" size={24} color="black"/>
|
||||||
<Button link onPress={() => setShowHint(!showHint)}>
|
</TouchableOpacity>
|
||||||
<Text>...</Text>
|
|
||||||
</Button>
|
|
||||||
</View>
|
|
||||||
</Hint>
|
|
||||||
|
|
||||||
<Dialog
|
<Dialog
|
||||||
visible={showQRCodeDialog}
|
visible={showQRCodeDialog}
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import {IToDo} from "@/hooks/firebase/types/todoData";
|
|||||||
|
|
||||||
export const useGetTodos = () => {
|
export const useGetTodos = () => {
|
||||||
const { user, profileData } = useAuthContext();
|
const { user, profileData } = useAuthContext();
|
||||||
|
//TODO: Add role based filtering for todos
|
||||||
|
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey: ["todos", user?.uid],
|
queryKey: ["todos", user?.uid],
|
||||||
|
|||||||
@ -117,6 +117,7 @@
|
|||||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER).expo.index_route</string>
|
<string>$(PRODUCT_BUNDLE_IDENTIFIER).expo.index_route</string>
|
||||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER).expo.index_route</string>
|
<string>$(PRODUCT_BUNDLE_IDENTIFIER).expo.index_route</string>
|
||||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER).expo.index_route</string>
|
<string>$(PRODUCT_BUNDLE_IDENTIFIER).expo.index_route</string>
|
||||||
|
<string>$(PRODUCT_BUNDLE_IDENTIFIER).expo.index_route</string>
|
||||||
</array>
|
</array>
|
||||||
<key>UILaunchStoryboardName</key>
|
<key>UILaunchStoryboardName</key>
|
||||||
<string>SplashScreen</string>
|
<string>SplashScreen</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user