diff --git a/lib/eventTypeInput.ts b/lib/eventTypeInput.ts index f3d9f66e..e8c76e42 100644 --- a/lib/eventTypeInput.ts +++ b/lib/eventTypeInput.ts @@ -1,4 +1,3 @@ - export enum EventTypeCustomInputType { Text = 'text', TextLong = 'textLong', @@ -12,4 +11,3 @@ export interface EventTypeCustomInput { label: string; required: boolean; } - diff --git a/pages/availability/event/[type].tsx b/pages/availability/event/[type].tsx index 7f40cce3..048afd89 100644 --- a/pages/availability/event/[type].tsx +++ b/pages/availability/event/[type].tsx @@ -19,12 +19,12 @@ import {PlusIcon} from "@heroicons/react/solid"; export default function EventType(props) { const router = useRouter(); - const inputOptions: OptionBase[] = [ - { value: EventTypeCustomInputType.Text, label: 'Text' }, - { value: EventTypeCustomInputType.TextLong, label: 'Multiline Text' }, - { value: EventTypeCustomInputType.Number, label: 'Number', }, - { value: EventTypeCustomInputType.Bool, label: 'Checkbox', }, - ] + const inputOptions: OptionBase[] = [ + { value: EventTypeCustomInputType.Text, label: 'Text' }, + { value: EventTypeCustomInputType.TextLong, label: 'Multiline Text' }, + { value: EventTypeCustomInputType.Number, label: 'Number', }, + { value: EventTypeCustomInputType.Bool, label: 'Checkbox', }, + ] const [ session, loading ] = useSession(); const [ showLocationModal, setShowLocationModal ] = useState(false); @@ -32,7 +32,7 @@ export default function EventType(props) { const [ selectedLocation, setSelectedLocation ] = useState(undefined); const [ selectedInputOption, setSelectedInputOption ] = useState(inputOptions[0]); const [ locations, setLocations ] = useState(props.eventType.locations || []); - const [customInputs, setCustomInputs] = useState(props.eventType.customInputs.sort((a, b) => a.id - b.id) || []); + const [customInputs, setCustomInputs] = useState(props.eventType.customInputs.sort((a, b) => a.id - b.id) || []); const titleRef = useRef(); const slugRef = useRef(); @@ -97,10 +97,10 @@ export default function EventType(props) { setShowLocationModal(false); }; - const closeAddCustomModal = () => { - setSelectedInputOption(inputOptions[0]); - setShowAddCustomModal(false); - }; + const closeAddCustomModal = () => { + setSelectedInputOption(inputOptions[0]); + setShowAddCustomModal(false); + }; const LocationOptions = () => { if (!selectedLocation) { @@ -152,22 +152,22 @@ export default function EventType(props) { setLocations(locations.filter( (location) => location.type !== selectedLocation.type )); }; - const updateCustom = (e) => { - e.preventDefault(); + const updateCustom = (e) => { + e.preventDefault(); - const customInput: EventTypeCustomInput = { - label: e.target.label.value, - required: e.target.required.checked, - type: e.target.type.value + const customInput: EventTypeCustomInput = { + label: e.target.label.value, + required: e.target.required.checked, + type: e.target.type.value + }; + + setCustomInputs(customInputs.concat(customInput)); + + console.log(customInput) + setShowAddCustomModal(false); }; - setCustomInputs(customInputs.concat(customInput)); - - console.log(customInput) - setShowAddCustomModal(false); - }; - - return ( + return (
{props.eventType.title} | Event Type | Calendso