fix: habit end date filtering + habit stop wording
This commit is contained in:
parent
172e8edf78
commit
748ac2476c
@ -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,6 +165,7 @@ export const HabitEditForm: React.FC<HabitEditFormProps> = ({ habit }) => {
|
||||
Save
|
||||
</Button>
|
||||
|
||||
{habit.endDate == null ? (
|
||||
<Button
|
||||
mode="outlined"
|
||||
onPress={async () => {
|
||||
@ -168,8 +175,19 @@ export const HabitEditForm: React.FC<HabitEditFormProps> = ({ habit }) => {
|
||||
disabled={habitStop.state === "loading"}
|
||||
style={[styles.spacing, { width: "96%" }]}
|
||||
>
|
||||
Stop
|
||||
🛑 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
|
||||
|
@ -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
|
||||
)
|
||||
})
|
||||
|
Reference in New Issue
Block a user