Skip to content

Commit

Permalink
refactor(ActionProgressBar): replace hardcoded score with useActionSc…
Browse files Browse the repository at this point in the history
…ore hook and update style options in ReferentielCard
  • Loading branch information
elisfainstein committed Jan 16, 2025
1 parent 496cffe commit 70fcfbf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { avancementToLabel } from '@/app/app/labels';
import { actionAvancementColors } from '@/app/app/theme';
import { ActionDefinitionSummary } from '@/app/core-logic/api/endpoints/ActionDefinitionSummaryReadEndpoint';
import ProgressBarWithTooltip from '@/app/ui/score/ProgressBarWithTooltip';
import { useActionScore } from '../../core-logic/hooks/scoreHooks';
import { ProgressBarStyleOptions } from '../score/ProgressBar';

export const ActionProgressBar = ({
Expand All @@ -14,26 +15,8 @@ export const ActionProgressBar = ({
className?: string;
styleOptions?: ProgressBarStyleOptions;
}) => {
// const score = useActionScore(action.id);
const score = {
referentiel: 'cae',
action_id: '1',
fait_taches_avancement: 1,
pas_concerne_taches_avancement: 2,
pas_fait_taches_avancement: 3,
programme_taches_avancement: 4,
point_fait: 5,
point_programme: 6,
point_pas_fait: 7,
point_non_renseigne: 8,
point_potentiel: 9,
point_potentiel_perso: 10,
point_referentiel: 11,
concerne: true,
total_taches_count: 8,
completed_taches_count: 9,
desactive: false,
};
const score = useActionScore(action.id);

const isReglementaire = action.identifiant.split('.').includes('0');

if (score === null || (score.point_potentiel < 1e-3 && !isReglementaire))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ export const ReferentielCard = ({
<Counter value={1} total={10} className="mb-3" />
<ActionProgressBar
action={action}
styleOptions={{ justify: 'start' }}
className=""
styleOptions={{ justify: 'start', fullWidth: true }}
/>
</div>
</>
Expand All @@ -79,7 +80,7 @@ export const ReferentielCard = ({
<Counter value={1} total={10} className="mb-3" />
<ActionProgressBar
action={action}
styleOptions={{ justify: 'start' }}
styleOptions={{ justify: 'start', fullWidth: true }}
/>
</div>
)}
Expand Down

0 comments on commit 70fcfbf

Please sign in to comment.