-
Notifications
You must be signed in to change notification settings - Fork 10
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
Notification: show "not reading latest version" #47
Conversation
`after` and `before` were inverted. See https://lit.dev/docs/components/properties/#haschanged Even using the correct order, it's seems that it's not triggering a re-render when returning `true` for some reason. I see the URLs being populated properly, but the element contains `href=""` (empty URLs) still.
Instead of duplicating the text from the title in the content, I changed the content to show more easy to read copy. Besides, I reduced the font-size a little bit so it's different than the title.
Update `this.urls` immediately when `loadConfig(config)` is called from outside.
Basic "search&replace" to solve the most common cases. We can improve this code later. However, the correct way to do this is by receiving the URL from the backend.
It re-uses the code from `NotificationElement`. However, I'm not happy with the implementation. It seems that they are pretty much different to make sense to re-use the class. It seems that what we want here is create a `NotificationBaseElement` where `NotificationExternalElement` and `NotificationNonLatestElement` can extend.
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.
This looks great! I only had small notes here
I don't quite follow here, is there a particular problem you see with the current approach? Having a single element seems to make sense to me for now. We want both warnings to occupy the same space, and these warnings well never be shown at the same time. If we add a third, unrelated notification, we either want it to occupy the same space (turn the description into a list of messages for example), or I'm assuming we'll make this into a list of notifications instead. But from a user's perspective, it's odd to require the user/theme author to define every individual notification we define, ie: <readthedocs-notification-external-version class="..."></readthedocs-notification-external-warning>
<readthedocs-notification-outdated-version class="..."></readthedocs-notification-outdated-warning>
<readthedocs-notification-new-build class="..."></readthedocs-notification-new-build>
<readthedocs-notification-doc-diff class="..."></readthedocs-notification-doc-diff>
<readthedocs-notification-foo class="..."></readthedocs-notification-foo> If we define different classes for each, then we need separate tags. There might be a better way to abstract the message from the element display though, this could be part of changing the notification to a notification list. |
Yeah, I thought about this and I didn't arrived at a pattern where I was happy with it. I feel the lack of js knowledge here. My original point about the implementation I've done here is that most of the functions/methods/properties from the class are not required for all the "notifications". For example I think it makes sense to use the same |
… humitos/non-latest-version-notification
Same, but I think we can develop this over time too and don't need to nail this implementation just yet. For basic/default usage, I think what we have now works well, but customization is where we will want to start building up this abstraction pattern more. This is where I probably want to see what theme maintainers want to do with our data, and make this implementation flexible enough to fit those needs. For example, I see maintainers not wanting to use this notification element at all, and instead wanting the underlying information (version is outdated/version is a pull request) directly so they can adjust independent visual elements. I can put up an issue with a few different directions from the HTML/JS side of things, maybe that is a good place to get some feedback to start.
Better naming could help here. Overall, the current design isn't bad though. When we figure out what the additional layer of abstraction is, this will feel cleaner.
It is not, and this will throw and exception actually.
This looks like it's just font size, which is expected. The This behavior is what I'd expect though, and is generally more correct than dictating a different font size than the root element. To avoid this, we could use Footnotes |
I've dropped some example patterns in #51 for now. But I'd say lets stew on that a bit, we don't need to get too fiddly just yet. |
I updated the PR with the feedback received and I will merge it. I'm sure there will be more work to be done here, but we can always open more PRs 😉 |
It re-uses the code from
NotificationElement
. However, I'm not happy with the implementation. It seems that they are pretty much different to make sense to re-use the class.It seems that what we want here is create a
NotificationBaseElement
whereNotificationExternalElement
andNotificationNonLatestElement
can extend.Example