Made event name customizable

This commit is contained in:
Malte Delfs committed 2021-06-15 17:26:16 +02:00
1 parent 49cb191254
commit 4fb0fbfe07
8 files changed
+51 -16

No files matched your search

+11 -2
View File
@@ -27,6 +27,7 @@ export default function EventType(props) {
const descriptionRef = useRef<HTMLTextAreaElement>();
const lengthRef = useRef<HTMLInputElement>();
const isHiddenRef = useRef<HTMLInputElement>();
const eventNameRef = useRef<HTMLInputElement>();
if (loading) {
return <p className="text-gray-400">Loading...</p>;
@@ -40,11 +41,12 @@ export default function EventType(props) {
const enteredDescription = descriptionRef.current.value;
const enteredLength = lengthRef.current.value;
const enteredIsHidden = isHiddenRef.current.checked;
const enteredEventName = eventNameRef.current.value;
// TODO: Add validation
const response = await fetch('/api/availability/eventtype', {
method: 'PATCH',
body: JSON.stringify({id: props.eventType.id, title: enteredTitle, slug: enteredSlug, description: enteredDescription, length: enteredLength, hidden: enteredIsHidden, locations }),
body: JSON.stringify({id: props.eventType.id, title: enteredTitle, slug: enteredSlug, description: enteredDescription, length: enteredLength, hidden: enteredIsHidden, locations, eventName: enteredEventName }),
headers: {
'Content-Type': 'application/json'
}
@@ -232,6 +234,12 @@ export default function EventType(props) {
</div>
</div>
</div>
<div className="mb-4">
<label htmlFor="eventName" className="block text-sm font-medium text-gray-700">Event name in calendar</label>
<div className="mt-1 relative rounded-md shadow-sm">
<input ref={eventNameRef} type="text" name="title" id="title" className="shadow-sm focus:ring-blue-500 focus:border-blue-500 block w-full sm:text-sm border-gray-300 rounded-md" placeholder="Meeting with {USER}" defaultValue={props.eventType.eventName} />
</div>
</div>
<div className="my-8">
<div className="relative flex items-start">
<div className="flex items-center h-5">
@@ -348,6 +356,7 @@ export async function getServerSideProps(context) {
length: true,
hidden: true,
locations: true,
eventName: true,
}
});
@@ -357,4 +366,4 @@ export async function getServerSideProps(context) {
eventType
},
}
}
}