In this episode, we tackle building the "New Endpoint" form! We start by swapping out the placeholder data for a real endpoint creation form that users will fill out. Along the way, we style the form for a decent look, import needed components like a Primary Button, Input Label, and Text Input, and arrange the layout so it's user-friendly.
We focus on the dropdown for endpoint frequency, which leverages enum values defined earlier. To power this dropdown, we discuss two ways of providing the enum data to the form: either by passing it through props from the Dashboard controller or by exposing it globally via Inertia's shared data for access anywhere in the app. This helps keep our code clean and ensures the frequency values are always in sync everywhere they're needed.
Then we add a method to the enum to generate user-friendly labels (like "One minute"), so the dropdown isn't just a dump of raw values. You'll see how effortless it is to change, add, or remove frequency options just by updating the enum—no more hunting through your codebase!
Finally, you'll learn how to access shared/global data from the Inertia page object, removing the need to pass everything down as props. By the end of this episode, your form's UI is ready to go, wired up with all the right fields and dynamic values, and we're all set up to handle submissions in the next video.