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 { useState } from "react"
|
||||||
import { Controller, useForm } from "react-hook-form"
|
import { Controller, useForm } from "react-hook-form"
|
||||||
import { ScrollView, StyleSheet, View } from "react-native"
|
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 { SafeAreaView } from "react-native-safe-area-context"
|
||||||
import ColorPicker, {
|
import ColorPicker, {
|
||||||
HueSlider,
|
HueSlider,
|
||||||
@ -159,17 +165,29 @@ export const HabitEditForm: React.FC<HabitEditFormProps> = ({ habit }) => {
|
|||||||
Save
|
Save
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button
|
{habit.endDate == null ? (
|
||||||
mode="outlined"
|
<Button
|
||||||
onPress={async () => {
|
mode="outlined"
|
||||||
await habitsTrackerPresenter.habitStop(habit)
|
onPress={async () => {
|
||||||
}}
|
await habitsTrackerPresenter.habitStop(habit)
|
||||||
loading={habitStop.state === "loading"}
|
}}
|
||||||
disabled={habitStop.state === "loading"}
|
loading={habitStop.state === "loading"}
|
||||||
style={[styles.spacing, { width: "96%" }]}
|
disabled={habitStop.state === "loading"}
|
||||||
>
|
style={[styles.spacing, { width: "96%" }]}
|
||||||
Stop
|
>
|
||||||
</Button>
|
🛑 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>
|
</ScrollView>
|
||||||
|
|
||||||
<Snackbar
|
<Snackbar
|
||||||
|
@ -94,7 +94,7 @@ export const HabitsList: React.FC<HabitsListProps> = (props) => {
|
|||||||
.filter((habitItem) => {
|
.filter((habitItem) => {
|
||||||
return (
|
return (
|
||||||
(habitItem.habit.endDate != null &&
|
(habitItem.habit.endDate != null &&
|
||||||
habitItem.habit.endDate <= selectedDate) ||
|
habitItem.habit.endDate >= selectedDate) ||
|
||||||
habitItem.habit.endDate == null
|
habitItem.habit.endDate == null
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user