fixed labels for seats, removes shadow from event-type inputs (#2862)

* fixed labels for seats

* minor fixes, removed shadow from all event-type inputs

* Render input field on pro accounts (#2859)

Co-authored-by: Joe Au-Yeung <[email protected]>
This commit is contained in:
Peer RichelsenandJoe Au-Yeung authored and GitHub committed 2022-05-24 22:15:53 +02:00
1 parent 323524b77c
commit eacfdac016
5 files changed
+81 -67

No files matched your search

Submodule
+1
Submodule apps/admin added at 8474e2baa2.
Submodule apps/api updated: 44f0830b16...be2d4338ee.
+76 -65
View File
@@ -173,7 +173,7 @@ const SuccessRedirectEdit = <T extends UseFormReturn<FormValues>>({
}}
readOnly={proUpgradeRequired}
type="url"
className=" block w-full rounded-sm border-gray-300 shadow-sm sm:text-sm"
className=" block w-full rounded-sm border-gray-300 sm:text-sm"
placeholder={t("external_redirect_url")}
defaultValue={eventType.successRedirectUrl || ""}
{...formMethods.register("successRedirectUrl")}
@@ -435,7 +435,7 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
{...locationFormMethods.register("locationAddress")}
id="address"
required
className=" block w-full rounded-sm border-gray-300 text-sm shadow-sm"
className=" block w-full rounded-sm border-gray-300 text-sm"
defaultValue={
formMethods
.getValues("locations")
@@ -457,7 +457,7 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
{...locationFormMethods.register("locationLink")}
id="address"
required
className=" block w-full rounded-sm border-gray-300 shadow-sm sm:text-sm"
className=" block w-full rounded-sm border-gray-300 sm:text-sm"
defaultValue={
formMethods.getValues("locations").find((location) => location.type === LocationType.Link)
?.link
@@ -630,9 +630,7 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
{formMethods.getValues("locations").length > 0 && (
<ul>
{formMethods.getValues("locations").map((location) => (
<li
key={location.type}
className="mb-2 rounded-sm border border-neutral-300 py-1.5 px-2 shadow-sm">
<li key={location.type} className="mb-2 rounded-sm border border-neutral-300 py-1.5 px-2">
<div className="flex justify-between">
{location.type === LocationType.InPerson && (
<div className="flex flex-grow items-center">
@@ -1048,7 +1046,7 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
</label>
</div>
<div className="w-full">
<div className="flex rounded-sm shadow-sm">
<div className="flex rounded-sm">
<span className="inline-flex items-center rounded-l-sm border border-r-0 border-gray-300 bg-gray-50 px-3 text-sm text-gray-500">
{process.env.NEXT_PUBLIC_WEBSITE_URL?.replace(/^(https?:|)\/\//, "")}/
{team ? "team/" + team.slug : eventType.users[0].username}/
@@ -1124,7 +1122,7 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
<div className="w-full">
<textarea
id="description"
className=" block w-full rounded-sm border-gray-300 text-sm shadow-sm"
className=" block w-full rounded-sm border-gray-300 text-sm"
placeholder={t("quick_video_meeting")}
{...formMethods.register("description")}
defaultValue={asStringOrUndefined(eventType.description)}></textarea>
@@ -1254,7 +1252,7 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
</label>
</div>
<div className="w-full">
<div className="relative mt-1 rounded-sm shadow-sm">
<div className="relative mt-1 rounded-sm">
<Controller
control={formMethods.control}
name="destinationCalendar"
@@ -1278,10 +1276,10 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
</label>
</div>
<div className="w-full">
<div className="relative mt-1 rounded-sm shadow-sm">
<div className="relative mt-1 rounded-sm">
<input
type="text"
className=" block w-full rounded-sm border-gray-300 text-sm shadow-sm"
className=" block w-full rounded-sm border-gray-300 text-sm"
placeholder={t("meeting_with_user")}
defaultValue={eventType.eventName || ""}
{...formMethods.register("eventName")}
@@ -1299,11 +1297,11 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
</label>
</div>
<div className="w-full">
<div className="relative mt-1 rounded-sm shadow-sm">
<div className="relative mt-1 rounded-sm">
{
<input
type="text"
className=" block w-full rounded-sm border-gray-300 text-sm shadow-sm"
className=" block w-full rounded-sm border-gray-300 text-sm"
placeholder={t("Example: 0x71c7656ec7ab88b098defb751b7401b5f6d8976f")}
defaultValue={(eventType.metadata.smartContractAddress || "") as string}
{...formMethods.register("smartContractAddress")}
@@ -1616,7 +1614,7 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
<div className="inline-flex">
<input
type="number"
className="block w-16 rounded-sm border-gray-300 shadow-sm [appearance:textfield] ltr:mr-2 rtl:ml-2 sm:text-sm"
className="block w-16 rounded-sm border-gray-300 [appearance:textfield] ltr:mr-2 rtl:ml-2 sm:text-sm"
placeholder="30"
{...formMethods.register("periodDays", { valueAsNumber: true })}
defaultValue={eventType.periodDays || 30}
@@ -1763,6 +1761,7 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
<CheckboxField
id="seats"
name="seats"
descriptionAsLabel
label={t("offer_seats")}
description={t("offer_seats_description")}
defaultChecked={!!eventType.seatsPerTimeSlot}
@@ -1802,10 +1801,12 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
{ value: 5, label: "5" },
{
value: -1,
isDisabled: !eventType.users.some((user) => user.plan === "PRO"),
isDisabled: !eventType.users.some(
(user) => user.plan === ("PRO" || "TRIAL")
),
label: (
<div className="flex flex-row justify-between">
<span>6 +</span>
<span>6+</span>
<Badge variant="default">PRO</Badge>
</div>
) as unknown as string,
@@ -1815,54 +1816,65 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
<>
<div className="block sm:flex">
<div className="flex-auto">
<label
htmlFor="beforeBufferTime"
className="mb-2 flex text-sm font-medium text-neutral-700">
Number of seats per booking
</label>
<Select
isSearchable={false}
classNamePrefix="react-select"
className="react-select-container focus:border-primary-500 focus:ring-primary-500 block w-full min-w-0 flex-auto rounded-sm border border-gray-300 sm:text-sm "
onChange={(val) => {
if (val!.value === -1) {
formMethods.setValue(
"seatsPerTimeSlot",
defaultSeatsInput
);
setInputSeatNumber(true);
} else {
setInputSeatNumber(false);
formMethods.setValue("seatsPerTimeSlot", val!.value);
}
}}
defaultValue={{
value: eventType.seatsPerTimeSlot || defaultSeats,
label: `${eventType.seatsPerTimeSlot || defaultSeats}`,
}}
options={selectSeatsPerTimeSlotOptions}
/>
{eventType.users.some(
(user) => user.plan === ("PRO" || "TRIAL")
) ? (
<div className="flex-auto">
<label
htmlFor="beforeBufferTime"
className="mb-2 flex text-sm font-medium text-neutral-700">
{t("enter_number_of_seats")}
</label>
<input
type="number"
className="focus:border-primary-500 focus:ring-primary-500 py- block w-20 rounded-sm border-gray-300 shadow-sm [appearance:textfield] ltr:mr-2 rtl:ml-2 sm:text-sm"
placeholder={`${defaultSeatsInput}`}
{...formMethods.register("seatsPerTimeSlot", {
valueAsNumber: true,
min: defaultSeatsInput,
})}
defaultValue={
eventType.seatsPerTimeSlot || defaultSeatsInput
}
/>
</div>
) : (
<>
<label
htmlFor="beforeBufferTime"
className="mb-2 flex text-sm font-medium text-neutral-700">
{t("number_of_seats")}
</label>
<Select
isSearchable={false}
classNamePrefix="react-select"
className="react-select-container focus:border-primary-500 focus:ring-primary-500 block w-full min-w-0 flex-auto rounded-sm border border-gray-300 sm:text-sm "
onChange={(val) => {
if (val!.value === -1) {
formMethods.setValue(
"seatsPerTimeSlot",
defaultSeatsInput
);
setInputSeatNumber(true);
} else {
setInputSeatNumber(false);
formMethods.setValue(
"seatsPerTimeSlot",
val!.value
);
}
}}
defaultValue={{
value: eventType.seatsPerTimeSlot || defaultSeats,
label: `${
eventType.seatsPerTimeSlot || defaultSeats
}`,
}}
options={selectSeatsPerTimeSlotOptions}
/>
</>
)}
</div>
{inputSeatNumber && (
<div className="flex-auto md:ml-5">
<label
htmlFor="beforeBufferTime"
className="mb-2 flex text-sm font-medium text-neutral-700">
Enter number of seats
</label>
<input
type="number"
className="focus:border-primary-500 focus:ring-primary-500 py- block w-20 rounded-sm border-gray-300 shadow-sm [appearance:textfield] ltr:mr-2 rtl:ml-2 sm:text-sm"
placeholder={`${defaultSeatsInput}`}
{...formMethods.register("seatsPerTimeSlot", {
valueAsNumber: true,
min: defaultSeatsInput,
})}
defaultValue={defaultSeatsInput}
/>
</div>
)}
</div>
</>
);
@@ -1873,7 +1885,6 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
</div>
)}
</div>
<hr className="border-neutral-200" />
</>
<SuccessRedirectEdit<typeof formMethods>
@@ -1936,7 +1947,7 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
<div className="w-full">
<div className="block items-center sm:flex">
<div className="w-full">
<div className="relative mt-1 rounded-sm shadow-sm">
<div className="relative mt-1 rounded-sm">
<Controller
defaultValue={eventType.price}
control={formMethods.control}
@@ -770,6 +770,8 @@
"offer_seats": "Offer seats",
"offer_seats_description": "Offer seats to bookings (This disables guests)",
"seats_available": "Seats available",
"number_of_seats": "Number of seats per booking",
"enter_number_of_seats": "Enter number of seats",
"you_can_manage_your_schedules": "You can manage your schedules on the Availability page.",
"booking_full": "No more seats available",
"api_keys": "API Keys",