-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
The current code has the following issues:
- Prop drilling
- Template select options are hard coded
- Some components accept CSS as props instead of className
- Timing logic is hard coded
My suggestions are as follows:
- 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.
- Loop in the TEMPLATE_CONFIGS object to display each template option.
- Rewrite/Remove these components as needed. CSS should be passed as className. Data should be passed as props.
- 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:
- Move DefaultTemplate from
src/templatestosrc/componentsas IMHOsrc/templatesshould contain only template components. - Rename DefaultTemplate to DynamicTemplate.
- Rename the meetup parameter at
src/components/Root.tsxon line 54 to meetupDetails. - Move Root from
src/componentstosrcassrc/componentsshould contain reusable components. - Rename Root to App to match React project conventions.
- Create an interface for TEMPLATE_CONFIGS objects to ensure type safety while adding/modifying TEMPLATE_CONFIGS.
Part2:
- Fix TEMPLATE_CONFIGS type by removing
: TemplateConfig& replacingas constwithsatisfies TemplateConfiginsrc/constants.ts. This enables the Template type to infer TEMPLATE_CONFIG's key type correctly (instead of string, it's inferred as "blackPanther" | "snowWhite" | "squareRoot" | "youtube"). - Move DynamicTemplate from
src/componentsinsidesrc/App.tsxas it's not being used elsewhere. - Rename
src/components/Covertosrc/components/cover. -
Move types.ts tosrc/types& rename to index.ts. - Add
src/utilsfolder. - Move constants from
srctosrc/utils. - Add
functions.tstosrc/utils. - Install clsx & tailwind-merge, then add cn (function to combine classNames) to
src/utils/functions.ts(instructions). - Add select for choosing audio; Move & rename audio.mp3 to
public/soundtracks/A_MEANINGFUL_NAME.mp3. - Add SOUNDTRACKS to
/src/constants.ts(e.g. type SoundTrack = 'audio1.mp3' | 'audio2.mp3'). - Add soundtrack to TemplateProvider.
- Replace
<Title />&<Subtitle />with html tags. (IMPORTANT: WE STASHED WIP.) - Remove
src/components/Title.tsx,src/components/Subtitle.tsx&src/components/SubtitleOutline.tsx. - Add slide components in a folder, e.g. move LogoFull & LogoMinimal to
src/components/slide/logo. We can then choose from multiple components for each slide. - Modify instructions in the README.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels