Skip to content

Commit

Permalink
fix: make fromStop and toStop input fields optional in ticket control…
Browse files Browse the repository at this point in the history
… feedback form (#442)

* Remove inout fields for fromStop and toStop.

* Make fromStop and toStop optional.
  • Loading branch information
jonasbrunvoll authored Nov 25, 2024
1 parent d6462c8 commit 8a47261
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
14 changes: 2 additions & 12 deletions src/page-modules/contact/ticket-control/forms/feedbackForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export const FeedbackForm = ({ state, send }: FeedbackFormProps) => {
/>

<SearchableSelect
label={t(PageText.Contact.input.fromStop.label)}
label={t(PageText.Contact.input.fromStop.optionalLabel)}
value={state.context.fromStop}
placeholder={t(PageText.Contact.input.fromStop.optionLabel)}
isDisabled={!state.context.line}
Expand All @@ -93,15 +93,10 @@ export const FeedbackForm = ({ state, send }: FeedbackFormProps) => {
value: value,
});
}}
error={
state.context?.errorMessages['fromStop']?.[0]
? t(state.context?.errorMessages['fromStop']?.[0])
: undefined
}
/>

<SearchableSelect
label={t(PageText.Contact.input.toStop.label)}
label={t(PageText.Contact.input.toStop.optionalLabel)}
value={state.context.toStop}
placeholder={t(PageText.Contact.input.toStop.optionLabel)}
isDisabled={!state.context.line}
Expand All @@ -113,11 +108,6 @@ export const FeedbackForm = ({ state, send }: FeedbackFormProps) => {
value: value,
});
}}
error={
state.context?.errorMessages['toStop']?.[0]
? t(state.context?.errorMessages['toStop']?.[0])
: undefined
}
/>

<DateSelector
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,6 @@ const setInputToValidate = (context: ContextProps) => {
SWIFT,
transportMode,
line,
fromStop,
toStop,
dateOfTicketControl,
timeOfTicketControl,
} = context;
Expand Down Expand Up @@ -165,8 +163,6 @@ const setInputToValidate = (context: ContextProps) => {
return {
transportMode,
line,
fromStop,
toStop,
dateOfTicketControl,
timeOfTicketControl,
feedback,
Expand Down
10 changes: 10 additions & 0 deletions src/translations/pages/contact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -887,6 +887,11 @@ export const Contact = {

fromStop: {
label: _('Fra holdeplass/kai', 'From stop/harbor', 'Frå haldeplass/kai'),
optionalLabel: _(
'Velg holdeplass/kai (valgfritt)',
'Select stop/harbor (optinal)',
'Vel haldeplass/kai (valfritt)',
),
optionLabel: _(
'Velg holdeplass/kai',
'Select stop/harbor',
Expand All @@ -903,6 +908,11 @@ export const Contact = {

toStop: {
label: _('Til holdeplass/kai', 'To stop/harbor', 'Til haldeplass/kai'),
optionalLabel: _(
'Velg holdeplass/kai (valgfritt)',
'Select stop/harbor (optinal)',
'Vel haldeplass/kai (valfritt)',
),
optionLabel: _(
'Velg holdeplass/kai',
'Select stop/harbor',
Expand Down

0 comments on commit 8a47261

Please sign in to comment.