ui changes, fixes

This commit is contained in:
ivic00
2024-12-24 13:03:42 +01:00
parent fb9be26e04
commit 5c6915c23d
10 changed files with 86 additions and 52 deletions

View File

@ -73,7 +73,7 @@ const AddBrainDump = ({
onPress={() => { onPress={() => {
addBrainDump({ addBrainDump({
id: 99, id: '99',
title: dumpTitle.trimEnd().trimStart(), title: dumpTitle.trimEnd().trimStart(),

View File

@ -97,7 +97,7 @@ export const DetailedCalendar: React.FC<EventCalendarProps> = ({calendarHeight,
{...bodyProps} {...bodyProps}
renderEvent={renderEvent} renderEvent={renderEvent}
/> />
<View marginB-45/> <View marginB-0/>
</CalendarContainer> </CalendarContainer>
); );
}; };

View File

@ -74,7 +74,8 @@ const styles = StyleSheet.create({
eventCell: { eventCell: {
flex: 1, flex: 1,
borderRadius: 4, borderRadius: 4,
padding: 8, paddingHorizontal: 8,
paddingBottom: 8,
height: '100%', height: '100%',
}, },
eventTitle: { eventTitle: {

View File

@ -28,7 +28,7 @@ export const InnerCalendar = () => {
style={{flex: 1, backgroundColor: "#fff", borderRadius: 0, marginBottom: 0, overflow: "hidden"}} style={{flex: 1, backgroundColor: "#fff", borderRadius: 0, marginBottom: 0, overflow: "hidden"}}
ref={calendarContainerRef} ref={calendarContainerRef}
onLayout={onLayout} onLayout={onLayout}
paddingB-15 paddingB-0
> >
{calendarHeight > 0 && ( {calendarHeight > 0 && (
<EventCalendar <EventCalendar

View File

@ -567,18 +567,10 @@ export const ManuallyAddEventModal = () => {
Save Save
</Text> </Text>
</TouchableOpacity> </TouchableOpacity>
{editEvent && (
<Button
style={styles.topBtn}
marginL-5
iconSource={() => <BinIcon/>}
onPress={showDeleteEventModal}
/>
)}
</View> </View>
</View> </View>
{/*)}*/} {/*)}*/}
<ScrollView style={{minHeight: "85%"}}> <ScrollView style={{minHeight: "81%"}}>
<TextField <TextField
placeholder="Add event title" placeholder="Add event title"
ref={titleRef} ref={titleRef}
@ -788,7 +780,6 @@ export const ManuallyAddEventModal = () => {
<Button <Button
disabled disabled
marginH-30 marginH-30
marginB-30
label="Create event from image" label="Create event from image"
text70 text70
style={{height: 47}} style={{height: 47}}
@ -800,6 +791,23 @@ export const ManuallyAddEventModal = () => {
</View> </View>
)} )}
/> />
{editEvent && (
<TouchableOpacity
onPress={showDeleteEventModal}
style={{ marginTop: 15, marginBottom: 40, alignSelf: "center" }}
hitSlop={{left: 30, right: 30, top: 10, bottom: 10}}
>
<Text
style={{
color: "#ff1637",
fontFamily: "PlusJakartaSans_500Medium",
fontSize: 15,
}}
>
Delete Event
</Text>
</TouchableOpacity>
)}
</View> </View>
{editEvent && ( {editEvent && (
<DeleteEventDialog <DeleteEventDialog

View File

@ -652,7 +652,7 @@ export const MonthCalendar: React.FC<EventCalendarProps> = React.memo(
ampm ampm
// renderCustomDateForMonth={renderCustomDateForMonth} // renderCustomDateForMonth={renderCustomDateForMonth}
/> />
<View style={{backgroundColor: 'white', height: 50, width: '100%'}}/> {/*<View style={{backgroundColor: 'white', height: 50, width: '100%'}}/>*/}
</> </>
); );
@ -666,7 +666,7 @@ const styles = StyleSheet.create({
}, },
calHeader: { calHeader: {
borderWidth: 0, borderWidth: 0,
paddingBottom: 60, paddingBottom: 0,
}, },
dayModeHeader: { dayModeHeader: {
alignSelf: "flex-start", alignSelf: "flex-start",

View File

@ -26,7 +26,7 @@ const ToDoItem = (props: {
isSettings?: boolean; isSettings?: boolean;
is7Days?: boolean; is7Days?: boolean;
localTodos: Array<IToDo>; localTodos: Array<IToDo>;
setLocalTodos: Function setLocalTodos: Function;
}) => { }) => {
const { updateToDo } = useToDosContext(); const { updateToDo } = useToDosContext();
const { data: members } = useGetFamilyMembers(); const { data: members } = useGetFamilyMembers();
@ -38,13 +38,15 @@ const ToDoItem = (props: {
const [visible, setVisible] = useState<boolean>(false); const [visible, setVisible] = useState<boolean>(false);
const [points, setPoints] = useState(props.item.points); const [points, setPoints] = useState(props.item.points);
const [pointsModalVisible, setPointsModalVisible] = useState<boolean>(false); const [pointsModalVisible, setPointsModalVisible] = useState<boolean>(false);
const [creator, setCreator] = useState(''); const [creator, setCreator] = useState("");
useEffect(() => { useEffect(() => {
let creatorMember = members?.find((member) => member?.uid === props.item.creatorId); let creatorMember = members?.find(
(member) => member?.uid === props.item.creatorId
);
const fullName = `${creatorMember?.firstName ?? ""}`; const fullName = `${creatorMember?.firstName ?? ""}`;
setCreator(fullName); setCreator(fullName);
}, []) }, []);
const handlePointsChange = (text: string) => { const handlePointsChange = (text: string) => {
const numericValue = parseInt(text, 10); const numericValue = parseInt(text, 10);
@ -111,6 +113,12 @@ const ToDoItem = (props: {
/> />
)} )}
<View paddingB-8 row spread> <View paddingB-8 row spread>
<TouchableOpacity
onPress={() => {
isTodoEditable ? setVisible(true) : null;
}}
hitSlop={{right: 150, top:10}}
>
<Text <Text
text70 text70
style={{ style={{
@ -119,12 +127,10 @@ const ToDoItem = (props: {
color: props.item.done ? "#a09f9f" : "black", color: props.item.done ? "#a09f9f" : "black",
fontSize: 15, fontSize: 15,
}} }}
onPress={() => {
isTodoEditable ? setVisible(true) : null;
}}
> >
{props.item.title} {props.item.title}
</Text> </Text>
</TouchableOpacity>
<Checkbox <Checkbox
value={props.item.done} value={props.item.done}
containerStyle={[styles.checkbox, { borderRadius: 50 }]} containerStyle={[styles.checkbox, { borderRadius: 50 }]}
@ -133,7 +139,11 @@ const ToDoItem = (props: {
borderRadius={50} borderRadius={50}
color="#fd1575" color="#fd1575"
onValueChange={() => { onValueChange={() => {
const updatedTodos = props.localTodos?.map((item) => item.id === props.item.id ? { ...item, done: !props.item.done } : item); const updatedTodos = props.localTodos?.map((item) =>
item.id === props.item.id
? { ...item, done: !props.item.done }
: item
);
props.setLocalTodos(updatedTodos); props.setLocalTodos(updatedTodos);
updateToDo({ id: props.item.id, done: !props.item.done }); updateToDo({ id: props.item.id, done: !props.item.done });
if (!props.item.done && isChild) { if (!props.item.done && isChild) {
@ -231,7 +241,7 @@ const ToDoItem = (props: {
borderRadius: 22, borderRadius: 22,
overflow: "hidden", overflow: "hidden",
borderWidth: 2, borderWidth: 2,
borderColor: member.eventColor || 'transparent' borderColor: member.eventColor || "transparent",
}} }}
/> />
) : ( ) : (
@ -242,7 +252,7 @@ const ToDoItem = (props: {
aspectRatio: 1, aspectRatio: 1,
borderWidth: 2, borderWidth: 2,
borderRadius: 100, borderRadius: 100,
borderColor: member.eventColor || '#ccc', borderColor: member.eventColor || "#ccc",
}} }}
> >
<View <View

View File

@ -3,11 +3,15 @@ import { useDeleteNote } from "@/hooks/firebase/useDeleteNote";
import { useGetNotes } from "@/hooks/firebase/useGetNotes"; import { useGetNotes } from "@/hooks/firebase/useGetNotes";
import { useUpdateNote } from "@/hooks/firebase/useUpdateNote"; import { useUpdateNote } from "@/hooks/firebase/useUpdateNote";
import { createContext, useContext, useState } from "react"; import { createContext, useContext, useState } from "react";
import firestore, { FirebaseFirestoreTypes } from '@react-native-firebase/firestore';
export interface IBrainDump { export interface IBrainDump {
id: number; id: string;
title: string; title: string;
description: string; description: string;
createdAt?: FirebaseFirestoreTypes.Timestamp;
updatedAt?: FirebaseFirestoreTypes.Timestamp;
creatorId?: string;
} }
interface IBrainDumpContext { interface IBrainDumpContext {

View File

@ -12,6 +12,8 @@ export const useCreateNote = () => {
mutationKey: ["createNote"], mutationKey: ["createNote"],
mutationFn: async (note: Partial<IBrainDump>) => { mutationFn: async (note: Partial<IBrainDump>) => {
try { try {
const timestamp = firestore.FieldValue.serverTimestamp();
if (note.id) { if (note.id) {
const snapshot = await firestore() const snapshot = await firestore()
.collection("BrainDumps") .collection("BrainDumps")
@ -27,16 +29,22 @@ export const useCreateNote = () => {
{ {
...note, ...note,
creatorId: currentUser?.uid, creatorId: currentUser?.uid,
updatedAt: timestamp
}, },
{ merge: true } { merge: true }
); );
return; return;
} }
} }
const newDoc = firestore().collection("BrainDumps").doc(); const newDoc = firestore().collection("BrainDumps").doc();
await firestore() await newDoc.set({
.collection("BrainDumps") ...note,
.add({ ...note, id: newDoc.id, creatorId: currentUser?.uid }); id: newDoc.id,
creatorId: currentUser?.uid,
updatedAt: timestamp,
createdAt: timestamp
});
} catch (e) { } catch (e) {
console.error(e); console.error(e);
} }

View File

@ -18,6 +18,9 @@ export const useGetNotes = () => {
return snapshot.docs.map((doc) => ({ return snapshot.docs.map((doc) => ({
...doc.data(), ...doc.data(),
id: doc.id,
createdAt: doc.data().createdAt,
updatedAt: doc.data().updatedAt,
})) as IBrainDump[]; })) as IBrainDump[];
} catch (error) { } catch (error) {
console.error("Error fetching braindumps:", error); console.error("Error fetching braindumps:", error);