Skip to content

Commit 9578ed2

Browse files
authored
Merge pull request #8 from hazre/feat/filter-updates
feat: filter by available updates
2 parents 5ad2f1c + a5d3650 commit 9578ed2

File tree

2 files changed

+34
-3
lines changed

2 files changed

+34
-3
lines changed

src/routes/+page.svelte

+10-2
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,15 @@
113113
*/
114114
let installedList = [];
115115
let installed = false;
116-
$: if (installed) {
117-
installedList = sortedList.filter((item) => item.installed !== undefined || false);
116+
let availableUpdates = false;
117+
$: if (installed || availableUpdates) {
118+
if (availableUpdates) {
119+
installedList = sortedList.filter(
120+
(item) => (item.installed !== undefined || false) && item.installed_version !== item.latest
121+
);
122+
} else {
123+
installedList = sortedList.filter((item) => item.installed !== undefined || false);
124+
}
118125
} else {
119126
installedList = [...sortedList];
120127
}
@@ -168,6 +175,7 @@
168175
{neos_folder}
169176
bind:categoryFilter
170177
bind:installed
178+
bind:availableUpdates
171179
/>
172180
<div
173181
class="list grow divide-y divide-gray-200 dark:divide-gray-700"

src/routes/Pageheader.svelte

+24-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
export let searchTerm = '';
1313
export let loaded = false;
1414
export let installed = false;
15+
export let availableUpdates = false;
1516
/**
1617
* @type {string[]}
1718
*/
@@ -56,6 +57,8 @@
5657
filteredCategories = [...categories];
5758
}
5859
60+
$: availableUpdates ? (installed = true) : (installed = false);
61+
5962
/**
6063
* @type {{ date: { commit: { author: { date: string | number | Date; }; }; }[]; }}
6164
*/
@@ -171,6 +174,7 @@
171174
<div class="w-full rounded hover:bg-gray-100 dark:hover:bg-gray-600">
172175
<div class="flex items-center pl-2">
173176
<input
177+
disabled={availableUpdates ? true : false}
174178
bind:checked={installed}
175179
id="checkbox-item-installed"
176180
type="checkbox"
@@ -179,8 +183,27 @@
179183
/>
180184
<label
181185
for="checkbox-item-installed"
186+
class="ml-2 w-full rounded py-2 text-sm font-medium {availableUpdates
187+
? 'text-gray-400 dark:text-gray-500'
188+
: 'text-gray-900 dark:text-gray-300'}">Installed</label
189+
>
190+
</div>
191+
</div>
192+
</li>
193+
<li>
194+
<div class="w-full rounded hover:bg-gray-100 dark:hover:bg-gray-600">
195+
<div class="flex items-center pl-2">
196+
<input
197+
bind:checked={availableUpdates}
198+
id="checkbox-item-updates"
199+
type="checkbox"
200+
value=""
201+
class="h-4 w-4 rounded border-gray-300 bg-gray-100 text-blue-600 focus:ring-2 focus:ring-blue-500 dark:border-gray-500 dark:bg-gray-600 dark:ring-offset-gray-700 dark:focus:ring-blue-600"
202+
/>
203+
<label
204+
for="checkbox-item-updates"
182205
class="ml-2 w-full rounded py-2 text-sm font-medium text-gray-900 dark:text-gray-300"
183-
>Installed</label
206+
>Updates</label
184207
>
185208
</div>
186209
</div>

0 commit comments

Comments
 (0)