Skip to content

Commit

Permalink
Image width fix and fix sort order for multi-item entities
Browse files Browse the repository at this point in the history
  • Loading branch information
gadgetchnnel committed Nov 19, 2019
1 parent e4c6c58 commit dbc9341
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lovelace-home-feed-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ class HomeFeedNotificationPopup extends HomeFeedCardHelpers.LitElement {
overflow-wrap: break-word;
}
ha-markdown img {
width: 100%;
}
a {
color: var(--primary-color);
}
Expand Down Expand Up @@ -252,6 +256,10 @@ class HomeFeedCard extends HomeFeedCardHelpers.LitElement {
color: var(--primary-color);
}
ha-markdown img {
width: 100%;
}
ha-markdown.compact {
max-width: 65%;
}
Expand Down Expand Up @@ -421,7 +429,8 @@ class HomeFeedCard extends HomeFeedCardHelpers.LitElement {
let created = (i.timestamp_property && p[i.timestamp_property]) ? p[i.timestamp_property] : stateObj.last_changed;
let timeStamp = isNaN(created) ? created : new Date(created * 1000);
return { ...stateObj, icon: icon, format: (i.format != null ? i.format : "relative"), entity: i.entity, display_name: this.applyTemplate(p, i.content_template), last_changed: timeStamp, stateObj: stateObj, more_info_on_tap: i.more_info_on_tap, item_data: p, detail: i.detail_template ? this.applyTemplate(p, i.detail_template, false) : null, item_type: "multi_entity", };
}).slice(0, (i.max_items) ? i.max_items : 5);
}).sort((a, b) => (a.last_changed < b.last_changed) ? 1 : -1) // Sort in reverse order of time to ensure latest items always first
.slice(0, (i.max_items) ? i.max_items : 5);
});

return [].concat.apply([], data);
Expand Down

0 comments on commit dbc9341

Please sign in to comment.