Skip to content

Commit 2b6d621

Browse files
Merge branch 'feat/hardware-signer-connection-filter'
2 parents 9feb490 + 594af80 commit 2b6d621

68 files changed

Lines changed: 593 additions & 29 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

assets/js/main.js

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,11 @@ const setupHardwareSignerFilters = () => {
257257
const buttons = Array.from(root.querySelectorAll('[data-connection-type]'))
258258
const cards = Array.from(root.querySelectorAll('[data-hardware-signer-card]'))
259259
const emptyState = root.querySelector('[data-hardware-signer-empty]')
260+
const grid = root.querySelector('[data-hardware-signer-grid]')
261+
const sortSelect = root.querySelector('[data-hardware-signer-sort]')
262+
const hasFilterButtons = buttons.length > 0
260263

261-
if (!buttons.length || !cards.length || !emptyState) {
264+
if (!cards.length || !emptyState || !grid) {
262265
return
263266
}
264267

@@ -277,6 +280,43 @@ const setupHardwareSignerFilters = () => {
277280
.filter(Boolean)
278281
)
279282

283+
const collator = new Intl.Collator(undefined, {
284+
numeric: true,
285+
sensitivity: 'base'
286+
})
287+
288+
const sortCards = () => {
289+
if (!sortSelect) {
290+
return
291+
}
292+
293+
const sortValue = sortSelect.value || 'alpha-asc'
294+
const sortedCards = [...cards]
295+
296+
if (sortValue === 'manual') {
297+
sortedCards
298+
.sort((left, right) => (
299+
Number(left.dataset.originalIndex || 0) - Number(right.dataset.originalIndex || 0)
300+
))
301+
.forEach((card) => grid.appendChild(card))
302+
return
303+
}
304+
305+
sortedCards.sort((left, right) => {
306+
const leftName = left.dataset.sortName || ''
307+
const rightName = right.dataset.sortName || ''
308+
const result = collator.compare(leftName, rightName)
309+
310+
if (result !== 0) {
311+
return sortValue === 'alpha-desc' ? -result : result
312+
}
313+
314+
return Number(left.dataset.originalIndex || 0) - Number(right.dataset.originalIndex || 0)
315+
})
316+
317+
sortedCards.forEach((card) => grid.appendChild(card))
318+
}
319+
280320
const updateCards = () => {
281321
const activeTypes = getActiveTypes()
282322
let visibleCount = 0
@@ -287,7 +327,9 @@ const setupHardwareSignerFilters = () => {
287327
.map(type => type.trim())
288328
.filter(Boolean)
289329

290-
const isVisible = activeTypes.size > 0 && supportedTypes.some(type => activeTypes.has(type))
330+
const isVisible = !hasFilterButtons || (
331+
activeTypes.size > 0 && supportedTypes.some(type => activeTypes.has(type))
332+
)
291333
card.hidden = !isVisible
292334

293335
if (isVisible) {
@@ -307,6 +349,14 @@ const setupHardwareSignerFilters = () => {
307349
})
308350
})
309351

352+
if (sortSelect) {
353+
sortSelect.addEventListener('change', () => {
354+
sortCards()
355+
updateCards()
356+
})
357+
}
358+
359+
sortCards()
310360
updateCards()
311361
})
312362
}

assets/sass/styles.scss

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ table img {
124124
display: flex;
125125
flex-wrap: wrap;
126126
align-items: center;
127-
gap: 0.9rem;
127+
gap: 1rem;
128+
min-width: 0;
128129
}
129130

