diff --git a/presentation/react/components/HabitForm/HabitEditForm.tsx b/presentation/react/components/HabitForm/HabitEditForm.tsx index a97f84457952db95b0016cf94b819a7a19da2eb1..f16c2161d63384d2d32f78ddcc011762a4055aaf 100644 --- a/presentation/react/components/HabitForm/HabitEditForm.tsx +++ b/presentation/react/components/HabitForm/HabitEditForm.tsx @@ -4,7 +4,13 @@ import { zodResolver } from "@hookform/resolvers/zod" import { useState } from "react" import { Controller, useForm } from "react-hook-form" import { ScrollView, StyleSheet, View } from "react-native" -import { Button, HelperText, Snackbar, TextInput } from "react-native-paper" +import { + Button, + HelperText, + Snackbar, + Text, + TextInput, +} from "react-native-paper" import { SafeAreaView } from "react-native-safe-area-context" import ColorPicker, { HueSlider, @@ -159,17 +165,29 @@ export const HabitEditForm: React.FC<HabitEditFormProps> = ({ habit }) => { Save </Button> - <Button - mode="outlined" - onPress={async () => { - await habitsTrackerPresenter.habitStop(habit) - }} - loading={habitStop.state === "loading"} - disabled={habitStop.state === "loading"} - style={[styles.spacing, { width: "96%" }]} - > - Stop - </Button> + {habit.endDate == null ? ( + <Button + mode="outlined" + onPress={async () => { + await habitsTrackerPresenter.habitStop(habit) + }} + loading={habitStop.state === "loading"} + disabled={habitStop.state === "loading"} + style={[styles.spacing, { width: "96%" }]} + > + 🛑 Stop Habit (effective tomorrow) + </Button> + ) : ( + <Text + style={{ + textAlign: "center", + marginVertical: 20, + fontSize: 20, + }} + > + 🛑 The habit has been stopped! (No further progress can be saved) + </Text> + )} </ScrollView> <Snackbar diff --git a/presentation/react/components/HabitsMainPage/HabitsList.tsx b/presentation/react/components/HabitsMainPage/HabitsList.tsx index 4bdddb24ed78d72f8bfe4fdacd30fdc1c9e3694a..01954324ffc773dcf05a90b8843dda40fa04fe40 100644 --- a/presentation/react/components/HabitsMainPage/HabitsList.tsx +++ b/presentation/react/components/HabitsMainPage/HabitsList.tsx @@ -94,7 +94,7 @@ export const HabitsList: React.FC<HabitsListProps> = (props) => { .filter((habitItem) => { return ( (habitItem.habit.endDate != null && - habitItem.habit.endDate <= selectedDate) || + habitItem.habit.endDate >= selectedDate) || habitItem.habit.endDate == null ) })