thamara / time-to-leave

Log work hours and get notified when it's time to leave the office and start to live.
http://timetoleave.app
GNU General Public License v3.0
463 stars 272 forks source link

Centralize Menu Labels and Accelerators as Constants in menu.js #1085

Open evanm510 opened 2 weeks ago

evanm510 commented 2 weeks ago

Describe the current limitation Currently, menu labels, IDs, and accelerator keys in the menu.js file are hardcoded across multiple functions, which makes the code harder to maintain and increases the chance of inconsistencies. Updating a menu label or shortcut requires finding each occurrence, making changes more time-consuming and prone to error.

Describe the proposed feature or enhancement Introduce a set of centralized constants for menu labels, IDs, and accelerators. These constants could be defined at the top of the file or in a separate constants.js file. By using constants, menu items can be updated in one place, improving maintainability, readability, and reducing redundancy across the codebase.

Additional context Centralizing these values reduces the likelihood of typos or inconsistencies, makes future localization easier, and enhances the overall structure of the code by separating data definitions from function logic. This approach also improves clarity for new contributors.