130131
.hardware-signer-filter-label {
@@ -137,6 +138,32 @@ table img {
137138
display: flex;
138139
flex-wrap: wrap;
139140
gap: 0.5rem;
141+
flex-grow: 1;
142+
flex-shrink: 1;
143+
flex-basis: 0;
144+
min-width: 0;
145+
}
146+
147+
.hardware-signer-sort {
148+
display: inline-flex;
149+
align-items: center;
150+
gap: 0.5rem;
151+
flex-grow: 0;
152+
flex-shrink: 0;
153+
flex-basis: auto;
154+
margin-left: auto;
155+
white-space: nowrap;
156+
}
157+
158+
.hardware-signer-sort-label {
159+
color: var(--bs-secondary-color);
160+
font-size: 0.95rem;
161+
font-weight: 600;
162+
margin-bottom: 0;
163+
}
164+
165+
.hardware-signer-sort-select {
166+
min-width: 220px;
140167
}
141168

142169
.hardware-signer-filter-btn {
@@ -193,6 +220,16 @@ table img {
193220
}
194221

195222
@media (max-width: 575.98px) {
223+
.hardware-signer-sort {
224+
width: 100%;
225+
margin-left: 0;
226+
}
227+
228+
.hardware-signer-sort-select {
229+
min-width: 0;
230+
flex: 1 1 auto;
231+
}
232+
196233
.hardware-signer-filter-btn {
197234
width: 100%;
198235
justify-content: center;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
aliases:
3+
- /ar/knowledge/supported-hardware-signers/trezor-safe-7/
4+
title: Trezor Safe 7
5+
signer: trezor-safe-7
6+
videos:
7+
- https://www.youtube.com/watch?v=m0g6ytYTy0w
8+
- https://www.youtube.com/watch?v=dbSmQmt0uDI
9+
---
10+
11+
# Videos
12+
13+
{{< youtube-gallery >}}
14+
15+
16+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
aliases:
3+
- /ca/knowledge/supported-hardware-signers/trezor-safe-7/
4+
title: Trezor Safe 7
5+
signer: trezor-safe-7
6+
videos:
7+
- https://www.youtube.com/watch?v=m0g6ytYTy0w
8+
- https://www.youtube.com/watch?v=dbSmQmt0uDI
9+
---
10+
11+
# Videos
12+
13+
{{< youtube-gallery >}}
14+
15+
16+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
aliases:
3+
- /de/knowledge/supported-hardware-signers/trezor-safe-7/
4+
title: Trezor Safe 7
5+
signer: trezor-safe-7
6+
videos:
7+
- https://www.youtube.com/watch?v=m0g6ytYTy0w
8+
- https://www.youtube.com/watch?v=dbSmQmt0uDI
9+
---
10+
11+
# Videos
12+
13+
{{< youtube-gallery >}}
14+
15+
16+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
aliases:
3+
- /es/knowledge/supported-hardware-signers/trezor-safe-7/
4+
title: Trezor Safe 7
5+
signer: trezor-safe-7
6+
videos:
7+
- https://www.youtube.com/watch?v=m0g6ytYTy0w
8+
- https://www.youtube.com/watch?v=dbSmQmt0uDI
9+
---
10+
11+
# Videos
12+
13+
{{< youtube-gallery >}}
14+
15+
16+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
aliases:
3+
- /fa/knowledge/supported-hardware-signers/trezor-safe-7/
4+
title: Trezor Safe 7
5+
signer: trezor-safe-7
6+
videos:
7+
- https://www.youtube.com/watch?v=m0g6ytYTy0w
8+
- https://www.youtube.com/watch?v=dbSmQmt0uDI
9+
---
10+
11+
# Videos
12+
13+
{{< youtube-gallery >}}
14+
15+
16+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
aliases:
3+
- /fr/knowledge/supported-hardware-signers/trezor-safe-7/
4+
title: Trezor Safe 7
5+
signer: trezor-safe-7
6+
videos:
7+
- https://www.youtube.com/watch?v=m0g6ytYTy0w
8+
- https://www.youtube.com/watch?v=dbSmQmt0uDI
9+
---
10+
11+
# Videos
12+
13+
{{< youtube-gallery >}}
14+
15+
16+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
aliases:
3+
- /hi/knowledge/supported-hardware-signers/trezor-safe-7/
4+
title: Trezor Safe 7
5+
signer: trezor-safe-7
6+
videos:
7+
- https://www.youtube.com/watch?v=m0g6ytYTy0w
8+
- https://www.youtube.com/watch?v=dbSmQmt0uDI
9+
---
10+
11+
# Videos
12+
13+
{{< youtube-gallery >}}
14+
15+
16+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
aliases:
3+
- /id/knowledge/supported-hardware-signers/trezor-safe-7/
4+
title: Trezor Safe 7
5+
signer: trezor-safe-7
6+
videos:
7+
- https://www.youtube.com/watch?v=m0g6ytYTy0w
8+
- https://www.youtube.com/watch?v=dbSmQmt0uDI
9+
---
10+
11+
# Videos
12+
13+
{{< youtube-gallery >}}
14+
15+
16+

0 commit comments

Comments
 (0)