19lmyers / cse110-w21-group14

1 stars 2 forks source link

Refactor codebase #58

Closed j1sun closed 3 years ago

j1sun commented 3 years ago

With the minimum viable product complete, we need to refactor and document the codebase to ensure it's clean.

Plan: Begin separating each class in main.js into its own components file, and update index.html accordingly with the new component. The goal is to make sure each component is individually controlled. Note that an underscore before a method indicates that the method is private. Below are the specifications for each component:

TimerApp

Do this last and keep in main.js, as it is not a web component. The primary controller. Handles big events in timer by calling on its child components at the right times.

TimerText

The timer text that counts down from 25:00. This timer inherently doesn't automatically start or stop itself. Like a countdown timer that ticks forever (almost like a pomodoro timer), this timer can be started, stopped, and set to a particular time.

TimerButton

The timer button that runs the app. Already a component.

TimerInfo

Deprecated. Rather than holding TimerInfoSessions and TimerInfoProgress, just remove it in favor of the two components below.

TimerSessions

The indicator for the number of timer sessions. Currently pending on whether it should hold the current number of sessions.

TimerProgress

The progress bar for the timer and already a component. Similar to TimerText in functionality: it can start, stop, update, be set, etc.

TimerSettings

Handles the settings page and dispatches events indicating updates and resets.

TimerSplash

The initial splash screen.

ConfirmDialog

A generic confirmation dialog. -constructor(): Initializes the confirmation dialog based on the existing template.

TaskList

TODO

Document code:

Checklist:

j1sun commented 3 years ago

Began refactoring by making TimerButton a web component that uses an attribute 'data-text' to update its text. No impact except for styling (which is now isolated in the web component). Currently waiting on pipeline fixes before pull requesting to master.

j1sun commented 3 years ago

Plan: Begin separating each class in main.js into its own components file, and update index.html accordingly with the new component. The goal is to make sure each component is individually controlled. Note that an underscore before a method indicates that the method is private. Below are the specifications for each component:

TimerApp

Do this last and keep in main.js, as it is not a web component. The primary controller. Handles big events in timer by calling on its child components at the right times.

TimerText

The timer text that counts down from 25:00. This timer inherently doesn't automatically start or stop itself. Like a countdown timer that ticks forever (almost like a pomodoro timer), this timer can be started, stopped, and set to a particular time.

TimerButton

The timer button that runs the app. Already a component.

TimerInfo

Deprecated. Rather than holding TimerInfoSessions and TimerInfoProgress, just remove it in favor of the two components below.

TimerSessions

The indicator for the number of timer sessions. Currently pending on whether it should hold the current number of sessions.

TimerProgress

The progress bar for the timer and already a component. Similar to TimerText in functionality: it can start, stop, update, be set, etc.

TimerSettings

Handles the settings page and dispatches events indicating updates and resets.

TimerSplash

The initial splash screen.

ConfirmDialog

A generic confirmation dialog. -constructor(): Initializes the confirmation dialog based on the existing template.

TaskList

TODO