feat: habit frequency & type labels
This commit is contained in:
parent
bc9d7ae1af
commit
a2d187a27a
@ -5,6 +5,7 @@ import {
|
|||||||
Button,
|
Button,
|
||||||
HelperText,
|
HelperText,
|
||||||
SegmentedButtons,
|
SegmentedButtons,
|
||||||
|
Text,
|
||||||
TextInput,
|
TextInput,
|
||||||
} from "react-native-paper"
|
} from "react-native-paper"
|
||||||
import { SafeAreaView } from "react-native-safe-area-context"
|
import { SafeAreaView } from "react-native-safe-area-context"
|
||||||
@ -14,11 +15,11 @@ import ColorPicker, {
|
|||||||
Preview,
|
Preview,
|
||||||
} from "reanimated-color-picker"
|
} from "reanimated-color-picker"
|
||||||
|
|
||||||
|
import type { GoalFrequency, GoalType } from "@/domain/entities/Goal"
|
||||||
|
import { GOAL_FREQUENCIES, GOAL_TYPES } from "@/domain/entities/Goal"
|
||||||
import type { HabitCreateData } from "@/domain/entities/Habit"
|
import type { HabitCreateData } from "@/domain/entities/Habit"
|
||||||
import { HabitCreateSchema } from "@/domain/entities/Habit"
|
import { HabitCreateSchema } from "@/domain/entities/Habit"
|
||||||
import type { User } from "@/domain/entities/User"
|
import type { User } from "@/domain/entities/User"
|
||||||
import type { GoalFrequency, GoalType } from "@/domain/entities/Goal"
|
|
||||||
import { GOAL_FREQUENCIES, GOAL_TYPES } from "@/domain/entities/Goal"
|
|
||||||
import { capitalize } from "@/presentation/presenters/utils/strings"
|
import { capitalize } from "@/presentation/presenters/utils/strings"
|
||||||
|
|
||||||
export interface HabitCreateFormProps {
|
export interface HabitCreateFormProps {
|
||||||
@ -154,6 +155,8 @@ export const HabitCreateForm: React.FC<HabitCreateFormProps> = ({ user }) => {
|
|||||||
control={control}
|
control={control}
|
||||||
render={({ field: { onChange, value } }) => {
|
render={({ field: { onChange, value } }) => {
|
||||||
return (
|
return (
|
||||||
|
<>
|
||||||
|
<Text style={{ margin: 8 }}>Habit frequency</Text>
|
||||||
<SegmentedButtons
|
<SegmentedButtons
|
||||||
onValueChange={onChange}
|
onValueChange={onChange}
|
||||||
value={value}
|
value={value}
|
||||||
@ -165,6 +168,7 @@ export const HabitCreateForm: React.FC<HabitCreateFormProps> = ({ user }) => {
|
|||||||
}
|
}
|
||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
|
</>
|
||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
name="goal.frequency"
|
name="goal.frequency"
|
||||||
@ -174,6 +178,8 @@ export const HabitCreateForm: React.FC<HabitCreateFormProps> = ({ user }) => {
|
|||||||
control={control}
|
control={control}
|
||||||
render={({ field: { onChange, value } }) => {
|
render={({ field: { onChange, value } }) => {
|
||||||
return (
|
return (
|
||||||
|
<>
|
||||||
|
<Text style={{ margin: 8 }}>Habit type</Text>
|
||||||
<SegmentedButtons
|
<SegmentedButtons
|
||||||
onValueChange={onChange}
|
onValueChange={onChange}
|
||||||
value={value}
|
value={value}
|
||||||
@ -185,6 +191,7 @@ export const HabitCreateForm: React.FC<HabitCreateFormProps> = ({ user }) => {
|
|||||||
}
|
}
|
||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
|
</>
|
||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
name="goal.target.type"
|
name="goal.target.type"
|
||||||
|
Reference in New Issue
Block a user