don't show location if only one (#5074)

Co-authored-by: CarinaWolli <wollencarina@gmail.com>
pull/4766/head
Carina Wollendorfer 2022-10-18 16:41:14 +02:00 committed by GitHub
parent 8272fcd5c7
commit 3cf47c2ee9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 42 additions and 39 deletions

View File

@ -584,48 +584,51 @@ const BookingPage = ({
)} )}
</div> </div>
</div> </div>
<div className="mb-4"> <>
<> {rescheduleUid ? (
<span className="block text-sm font-medium text-gray-700 dark:text-white"> <div className="mb-4">
{t("location")} <span className="block text-sm font-medium text-gray-700 dark:text-white">
</span> {t("location")}
{rescheduleUid ? ( </span>
<p className="mt-1 text-sm text-gray-500"> <p className="mt-1 text-sm text-gray-500">
{getHumanReadableLocationValue(booking?.location, t)} {getHumanReadableLocationValue(booking?.location, t)}
</p> </p>
) : ( </div>
locations.length > 1 && ( ) : (
<> locations.length > 1 && (
{locations.map((location, i) => { <div className="mb-4">
const locationString = locationKeyToString(location); <span className="block text-sm font-medium text-gray-700 dark:text-white">
if (!selectedLocationType) { {t("location")}
bookingForm.setValue("locationType", locations[0].type); </span>
} {locations.map((location, i) => {
if (typeof locationString !== "string") { const locationString = locationKeyToString(location);
// It's possible that location app got uninstalled if (!selectedLocationType) {
return null; bookingForm.setValue("locationType", locations[0].type);
} }
return ( if (typeof locationString !== "string") {
<label key={i} className="block"> // It's possible that location app got uninstalled
<input return null;
type="radio" }
disabled={!!disableLocations} return (
className="location dark:bg-darkgray-300 dark:border-darkgray-300 h-4 w-4 border-gray-300 text-black focus:ring-black ltr:mr-2 rtl:ml-2" <label key={i} className="block">
{...bookingForm.register("locationType", { required: true })} <input
value={location.type} type="radio"
defaultChecked={i === 0} disabled={!!disableLocations}
/> className="location dark:bg-darkgray-300 dark:border-darkgray-300 h-4 w-4 border-gray-300 text-black focus:ring-black ltr:mr-2 rtl:ml-2"
<span className="text-sm ltr:ml-2 rtl:mr-2 dark:text-white"> {...bookingForm.register("locationType", { required: true })}
{locationKeyToString(location)} value={location.type}
</span> defaultChecked={i === 0}
</label> />
); <span className="text-sm ltr:ml-2 rtl:mr-2 dark:text-white">
})} {locationKeyToString(location)}
</> </span>
) </label>
)} );
</> })}
</div> </div>
)
)}
</>
{/* TODO: Change name and id ="phone" to something generic */} {/* TODO: Change name and id ="phone" to something generic */}
{AttendeeInput && ( {AttendeeInput && (
<div className="mb-4"> <div className="mb-4">