Form fixes

This commit is contained in:
zomars 2022-05-06 15:44:33 -06:00
parent 269dea70a1
commit a05860515e
3 changed files with 51 additions and 45 deletions

View file

@ -58,7 +58,9 @@ export default function WebhookDialogForm(props: {
props.handleClose(); props.handleClose();
}} }}
className="space-y-4"> className="space-y-4">
<input type="hidden" {...form.register("id")} /> <div>
<input type="hidden" {...form.register("id")} />
</div>
<fieldset className="space-y-2"> <fieldset className="space-y-2">
<InputGroupBox className="border-0 bg-gray-50"> <InputGroupBox className="border-0 bg-gray-50">
<Controller <Controller
@ -76,20 +78,21 @@ export default function WebhookDialogForm(props: {
/> />
</InputGroupBox> </InputGroupBox>
</fieldset> </fieldset>
<TextField <div>
label={t("subscriber_url")} <TextField
{...form.register("subscriberUrl")} label={t("subscriber_url")}
required {...form.register("subscriberUrl")}
type="url" required
onChange={(e) => { type="url"
form.setValue("subscriberUrl", e.target.value); onChange={(e) => {
if (hasTemplateIntegration({ url: e.target.value })) { form.setValue("subscriberUrl", e.target.value);
setUseCustomPayloadTemplate(true); if (hasTemplateIntegration({ url: e.target.value })) {
form.setValue("payloadTemplate", customTemplate({ url: e.target.value })); setUseCustomPayloadTemplate(true);
} form.setValue("payloadTemplate", customTemplate({ url: e.target.value }));
}} }
/> }}
/>
</div>
<fieldset className="space-y-2"> <fieldset className="space-y-2">
<FieldsetLegend>{t("event_triggers")}</FieldsetLegend> <FieldsetLegend>{t("event_triggers")}</FieldsetLegend>
<InputGroupBox className="border-0 bg-gray-50"> <InputGroupBox className="border-0 bg-gray-50">

View file

@ -102,17 +102,18 @@ export default function ApiKeyDialogForm(props: {
setSuccessfulNewApiKeyModal(true); setSuccessfulNewApiKeyModal(true);
}} }}
className="space-y-4"> className="space-y-4">
<div className=" mb-10 mt-1"> <div className="mb-10 mt-1">
<h2 className="font-semi-bold font-cal text-xl tracking-wide text-gray-900">{props.title}</h2> <h2 className="font-semi-bold font-cal text-xl tracking-wide text-gray-900">{props.title}</h2>
<p className="mt-1 mb-5 text-sm text-gray-500">{t("api_key_modal_subtitle")}</p> <p className="mt-1 mb-5 text-sm text-gray-500">{t("api_key_modal_subtitle")}</p>
</div> </div>
<TextField <div>
label={t("personal_note")} <TextField
placeholder={t("personal_note_placeholder")} label={t("personal_note")}
{...form.register("note")} placeholder={t("personal_note_placeholder")}
type="text" {...form.register("note")}
/> type="text"
/>
</div>
<div className="flex flex-col"> <div className="flex flex-col">
<div className="flex justify-between py-2"> <div className="flex justify-between py-2">
<span className="block text-sm font-medium text-gray-700">{t("expire_date")}</span> <span className="block text-sm font-medium text-gray-700">{t("expire_date")}</span>

View file

@ -1888,28 +1888,30 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
addLocation(newLocation, details); addLocation(newLocation, details);
setShowLocationModal(false); setShowLocationModal(false);
}}> }}>
<Controller <div>
name="locationType" <Controller
control={locationFormMethods.control} name="locationType"
render={() => ( control={locationFormMethods.control}
<Select render={() => (
maxMenuHeight={100} <Select
name="location" maxMenuHeight={100}
defaultValue={selectedLocation} name="location"
options={locationOptions} defaultValue={selectedLocation}
isSearchable={false} options={locationOptions}
className=" my-4 block w-full min-w-0 flex-1 rounded-sm border border-gray-300 sm:text-sm" isSearchable={false}
onChange={(val) => { className=" my-4 block w-full min-w-0 flex-1 rounded-sm border border-gray-300 sm:text-sm"
if (val) { onChange={(val) => {
locationFormMethods.setValue("locationType", val.value); if (val) {
locationFormMethods.unregister("locationLink"); locationFormMethods.setValue("locationType", val.value);
locationFormMethods.unregister("locationAddress"); locationFormMethods.unregister("locationLink");
setSelectedLocation(val); locationFormMethods.unregister("locationAddress");
} setSelectedLocation(val);
}} }
/> }}
)} />
/> )}
/>
</div>
<LocationOptions /> <LocationOptions />
<div className="mt-4 flex justify-end space-x-2"> <div className="mt-4 flex justify-end space-x-2">
<Button onClick={() => setShowLocationModal(false)} type="button" color="secondary"> <Button onClick={() => setShowLocationModal(false)} type="button" color="secondary">