-
Notifications
You must be signed in to change notification settings - Fork 35
Some minor enhancements #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Add an option to force sorting by due date Add the due date to the displayed card
| : item.content} | ||
| ${item.content ? html`<span class="todoist-item-content">${item.content}</span>` : null} | ||
| ${item.description ? html`<span class="todoist-item-description">${item.description}</span>` : null} | ||
| ${item.due ? html`<span class="todoist-item-due">${item.due.date}</span>` : null} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't there be a problem with margins if item's description and due are empty?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using ? as a ternary operator is safe to use to check if those are null and to render null html if so, otherwise render the corresponding data with it. This allows the card to have all 3 of these properties as optionals.
The css could probably use a little work as I'm very amateur with front-end code so it's a little rough:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I'm trying to say is that if description and due fields are empty, content will be rendered in a <span> with todoist-item-content class, which has top and bottom margins.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is the worst option:
${item.description || item.due
? html`<span class="todoist-item-content">${item.content}</span>
<span class="todoist-item-description">${[item.description, item.due?.date].filter().join(' | ')}</span>`
: item.content}
I would be very grateful if you could test it. I'm in the process of moving and my home server with Home Assistant installed has not yet moved to a new home.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I can give it a shot sometime this week - I should have more time this weekend
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's just cache. In my code, description and due.date are separated by a vertical bar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yeah I see that now, I'll try again soon(ish)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sw-carlos-cristobal did you have some time to take a look at this?



Uh oh!
There was an error while loading. Please reload this page.