mirror of
https://github.com/urosran/cally.git
synced 2025-11-26 16:34:54 +00:00
Merge branch 'dev'
This commit is contained in:
@ -256,7 +256,7 @@ export default function TabLayout() {
|
|||||||
/>*/}
|
/>*/}
|
||||||
<DrawerButton
|
<DrawerButton
|
||||||
color="#8005eb"
|
color="#8005eb"
|
||||||
title={"To Do's"}
|
title={"To Dos"}
|
||||||
bgColor={"#f3e6fd"}
|
bgColor={"#f3e6fd"}
|
||||||
pressFunc={() => {
|
pressFunc={() => {
|
||||||
props.navigation.navigate("todos");
|
props.navigation.navigate("todos");
|
||||||
@ -401,8 +401,8 @@ export default function TabLayout() {
|
|||||||
drawerLabel: "To-Do",
|
drawerLabel: "To-Do",
|
||||||
title:
|
title:
|
||||||
Device.deviceType === DeviceType.TABLET
|
Device.deviceType === DeviceType.TABLET
|
||||||
? "Family To Do's"
|
? "Family To Dos"
|
||||||
: "To Do's",
|
: "To Dos",
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Drawer.Screen
|
<Drawer.Screen
|
||||||
|
|||||||
@ -23,7 +23,7 @@ const ViewSwitch = memo(function ViewSwitch({ navigation }: ViewSwitchProps) {
|
|||||||
<SegmentedControl
|
<SegmentedControl
|
||||||
segments={[
|
segments={[
|
||||||
{ label: "Calendar", segmentLabelStyle: styles.labelStyle },
|
{ label: "Calendar", segmentLabelStyle: styles.labelStyle },
|
||||||
{ label: "To Do's", segmentLabelStyle: styles.labelStyle },
|
{ label: "To Dos", segmentLabelStyle: styles.labelStyle },
|
||||||
]}
|
]}
|
||||||
containerStyle={styles.segmentContainer}
|
containerStyle={styles.segmentContainer}
|
||||||
style={styles.segment}
|
style={styles.segment}
|
||||||
|
|||||||
@ -3,12 +3,13 @@ import React, {useState} from "react";
|
|||||||
import {Button, Text, TextField, View} from "react-native-ui-lib";
|
import {Button, Text, TextField, View} from "react-native-ui-lib";
|
||||||
import DumpList from "./DumpList";
|
import DumpList from "./DumpList";
|
||||||
import HeaderTemplate from "@/components/shared/HeaderTemplate";
|
import HeaderTemplate from "@/components/shared/HeaderTemplate";
|
||||||
import {Feather, MaterialIcons} from "@expo/vector-icons";
|
import {Feather} from "@expo/vector-icons";
|
||||||
import AddBrainDump from "./AddBrainDump";
|
import AddBrainDump from "./AddBrainDump";
|
||||||
import LinearGradient from "react-native-linear-gradient";
|
import LinearGradient from "react-native-linear-gradient";
|
||||||
import PlusIcon from "@/assets/svgs/PlusIcon";
|
import PlusIcon from "@/assets/svgs/PlusIcon";
|
||||||
import * as Device from 'expo-device'
|
import * as Device from 'expo-device'
|
||||||
import {DeviceType} from 'expo-device'
|
import {DeviceType} from 'expo-device'
|
||||||
|
|
||||||
const BrainDumpPage = () => {
|
const BrainDumpPage = () => {
|
||||||
const [searchText, setSearchText] = useState<string>("");
|
const [searchText, setSearchText] = useState<string>("");
|
||||||
const [isAddVisible, setIsAddVisible] = useState<boolean>(false);
|
const [isAddVisible, setIsAddVisible] = useState<boolean>(false);
|
||||||
@ -21,7 +22,7 @@ const BrainDumpPage = () => {
|
|||||||
showsVerticalScrollIndicator={false}
|
showsVerticalScrollIndicator={false}
|
||||||
showsHorizontalScrollIndicator={false}
|
showsHorizontalScrollIndicator={false}
|
||||||
>
|
>
|
||||||
<View marginH-25 style={isTablet ? {alignItems: 'center'} : undefined}>
|
<View marginH-25 marginT-20 style={isTablet ? {alignItems: 'center'} : undefined}>
|
||||||
<HeaderTemplate
|
<HeaderTemplate
|
||||||
message={"Welcome to your notes!"}
|
message={"Welcome to your notes!"}
|
||||||
isWelcome={false}
|
isWelcome={false}
|
||||||
@ -117,6 +118,8 @@ const styles = StyleSheet.create({
|
|||||||
height: 42,
|
height: 42,
|
||||||
paddingLeft: 10,
|
paddingLeft: 10,
|
||||||
marginVertical: 20,
|
marginVertical: 20,
|
||||||
|
marginTop: 30,
|
||||||
|
boxShadow: 'inset 0px 0px 37px 0px rgba(239,238,237,1)',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -18,7 +18,7 @@ const BrainDumpItem = (props: { item: IBrainDump }) => {
|
|||||||
marginV-5
|
marginV-5
|
||||||
paddingH-13
|
paddingH-13
|
||||||
paddingV-10
|
paddingV-10
|
||||||
style={{ borderRadius: 15, elevation: 2 }}
|
style={{ borderRadius: 15, elevation: 0 }}
|
||||||
>
|
>
|
||||||
<Text
|
<Text
|
||||||
text70B
|
text70B
|
||||||
|
|||||||
@ -145,7 +145,7 @@ const MoveBrainDump = (props: {
|
|||||||
style={styles.optionsIcon}
|
style={styles.optionsIcon}
|
||||||
/>
|
/>
|
||||||
<Text style={styles.optionsReg}>Move to</Text>
|
<Text style={styles.optionsReg}>Move to</Text>
|
||||||
<Text style={styles.optionsBold}> my to do's</Text>
|
<Text style={styles.optionsBold}> my to dos</Text>
|
||||||
</View>
|
</View>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
<TouchableOpacity>
|
<TouchableOpacity>
|
||||||
|
|||||||
@ -422,7 +422,7 @@ export const ManuallyAddEventModal = () => {
|
|||||||
is24Hour={profileData?.userType === ProfileType.PARENT ? false : true}
|
is24Hour={profileData?.userType === ProfileType.PARENT ? false : true}
|
||||||
onChange={(time) => {
|
onChange={(time) => {
|
||||||
if (endDate.getDate() === startDate.getDate() &&
|
if (endDate.getDate() === startDate.getDate() &&
|
||||||
time.getHours() >= endTime.getHours())
|
time.getHours() >= endTime.getHours() && time.getMinutes() >= endTime.getHours())
|
||||||
{
|
{
|
||||||
const newEndDate = new Date(endDate);
|
const newEndDate = new Date(endDate);
|
||||||
|
|
||||||
@ -435,7 +435,7 @@ export const ManuallyAddEventModal = () => {
|
|||||||
}}
|
}}
|
||||||
minuteInterval={5}
|
minuteInterval={5}
|
||||||
mode="time"
|
mode="time"
|
||||||
timeFormat={profileData?.userType === ProfileType.PARENT ? "hh:mm" : "HH:mm"}
|
timeFormat={profileData?.userType === ProfileType.PARENT ? "hh:mm A" : "HH:mm A"}
|
||||||
style={[styles.timePicker]}
|
style={[styles.timePicker]}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
@ -461,7 +461,8 @@ export const ManuallyAddEventModal = () => {
|
|||||||
setEndTime(time);
|
setEndTime(time);
|
||||||
if (
|
if (
|
||||||
endDate.getDate() === startDate.getDate() &&
|
endDate.getDate() === startDate.getDate() &&
|
||||||
time.getHours() < startTime.getHours()
|
time.getHours() <= startTime.getHours() &&
|
||||||
|
time.getMinutes() <= startTime.getMinutes()
|
||||||
) {
|
) {
|
||||||
const newEndDate = new Date(endDate);
|
const newEndDate = new Date(endDate);
|
||||||
newEndDate.setDate(newEndDate.getDate() + 1);
|
newEndDate.setDate(newEndDate.getDate() + 1);
|
||||||
@ -470,7 +471,7 @@ export const ManuallyAddEventModal = () => {
|
|||||||
}}
|
}}
|
||||||
minuteInterval={5}
|
minuteInterval={5}
|
||||||
mode="time"
|
mode="time"
|
||||||
timeFormat={profileData?.userType === ProfileType.PARENT ? "hh:mm" : "HH:mm"}
|
timeFormat={profileData?.userType === ProfileType.PARENT ? "hh:mm A" : "HH:mm A"}
|
||||||
style={[styles.timePicker]}
|
style={[styles.timePicker]}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@ -139,7 +139,13 @@ const ToDosList = ({ isSettings, members }: { isSettings?: boolean, members?: Ar
|
|||||||
if (localTodos && selectedFilter) {
|
if (localTodos && selectedFilter) {
|
||||||
let resolvedGroupedTodos;
|
let resolvedGroupedTodos;
|
||||||
if (selectedFilter?.value === FILTER_OPTIONS.EVERYONE) {
|
if (selectedFilter?.value === FILTER_OPTIONS.EVERYONE) {
|
||||||
resolvedGroupedTodos = groupToDosByDate(toDos ?? []);
|
let filtered = localTodos?.filter((todo) =>
|
||||||
|
todo.assignees?.some(assigneeId =>
|
||||||
|
members.some(member => member.uid === assigneeId)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
resolvedGroupedTodos = groupToDosByDate(filtered ?? []);
|
||||||
} else {
|
} else {
|
||||||
let filtered = localTodos?.filter((todo) => todo.assignees?.includes(selectedFilter.value)) || [];
|
let filtered = localTodos?.filter((todo) => todo.assignees?.includes(selectedFilter.value)) || [];
|
||||||
|
|
||||||
@ -327,10 +333,15 @@ const ToDosList = ({ isSettings, members }: { isSettings?: boolean, members?: Ar
|
|||||||
style={{ marginRight: 8 }}
|
style={{ marginRight: 8 }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
renderItem={(item) => {
|
renderItem={(item, selected) => {
|
||||||
return (
|
return (
|
||||||
<View height={36.02} centerV>
|
<View height={36.02} centerV>
|
||||||
<Text style={styles.itemText}>{item.label}</Text>
|
<Text style={[
|
||||||
|
styles.itemText,
|
||||||
|
selected && { color: 'white' }
|
||||||
|
]}>
|
||||||
|
{item.label}
|
||||||
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
|
|||||||
@ -41,7 +41,7 @@ const ToDosPage = () => {
|
|||||||
<View>
|
<View>
|
||||||
<View>
|
<View>
|
||||||
<HeaderTemplate
|
<HeaderTemplate
|
||||||
message="Here are your To Do's"
|
message="Here are your To Dos"
|
||||||
isWelcome={true}
|
isWelcome={true}
|
||||||
link={profileData?.userType == ProfileType.PARENT && pageLink}
|
link={profileData?.userType == ProfileType.PARENT && pageLink}
|
||||||
isToDos={true}
|
isToDos={true}
|
||||||
|
|||||||
@ -33,7 +33,7 @@ const FamilyChoresProgress = ({
|
|||||||
style={{ fontFamily: "Poppins_400Regular", fontSize: 14.71 }}
|
style={{ fontFamily: "Poppins_400Regular", fontSize: 14.71 }}
|
||||||
color="#979797"
|
color="#979797"
|
||||||
>
|
>
|
||||||
Return to To Do's
|
Return to To Dos
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
@ -123,7 +123,7 @@ const FamilyChoresProgress = ({
|
|||||||
</Text>
|
</Text>
|
||||||
<View centerV>
|
<View centerV>
|
||||||
<Text style={{ fontSize: 15, fontFamily: "Manrope_700Bold" }}>
|
<Text style={{ fontSize: 15, fontFamily: "Manrope_700Bold" }}>
|
||||||
x/y chores completed
|
{`${child?.weeklyCompletedTodos ?? 0}/y chores completed`}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@ -44,5 +44,7 @@ export interface UserProfile {
|
|||||||
microsoftAccounts?: { [email: string]: MicrosoftAccount };
|
microsoftAccounts?: { [email: string]: MicrosoftAccount };
|
||||||
appleAccounts?: { [email: string]: AppleAccount };
|
appleAccounts?: { [email: string]: AppleAccount };
|
||||||
weeklyPoints?: number;
|
weeklyPoints?: number;
|
||||||
|
weeklyDayPoints?: Object;
|
||||||
allTimePoints?: number;
|
allTimePoints?: number;
|
||||||
|
weeklyCompletedTodos?: number;
|
||||||
}
|
}
|
||||||
@ -130,16 +130,37 @@ export const useUpdateTodo = () => {
|
|||||||
? userWeeklyPoints + todoUpdate.points
|
? userWeeklyPoints + todoUpdate.points
|
||||||
: userWeeklyPoints - todoUpdate.points;
|
: userWeeklyPoints - todoUpdate.points;
|
||||||
|
|
||||||
|
let pointsPerDay = userData.weeklyDayPoints || {
|
||||||
|
Monday: 0,
|
||||||
|
Tuesday: 0,
|
||||||
|
Wednesday: 0,
|
||||||
|
Thursday: 0,
|
||||||
|
Friday: 0,
|
||||||
|
Saturday: 0,
|
||||||
|
Sunday: 0,
|
||||||
|
};
|
||||||
|
const currentDay = getCurrentDay();
|
||||||
|
const updatedPointsPerDay = todoData.done
|
||||||
|
? pointsPerDay[currentDay] + todoUpdate.points
|
||||||
|
: pointsPerDay[currentDay] - todoUpdate.points;
|
||||||
|
pointsPerDay[currentDay] = Math.max(0, updatedPointsPerDay);
|
||||||
|
|
||||||
let userAllTimePoints = userData.allTimePoints ?? 0;
|
let userAllTimePoints = userData.allTimePoints ?? 0;
|
||||||
const allTimePoints = todoData.done
|
const allTimePoints = todoData.done
|
||||||
? userAllTimePoints + todoUpdate.points
|
? userAllTimePoints + todoUpdate.points
|
||||||
: userAllTimePoints - todoUpdate.points;
|
: userAllTimePoints - todoUpdate.points;
|
||||||
|
|
||||||
|
const weeklyCompletedTodos = todoData.done
|
||||||
|
? (userData.weeklyCompletedTodos || 0) + 1
|
||||||
|
: (userData.weeklyCompletedTodos || 0) - 1;
|
||||||
|
|
||||||
// Update the user's points in Firestore
|
// Update the user's points in Firestore
|
||||||
userData = {
|
userData = {
|
||||||
...userData,
|
...userData,
|
||||||
weeklyPoints: weeklyPoints >= 0 ? weeklyPoints : 0,
|
weeklyPoints: weeklyPoints >= 0 ? weeklyPoints : 0,
|
||||||
allTimePoints: allTimePoints >= 0 ? allTimePoints : 0
|
weeklyDayPoints: updatedPointsPerDay,
|
||||||
|
allTimePoints: allTimePoints >= 0 ? allTimePoints : 0,
|
||||||
|
weeklyCompletedTodos: weeklyCompletedTodos >= 0 ? weeklyCompletedTodos : 0
|
||||||
}
|
}
|
||||||
userBatch.update(userRef, userData);
|
userBatch.update(userRef, userData);
|
||||||
});
|
});
|
||||||
@ -162,3 +183,9 @@ export const useUpdateTodo = () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getCurrentDay = () => {
|
||||||
|
const days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
|
||||||
|
const now = new Date();
|
||||||
|
return days[now.getDay()];
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user