frontendmu / video

The project automatically generates videos that we can use to promote frontendmu meetups on social media
1 stars 2 forks source link

Code refactor #6

Open n-d-r-d-g opened 1 month ago

n-d-r-d-g commented 1 month ago

The current code has the following issues:

  1. Prop drilling
  2. Template select options are hard coded
  3. Some components accept CSS as props instead of className
  4. Timing logic is hard coded

My suggestions are as follows:

  1. Use React Context to avoid prop drilling (can be implemented for meetup details as well as templates). The code will be cleaner and more maintainable.
  2. Loop in the TEMPLATE_CONFIGS object to display each template option.
  3. Rewrite/Remove these components as needed. CSS should be passed as className. Data should be passed as props.
  4. The timing logic has to be dynamic and magic numbers should be avoided. We can name variables/constants properly to ease readability. Each template config can have a timing calculator function that takes the meetup details as argument.

Other improvements: Part1:

Part2:

derecklhw commented 1 month ago

@n-d-r-d-g sorry for prop drilling XD

n-d-r-d-g commented 1 month ago

@derecklhw I did it too! We needed to make it work. That's our excuse! 😜