Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1804: Adding hint for birth date input for koblenz #1858

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

bahaaTuffaha
Copy link
Contributor

Short description

When entering the birth date in our self service portal there should be a hint: "Bei Minderjährigen unter 16 Jahren darf der KoblenzPass nur mit Einverständnis der Erziehungsberechtigten abgerufen werden."

Proposed changes

  • Added an optional sideComponent prop for customDatePicker.
  • I used HelpOutline icon wrapped with Tool Tip from bluePrint.

Side effects

  • CustomDatePicker.tsx, BirthdayExtension.tsx

Testing

  • I just test it from http://localhost:3000/erstellen

Fixes: #1804

Copy link
Contributor

@f1sh1918 f1sh1918 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tooltip is slightly misaligned (sorry for the nit-pick)
image

this could be fixed by setting the width and the margin on the tooltip component and not on the icon
image

administration/src/cards/extensions/BirthdayExtension.tsx Outdated Show resolved Hide resolved
{projectConfig.showBirthdayMinorHint && (
<StyledToolTip
className={Classes.TOOLTIP_INDICATOR}
content='Bei Minderjährigen unter 16 Jahren darf der KoblenzPass nur mit Einverständnis der Erziehungsberechtigten abgerufen werden.'>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@f1sh1918 how is it with translations? Should we move this there? Or even to some build config specific place as this is koblenz-only?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes it should be in the translations file. we may create a namespaces "extensions" for this.
Currently i think we have no need to create project specific translations in administration but it could be necessary for the future. I wouldn't put effort in this currently but maybe create overrides in the future

@@ -36,6 +36,7 @@ const config: ProjectConfig = {
selfServiceEnabled: true,
storesManagement: storesManagementConfig,
userImportApiEnabled: true,
showBirthdayMinorHint: true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would make it clearer, other wise it sounds like a minor (as in not that important) hint

Suggested change
showBirthdayMinorHint: true,
showUnderageHint: true,

Copy link
Contributor

@seluianova seluianova Jan 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

showBirthdayInfoHint or showBirthdayHint, if the text is customizable per project? (it could contain any kind of info then?)

Copy link
Contributor

@f1sh1918 f1sh1918 Jan 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm since we have no real configuration structure for our extensions i think we may include the extension name in the flag. Maybe we want to refactor the extensions structure in the future and this flag can move then to the extension itself

Comment on lines +63 to +73
sideComponent={
<>
{projectConfig.showBirthdayMinorHint && (
<StyledToolTip
className={Classes.TOOLTIP_INDICATOR}
content='Bei Minderjährigen unter 16 Jahren darf der KoblenzPass nur mit Einverständnis der Erziehungsberechtigten abgerufen werden.'>
<StyledHelpOutlineIcon fontSize='small' />
</StyledToolTip>
)}
</>
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 I think we should not pass this to the DatePicker component, this is not a thing it should be concerned with. Instead, we should make sure the styling is correct here and render the hint directly here.
I see three options:

  1. Render it next to the label of the FormGroup (label accepts also React nodes)
  2. Use FormGroups helperText prop and just display a text, possibly only if the birthday is actually underage
  3. Render it here next to the date input and fix the styling here. I don't really like it though as it makes the inputs have different lengths

@f1sh1918 what do you think?

Copy link
Contributor

@f1sh1918 f1sh1918 Jan 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm i think you should ask @hauf-toni
We have already an explanation to the "Aktenzeichen" form field which opens a modal with explanations
i'm not pretty sure if we want to implement the same behavior but it makes it easier for the user to have sth. consistent and predictable

image

Copy link
Contributor

@seluianova seluianova Jan 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wanted to share that I also liked it more, when all fields have the same width.

As an idea, what if we show this warning as a dialog after the form submission, only if the selected date was under 18? And the user could explicitly confirm that he is "einverstanden".. 🤔

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would even ask toni

maxDate={maxDate}
onChange={onChange}
/>
{sideComponent}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The icon is sadly not correctly vertically centered/aligned:
image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like the parent is not flex

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but first check where we want to put it in the end (see other comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add "Hint"-button to self-service-portal birth date input field
4 participants