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

chore: cleanup translations #368

Merged
merged 9 commits into from
Sep 27, 2024
38 changes: 20 additions & 18 deletions src/page-modules/contact/means-of-transport/forms/delayForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const DelayForm = ({ state, send }: DelayFormProps) => {
</Typo.p>

<Select
label={t(PageText.Contact.inputFields.transportMode.label).toString()}
label={t(PageText.Contact.input.transportMode.label).toString()}
value={state.context.transportMode}
onChange={(value) =>
send({
Expand All @@ -58,13 +58,11 @@ export const DelayForm = ({ state, send }: DelayFormProps) => {
}
valueToId={(val: TransportModeType) => val}
options={['bus', 'water'] as TransportModeType[]}
placeholder={t(
PageText.Contact.inputFields.transportMode.optionLabel,
)}
placeholder={t(PageText.Contact.input.transportMode.optionLabel)}
/>

<Select
label={t(PageText.Contact.inputFields.line.label)}
label={t(PageText.Contact.input.line.label)}
value={state.context.line}
disabled={!state.context.transportMode}
onChange={(value: Line | undefined) => {
Expand All @@ -80,7 +78,7 @@ export const DelayForm = ({ state, send }: DelayFormProps) => {
)}
valueToId={(line: Line) => line.id}
valueToText={(line: Line) => line.name}
placeholder={t(PageText.Contact.inputFields.line.optionLabel)}
placeholder={t(PageText.Contact.input.line.optionLabel)}
error={
state.context?.errorMessages['line']?.[0]
? t(state.context?.errorMessages['line']?.[0])
Expand All @@ -89,7 +87,7 @@ export const DelayForm = ({ state, send }: DelayFormProps) => {
/>

<Select
label={t(PageText.Contact.inputFields.fromStop.label)}
label={t(PageText.Contact.input.fromStop.label)}
value={state.context.fromStop}
disabled={!state.context.line}
onChange={(value) => {
Expand All @@ -103,7 +101,7 @@ export const DelayForm = ({ state, send }: DelayFormProps) => {
options={
state.context.line?.id ? getQuaysByLine(state.context.line.id) : []
}
placeholder={t(PageText.Contact.inputFields.fromStop.optionLabel)}
placeholder={t(PageText.Contact.input.fromStop.optionLabel)}
error={
state.context?.errorMessages['fromStop']?.[0]
? t(state.context?.errorMessages['fromStop']?.[0])
Expand All @@ -114,7 +112,7 @@ export const DelayForm = ({ state, send }: DelayFormProps) => {
/>

<Select
label={t(PageText.Contact.inputFields.toStop.label)}
label={t(PageText.Contact.input.toStop.label)}
value={state.context.toStop}
disabled={!state.context.line}
onChange={(value) => {
Expand All @@ -125,7 +123,7 @@ export const DelayForm = ({ state, send }: DelayFormProps) => {
value: value,
});
}}
placeholder={t(PageText.Contact.inputFields.toStop.optionLabel)}
placeholder={t(PageText.Contact.input.toStop.optionLabel)}
options={
state.context.line?.id ? getQuaysByLine(state.context.line.id) : []
}
Expand All @@ -139,10 +137,11 @@ export const DelayForm = ({ state, send }: DelayFormProps) => {
/>

<Input
label={PageText.Contact.inputFields.date}
label={PageText.Contact.input.date.label}
type="date"
name="date"
value={state.context.date}
errorMessage={state.context?.errorMessages['date']?.[0]}
onChange={(e) =>
send({
type: 'ON_INPUT_CHANGE',
Expand All @@ -153,10 +152,13 @@ export const DelayForm = ({ state, send }: DelayFormProps) => {
/>

<Input
label={PageText.Contact.inputFields.plannedDepartureTime}
label={PageText.Contact.input.plannedDepartureTime.label}
type="time"
name="time"
value={state.context.plannedDepartureTime}
errorMessage={
state.context?.errorMessages['plannedDepartureTime']?.[0]
}
onChange={(e) =>
send({
type: 'ON_INPUT_CHANGE',
Expand All @@ -167,9 +169,9 @@ export const DelayForm = ({ state, send }: DelayFormProps) => {
/>
</SectionCard>

<SectionCard title={t(PageText.Contact.inputFields.feedback.title)}>
<SectionCard title={t(PageText.Contact.input.feedback.title)}>
<Typo.p textType="body__primary">
{t(PageText.Contact.inputFields.feedback.description)}
{t(PageText.Contact.input.feedback.description)}
</Typo.p>
<Textarea
value={state.context.feedback}
Expand All @@ -188,7 +190,7 @@ export const DelayForm = ({ state, send }: DelayFormProps) => {
/>
<FileInput
name="attachments"
label={t(PageText.Contact.inputFields.feedback.attachment)}
label={t(PageText.Contact.input.feedback.attachment)}
onChange={(files) => {
send({
type: 'ON_INPUT_CHANGE',
Expand All @@ -200,7 +202,7 @@ export const DelayForm = ({ state, send }: DelayFormProps) => {
</SectionCard>
<SectionCard title={t(PageText.Contact.aboutYouInfo.optionalTitle)}>
<Input
label={PageText.Contact.inputFields.firstName.label}
label={PageText.Contact.input.firstName.label}
type="text"
name="firstName"
value={state.context.firstName}
Expand All @@ -214,7 +216,7 @@ export const DelayForm = ({ state, send }: DelayFormProps) => {
/>

<Input
label={PageText.Contact.inputFields.lastName.label}
label={PageText.Contact.input.lastName.label}
type="text"
name="lastName"
value={state.context.lastName}
Expand All @@ -228,7 +230,7 @@ export const DelayForm = ({ state, send }: DelayFormProps) => {
/>

<Input
label={PageText.Contact.inputFields.email.label}
label={PageText.Contact.input.email.label}
type="email"
name="email"
value={state.context.email}
Expand Down
50 changes: 26 additions & 24 deletions src/page-modules/contact/means-of-transport/forms/driverForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const DriverForm = ({ state, send }: DriverFormProps) => {
</Typo.p>

<Select
label={t(PageText.Contact.inputFields.area.label).toString()}
label={t(PageText.Contact.input.area.label).toString()}
value={state.context.area}
valueToId={(option) => option.id}
valueToText={(option) => t(option.name)}
Expand All @@ -52,8 +52,8 @@ export const DriverForm = ({ state, send }: DriverFormProps) => {
value: value,
});
}}
placeholder={t(PageText.Contact.inputFields.area.optionLabel)}
options={PageText.Contact.inputFields.area.options}
placeholder={t(PageText.Contact.input.area.optionLabel)}
options={PageText.Contact.input.area.options}
error={
state.context?.errorMessages['area']?.[0]
? t(state.context?.errorMessages['area']?.[0])
Expand All @@ -62,7 +62,7 @@ export const DriverForm = ({ state, send }: DriverFormProps) => {
/>

<Select
label={t(PageText.Contact.inputFields.transportMode.label).toString()}
label={t(PageText.Contact.input.transportMode.label).toString()}
value={state.context.transportMode}
onChange={(value) =>
send({
Expand All @@ -81,13 +81,11 @@ export const DriverForm = ({ state, send }: DriverFormProps) => {
}
valueToId={(val: TransportModeType) => val}
options={['bus', 'water'] as TransportModeType[]}
placeholder={t(
PageText.Contact.inputFields.transportMode.optionLabel,
)}
placeholder={t(PageText.Contact.input.transportMode.optionLabel)}
/>

<Select
label={t(PageText.Contact.inputFields.line.label)}
label={t(PageText.Contact.input.line.label)}
value={state.context.line}
disabled={!state.context.transportMode}
onChange={(value: Line | undefined) => {
Expand All @@ -103,7 +101,7 @@ export const DriverForm = ({ state, send }: DriverFormProps) => {
)}
valueToId={(line: Line) => line.id}
valueToText={(line: Line) => line.name}
placeholder={t(PageText.Contact.inputFields.line.optionLabel)}
placeholder={t(PageText.Contact.input.line.optionLabel)}
error={
state.context?.errorMessages['line']?.[0]
? t(state.context?.errorMessages['line']?.[0])
Expand All @@ -112,7 +110,7 @@ export const DriverForm = ({ state, send }: DriverFormProps) => {
/>

<Select
label={t(PageText.Contact.inputFields.fromStop.label)}
label={t(PageText.Contact.input.fromStop.label)}
value={state.context.fromStop}
disabled={!state.context.line}
onChange={(value) => {
Expand All @@ -126,7 +124,7 @@ export const DriverForm = ({ state, send }: DriverFormProps) => {
options={
state.context.line?.id ? getQuaysByLine(state.context.line.id) : []
}
placeholder={t(PageText.Contact.inputFields.fromStop.optionLabel)}
placeholder={t(PageText.Contact.input.fromStop.optionLabel)}
error={
state.context?.errorMessages['fromStop']?.[0]
? t(state.context?.errorMessages['fromStop']?.[0])
Expand All @@ -137,7 +135,7 @@ export const DriverForm = ({ state, send }: DriverFormProps) => {
/>

<Select
label={t(PageText.Contact.inputFields.toStop.label)}
label={t(PageText.Contact.input.toStop.label)}
value={state.context.toStop}
disabled={!state.context.line}
onChange={(value) => {
Expand All @@ -148,7 +146,7 @@ export const DriverForm = ({ state, send }: DriverFormProps) => {
value: value,
});
}}
placeholder={t(PageText.Contact.inputFields.toStop.optionLabel)}
placeholder={t(PageText.Contact.input.toStop.optionLabel)}
options={
state.context.line?.id ? getQuaysByLine(state.context.line.id) : []
}
Expand All @@ -162,10 +160,11 @@ export const DriverForm = ({ state, send }: DriverFormProps) => {
/>

<Input
label={PageText.Contact.inputFields.date}
label={PageText.Contact.input.date.label}
type="date"
name="date"
value={state.context.date}
errorMessage={state.context?.errorMessages['date']?.[0]}
onChange={(e) =>
send({
type: 'ON_INPUT_CHANGE',
Expand All @@ -176,10 +175,13 @@ export const DriverForm = ({ state, send }: DriverFormProps) => {
/>

<Input
label={PageText.Contact.inputFields.plannedDepartureTime}
label={PageText.Contact.input.plannedDepartureTime.label}
type="time"
name="time"
value={state.context.plannedDepartureTime}
errorMessage={
state.context?.errorMessages['plannedDepartureTime']?.[0]
}
onChange={(e) =>
send({
type: 'ON_INPUT_CHANGE',
Expand All @@ -190,9 +192,9 @@ export const DriverForm = ({ state, send }: DriverFormProps) => {
/>
</SectionCard>

<SectionCard title={t(PageText.Contact.inputFields.feedback.title)}>
<SectionCard title={t(PageText.Contact.input.feedback.title)}>
<Typo.p textType="body__primary">
{t(PageText.Contact.inputFields.feedback.description)}
{t(PageText.Contact.input.feedback.description)}
</Typo.p>
<Textarea
value={state.context.feedback}
Expand All @@ -211,7 +213,7 @@ export const DriverForm = ({ state, send }: DriverFormProps) => {
/>
<FileInput
name="attachments"
label={t(PageText.Contact.inputFields.feedback.attachment)}
label={t(PageText.Contact.input.feedback.attachment)}
onChange={(files) => {
send({
type: 'ON_INPUT_CHANGE',
Expand All @@ -223,7 +225,7 @@ export const DriverForm = ({ state, send }: DriverFormProps) => {
</SectionCard>
<SectionCard title={t(PageText.Contact.aboutYouInfo.optionalTitle)}>
<Input
label={PageText.Contact.inputFields.firstName.label}
label={PageText.Contact.input.firstName.label}
type="text"
name="firstName"
value={state.context.firstName}
Expand All @@ -237,7 +239,7 @@ export const DriverForm = ({ state, send }: DriverFormProps) => {
/>

<Input
label={PageText.Contact.inputFields.lastName.label}
label={PageText.Contact.input.lastName.label}
type="text"
name="lastName"
value={state.context.lastName}
Expand All @@ -251,11 +253,11 @@ export const DriverForm = ({ state, send }: DriverFormProps) => {
/>

<Typo.p textType="body__primary">
{t(PageText.Contact.inputFields.email.wantsToBeContacted.question)}
{t(PageText.Contact.input.email.wantsToBeContacted.question)}
</Typo.p>

<RadioInput
label={t(PageText.Contact.inputFields.email.wantsToBeContacted.yes)}
label={t(PageText.Contact.input.email.wantsToBeContacted.yes)}
name="wantsToBeContacted"
checked={state.context.wantsToBeContacted}
onChange={() =>
Expand All @@ -267,7 +269,7 @@ export const DriverForm = ({ state, send }: DriverFormProps) => {
}
/>
<RadioInput
label={t(PageText.Contact.inputFields.email.wantsToBeContacted.no)}
label={t(PageText.Contact.input.email.wantsToBeContacted.no)}
name="wantsToBeContacted"
checked={!state.context.wantsToBeContacted}
onChange={() =>
Expand All @@ -280,7 +282,7 @@ export const DriverForm = ({ state, send }: DriverFormProps) => {
/>
{state.context.wantsToBeContacted && (
<Input
label={PageText.Contact.inputFields.email.wantsToBeContacted.label}
label={PageText.Contact.input.email.wantsToBeContacted.label}
type="email"
name="email"
value={state.context.email}
Expand Down
Loading
Loading