Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add check on event creation #67

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dylan-pham
Copy link

@dylan-pham dylan-pham commented Apr 16, 2023

Description

Add check on event creation to make sure all details are filled out. Before, user would be able to create event with missing fields which resulted in null related bug when accessing event after creation.

Figma Designs

Include a link to the Figma design here if neccesary.

  • Approved by designer

Screenshots/Video

Include screenshots of added features/bugfixes if neccesary.
Screenshot 2023-04-16 at 4 44 55 PM

@dylan-pham dylan-pham linked an issue Apr 16, 2023 that may be closed by this pull request
@SimChadha SimChadha requested a review from ross3102 April 19, 2023 23:45
const createEvent = () => {
const eventDataCopy = { ...fields };

if (!hasAllEventDetails(eventDataCopy)) {
alert('missing required event details');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use the Toast component for all error messages, just replace alert with something like

Toast.show('Missing required event details', {
      duration: Toast.durations.LONG,
      backgroundColor: 'red',
      position: 20,
});

(plus the import ofc)

@@ -86,8 +86,27 @@ const CreateEvent = ({ navigation, route }: CreateEventProps) => {

const schema = data['eventSchemas'][route.params.type.toLowerCase()];

function hasAllEventDetails(eventData: any) {
return (

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this works quite right since different event types have different fields. For example, Special Events don't have a distance field, so with this logic it's impossible to create one. There's probably some way to check all of the fields specific to the event type?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add error message on event creation attempt with missing details
3 participants