From df830784d05b1a5889c358794aa9536ab98c462a Mon Sep 17 00:00:00 2001 From: dag-mara Date: Sun, 5 Jan 2025 19:10:08 +0100 Subject: [PATCH 1/3] hide user info --- .../registration/ShowApplicationModal.tsx | 109 ------------------ 1 file changed, 109 deletions(-) diff --git a/frontend/src/org/components/EventForm/steps/registration/ShowApplicationModal.tsx b/frontend/src/org/components/EventForm/steps/registration/ShowApplicationModal.tsx index 3188217e..0dcdda17 100644 --- a/frontend/src/org/components/EventForm/steps/registration/ShowApplicationModal.tsx +++ b/frontend/src/org/components/EventForm/steps/registration/ShowApplicationModal.tsx @@ -177,115 +177,6 @@ export const ShowApplicationModal: FC = ({ )} - {userId && user && ( -
-
-

Uživatel přidaný na akci:

-

- {user.first_name} {user.last_name}{' '} - {user.nickname && `(${user.nickname})`}{' '} -

-
- - {user.birthday && ( -
- Datum narození: - {user.birthday} -
- )} - {user.pronoun?.name && ( -
- Oslovení: - {user.pronoun.name} -
- )} - - {user.email && ( -
- E-mail: - - {user.email} - -
- )} - {user.phone && ( -
- Telefon: - - {user.phone} - -
- )} - {user.health_issues && ( -
- Zdravotní omezení: - {user.health_issues} -
- )} - {user.close_person && ( -
- Blízká osoba: - {`${user.close_person.first_name} ${user.close_person.last_name}`} - {user.close_person.email && ( - - 'email: ' {user.close_person.email} - - )} - {user.close_person.phone && ( - - 'tel: ' {user.close_person.phone} - - )} -
- )} - {currentMemberships && currentMemberships.length !== 0 && ( -
- Členství: -
- {currentMemberships.map(membership => { - return ( - - {administrationUnits && categories && ( -
- { - administrationUnits.find( - unit => - membership.administration_unit === unit.id, - )?.name - } - {' - '} - { - categories.find( - category => - membership.category.id === category.id, - )?.name - }{' '} - ({membership.year}) -
- )} -
- ) - })} -
-
- )} -
- )} - {userId && - user && - currentApplication && - currentApplication.email === formattedUser.email && ( -
-

Detaily uživatele:

- -
- )} ) } From 7f4656e4aadc009d607b161e2d2f13bf18bcd63b Mon Sep 17 00:00:00 2001 From: dag-mara Date: Sun, 5 Jan 2025 19:34:05 +0100 Subject: [PATCH 2/3] delete unused imports --- .../registration/ShowApplicationModal.tsx | 26 ++----------------- 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/frontend/src/org/components/EventForm/steps/registration/ShowApplicationModal.tsx b/frontend/src/org/components/EventForm/steps/registration/ShowApplicationModal.tsx index 0dcdda17..f4b852a3 100644 --- a/frontend/src/org/components/EventForm/steps/registration/ShowApplicationModal.tsx +++ b/frontend/src/org/components/EventForm/steps/registration/ShowApplicationModal.tsx @@ -6,12 +6,9 @@ import type { MembershipCategory, User, } from 'app/services/bisTypes' -import { EmailButton, PhoneButton, StyledModal, DataView } from 'components' +import { EmailButton, PhoneButton, StyledModal } from 'components' +import { FC } from 'react' import styles from '../ParticipantsStep.module.scss' -import { FC, Fragment } from 'react' -import { mergeWith, omit } from 'lodash' -import { withOverwriteArray } from 'utils/helpers' -import * as combinedTranslations from 'config/static/combinedTranslations' interface IShowApplicationModalProps { open: boolean @@ -37,8 +34,6 @@ export const ShowApplicationModal: FC = ({ // setShowAddParticipantModal, // deleteEventApplication, userId, - categories, - administrationUnits, currentParticipant, participantsMap, }) => { @@ -64,23 +59,6 @@ export const ShowApplicationModal: FC = ({ } : skipToken, ) - // we'll also show last year membership till end of February - // we want to give people time to register for the new year - // and still show continuity of membership - const currentYear = new Date().getFullYear() - const currentMonth = new Date().getMonth() - const currentMemberships = (user?.memberships ?? []).filter( - membership => - membership.year === currentYear || - (currentMonth < 2 && membership.year === currentYear - 1), - ) - // TODO consider showing historical memberships, too - - const formattedUser = mergeWith( - omit(user, 'id', '_search_id', 'display_name'), - { memberships: user?.memberships }, - withOverwriteArray, - ) if (!open) return null From 39077d2dd25e1540707d18b0729bcf8dc63fada6 Mon Sep 17 00:00:00 2001 From: dag-mara Date: Mon, 6 Jan 2025 20:16:44 +0100 Subject: [PATCH 3/3] revert change --- .../registration/ShowApplicationModal.tsx | 138 +++++++++++++++++- 1 file changed, 137 insertions(+), 1 deletion(-) diff --git a/frontend/src/org/components/EventForm/steps/registration/ShowApplicationModal.tsx b/frontend/src/org/components/EventForm/steps/registration/ShowApplicationModal.tsx index f4b852a3..0e835d12 100644 --- a/frontend/src/org/components/EventForm/steps/registration/ShowApplicationModal.tsx +++ b/frontend/src/org/components/EventForm/steps/registration/ShowApplicationModal.tsx @@ -7,7 +7,9 @@ import type { User, } from 'app/services/bisTypes' import { EmailButton, PhoneButton, StyledModal } from 'components' -import { FC } from 'react' +import { mergeWith, omit } from 'lodash' +import { FC, Fragment } from 'react' +import { withOverwriteArray } from 'utils/helpers' import styles from '../ParticipantsStep.module.scss' interface IShowApplicationModalProps { @@ -34,6 +36,8 @@ export const ShowApplicationModal: FC = ({ // setShowAddParticipantModal, // deleteEventApplication, userId, + categories, + administrationUnits, currentParticipant, participantsMap, }) => { @@ -60,6 +64,26 @@ export const ShowApplicationModal: FC = ({ : skipToken, ) + // we'll also show last year membership till end of February + // we want to give people time to register for the new year + // and still show continuity of membership + const currentYear = new Date().getFullYear() + const currentMonth = new Date().getMonth() + const currentMemberships = (user?.memberships ?? []).filter( + membership => + membership.year === currentYear || + (currentMonth < 2 && membership.year === currentYear - 1), + ) + // TODO consider showing historical memberships, too + + const formattedUser = mergeWith( + omit(user, 'id', '_search_id', 'display_name'), + { memberships: user?.memberships }, + withOverwriteArray, + ) + + console.log(currentApplication) + if (!open) return null return ( @@ -155,6 +179,118 @@ export const ShowApplicationModal: FC = ({ )} + {(!currentApplication || Object.keys(currentApplication).length === 0) && + userId && + user && ( +
+
+

Uživatel přidaný na akci:

+

+ {user.first_name} {user.last_name}{' '} + {user.nickname && `(${user.nickname})`}{' '} +

+
+ + {user.birthday && ( +
+ Datum narození: + {user.birthday} +
+ )} + {user.pronoun?.name && ( +
+ Oslovení: + {user.pronoun.name} +
+ )} + + {user.email && ( +
+ E-mail: + + {user.email} + +
+ )} + {user.phone && ( +
+ Telefon: + + {user.phone} + +
+ )} + {user.health_issues && ( +
+ Zdravotní omezení: + {user.health_issues} +
+ )} + {user.close_person && ( +
+ Blízká osoba: + {`${user.close_person.first_name} ${user.close_person.last_name}`} + {user.close_person.email && ( + + 'email: '{' '} + {user.close_person.email} + + )} + {user.close_person.phone && ( + + 'tel: ' {user.close_person.phone} + + )} +
+ )} + {currentMemberships && currentMemberships.length !== 0 && ( +
+ Členství: +
+ {currentMemberships.map(membership => { + return ( + + {administrationUnits && categories && ( +
+ { + administrationUnits.find( + unit => + membership.administration_unit === unit.id, + )?.name + } + {' - '} + { + categories.find( + category => + membership.category.id === category.id, + )?.name + }{' '} + ({membership.year}) +
+ )} +
+ ) + })} +
+
+ )} +
+ )} + {/* {userId && + user && + currentApplication && + currentApplication.email === formattedUser.email && ( +
+

Detaily uživatele:

+ +
+ )} */} ) }