Skip to content

Commit 72b5039

Browse files
authored
[UI] Add options to sort games by title and status (#1249)
* test * feat: add button to sort alphabetically * feat: add sort by status button * i18n: add new keys * chore: rename toggles * feat: save sort choice on storage * fix: sorting logic * i18n: updated keys * fix: pr comments
1 parent 17da859 commit 72b5039

37 files changed

+217
-53
lines changed

.eslintrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"plugins": ["react", "@typescript-eslint"],
2323
"settings": {
2424
"react": {
25-
"version": "17.0"
25+
"version": "detect"
2626
}
2727
},
2828
"rules": {

electron/legendary/library.ts

+2-7
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,8 @@ export class LegendaryLibrary {
156156
} catch (error) {
157157
logError(`${error}`, LogPrefix.Legendary)
158158
}
159-
const arr = Array.from(this.library.values()).sort(
160-
(a: { title: string }, b: { title: string }) => {
161-
const gameA = a.title.toUpperCase().replace('THE ', '')
162-
const gameB = b.title.toUpperCase().replace('THE ', '')
163-
return gameA < gameB ? -1 : 1
164-
}
165-
)
159+
const arr = Array.from(this.library.values())
160+
166161
if (format === 'info') {
167162
if (libraryStore.has('library')) {
168163
libraryStore.delete('library')

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@
131131
"@fontsource/rubik": "^4.5.6",
132132
"@fortawesome/fontawesome-svg-core": "^6.1.1",
133133
"@fortawesome/free-brands-svg-icons": "^6.1.1",
134+
"@fortawesome/free-regular-svg-icons": "^6.1.1",
134135
"@fortawesome/free-solid-svg-icons": "^6.1.1",
135136
"@fortawesome/react-fontawesome": "^0.1.18",
136137
"@mui/icons-material": "^5.6.2",

public/locales/bg/translation.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@
156156
"library": {
157157
"gridView": "Изглед във вид на решетка",
158158
"listView": "Изглед във вид на списък",
159-
"refresh": "Опресняване"
159+
"refresh": "Опресняване",
160+
"sortAscending": "Sort Ascending",
161+
"sortByStatus": "Sort by Status",
162+
"sortDescending": "Sort Descending"
160163
},
161164
"Library": "Библиотека",
162165
"loading": {

public/locales/ca/translation.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@
156156
"library": {
157157
"gridView": "",
158158
"listView": "",
159-
"refresh": ""
159+
"refresh": "",
160+
"sortAscending": "Sort Ascending",
161+
"sortByStatus": "Sort by Status",
162+
"sortDescending": "Sort Descending"
160163
},
161164
"Library": "Biblioteca",
162165
"loading": {

public/locales/cs/translation.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@
156156
"library": {
157157
"gridView": "",
158158
"listView": "",
159-
"refresh": ""
159+
"refresh": "",
160+
"sortAscending": "Sort Ascending",
161+
"sortByStatus": "Sort by Status",
162+
"sortDescending": "Sort Descending"
160163
},
161164
"Library": "Knihovna",
162165
"loading": {

public/locales/de/translation.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@
156156
"library": {
157157
"gridView": "Rasteransicht",
158158
"listView": "Listenansicht",
159-
"refresh": "Aktualisieren"
159+
"refresh": "Aktualisieren",
160+
"sortAscending": "Sort Ascending",
161+
"sortByStatus": "Sort by Status",
162+
"sortDescending": "Sort Descending"
160163
},
161164
"Library": "Bibliothek",
162165
"loading": {

public/locales/el/translation.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@
156156
"library": {
157157
"gridView": "Προβολή Πλέγματος",
158158
"listView": "Προβολή Λίστας",
159-
"refresh": "Ανανέωση"
159+
"refresh": "Ανανέωση",
160+
"sortAscending": "Sort Ascending",
161+
"sortByStatus": "Sort by Status",
162+
"sortDescending": "Sort Descending"
160163
},
161164
"Library": "Βιβλιοθήκη",
162165
"loading": {

public/locales/en/translation.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@
156156
"library": {
157157
"gridView": "Grid view",
158158
"listView": "List view",
159-
"refresh": "Refresh"
159+
"refresh": "Refresh",
160+
"sortAscending": "Sort Ascending",
161+
"sortByStatus": "Sort by Status",
162+
"sortDescending": "Sort Descending"
160163
},
161164
"Library": "Library",
162165
"loading": {

public/locales/es/translation.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@
156156
"library": {
157157
"gridView": "Vista de cuadrícula",
158158
"listView": "Vista de lista",
159-
"refresh": "Actualizar"
159+
"refresh": "Actualizar",
160+
"sortAscending": "Sort Ascending",
161+
"sortByStatus": "Sort by Status",
162+
"sortDescending": "Sort Descending"
160163
},
161164
"Library": "Biblioteca",
162165
"loading": {

public/locales/et/translation.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@
156156
"library": {
157157
"gridView": "Ruudustikvaade",
158158
"listView": "Loendivaade",
159-
"refresh": "Värskenda"
159+
"refresh": "Värskenda",
160+
"sortAscending": "Sort Ascending",
161+
"sortByStatus": "Sort by Status",
162+
"sortDescending": "Sort Descending"
160163
},
161164
"Library": "Varamu",
162165
"loading": {

public/locales/fa/translation.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@
156156
"library": {
157157
"gridView": "",
158158
"listView": "",
159-
"refresh": ""
159+
"refresh": "",
160+
"sortAscending": "Sort Ascending",
161+
"sortByStatus": "Sort by Status",
162+
"sortDescending": "Sort Descending"
160163
},
161164
"Library": "کتابخانه",
162165
"loading": {

public/locales/fi/translation.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@
156156
"library": {
157157
"gridView": "",
158158
"listView": "",
159-
"refresh": ""
159+
"refresh": "",
160+
"sortAscending": "Sort Ascending",
161+
"sortByStatus": "Sort by Status",
162+
"sortDescending": "Sort Descending"
160163
},
161164
"Library": "Kirjasto",
162165
"loading": {

public/locales/fr/translation.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@
156156
"library": {
157157
"gridView": "",
158158
"listView": "",
159-
"refresh": ""
159+
"refresh": "",
160+
"sortAscending": "Sort Ascending",
161+
"sortByStatus": "Sort by Status",
162+
"sortDescending": "Sort Descending"
160163
},
161164
"Library": "Bibliothèque",
162165
"loading": {

public/locales/gl/translation.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@
156156
"library": {
157157
"gridView": "Vista de cadrícula",
158158
"listView": "Vista de lista",
159-
"refresh": "Actualizar"
159+
"refresh": "Actualizar",
160+
"sortAscending": "Sort Ascending",
161+
"sortByStatus": "Sort by Status",
162+
"sortDescending": "Sort Descending"
160163
},
161164
"Library": "Biblioteca",
162165
"loading": {

public/locales/hr/translation.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@
156156
"library": {
157157
"gridView": "",
158158
"listView": "",
159-
"refresh": ""
159+
"refresh": "",
160+
"sortAscending": "Sort Ascending",
161+
"sortByStatus": "Sort by Status",
162+
"sortDescending": "Sort Descending"
160163
},
161164
"Library": "",
162165
"loading": {

public/locales/hu/translation.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@
156156
"library": {
157157
"gridView": "Rács nézet",
158158
"listView": "Lista nézet",
159-
"refresh": "Frissítés"
159+
"refresh": "Frissítés",
160+
"sortAscending": "Sort Ascending",
161+
"sortByStatus": "Sort by Status",
162+
"sortDescending": "Sort Descending"
160163
},
161164
"Library": "Könyvtár",
162165
"loading": {

public/locales/id/translation.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@
156156
"library": {
157157
"gridView": "Tampilan bergaris",
158158
"listView": "Tampilan daftar",
159-
"refresh": "Segarkan"
159+
"refresh": "Segarkan",
160+
"sortAscending": "Sort Ascending",
161+
"sortByStatus": "Sort by Status",
162+
"sortDescending": "Sort Descending"
160163
},
161164
"Library": "Perpustakaan",
162165
"loading": {

public/locales/it/translation.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@
156156
"library": {
157157
"gridView": "",
158158
"listView": "",
159-
"refresh": ""
159+
"refresh": "",
160+
"sortAscending": "Sort Ascending",
161+
"sortByStatus": "Sort by Status",
162+
"sortDescending": "Sort Descending"
160163
},
161164
"Library": "Libreria",
162165
"loading": {

public/locales/ja/translation.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@
156156
"library": {
157157
"gridView": "",
158158
"listView": "",
159-
"refresh": ""
159+
"refresh": "",
160+
"sortAscending": "Sort Ascending",
161+
"sortByStatus": "Sort by Status",
162+
"sortDescending": "Sort Descending"
160163
},
161164
"Library": "ライブラリ",
162165
"loading": {

public/locales/ko/translation.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@
156156
"library": {
157157
"gridView": "그리드 보기",
158158
"listView": "목록 보기",
159-
"refresh": "새로고침"
159+
"refresh": "새로고침",
160+
"sortAscending": "Sort Ascending",
161+
"sortByStatus": "Sort by Status",
162+
"sortDescending": "Sort Descending"
160163
},
161164
"Library": "라이브러리",
162165
"loading": {

public/locales/ml/translation.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@
156156
"library": {
157157
"gridView": "",
158158
"listView": "",
159-
"refresh": ""
159+
"refresh": "",
160+
"sortAscending": "Sort Ascending",
161+
"sortByStatus": "Sort by Status",
162+
"sortDescending": "Sort Descending"
160163
},
161164
"Library": "കളിശാല",
162165
"loading": {

public/locales/nl/translation.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@
156156
"library": {
157157
"gridView": "",
158158
"listView": "",
159-
"refresh": ""
159+
"refresh": "",
160+
"sortAscending": "Sort Ascending",
161+
"sortByStatus": "Sort by Status",
162+
"sortDescending": "Sort Descending"
160163
},
161164
"Library": "Bibliotheek",
162165
"loading": {

public/locales/pl/translation.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@
156156
"library": {
157157
"gridView": "",
158158
"listView": "",
159-
"refresh": ""
159+
"refresh": "",
160+
"sortAscending": "Sort Ascending",
161+
"sortByStatus": "Sort by Status",
162+
"sortDescending": "Sort Descending"
160163
},
161164
"Library": "Biblioteka",
162165
"loading": {

public/locales/pt/translation.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@
156156
"library": {
157157
"gridView": "",
158158
"listView": "",
159-
"refresh": ""
159+
"refresh": "",
160+
"sortAscending": "Sort Ascending",
161+
"sortByStatus": "Sort by Status",
162+
"sortDescending": "Sort Descending"
160163
},
161164
"Library": "Biblioteca",
162165
"loading": {

public/locales/pt_BR/translation.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@
156156
"library": {
157157
"gridView": "Visualização em grade",
158158
"listView": "Visto por último",
159-
"refresh": "Atualizar"
159+
"refresh": "Atualizar",
160+
"sortAscending": "Sort Ascending",
161+
"sortByStatus": "Sort by Status",
162+
"sortDescending": "Sort Descending"
160163
},
161164
"Library": "Biblioteca",
162165
"loading": {

public/locales/ru/translation.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@
156156
"library": {
157157
"gridView": "В виде сетки",
158158
"listView": "В виде списка",
159-
"refresh": "Обновить"
159+
"refresh": "Обновить",
160+
"sortAscending": "Sort Ascending",
161+
"sortByStatus": "Sort by Status",
162+
"sortDescending": "Sort Descending"
160163
},
161164
"Library": "Библиотека",
162165
"loading": {

public/locales/sv/translation.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@
156156
"library": {
157157
"gridView": "",
158158
"listView": "Listvy",
159-
"refresh": "Uppdatera"
159+
"refresh": "Uppdatera",
160+
"sortAscending": "Sort Ascending",
161+
"sortByStatus": "Sort by Status",
162+
"sortDescending": "Sort Descending"
160163
},
161164
"Library": "Bibliotek",
162165
"loading": {

public/locales/ta/translation.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@
156156
"library": {
157157
"gridView": "",
158158
"listView": "",
159-
"refresh": ""
159+
"refresh": "",
160+
"sortAscending": "Sort Ascending",
161+
"sortByStatus": "Sort by Status",
162+
"sortDescending": "Sort Descending"
160163
},
161164
"Library": "விளையாட்டு பட்டியல்",
162165
"loading": {

public/locales/tr/translation.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@
156156
"library": {
157157
"gridView": "Izgara görünümü",
158158
"listView": "Liste görünümü",
159-
"refresh": "Yenile"
159+
"refresh": "Yenile",
160+
"sortAscending": "Sort Ascending",
161+
"sortByStatus": "Sort by Status",
162+
"sortDescending": "Sort Descending"
160163
},
161164
"Library": "Kütüphane",
162165
"loading": {

public/locales/uk/translation.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@
156156
"library": {
157157
"gridView": "",
158158
"listView": "",
159-
"refresh": ""
159+
"refresh": "",
160+
"sortAscending": "Sort Ascending",
161+
"sortByStatus": "Sort by Status",
162+
"sortDescending": "Sort Descending"
160163
},
161164
"Library": "Бібліотека",
162165
"loading": {

public/locales/vi/translation.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@
156156
"library": {
157157
"gridView": "Hiển thị dạng ô",
158158
"listView": "Hiển thị dạng danh sánh",
159-
"refresh": "Tải lại"
159+
"refresh": "Tải lại",
160+
"sortAscending": "Sort Ascending",
161+
"sortByStatus": "Sort by Status",
162+
"sortDescending": "Sort Descending"
160163
},
161164
"Library": "Thư viện",
162165
"loading": {

public/locales/zh_Hans/translation.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@
156156
"library": {
157157
"gridView": "网格视图",
158158
"listView": "列表视图",
159-
"refresh": "刷新"
159+
"refresh": "刷新",
160+
"sortAscending": "Sort Ascending",
161+
"sortByStatus": "Sort by Status",
162+
"sortDescending": "Sort Descending"
160163
},
161164
"Library": "仓库",
162165
"loading": {

0 commit comments

Comments
 (0)