Skip to content

Commit

Permalink
feat/show description logo in list (#1703)
Browse files Browse the repository at this point in the history
* feat(dashboard): affiche les Autres pseudos dans les tableaux de passages/rencontres/actions/consultations des comptes rendus

* feat(dashboard): affiche une petite icône "description" lorsque une action/consultation a le champ "description" de renseigné
  • Loading branch information
arnaudambro authored Oct 5, 2023
1 parent 89e2e93 commit 2c1193a
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 11 deletions.
14 changes: 14 additions & 0 deletions dashboard/src/assets/icons/description-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions dashboard/src/components/ActionsCalendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { CANCEL, DONE, sortActionsOrConsultations } from '../recoil/actions';
import TagTeam from './TagTeam';
import { useLocalStorage } from '../services/useLocalStorage';
import TabsNav from './tailwind/TabsNav';
import DescriptionIcon from './DescriptionIcon';

const ActionsCalendar = ({ actions, isNightSession, columns = ['Heure', 'Nom', 'Personne suivie', 'Créée le', 'Statut', 'Équipe(s) en charge'] }) => {
const history = useHistory();
Expand Down Expand Up @@ -118,6 +119,7 @@ const ActionsCalendar = ({ actions, isNightSession, columns = ['Heure', 'Nom', '
return (
<div className="tw-flex tw-items-center tw-justify-center tw-gap-1">
{!!actionOrConsult.urgent && <ExclamationMarkButton />}
{!!actionOrConsult.description && <DescriptionIcon />}
{!!organisation.groupsEnabled && !!actionOrConsult.group && (
<span className="tw-text-3xl" aria-label="Action familiale" title="Action familiale">
👪
Expand Down
2 changes: 2 additions & 0 deletions dashboard/src/components/ActionsSortableList.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import TagTeam from './TagTeam';
import { useLocalStorage } from '../services/useLocalStorage';
import Page from './pagination';
import useSearchParamState from '../services/useSearchParamState';
import DescriptionIcon from './DescriptionIcon';

const ActionsSortableList = ({ data, limit }) => {
useTitle('Agenda');
Expand Down Expand Up @@ -72,6 +73,7 @@ const ActionsSortableList = ({ data, limit }) => {
return (
<div className="tw-flex tw-items-center tw-justify-center tw-gap-1">
{!!actionOrConsult.urgent && <ExclamationMarkButton />}
{!!actionOrConsult.description && <DescriptionIcon />}
{!!organisation.groupsEnabled && !!actionOrConsult.group && (
<span className="tw-text-3xl" aria-label="Action familiale" title="Action familiale">
👪
Expand Down
1 change: 1 addition & 0 deletions dashboard/src/components/ActionsWeekly.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { organisationState, userState } from '../recoil/auth';
import TagTeam from './TagTeam';
import useSearchParamState from '../services/useSearchParamState';
import { disableConsultationRow } from '../recoil/consultations';
import DescriptionIcon from './DescriptionIcon';

// TODO: remove inline style when UI is stabilized.

Expand Down
8 changes: 8 additions & 0 deletions dashboard/src/components/DescriptionIcon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import React from 'react';
import openNewWindow from '../assets/icons/description-icon.svg';

const DescriptionIcon = () => (
<div className="tw-ml-1 tw-inline-block tw-h-4 tw-w-4 tw-bg-contain tw-text-gray-300" style={{ backgroundImage: `url(${openNewWindow})` }} />
);

export default DescriptionIcon;
5 changes: 3 additions & 2 deletions dashboard/src/components/PersonName.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { personsObjectSelector } from '../recoil/selectors';
export default function PersonName({ item, onClick = null, redirectToTab = 'Résumé' }) {
const history = useHistory();
const persons = useRecoilValue(personsObjectSelector);
const personName = item?.personPopulated?.name || persons[item.person]?.name;
const person = item?.personPopulated ?? persons[item.person];
return (
<span
className="hover:tw-cursor-zoom-in hover:tw-bg-yellow-400"
Expand All @@ -15,7 +15,8 @@ export default function PersonName({ item, onClick = null, redirectToTab = 'Rés
if (onClick) return onClick();
if (item.person) history.push(`/person/${item.person}?tab=${redirectToTab}`);
}}>
{personName}
{person.name}
{person.otherNames ? <small className="tw-text-main75"> - {person.otherNames}</small> : null}
</span>
);
}
7 changes: 5 additions & 2 deletions dashboard/src/scenes/person/components/Actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { AgendaMutedIcon } from './AgendaMutedIcon';
import { FullScreenIcon } from './FullScreenIcon';
import UserName from '../../../components/UserName';
import { itemsGroupedByPersonSelector } from '../../../recoil/selectors';
import DescriptionIcon from '../../../components/DescriptionIcon';

const filteredPersonActionsSelector = selectorFamily({
key: 'filteredPersonActionsSelector',
Expand Down Expand Up @@ -185,8 +186,10 @@ const ActionsTable = ({ filteredData }) => {
history.push(`?${searchParams.toString()}`);
}}>
<div className="tw-flex">
<div className="tw-flex-1">
{action.urgent ? <ExclamationMarkButton /> : null} {`${date}${time}`}
<div className="tw-flex tw-flex-1 tw-items-center tw-gap-x-2">
{action.urgent ? <ExclamationMarkButton /> : null}
{action.description ? <DescriptionIcon /> : null}
<span>{`${date}${time}`}</span>
</div>
<div>
<ActionStatus status={action.status} />
Expand Down
6 changes: 5 additions & 1 deletion dashboard/src/scenes/person/components/Consultations.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { AgendaMutedIcon } from './AgendaMutedIcon';
import { disableConsultationRow } from '../../../recoil/consultations';
import { FullScreenIcon } from './FullScreenIcon';
import UserName from '../../../components/UserName';
import DescriptionIcon from '../../../components/DescriptionIcon';

export const Consultations = ({ person }) => {
const [fullScreen, setFullScreen] = useState(false);
Expand Down Expand Up @@ -184,7 +185,10 @@ const ConsultationsTable = ({ filteredData, person }) => {
history.push(`?${searchParams.toString()}`);
}}>
<div className="tw-flex">
<div className="tw-flex-1">{`${date}${time}`}</div>
<div className="tw-flex-1">
{!!consultation.description && <DescriptionIcon />}
{`${date}${time}`}
</div>
<div>
<ActionStatus status={consultation.status} />
</div>
Expand Down
19 changes: 13 additions & 6 deletions dashboard/src/scenes/report/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import { useLocalStorage } from '../../services/useLocalStorage';
import { arrayOfitemsGroupedByActionSelector, arrayOfitemsGroupedByConsultationSelector, personsObjectSelector } from '../../recoil/selectors';
import { treatmentsState } from '../../recoil/treatments';
import { medicalFileState } from '../../recoil/medicalFiles';
import DescriptionIcon from '../../components/DescriptionIcon';

const getPeriodTitle = (date, nightSession) => {
if (!nightSession) return `Journée du ${formatDateWithNameOfDay(date)}`;
Expand Down Expand Up @@ -1108,6 +1109,7 @@ const ActionCompletedAt = ({ date, status, actions, setSortOrder, setSortBy, sor
return (
<div className="tw-flex tw-items-center tw-justify-center tw-gap-1">
{!!action.urgent && <ExclamationMarkButton />}
{!!action.description && <DescriptionIcon />}
{!!organisation.groupsEnabled && !!action.group && (
<span className="tw-text-3xl" aria-label="Action familiale" title="Action familiale">
👪
Expand Down Expand Up @@ -1150,7 +1152,7 @@ const ActionCompletedAt = ({ date, status, actions, setSortOrder, setSortBy, sor
onSortBy: setSortBy,
sortBy,
sortOrder,
render: (action) => <PersonName item={action} />,
render: (action) => <PersonName showOtherNames item={action} />,
},
{
title: 'Statut',
Expand Down Expand Up @@ -1214,6 +1216,7 @@ const ActionCreatedAt = ({ date, actions, setSortOrder, setSortBy, sortBy, sortO
return (
<div className="tw-flex tw-items-center tw-justify-center tw-gap-1">
{!!action.urgent && <ExclamationMarkButton />}
{!!action.description && <DescriptionIcon />}
{!!organisation.groupsEnabled && !!action.group && (
<span className="tw-text-3xl" aria-label="Action familiale" title="Action familiale">
👪
Expand Down Expand Up @@ -1256,7 +1259,7 @@ const ActionCreatedAt = ({ date, actions, setSortOrder, setSortBy, sortBy, sortO
onSortBy: setSortBy,
sortBy,
sortOrder,
render: (action) => <PersonName item={action} />,
render: (action) => <PersonName showOtherNames item={action} />,
},
{
title: 'Statut',
Expand Down Expand Up @@ -1358,7 +1361,7 @@ const Consultations = ({ date, status, consultations, setSortOrder, setSortBy, s
onSortBy: setSortBy,
sortBy,
sortOrder,
render: (consultation) => <PersonName item={consultation} />,
render: (consultation) => <PersonName showOtherNames item={consultation} />,
},
{
title: 'Statut',
Expand Down Expand Up @@ -1423,7 +1426,7 @@ const ConsultationsCreatedAt = ({ date, consultations }) => {
{
title: 'Personne suivie',
dataKey: 'person',
render: (action) => <PersonName item={action} />,
render: (action) => <PersonName showOtherNames item={action} />,
},
{ title: 'Statut', dataKey: 'status', render: (action) => <ActionStatus status={action.status} /> },
]}
Expand Down Expand Up @@ -1643,7 +1646,7 @@ const PassagesCreatedAt = ({ date, passages, selectedTeams }) => {
title: 'Personne suivie',
dataKey: 'person',
render: (passage) =>
passage.person ? <PersonName item={passage} /> : <span style={{ opacity: 0.3, fontStyle: 'italic' }}>Anonyme</span>,
passage.person ? <PersonName showOtherNames item={passage} /> : <span style={{ opacity: 0.3, fontStyle: 'italic' }}>Anonyme</span>,
},
{
title: 'Enregistré par',
Expand Down Expand Up @@ -1723,7 +1726,11 @@ const RencontresCreatedAt = ({ date, rencontres, selectedTeams }) => {
title: 'Personne suivie',
dataKey: 'person',
render: (rencontre) =>
rencontre.person ? <PersonName item={rencontre} /> : <span style={{ opacity: 0.3, fontStyle: 'italic' }}>Anonyme</span>,
rencontre.person ? (
<PersonName showOtherNames item={rencontre} />
) : (
<span style={{ opacity: 0.3, fontStyle: 'italic' }}>Anonyme</span>
),
},
{
title: 'Enregistrée par',
Expand Down
2 changes: 2 additions & 0 deletions dashboard/src/scenes/search/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import ConsultationButton from '../../components/ConsultationButton';
import { useLocalStorage } from '../../services/useLocalStorage';
import { territoryObservationsState } from '../../recoil/territoryObservations';
import TabsNav from '../../components/tailwind/TabsNav';
import DescriptionIcon from '../../components/DescriptionIcon';

const personsWithFormattedBirthDateSelector = selector({
key: 'personsWithFormattedBirthDateSelector',
Expand Down Expand Up @@ -271,6 +272,7 @@ const Actions = ({ actions }) => {
return (
<div className="tw-flex tw-items-center tw-justify-center tw-gap-1">
{!!actionOrConsult.urgent && <ExclamationMarkButton />}
{!!actionOrConsult.description && <DescriptionIcon />}
{!!organisation.groupsEnabled && !!actionOrConsult.group && (
<span className="tw-text-3xl" aria-label="Action familiale" title="Action familiale">
👪
Expand Down

0 comments on commit 2c1193a

Please sign in to comment.