diff --git a/administration/src/bp-modules/cards/AddCardForm.tsx b/administration/src/bp-modules/cards/AddCardForm.tsx index 6fadd5ba8..cc3fbc4b0 100644 --- a/administration/src/bp-modules/cards/AddCardForm.tsx +++ b/administration/src/bp-modules/cards/AddCardForm.tsx @@ -1,6 +1,6 @@ import { Button, Card, FormGroup, InputGroup, Intent } from '@blueprintjs/core' import { TextField } from '@mui/material' -import React, { ChangeEvent, ReactElement } from 'react' +import React, { ChangeEvent, JSXElementConstructor, ReactElement } from 'react' import styled from 'styled-components' import { CardBlueprint } from '../../cards/CardBlueprint' @@ -29,13 +29,17 @@ type CreateCardsFormProps = { } export const maxCardValidity = { years: 99 } -export const ExtensionForm = ({ extension, onUpdate, viewportSmall }: ExtensionFormProps) => { +export const ExtensionForm = ({ + extension, + onUpdate, + viewportSmall, +}: ExtensionFormProps): ReactElement> | null => { return extension.createForm(() => { onUpdate() }, viewportSmall) } -const CreateCardForm = ({ cardBlueprint, onRemove, onUpdate }: CreateCardsFormProps): ReactElement => { +const AddCardForm = ({ cardBlueprint, onRemove, onUpdate }: CreateCardsFormProps): ReactElement => { const { viewportSmall } = useWindowDimensions() const today = PlainDate.fromLocalDate(new Date()) return ( @@ -89,4 +93,4 @@ const CreateCardForm = ({ cardBlueprint, onRemove, onUpdate }: CreateCardsFormPr ) } -export default CreateCardForm +export default AddCardForm diff --git a/administration/src/bp-modules/cards/AddCardsForm.tsx b/administration/src/bp-modules/cards/AddCardsForm.tsx index dfcbe10a2..c2a9b7abf 100644 --- a/administration/src/bp-modules/cards/AddCardsForm.tsx +++ b/administration/src/bp-modules/cards/AddCardsForm.tsx @@ -6,7 +6,7 @@ import styled from 'styled-components' import { CardBlueprint } from '../../cards/CardBlueprint' import { Region } from '../../generated/graphql' import { ProjectConfigContext } from '../../project-configs/ProjectConfigContext' -import CreateCardForm from './AddCardForm' +import AddCardForm from './AddCardForm' import CardFormButton from './CardFormButton' import { getHeaders } from './ImportCardsController' @@ -110,7 +110,7 @@ const AddCardsForm = ({ }}> {cardBlueprints.map(blueprint => ( - removeCardBlueprint(blueprint)} onUpdate={notifyUpdate} diff --git a/administration/src/bp-modules/self-service/CardSelfServiceForm.tsx b/administration/src/bp-modules/self-service/CardSelfServiceForm.tsx index f0d1a0d48..40e8feac9 100644 --- a/administration/src/bp-modules/self-service/CardSelfServiceForm.tsx +++ b/administration/src/bp-modules/self-service/CardSelfServiceForm.tsx @@ -29,6 +29,7 @@ const StyledCheckbox = styled(Checkbox)` const StyledAlert = styled(Alert)` margin-bottom: 24px; + white-space: pre-line; ` const Container = styled('div')` @@ -52,7 +53,7 @@ const getTooltipMessage = (cardsValid: boolean, dataPrivacyAccepted: boolean): s tooltipMessages.push('Bitte akzeptieren Sie die Datenschutzerklärung.') } - return tooltipMessages.join(' ') + return tooltipMessages.join('\n') } const CardSelfServiceForm = ({ card, @@ -123,11 +124,7 @@ const CardSelfServiceForm = ({ maxWidth='md' onUpdateOpen={setOpenDataPrivacy} title={projectConfig.dataPrivacyHeadline} - content={ - <> - - - } + content={} /> ) diff --git a/administration/src/bp-modules/self-service/hooks/useCardGeneratorSelfService.ts b/administration/src/bp-modules/self-service/hooks/useCardGeneratorSelfService.ts index 22946a69d..8dc23be44 100644 --- a/administration/src/bp-modules/self-service/hooks/useCardGeneratorSelfService.ts +++ b/administration/src/bp-modules/self-service/hooks/useCardGeneratorSelfService.ts @@ -79,7 +79,7 @@ const useCardGeneratorSelfService = (): UseCardGeneratorSelfServiceReturn => { [appToaster, setSelfServiceState] ) - const generateCards = useCallback(async () => { + const generateCards = useCallback(async (): Promise => { setIsLoading(true) try { @@ -125,9 +125,9 @@ const useCardGeneratorSelfService = (): UseCardGeneratorSelfServiceReturn => { } catch (error) { handleErrors(error) } - }, [selfServiceCards, projectConfig, setIsLoading, setSelfServiceCards, setDeepLink, setCode]) + }, [projectConfig, setIsLoading, setDeepLink, setCode, createCardsSelfService, handleErrors, selfServiceCards]) - const downloadPdf = async (code: CreateCardsResult, fileName: string) => { + const downloadPdf = async (code: CreateCardsResult, fileName: string): Promise => { const blob = await generatePdf([code], selfServiceCards, projectConfig.pdf) downloadDataUri(blob, fileName) } diff --git a/administration/src/cards/PdfFactory.ts b/administration/src/cards/PdfFactory.ts index dc89d1fbb..5a8efdd35 100644 --- a/administration/src/cards/PdfFactory.ts +++ b/administration/src/cards/PdfFactory.ts @@ -82,7 +82,7 @@ export async function generatePdf( cardBlueprints: CardBlueprint[], pdfConfig: PdfConfig, region?: Region -):Promise { +): Promise { try { const doc = await PDFDocument.create() diff --git a/administration/src/cards/extensions/BirthdayExtension.tsx b/administration/src/cards/extensions/BirthdayExtension.tsx index 7decc7341..9962b4d32 100644 --- a/administration/src/cards/extensions/BirthdayExtension.tsx +++ b/administration/src/cards/extensions/BirthdayExtension.tsx @@ -1,7 +1,7 @@ import { Colors, FormGroup } from '@blueprintjs/core' import { PartialMessage } from '@bufbuild/protobuf' import { TextField } from '@mui/material' -import {ReactElement} from "react"; +import { ReactElement } from 'react' import { CardExtensions } from '../../generated/card_pb' import PlainDate from '../../util/PlainDate' @@ -14,7 +14,7 @@ const minBirthday = new PlainDate(1900, 1, 1) class BirthdayExtension extends Extension { public readonly name = BirthdayExtension.name - setInitialState() { + setInitialState(): void { this.state = { birthday: minBirthday.toDaysSinceEpoch() } } diff --git a/administration/src/cards/extensions/KoblenzReferenceNumberExtension.tsx b/administration/src/cards/extensions/KoblenzReferenceNumberExtension.tsx index 2fede4464..ce678b60b 100644 --- a/administration/src/cards/extensions/KoblenzReferenceNumberExtension.tsx +++ b/administration/src/cards/extensions/KoblenzReferenceNumberExtension.tsx @@ -1,5 +1,6 @@ import { FormGroup, InputGroup, Intent } from '@blueprintjs/core' import { PartialMessage } from '@bufbuild/protobuf' +import { ReactElement } from 'react' import { CardExtensions } from '../../generated/card_pb' import ClearInputButton from './components/ClearInputButton' @@ -13,8 +14,8 @@ const KoblenzReferenceNumberMaxLength = 15 class KoblenzReferenceNumberExtension extends Extension { public readonly name = KoblenzReferenceNumberExtension.name - setInitialState() {} - createForm(onUpdate: () => void, viewportSmall = true) { + setInitialState(): void {} + createForm(onUpdate: () => void, viewportSmall = true): ReactElement { const clearInput = () => { this.state = { referenceNumber: '' } onUpdate() @@ -53,16 +54,16 @@ class KoblenzReferenceNumberExtension extends Extension) { + setProtobufData(message: PartialMessage): void { message.extensionKoblenzReferenceNumber = { referenceNumber: this.state?.referenceNumber, } } - isValid() { + isValid(): boolean { return ( this.state !== null && this.state.referenceNumber.length >= KoblenzReferenceNumberMinLength && @@ -70,14 +71,11 @@ class KoblenzReferenceNumberExtension extends Extension ( +export const ActivationText = (applicationName: string, downloadLink: string, deepLink: string): ReactElement => (
Aktivierung nur in der App möglich