mirror of
https://github.com/urosran/cally.git
synced 2026-10-23 09:47:53 +00:00
- Added created by label in the todo item
This commit is contained in:
@@ -8,7 +8,7 @@ import {
|
|||||||
Checkbox,
|
Checkbox,
|
||||||
} from "react-native-ui-lib";
|
} from "react-native-ui-lib";
|
||||||
|
|
||||||
import React, { useState } from "react";
|
import React, {useEffect, useState} from "react";
|
||||||
import { useToDosContext } from "@/contexts/ToDosContext";
|
import { useToDosContext } from "@/contexts/ToDosContext";
|
||||||
import { Ionicons } from "@expo/vector-icons";
|
import { Ionicons } from "@expo/vector-icons";
|
||||||
import PointsSlider from "@/components/shared/PointsSlider";
|
import PointsSlider from "@/components/shared/PointsSlider";
|
||||||
@@ -33,6 +33,13 @@ 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('');
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
let creatorMember = members?.find((member) => member?.uid === props.item.creatorId);
|
||||||
|
const fullName = `${creatorMember?.firstName ?? ""}`;
|
||||||
|
setCreator(fullName);
|
||||||
|
}, [])
|
||||||
|
|
||||||
const handlePointsChange = (text: string) => {
|
const handlePointsChange = (text: string) => {
|
||||||
const numericValue = parseInt(text, 10);
|
const numericValue = parseInt(text, 10);
|
||||||
@@ -117,57 +124,66 @@ const ToDoItem = (props: {
|
|||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
<View centerV centerH marginT-8 row spread>
|
<View centerV centerH marginT-8 row spread>
|
||||||
<View row>
|
<View>
|
||||||
{props.item.points && props.item.points > 0 ? (
|
<View row>
|
||||||
<TouchableOpacity
|
{props.item.points && props.item.points > 0 ? (
|
||||||
onPress={() => {
|
<TouchableOpacity
|
||||||
if (props.isSettings) {
|
onPress={() => {
|
||||||
setPointsModalVisible(true);
|
if (props.isSettings) {
|
||||||
}
|
setPointsModalVisible(true);
|
||||||
}}
|
}
|
||||||
>
|
|
||||||
<View centerV row gap-3>
|
|
||||||
<Ionicons name="gift-outline" size={20} color="#46a80a" />
|
|
||||||
<Text
|
|
||||||
color="#46a80a"
|
|
||||||
style={{ fontSize: 12, fontFamily: "Manrope_500Medium" }}
|
|
||||||
>
|
|
||||||
{props.item.points} points
|
|
||||||
</Text>
|
|
||||||
</View>
|
|
||||||
</TouchableOpacity>
|
|
||||||
) : (
|
|
||||||
<View />
|
|
||||||
)}
|
|
||||||
|
|
||||||
{!(props.item.repeatType == "None") && (
|
|
||||||
<View row centerV marginL-8>
|
|
||||||
<RepeatIcon style={{ marginRight: 4 }} />
|
|
||||||
<Text
|
|
||||||
style={{
|
|
||||||
fontSize: 12,
|
|
||||||
fontFamily: "Manrope_500Medium",
|
|
||||||
color: "#858585",
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{(() => {
|
<View centerV row gap-3>
|
||||||
switch (props.item.repeatType) {
|
<Ionicons name="gift-outline" size={20} color="#46a80a" />
|
||||||
case "Once a month":
|
<Text
|
||||||
return "Monthly";
|
color="#46a80a"
|
||||||
case "Every week":
|
style={{ fontSize: 12, fontFamily: "Manrope_500Medium" }}
|
||||||
return "Weekly";
|
>
|
||||||
case "Once a year":
|
{props.item.points} points
|
||||||
return "Yearly";
|
</Text>
|
||||||
default:
|
</View>
|
||||||
return props.item.repeatType;
|
</TouchableOpacity>
|
||||||
}
|
) : (
|
||||||
})()}
|
<View />
|
||||||
{props.item.date &&
|
)}
|
||||||
props.is7Days &&
|
|
||||||
" / " + format(props.item.date, "EEEE")}
|
{!(props.item.repeatType == "None") && (
|
||||||
</Text>
|
<View row centerV marginL-8>
|
||||||
</View>
|
<RepeatIcon style={{ marginRight: 4 }} />
|
||||||
)}
|
<Text
|
||||||
|
style={{
|
||||||
|
fontSize: 12,
|
||||||
|
fontFamily: "Manrope_500Medium",
|
||||||
|
color: "#858585",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{(() => {
|
||||||
|
switch (props.item.repeatType) {
|
||||||
|
case "Once a month":
|
||||||
|
return "Monthly";
|
||||||
|
case "Every week":
|
||||||
|
return "Weekly";
|
||||||
|
case "Once a year":
|
||||||
|
return "Yearly";
|
||||||
|
default:
|
||||||
|
return props.item.repeatType;
|
||||||
|
}
|
||||||
|
})()}
|
||||||
|
{props.item.date &&
|
||||||
|
props.is7Days &&
|
||||||
|
" / " + format(props.item.date, "EEEE")}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
<View row centerV marginL-3>
|
||||||
|
<Text
|
||||||
|
style={{ fontSize: 12, fontFamily: "Manrope_500Medium" }}
|
||||||
|
>
|
||||||
|
Created by: {creator}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View row style={{ gap: 3 }}>
|
<View row style={{ gap: 3 }}>
|
||||||
{selectedMembers?.map((member) => {
|
{selectedMembers?.map((member) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user