| 3719 |
stevensc |
1 |
import React from 'react';
|
|
|
2 |
import { useNavigate } from 'react-router-dom';
|
|
|
3 |
import { Button } from '@mui/material';
|
|
|
4 |
|
|
|
5 |
import { useHabitProgress } from '@hooks';
|
|
|
6 |
|
|
|
7 |
import List from '@components/common/list';
|
|
|
8 |
import PageHeader from '@components/common/page-header';
|
|
|
9 |
import LoadingWrapper from '@components/common/loading-wrapper';
|
|
|
10 |
import ProgressItem from '@components/habits/progress/progress-item';
|
|
|
11 |
|
|
|
12 |
export default function HabitProgressPage() {
|
|
|
13 |
const navigate = useNavigate();
|
|
|
14 |
|
|
|
15 |
const { registers, loading, habitName } = useHabitProgress();
|
|
|
16 |
|
|
|
17 |
return (
|
|
|
18 |
<>
|
|
|
19 |
<PageHeader
|
|
|
20 |
title={habitName}
|
|
|
21 |
action={() => <Button onClick={() => navigate('add')}>Agregar</Button>}
|
|
|
22 |
goBack
|
|
|
23 |
/>
|
|
|
24 |
<LoadingWrapper loading={loading}>
|
|
|
25 |
<List
|
|
|
26 |
items={registers}
|
|
|
27 |
renderItem={(progress) => <ProgressItem progress={progress} />}
|
|
|
28 |
emptyMessage='No hay progreso para este hábito'
|
|
|
29 |
/>
|
|
|
30 |
</LoadingWrapper>
|
|
|
31 |
</>
|
|
|
32 |
);
|
|
|
33 |
}
|