-
Notifications
You must be signed in to change notification settings - Fork 3
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
base: main
Are you sure you want to change the base?
Changes from all commits
cfc96cc
cb02c2e
c8c1620
2f557f2
ff37657
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,24 @@ | ||
import { FormGroup } from '@blueprintjs/core' | ||
import React, { ReactElement, useState } from 'react' | ||
import { Classes, FormGroup, Tooltip } from '@blueprintjs/core' | ||
import HelpOutlineIcon from '@mui/icons-material/HelpOutline' | ||
import React, { ReactElement, useContext, useState } from 'react' | ||
import styled from 'styled-components' | ||
|
||
import CustomDatePicker from '../../bp-modules/components/CustomDatePicker' | ||
import FormErrorMessage from '../../bp-modules/self-service/components/FormErrorMessage' | ||
import { ProjectConfigContext } from '../../project-configs/ProjectConfigContext' | ||
import PlainDate from '../../util/PlainDate' | ||
import { Extension, ExtensionComponentProps } from './extensions' | ||
|
||
const StyledToolTip = styled(Tooltip)` | ||
border: 0; | ||
width: 20px; | ||
margin-left: 16px; | ||
` | ||
|
||
const StyledHelpOutlineIcon = styled(HelpOutlineIcon)` | ||
color: #595959; | ||
` | ||
|
||
export const BIRTHDAY_EXTENSION_NAME = 'birthday' | ||
export type BirthdayExtensionState = { [BIRTHDAY_EXTENSION_NAME]: PlainDate | null } | ||
|
||
|
@@ -21,6 +34,8 @@ const BirthdayForm = ({ | |
const [touched, setTouched] = useState(false) | ||
const { birthday } = value | ||
const showErrorMessage = touched || showRequired | ||
const projectConfig = useContext(ProjectConfigContext) | ||
|
||
const getErrorMessage = (): string | null => { | ||
if (!birthday) { | ||
return 'Bitte geben Sie ein gültiges Geburtsdatum an.' | ||
|
@@ -45,6 +60,17 @@ const BirthdayForm = ({ | |
isValid={isValid || !showErrorMessage} | ||
maxDate={new Date()} | ||
disableFuture | ||
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.'> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
<StyledHelpOutlineIcon fontSize='small' /> | ||
</StyledToolTip> | ||
)} | ||
</> | ||
} | ||
Comment on lines
+63
to
+73
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
@f1sh1918 what do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm i think you should ask @hauf-toni There was a problem hiding this comment. Choose a reason for hiding this commentThe 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".. 🤔 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i would even ask toni |
||
/> | ||
{showErrorMessage && <FormErrorMessage errorMessage={getErrorMessage()} />} | ||
</FormGroup> | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -36,6 +36,7 @@ const config: ProjectConfig = { | |||||
selfServiceEnabled: true, | ||||||
storesManagement: storesManagementConfig, | ||||||
userImportApiEnabled: true, | ||||||
showBirthdayMinorHint: true, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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?) There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||||||
} | ||||||
|
||||||
export default config |
There was a problem hiding this comment.
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:
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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)