Skip to content

Commit bd65e43

Browse files
committed
Group components by version released
1 parent a420dd2 commit bd65e43

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

sass/custom/_paulus.scss

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,14 @@ p.note {
398398
margin: 12px 0;
399399
}
400400

401+
.added_in_current_version {
402+
margin-top: 12px;
403+
}
404+
405+
.added_two_versions_ago {
406+
margin-bottom: 12px;
407+
}
408+
401409
.btn {
402410
display: block;
403411
background: 0;
@@ -472,4 +480,4 @@ a code {
472480
twitterwidget {
473481
margin-left: auto;
474482
margin-right: auto;
475-
}
483+
}

source/components/index.html

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,27 @@
1818
{% assign tot = count | minus: nocat %}
1919
{% assign components = site.components | sort: 'title' %}
2020
{% assign categories = components | sort: 'ha_category' | map: 'ha_category' | uniq %}
21+
{% capture current_version %}{{ site.current_major_version }}.{{ site.current_minor_version }}{% endcapture %}
22+
{% assign added_one_ago_minor_version = site.current_minor_version|minus: 1 %}
23+
{% capture added_one_ago_version %}{{ site.current_major_version }}.{{ added_one_ago_minor_version }}{% endcapture %}
24+
{% assign added_two_ago_minor_version = site.current_minor_version|minus: 2 %}
25+
{% capture added_two_ago_version %}{{ site.current_major_version }}.{{ added_two_ago_minor_version }}{% endcapture %}
26+
{% assign current_version_components_count = site.components | where: 'ha_release', current_version | size %}
27+
{% assign one_ago_version_components_count = site.components | where: 'ha_release', added_one_ago_version | size %}
28+
{% assign two_ago_version_components_count = site.components | where: 'ha_release', added_two_ago_version | size %}
2129

2230
<p class='note'>
2331
Support for these components is provided by the Home Assistant community.
2432
</p>
25-
2633
<div class="grid">
2734
<div class="grid__item one-sixth lap-one-whole palm-one-whole">
2835

2936
<div class="filter-button-group">
3037
<a href='#all' class="btn">All ({{tot}})</a>
3138
<a href='#featured' class="btn featured">Featured</a>
39+
<a href='#added_in_current_version' class="btn added_in_current_version">Added in {{ current_version }} ({{ current_version_components_count }})</a>
40+
<a href='#added_one_version_ago' class="btn added_one_version_ago">Added in {{ added_one_ago_version }} ({{ one_ago_version_components_count }})</a>
41+
<a href='#added_two_versions_ago' class="btn added_two_versions_ago">Added in {{ added_two_ago_version }} ({{ two_ago_version_components_count }})</a>
3242

3343
{% for category in categories %}
3444
{% if category and category != 'Other' %}
@@ -45,8 +55,10 @@
4555
<div class="grid__item five-sixths lap-one-whole palm-one-whole" id="componentContainer">
4656
{% for component in components %}
4757
{% if component.ha_category %}
58+
{% assign sliced_version = component.ha_release | split: '.' %}
59+
{% assign minor_version = sliced_version[1]|plus: 0 %}
4860
<a href='{{ component.url }}'
49-
class='{{ component.ha_category | slugify }}{% if component.featured %} featured{% endif %}'
61+
class='{{ component.ha_category | slugify }}{% if minor_version == site.current_minor_version %} added_in_current_version{% elsif minor_version == added_one_ago_minor_version %} added_one_version_ago{% elsif minor_version == added_two_ago_minor_version %} added_two_versions_ago{% endif %}{% if component.featured %} featured{% endif %}'
5062
{% unless component.featured %}style='display: none'{% endunless %}>
5163
<div class='img-container'>
5264
{% if component.logo %}

0 commit comments

Comments
 (0)