|
18 | 18 | {% assign tot = count | minus: nocat %}
|
19 | 19 | {% assign components = site.components | sort: 'title' %}
|
20 | 20 | {% 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 %} |
21 | 29 |
|
22 | 30 | <p class='note'>
|
23 | 31 | Support for these components is provided by the Home Assistant community.
|
24 | 32 | </p>
|
25 |
| - |
26 | 33 | <div class="grid">
|
27 | 34 | <div class="grid__item one-sixth lap-one-whole palm-one-whole">
|
28 | 35 |
|
29 | 36 | <div class="filter-button-group">
|
30 | 37 | <a href='#all' class="btn">All ({{tot}})</a>
|
31 | 38 | <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> |
32 | 42 |
|
33 | 43 | {% for category in categories %}
|
34 | 44 | {% if category and category != 'Other' %}
|
|
45 | 55 | <div class="grid__item five-sixths lap-one-whole palm-one-whole" id="componentContainer">
|
46 | 56 | {% for component in components %}
|
47 | 57 | {% if component.ha_category %}
|
| 58 | + {% assign sliced_version = component.ha_release | split: '.' %} |
| 59 | + {% assign minor_version = sliced_version[1]|plus: 0 %} |
48 | 60 | <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 %}' |
50 | 62 | {% unless component.featured %}style='display: none'{% endunless %}>
|
51 | 63 | <div class='img-container'>
|
52 | 64 | {% if component.logo %}
|
|
0 commit comments