mirror of
https://github.com/urosran/cally.git
synced 2025-11-26 00:24:53 +00:00
Merge branch 'dev'
This commit is contained in:
@ -256,7 +256,7 @@ export default function TabLayout() {
|
||||
/>*/}
|
||||
<DrawerButton
|
||||
color="#8005eb"
|
||||
title={"To Do's"}
|
||||
title={"To Dos"}
|
||||
bgColor={"#f3e6fd"}
|
||||
pressFunc={() => {
|
||||
props.navigation.navigate("todos");
|
||||
@ -401,8 +401,8 @@ export default function TabLayout() {
|
||||
drawerLabel: "To-Do",
|
||||
title:
|
||||
Device.deviceType === DeviceType.TABLET
|
||||
? "Family To Do's"
|
||||
: "To Do's",
|
||||
? "Family To Dos"
|
||||
: "To Dos",
|
||||
}}
|
||||
/>
|
||||
<Drawer.Screen
|
||||
|
||||
@ -23,7 +23,7 @@ const ViewSwitch = memo(function ViewSwitch({ navigation }: ViewSwitchProps) {
|
||||
<SegmentedControl
|
||||
segments={[
|
||||
{ label: "Calendar", segmentLabelStyle: styles.labelStyle },
|
||||
{ label: "To Do's", segmentLabelStyle: styles.labelStyle },
|
||||
{ label: "To Dos", segmentLabelStyle: styles.labelStyle },
|
||||
]}
|
||||
containerStyle={styles.segmentContainer}
|
||||
style={styles.segment}
|
||||
|
||||
@ -3,12 +3,13 @@ import React, {useState} from "react";
|
||||
import {Button, Text, TextField, View} from "react-native-ui-lib";
|
||||
import DumpList from "./DumpList";
|
||||
import HeaderTemplate from "@/components/shared/HeaderTemplate";
|
||||
import {Feather, MaterialIcons} from "@expo/vector-icons";
|
||||
import {Feather} from "@expo/vector-icons";
|
||||
import AddBrainDump from "./AddBrainDump";
|
||||
import LinearGradient from "react-native-linear-gradient";
|
||||
import PlusIcon from "@/assets/svgs/PlusIcon";
|
||||
import * as Device from 'expo-device'
|
||||
import {DeviceType} from 'expo-device'
|
||||
|
||||
const BrainDumpPage = () => {
|
||||
const [searchText, setSearchText] = useState<string>("");
|
||||
const [isAddVisible, setIsAddVisible] = useState<boolean>(false);
|
||||
@ -21,7 +22,7 @@ const BrainDumpPage = () => {
|
||||
showsVerticalScrollIndicator={false}
|
||||
showsHorizontalScrollIndicator={false}
|
||||
>
|
||||
<View marginH-25 style={isTablet ? {alignItems: 'center'} : undefined}>
|
||||
<View marginH-25 marginT-20 style={isTablet ? {alignItems: 'center'} : undefined}>
|
||||
<HeaderTemplate
|
||||
message={"Welcome to your notes!"}
|
||||
isWelcome={false}
|
||||
@ -117,6 +118,8 @@ const styles = StyleSheet.create({
|
||||
height: 42,
|
||||
paddingLeft: 10,
|
||||
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
|
||||
paddingH-13
|
||||
paddingV-10
|
||||
style={{ borderRadius: 15, elevation: 2 }}
|
||||
style={{ borderRadius: 15, elevation: 0 }}
|
||||
>
|
||||
<Text
|
||||
text70B
|
||||
|
||||
@ -145,7 +145,7 @@ const MoveBrainDump = (props: {
|
||||
style={styles.optionsIcon}
|
||||
/>
|
||||
<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>
|
||||
</TouchableOpacity>
|
||||
<TouchableOpacity>
|
||||
|
||||
@ -422,7 +422,7 @@ export const ManuallyAddEventModal = () => {
|
||||
is24Hour={profileData?.userType === ProfileType.PARENT ? false : true}
|
||||
onChange={(time) => {
|
||||
if (endDate.getDate() === startDate.getDate() &&
|
||||
time.getHours() >= endTime.getHours())
|
||||
time.getHours() >= endTime.getHours() && time.getMinutes() >= endTime.getHours())
|
||||
{
|
||||
const newEndDate = new Date(endDate);
|
||||
|
||||
@ -435,7 +435,7 @@ export const ManuallyAddEventModal = () => {
|
||||
}}
|
||||
minuteInterval={5}
|
||||
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]}
|
||||
/>
|
||||
</View>
|
||||
@ -461,7 +461,8 @@ export const ManuallyAddEventModal = () => {
|
||||
setEndTime(time);
|
||||
if (
|
||||
endDate.getDate() === startDate.getDate() &&
|
||||
time.getHours() < startTime.getHours()
|
||||
time.getHours() <= startTime.getHours() &&
|
||||
time.getMinutes() <= startTime.getMinutes()
|
||||
) {
|
||||
const newEndDate = new Date(endDate);
|
||||
newEndDate.setDate(newEndDate.getDate() + 1);
|
||||
@ -470,7 +471,7 @@ export const ManuallyAddEventModal = () => {
|
||||
}}
|
||||
minuteInterval={5}
|
||||
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]}
|
||||
/>
|
||||
</View>
|
||||
|
||||
@ -139,7 +139,13 @@ const ToDosList = ({ isSettings, members }: { isSettings?: boolean, members?: Ar
|
||||
if (localTodos && selectedFilter) {
|
||||
let resolvedGroupedTodos;
|
||||
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 {
|
||||
let filtered = localTodos?.filter((todo) => todo.assignees?.includes(selectedFilter.value)) || [];
|
||||
|
||||
@ -327,11 +333,16 @@ const ToDosList = ({ isSettings, members }: { isSettings?: boolean, members?: Ar
|
||||
style={{ marginRight: 8 }}
|
||||
/>
|
||||
)}
|
||||
renderItem={(item) => {
|
||||
renderItem={(item, selected) => {
|
||||
return (
|
||||
<View height={36.02} centerV>
|
||||
<Text style={styles.itemText}>{item.label}</Text>
|
||||
</View>
|
||||
<View height={36.02} centerV>
|
||||
<Text style={[
|
||||
styles.itemText,
|
||||
selected && { color: 'white' }
|
||||
]}>
|
||||
{item.label}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
}}
|
||||
onChange={(item) => {
|
||||
|
||||
@ -41,7 +41,7 @@ const ToDosPage = () => {
|
||||
<View>
|
||||
<View>
|
||||
<HeaderTemplate
|
||||
message="Here are your To Do's"
|
||||
message="Here are your To Dos"
|
||||
isWelcome={true}
|
||||
link={profileData?.userType == ProfileType.PARENT && pageLink}
|
||||
isToDos={true}
|
||||
|
||||
@ -33,7 +33,7 @@ const FamilyChoresProgress = ({
|
||||
style={{ fontFamily: "Poppins_400Regular", fontSize: 14.71 }}
|
||||
color="#979797"
|
||||
>
|
||||
Return to To Do's
|
||||
Return to To Dos
|
||||
</Text>
|
||||
</View>
|
||||
</TouchableOpacity>
|
||||
@ -123,7 +123,7 @@ const FamilyChoresProgress = ({
|
||||
</Text>
|
||||
<View centerV>
|
||||
<Text style={{ fontSize: 15, fontFamily: "Manrope_700Bold" }}>
|
||||
x/y chores completed
|
||||
{`${child?.weeklyCompletedTodos ?? 0}/y chores completed`}
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
@ -44,5 +44,7 @@ export interface UserProfile {
|
||||
microsoftAccounts?: { [email: string]: MicrosoftAccount };
|
||||
appleAccounts?: { [email: string]: AppleAccount };
|
||||
weeklyPoints?: number;
|
||||
weeklyDayPoints?: Object;
|
||||
allTimePoints?: number;
|
||||
weeklyCompletedTodos?: number;
|
||||
}
|
||||
@ -130,16 +130,37 @@ export const useUpdateTodo = () => {
|
||||
? 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;
|
||||
const allTimePoints = todoData.done
|
||||
? 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
|
||||
userData = {
|
||||
...userData,
|
||||
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);
|
||||
});
|
||||
@ -161,4 +182,10 @@ export const useUpdateTodo = () => {
|
||||
queryClients.invalidateQueries({queryKey: ["todos"]})
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
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