2024-03-15 23:24:08 +01:00
|
|
|
import { SafeAreaView } from "react-native-safe-area-context"
|
2024-03-24 23:51:29 +01:00
|
|
|
import { ActivityIndicator } from "react-native-paper"
|
2024-03-15 23:24:08 +01:00
|
|
|
|
2024-03-24 23:41:23 +01:00
|
|
|
import { HabitsHistory } from "@/presentation/react/components/HabitsHistory/HabitsHistory"
|
2024-03-16 00:36:44 +01:00
|
|
|
import { useHabitsTracker } from "@/presentation/react/contexts/HabitsTracker"
|
2024-03-15 23:24:08 +01:00
|
|
|
|
|
|
|
const HabitsPage: React.FC = () => {
|
2024-03-24 23:51:29 +01:00
|
|
|
const { habitsTracker, retrieveHabitsTracker } = useHabitsTracker()
|
2024-03-15 23:24:08 +01:00
|
|
|
|
|
|
|
return (
|
2024-03-24 23:41:23 +01:00
|
|
|
<SafeAreaView
|
|
|
|
style={[
|
|
|
|
{
|
|
|
|
flex: 1,
|
|
|
|
alignItems: "center",
|
2024-03-24 23:51:29 +01:00
|
|
|
justifyContent:
|
|
|
|
retrieveHabitsTracker.state === "loading" ? "center" : "flex-start",
|
2024-03-24 23:41:23 +01:00
|
|
|
},
|
|
|
|
]}
|
|
|
|
>
|
2024-03-24 23:51:29 +01:00
|
|
|
{retrieveHabitsTracker.state === "loading" ? (
|
|
|
|
<ActivityIndicator animating size="large" />
|
|
|
|
) : (
|
2024-03-25 13:05:15 +01:00
|
|
|
<HabitsHistory habitsTracker={habitsTracker} />
|
2024-03-24 23:51:29 +01:00
|
|
|
)}
|
2024-03-15 23:24:08 +01:00
|
|
|
</SafeAreaView>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default HabitsPage
|