cbrooker / MMM-Todoist

This is an extension for the MagicMirror2 platform. It will display your Todoist todos on your MagicMirror.
MIT License
151 stars 58 forks source link

Converting to Template #116

Open mossglenn opened 1 year ago

mossglenn commented 1 year ago

My changes replace the current dom creation with an njk template. This should make it easier to add new features, especially to the display of tasks. The significant new feature I added is to allow the user to determine which columns are displayed and in what order just by listing the columns in the "DisplayOrder" config option.

Some things could be removed because their features are in the template: -removed table-building methods (table-building is done by the template) -converted addDueDateCell method to addDueDate method, which keeps the internationalization but strips out the table building parts (and uses specific CSS classes) -removed javascript calculation of word width and text wrapping (these features are handled in the CSS with ch units)

Additions necessary to use the template include: -adding javascript to MMM-Todoist.js to convert some of each task's information into a template-ready format -adding "colorMap" to map colors represented in the API as text or as numbers into hex codes

New features using the new template include: -adding colored flags to the priority column (set by priorityColors option in config) -adding an additional column displaying the number of days until the task is due -adding "displayOrder" config option to display which columns and in which order -adding "displayProjectAs" config option to display project name, project color, or both -adding "displayColumnHeadings" config option to display table headers as text or as icons (to save space) -adding labels displayed in translucent bubbles -adding Todoist URL to hotlink avatars

If I were a more experienced coder, I would have probably found ways to restrain the number of changes necessary to implement the template. But, alas, there were plenty of things I did not foresee and changes piled up in the debugging. So this merge is not going to be an easy one--and may not be interesting enough to you to invest the time needed to do the merge. I'd be happy to help or talk more about the pull request.