Skip to content

Commit

Permalink
retours revue
Browse files Browse the repository at this point in the history
  • Loading branch information
octo-theg committed Dec 14, 2023
1 parent a127f82 commit 3c28db8
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 18 deletions.
2 changes: 1 addition & 1 deletion assets/icons/actions/filter.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion components/action/ActionRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ export default function ActionRow({ action, jeuneId }: ActionRowProps) {
<TD className='rounded-r-base w-[160px]'>
<span className='flex items-center justify-between'>
<TagStatutAction
status={actionEstEnRetard ? StatutAction.EnRetard : action.status}
status={action.status}
actionEstEnRetard={actionEstEnRetard}
/>
<IconComponent
name={IconName.ChevronRight}
Expand Down
1 change: 1 addition & 0 deletions components/action/FiltresStatutsActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export default function FiltresStatutsActions({
aria-expanded={afficherFiltresStatuts}
onClick={() => setAfficherFiltresStatuts(!afficherFiltresStatuts)}
aria-label='Statut - Filtrer les actions'
title='Filtrer les actions par statut'
className='flex items-center p-4 w-full h-full'
>
Statut
Expand Down
5 changes: 3 additions & 2 deletions components/action/OngletActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,16 @@ export default function OngletActions({
filtresParEtatsQualification,
tri
).then(({ actions, metadonnees }) => {
if (filtresParStatuts.includes(StatutAction.EnRetard))
/*if (filtresParStatuts.includes(StatutAction.EnRetard))
setActionsAffichees(
actions.filter(
(action) =>
DateTime.fromISO(action.dateEcheance) < DateTime.now() &&
action.status === StatutAction.EnCours
)
)
else setActionsAffichees(actions)
else */
setActionsAffichees(actions)

setNombrePages(metadonnees.nombrePages)
setIsLoading(false)
Expand Down
9 changes: 8 additions & 1 deletion components/action/TableauActionsJeune.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ export default function TableauActionsJeune({
const headerColumnWithButtonHover = 'rounded-base hover:bg-primary_lighten'
const columnHeaderButtonStyle = 'flex items-center w-full h-full p-4'

function getOrdreTriParDate() {
return `Trier les actions ordre ${
getIsSortedDesc() ? 'antéchronologique' : 'chronologique'
}`
}

function filtrerActionsParStatuts(statutsSelectionnes: StatutAction[]) {
setStatutsValides(statutsSelectionnes)
onFiltres({
Expand Down Expand Up @@ -113,7 +119,8 @@ export default function TableauActionsJeune({
<TH className={headerColumnWithButtonHover} estCliquable={true}>
<button
onClick={trierParDateEcheance}
aria-label='Date de l’action - trier les actions'
aria-label={`Date de l’action - ${getOrdreTriParDate()}`}
title={getOrdreTriParDate()}
className={columnHeaderButtonStyle}
>
Date de l’action
Expand Down
23 changes: 17 additions & 6 deletions components/action/TagStatutAction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,25 @@ import { StatutAction } from 'interfaces/action'

interface TagStatutActionProps {
status: StatutAction
actionEstEnRetard: boolean
}

export default function TagStatutAction({ status }: TagStatutActionProps) {
const {
label,
color,
altColor: backgroundColor,
} = propsStatutsActions[status]
export default function TagStatutAction({
status,
actionEstEnRetard,
}: TagStatutActionProps) {
const { label, color, altColor: backgroundColor } = determineAttributs()

function determineAttributs() {
if (actionEstEnRetard)
return {
label: 'En retard',
color: 'warning',
altColor: 'warning_lighten',
}
return propsStatutsActions[status]
}

return (
<TagStatut
label={label}
Expand Down
5 changes: 0 additions & 5 deletions components/action/propsStatutsActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ const propsStatutsActions: {
color: 'success',
altColor: 'success_lighten',
},
EnRetard: {
label: 'En retard',
color: 'warning',
altColor: 'warning_lighten',
},
}

export default propsStatutsActions
17 changes: 16 additions & 1 deletion components/agenda-jeune/AgendaRow.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { DateTime } from 'luxon'
import Link from 'next/link'
import { useRouter } from 'next/router'
import React from 'react'

import TagStatutAction from 'components/action/TagStatutAction'
import IconComponent, { IconName } from 'components/ui/IconComponent'
import { TagStatut } from 'components/ui/Indicateurs/Tag'
import { StatutAction } from 'interfaces/action'
import { EntreeAgenda } from 'interfaces/agenda'
import { StructureConseiller } from 'interfaces/conseiller'

Expand Down Expand Up @@ -44,6 +46,14 @@ export default function AgendaRow({ entree, idBeneficiaire }: AgendaRowProps) {
}
const { href, iconName, label } = props[entree.type]

function determineActionEnRetard() {
return (
entree.type === 'action' &&
entree.statut === StatutAction.EnCours &&
entree.date < DateTime.now()
)
}

return (
<li className='mt-4 text-base-regular rounded-base shadow-base hover:bg-primary_lighten'>
<Link
Expand All @@ -66,7 +76,12 @@ export default function AgendaRow({ entree, idBeneficiaire }: AgendaRowProps) {
{entree.typeSession && entree.sousTitre && entree.sousTitre}
</div>
<div className='flex justify-end'>
{entree.statut && <TagStatutAction status={entree.statut} />}
{entree.statut && (
<TagStatutAction
status={entree.statut}
actionEstEnRetard={determineActionEnRetard()}
/>
)}
{entree.source === StructureConseiller.MILO && (
<>
{entree.type === 'session' && entree.typeSession && (
Expand Down
1 change: 0 additions & 1 deletion interfaces/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export enum StatutAction {
Terminee = 'Terminee',
Qualifiee = 'Qualifiee',
Annulee = 'Annulee',
EnRetard = 'EnRetard',
}

export enum EtatQualificationAction {
Expand Down

0 comments on commit 3c28db8

Please sign in to comment.