Skip to content

Commit 30ae156

Browse files
committed
updated dailyview
1 parent 6b082a6 commit 30ae156

File tree

2 files changed

+57
-8
lines changed

2 files changed

+57
-8
lines changed

components/DailyView.js

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import eventEmitter from "./EventEmitter";
1414
import { useTheme } from "../services/ThemeContext";
1515
import getStyles from "../styles/DailyViewStyles";
1616
import BirthdayCelebration from "./BDCelebration";
17+
import Icon from 'react-native-vector-icons/FontAwesome';
18+
import Icon2 from 'react-native-vector-icons/Fontisto';
1719

1820
const DailyView = ({
1921
userID,
@@ -136,23 +138,38 @@ const DailyView = ({
136138
keyExtractor={(item) => item.id.toString()}
137139
renderItem={({ item }) => (
138140
<View style={styles.taskItem}>
139-
<Text style={styles.taskItemText}>
140-
{item.name} {item.completed ? "✓" : ""}
141+
<Text style={styles.taskItemText} numberOfLines={1} ellipsizeMode='tail'>
142+
{item.completed ? <Icon name="check-circle" size={20} color="green" /> : ""} {item.name}
141143
</Text>
142144
<TouchableOpacity
143145
style={styles.moreButton}
144146
onPress={() => setVisibleTaskActions(prev => ({
145147
...prev,
146-
[item.id]: !prev[item.id] // Toggle visibility of action buttons
148+
[item.id]: !prev[item.id]
147149
}))}
148150
>
149-
<Text></Text>
151+
<Icon name="bars" size={20} color="#000" />
150152
</TouchableOpacity>
151153
{visibleTaskActions[item.id] && (
152154
<View style={styles.taskActions}>
153-
<Button title="Completion" onPress={() => toggleCompletion(item)} />
154-
<Button title="Edit" onPress={() => navigation.navigate("EditTaskScreen", { task: item, userId: userID })} />
155-
<Button title="Delete" onPress={() => onTaskDelete(item.id)} />
155+
<TouchableOpacity
156+
style={[styles.actionButton, styles.completeButton]}
157+
onPress={() => toggleCompletion(item)}
158+
>
159+
<Icon2 name={item.completed ? "checkbox-active" : "checkbox-passive"} size={15} color={"white"} />
160+
</TouchableOpacity>
161+
<TouchableOpacity
162+
style={[styles.actionButton, styles.editButton]}
163+
onPress={() => navigation.navigate("EditTaskScreen", { task: item, userId: userID })}
164+
>
165+
<Icon name="pencil" size={15} color="white" />
166+
</TouchableOpacity>
167+
<TouchableOpacity
168+
style={[styles.actionButton, styles.deleteButton]}
169+
onPress={() => onTaskDelete(item.id)}
170+
>
171+
<Icon name="trash" size={20} color="white" />
172+
</TouchableOpacity>
156173
</View>
157174
)}
158175
</View>
@@ -162,4 +179,4 @@ const DailyView = ({
162179
);
163180
};
164181

165-
export default DailyView;
182+
export default DailyView;

styles/DailyViewStyles.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ const getStyles = (theme) =>
2424
},
2525
taskItemText: {
2626
fontSize: 16,
27+
maxWidth: '50%', // Set the maxWidth to a value that works with your layout
28+
marginRight: 10, // Add some margin to the right of the text
29+
minWidth: '50%', // Set the minWidth to a value that works with your layout
2730
},
2831
taskActions: {
2932
flexDirection: 'row',
@@ -50,6 +53,35 @@ const getStyles = (theme) =>
5053
alignSelf: "center",
5154
color: theme === "dark" ? "white" : "black",
5255
},
56+
taskItem: {
57+
flexDirection: 'row',
58+
alignItems: 'center',
59+
justifyContent: 'space-between',
60+
padding: 10,
61+
},
62+
moreButton: {
63+
padding: 10,
64+
},
65+
taskActions: {
66+
flexDirection: 'row',
67+
alignItems: 'center',
68+
},
69+
actionButton: {
70+
marginHorizontal: 5,
71+
borderRadius: 15,
72+
padding: 10,
73+
justifyContent: 'center',
74+
alignItems: 'center',
75+
},
76+
completeButton: {
77+
backgroundColor: '#20B2AA',
78+
},
79+
editButton: {
80+
backgroundColor: '#778899',
81+
},
82+
deleteButton: {
83+
backgroundColor: '#FFA07A',
84+
},
5385
});
5486

5587
export default getStyles;

0 commit comments

Comments
 (0)