feat: SW-276 Updated translations
This commit is contained in:
@@ -4,17 +4,9 @@ import Select from "@/components/TempDesignSystem/Select"
|
|||||||
|
|
||||||
import {
|
import {
|
||||||
Child,
|
Child,
|
||||||
ChildBed,
|
ChildInfoSelectorProps,
|
||||||
} from "@/types/components/bookingWidget/guestsRoomsPicker"
|
} from "@/types/components/bookingWidget/guestsRoomsPicker"
|
||||||
|
|
||||||
type ChildSelectorProps = {
|
|
||||||
child: Child
|
|
||||||
index: number
|
|
||||||
availableBedTypes?: ChildBed[]
|
|
||||||
updateChild: (child: Child, index: number) => void
|
|
||||||
childAgeError: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function ChildInfoSelector({
|
export default function ChildInfoSelector({
|
||||||
child = { age: -1, bed: -1 },
|
child = { age: -1, bed: -1 },
|
||||||
index = 0,
|
index = 0,
|
||||||
@@ -24,10 +16,11 @@ export default function ChildInfoSelector({
|
|||||||
{ label: "In extra bed", value: 2 },
|
{ label: "In extra bed", value: 2 },
|
||||||
],
|
],
|
||||||
updateChild = (child: Child, index: number) => {},
|
updateChild = (child: Child, index: number) => {},
|
||||||
childAgeError,
|
isValid,
|
||||||
}: ChildSelectorProps) {
|
}: ChildInfoSelectorProps) {
|
||||||
const intl = useIntl()
|
const intl = useIntl()
|
||||||
const ageLabel = intl.formatMessage({ id: "Age" })
|
const ageLabel = intl.formatMessage({ id: "Age" })
|
||||||
|
const ageReqdErrMsg = intl.formatMessage({ id: "Child age is required" })
|
||||||
const bedLabel = intl.formatMessage({ id: "Bed" })
|
const bedLabel = intl.formatMessage({ id: "Bed" })
|
||||||
|
|
||||||
const ageList = [
|
const ageList = [
|
||||||
@@ -70,9 +63,7 @@ export default function ChildInfoSelector({
|
|||||||
name="age"
|
name="age"
|
||||||
placeholder={ageLabel}
|
placeholder={ageLabel}
|
||||||
/>
|
/>
|
||||||
{childAgeError && child.age < 0 ? (
|
{!isValid && child.age < 0 ? <span>{ageReqdErrMsg}</span> : null}
|
||||||
<span>Child Age is required</span>
|
|
||||||
) : null}
|
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
{child.age !== -1 ? (
|
{child.age !== -1 ? (
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ export default function ChildSelector({
|
|||||||
roomChildren = [],
|
roomChildren = [],
|
||||||
adultCount = 1,
|
adultCount = 1,
|
||||||
updateChildren = (children: Child[]) => {},
|
updateChildren = (children: Child[]) => {},
|
||||||
childAgeError,
|
isValid,
|
||||||
}: ChildSelectorProps) {
|
}: ChildSelectorProps) {
|
||||||
const intl = useIntl()
|
const intl = useIntl()
|
||||||
const childrenLabel = intl.formatMessage({ id: "Children" })
|
const childrenLabel = intl.formatMessage({ id: "Children" })
|
||||||
@@ -107,7 +107,7 @@ export default function ChildSelector({
|
|||||||
child={child}
|
child={child}
|
||||||
availableBedTypes={childBedTypes[index]}
|
availableBedTypes={childBedTypes[index]}
|
||||||
updateChild={updateChildInfo}
|
updateChild={updateChildInfo}
|
||||||
childAgeError={childAgeError}
|
isValid={isValid}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ export default function GuestsRoomPicker({
|
|||||||
handleOnSelect = (selected: GuestsRoom, index: number) => {},
|
handleOnSelect = (selected: GuestsRoom, index: number) => {},
|
||||||
room = { adults: 1, children: [] },
|
room = { adults: 1, children: [] },
|
||||||
index = 1,
|
index = 1,
|
||||||
childAgeError,
|
isValid,
|
||||||
}: GuestsRoomPickerProps) {
|
}: GuestsRoomPickerProps) {
|
||||||
const intl = useIntl()
|
const intl = useIntl()
|
||||||
const roomLabel = intl.formatMessage({ id: "Room" })
|
const roomLabel = intl.formatMessage({ id: "Room" })
|
||||||
@@ -42,7 +42,7 @@ export default function GuestsRoomPicker({
|
|||||||
roomChildren={room.children}
|
roomChildren={room.children}
|
||||||
adultCount={room.adults}
|
adultCount={room.adults}
|
||||||
updateChildren={updateChildren}
|
updateChildren={updateChildren}
|
||||||
childAgeError={childAgeError}
|
isValid={isValid}
|
||||||
/>
|
/>
|
||||||
</section>
|
</section>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
"use client"
|
"use client"
|
||||||
import { useState } from "react"
|
import { useState } from "react"
|
||||||
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
import useLang from "@/hooks/useLang"
|
import useLang from "@/hooks/useLang"
|
||||||
|
|
||||||
@@ -23,9 +24,11 @@ export default function GuestsRoomsPicker({
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
closePicker,
|
closePicker,
|
||||||
childAgeError,
|
isValid,
|
||||||
}: GuestsRoomsPickerProps) {
|
}: GuestsRoomsPickerProps) {
|
||||||
const lang = useLang()
|
const lang = useLang()
|
||||||
|
const intl = useIntl()
|
||||||
|
const doneLabel = intl.formatMessage({ id: "Done" })
|
||||||
const [selectedGuests, setSelectedGuests] =
|
const [selectedGuests, setSelectedGuests] =
|
||||||
useState<GuestsRoom[]>(initialSelected)
|
useState<GuestsRoom[]>(initialSelected)
|
||||||
|
|
||||||
@@ -39,6 +42,7 @@ export default function GuestsRoomsPicker({
|
|||||||
setSelectedGuests(updatedSelectedGuests)
|
setSelectedGuests(updatedSelectedGuests)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Not in MVP scope
|
||||||
function addRoom() {
|
function addRoom() {
|
||||||
if (selectedGuests.length < 4) {
|
if (selectedGuests.length < 4) {
|
||||||
let updatedSelectedGuests = JSON.parse(JSON.stringify(selectedGuests))
|
let updatedSelectedGuests = JSON.parse(JSON.stringify(selectedGuests))
|
||||||
@@ -51,6 +55,7 @@ export default function GuestsRoomsPicker({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Not in MVP scope
|
||||||
function removeRoom(index: number) {
|
function removeRoom(index: number) {
|
||||||
if (selectedGuests.length > 1) {
|
if (selectedGuests.length > 1) {
|
||||||
let updatedSelectedGuests = JSON.parse(JSON.stringify(selectedGuests))
|
let updatedSelectedGuests = JSON.parse(JSON.stringify(selectedGuests))
|
||||||
@@ -68,7 +73,7 @@ export default function GuestsRoomsPicker({
|
|||||||
room={room}
|
room={room}
|
||||||
handleOnSelect={handleSelectRoomGuests}
|
handleOnSelect={handleSelectRoomGuests}
|
||||||
index={index}
|
index={index}
|
||||||
childAgeError={childAgeError}
|
isValid={isValid}
|
||||||
/>
|
/>
|
||||||
{/* Not in MVP
|
{/* Not in MVP
|
||||||
{index > 0 ? (
|
{index > 0 ? (
|
||||||
@@ -86,7 +91,9 @@ export default function GuestsRoomsPicker({
|
|||||||
Add Room
|
Add Room
|
||||||
</Button>
|
</Button>
|
||||||
) : null} */}
|
) : null} */}
|
||||||
<Button onClick={closePicker}>Done</Button>
|
<Button onClick={closePicker} disabled={!isValid}>
|
||||||
|
{doneLabel}
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ export default function GuestsRoomsPickerForm({
|
|||||||
}: GuestsRoomsFormProps) {
|
}: GuestsRoomsFormProps) {
|
||||||
const intl = useIntl()
|
const intl = useIntl()
|
||||||
const [isOpen, setIsOpen] = useState(false)
|
const [isOpen, setIsOpen] = useState(false)
|
||||||
const [isAgeError, setIsAgeError] = useState(false)
|
const [isValid, setIsValid] = useState(true)
|
||||||
const selectedGuests = useWatch({ name })
|
const selectedGuests = useWatch({ name })
|
||||||
const { register, setValue } = useFormContext()
|
const { register, setValue } = useFormContext()
|
||||||
const ref = useRef<HTMLDivElement | null>(null)
|
const ref = useRef<HTMLDivElement | null>(null)
|
||||||
@@ -30,14 +30,14 @@ export default function GuestsRoomsPickerForm({
|
|||||||
}
|
}
|
||||||
function handleSelectGuest(selected: GuestsRoom[]) {
|
function handleSelectGuest(selected: GuestsRoom[]) {
|
||||||
setValue(name, selected)
|
setValue(name, selected)
|
||||||
setIsAgeError(false)
|
setIsValid(true)
|
||||||
}
|
}
|
||||||
const closePicker = useCallback(() => {
|
const closePicker = useCallback(() => {
|
||||||
const guestRoomsValidData = guestRoomsSchema.safeParse(selectedGuests)
|
const guestRoomsValidData = guestRoomsSchema.safeParse(selectedGuests)
|
||||||
if (guestRoomsValidData.success) {
|
if (guestRoomsValidData.success) {
|
||||||
setIsOpen(false)
|
setIsOpen(false)
|
||||||
} else {
|
} else {
|
||||||
setIsAgeError(true)
|
setIsValid(false)
|
||||||
}
|
}
|
||||||
}, [selectedGuests])
|
}, [selectedGuests])
|
||||||
|
|
||||||
@@ -90,7 +90,7 @@ export default function GuestsRoomsPickerForm({
|
|||||||
handleOnSelect={handleSelectGuest}
|
handleOnSelect={handleSelectGuest}
|
||||||
initialSelected={selectedGuests}
|
initialSelected={selectedGuests}
|
||||||
closePicker={closePicker}
|
closePicker={closePicker}
|
||||||
childAgeError={isAgeError}
|
isValid={isValid}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -86,6 +86,7 @@
|
|||||||
"Discard unsaved changes?": "Slette ændringer, der ikke er gemt?",
|
"Discard unsaved changes?": "Slette ændringer, der ikke er gemt?",
|
||||||
"Distance to city centre": "{number}km til centrum",
|
"Distance to city centre": "{number}km til centrum",
|
||||||
"Do you want to start the day with Scandics famous breakfast buffé?": "Vil du starte dagen med Scandics berømte morgenbuffet?",
|
"Do you want to start the day with Scandics famous breakfast buffé?": "Vil du starte dagen med Scandics berømte morgenbuffet?",
|
||||||
|
"Done": "Færdig",
|
||||||
"Download the Scandic app": "Download Scandic-appen",
|
"Download the Scandic app": "Download Scandic-appen",
|
||||||
"Earn bonus nights & points": "Optjen bonusnætter og point",
|
"Earn bonus nights & points": "Optjen bonusnætter og point",
|
||||||
"Edit": "Redigere",
|
"Edit": "Redigere",
|
||||||
|
|||||||
@@ -86,6 +86,7 @@
|
|||||||
"Discard unsaved changes?": "Nicht gespeicherte Änderungen verwerfen?",
|
"Discard unsaved changes?": "Nicht gespeicherte Änderungen verwerfen?",
|
||||||
"Distance to city centre": "{number}km zum Stadtzentrum",
|
"Distance to city centre": "{number}km zum Stadtzentrum",
|
||||||
"Do you want to start the day with Scandics famous breakfast buffé?": "Möchten Sie den Tag mit Scandics berühmtem Frühstücksbuffet beginnen?",
|
"Do you want to start the day with Scandics famous breakfast buffé?": "Möchten Sie den Tag mit Scandics berühmtem Frühstücksbuffet beginnen?",
|
||||||
|
"Done": "Fertig",
|
||||||
"Download the Scandic app": "Laden Sie die Scandic-App herunter",
|
"Download the Scandic app": "Laden Sie die Scandic-App herunter",
|
||||||
"Earn bonus nights & points": "Sammeln Sie Bonusnächte und -punkte",
|
"Earn bonus nights & points": "Sammeln Sie Bonusnächte und -punkte",
|
||||||
"Edit": "Bearbeiten",
|
"Edit": "Bearbeiten",
|
||||||
|
|||||||
@@ -50,6 +50,7 @@
|
|||||||
"Check out the credit cards saved to your profile. Pay with a saved card when signed in for a smoother web experience.": "Check out the credit cards saved to your profile. Pay with a saved card when signed in for a smoother web experience.",
|
"Check out the credit cards saved to your profile. Pay with a saved card when signed in for a smoother web experience.": "Check out the credit cards saved to your profile. Pay with a saved card when signed in for a smoother web experience.",
|
||||||
"Child": "Child",
|
"Child": "Child",
|
||||||
"Children": "Children",
|
"Children": "Children",
|
||||||
|
"Child age is required": "Child age is required",
|
||||||
"Choose room": "Choose room",
|
"Choose room": "Choose room",
|
||||||
"Cities": "Cities",
|
"Cities": "Cities",
|
||||||
"City": "City",
|
"City": "City",
|
||||||
@@ -88,6 +89,7 @@
|
|||||||
"Discard unsaved changes?": "Discard unsaved changes?",
|
"Discard unsaved changes?": "Discard unsaved changes?",
|
||||||
"Distance to city centre": "{number}km to city centre",
|
"Distance to city centre": "{number}km to city centre",
|
||||||
"Do you want to start the day with Scandics famous breakfast buffé?": "Do you want to start the day with Scandics famous breakfast buffé?",
|
"Do you want to start the day with Scandics famous breakfast buffé?": "Do you want to start the day with Scandics famous breakfast buffé?",
|
||||||
|
"Done": "Done",
|
||||||
"Download the Scandic app": "Download the Scandic app",
|
"Download the Scandic app": "Download the Scandic app",
|
||||||
"Earn bonus nights & points": "Earn bonus nights & points",
|
"Earn bonus nights & points": "Earn bonus nights & points",
|
||||||
"Edit": "Edit",
|
"Edit": "Edit",
|
||||||
|
|||||||
@@ -86,6 +86,7 @@
|
|||||||
"Discard unsaved changes?": "Hylkäätkö tallentamattomat muutokset?",
|
"Discard unsaved changes?": "Hylkäätkö tallentamattomat muutokset?",
|
||||||
"Distance to city centre": "{number}km Etäisyys kaupunkiin",
|
"Distance to city centre": "{number}km Etäisyys kaupunkiin",
|
||||||
"Do you want to start the day with Scandics famous breakfast buffé?": "Haluatko aloittaa päiväsi Scandicsin kuuluisalla aamiaisbuffella?",
|
"Do you want to start the day with Scandics famous breakfast buffé?": "Haluatko aloittaa päiväsi Scandicsin kuuluisalla aamiaisbuffella?",
|
||||||
|
"Done": "Valmis",
|
||||||
"Download the Scandic app": "Lataa Scandic-sovellus",
|
"Download the Scandic app": "Lataa Scandic-sovellus",
|
||||||
"Earn bonus nights & points": "Ansaitse bonusöitä ja -pisteitä",
|
"Earn bonus nights & points": "Ansaitse bonusöitä ja -pisteitä",
|
||||||
"Edit": "Muokata",
|
"Edit": "Muokata",
|
||||||
|
|||||||
@@ -85,6 +85,7 @@
|
|||||||
"Discard unsaved changes?": "Forkaste endringer som ikke er lagret?",
|
"Discard unsaved changes?": "Forkaste endringer som ikke er lagret?",
|
||||||
"Distance to city centre": "{number}km til sentrum",
|
"Distance to city centre": "{number}km til sentrum",
|
||||||
"Do you want to start the day with Scandics famous breakfast buffé?": "Vil du starte dagen med Scandics berømte frokostbuffé?",
|
"Do you want to start the day with Scandics famous breakfast buffé?": "Vil du starte dagen med Scandics berømte frokostbuffé?",
|
||||||
|
"Done": "Ferdig",
|
||||||
"Download the Scandic app": "Last ned Scandic-appen",
|
"Download the Scandic app": "Last ned Scandic-appen",
|
||||||
"Earn bonus nights & points": "Tjen bonusnetter og poeng",
|
"Earn bonus nights & points": "Tjen bonusnetter og poeng",
|
||||||
"Edit": "Redigere",
|
"Edit": "Redigere",
|
||||||
|
|||||||
@@ -85,6 +85,7 @@
|
|||||||
"Discard unsaved changes?": "Vill du ignorera ändringar som inte har sparats?",
|
"Discard unsaved changes?": "Vill du ignorera ändringar som inte har sparats?",
|
||||||
"Distance to city centre": "{number}km till centrum",
|
"Distance to city centre": "{number}km till centrum",
|
||||||
"Do you want to start the day with Scandics famous breakfast buffé?": "Vill du starta dagen med Scandics berömda frukostbuffé?",
|
"Do you want to start the day with Scandics famous breakfast buffé?": "Vill du starta dagen med Scandics berömda frukostbuffé?",
|
||||||
|
"Done": "Klar",
|
||||||
"Download the Scandic app": "Ladda ner Scandic-appen",
|
"Download the Scandic app": "Ladda ner Scandic-appen",
|
||||||
"Earn bonus nights & points": "Tjäna bonusnätter och poäng",
|
"Earn bonus nights & points": "Tjäna bonusnätter och poäng",
|
||||||
"Edit": "Redigera",
|
"Edit": "Redigera",
|
||||||
|
|||||||
@@ -21,14 +21,14 @@ export interface GuestsRoomsPickerProps {
|
|||||||
handleOnSelect: (selected: GuestsRoom[]) => void
|
handleOnSelect: (selected: GuestsRoom[]) => void
|
||||||
initialSelected?: GuestsRoom[]
|
initialSelected?: GuestsRoom[]
|
||||||
closePicker: () => void
|
closePicker: () => void
|
||||||
childAgeError: boolean
|
isValid: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export type GuestsRoomPickerProps = {
|
export type GuestsRoomPickerProps = {
|
||||||
handleOnSelect: (selected: GuestsRoom, index: number) => void
|
handleOnSelect: (selected: GuestsRoom, index: number) => void
|
||||||
room: GuestsRoom
|
room: GuestsRoom
|
||||||
index: number
|
index: number
|
||||||
childAgeError: boolean
|
isValid: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AdultSelectorProps = {
|
export type AdultSelectorProps = {
|
||||||
@@ -40,5 +40,13 @@ export type ChildSelectorProps = {
|
|||||||
roomChildren: Child[]
|
roomChildren: Child[]
|
||||||
adultCount: number
|
adultCount: number
|
||||||
updateChildren: (children: Child[]) => void
|
updateChildren: (children: Child[]) => void
|
||||||
childAgeError: boolean
|
isValid: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
export type ChildInfoSelectorProps = {
|
||||||
|
child: Child
|
||||||
|
index: number
|
||||||
|
availableBedTypes?: ChildBed[]
|
||||||
|
updateChild: (child: Child, index: number) => void
|
||||||
|
isValid: boolean
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user