Skip to content

Commit 653a014

Browse files
authored
Merge pull request #2410 from rommapp/romm-2148
[ROMM-2148] Add metadata icons to table view
2 parents 35f47ce + 208ed77 commit 653a014

2 files changed

Lines changed: 107 additions & 18 deletions

File tree

frontend/src/components/common/Game/VirtualTable.vue

Lines changed: 106 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import PlatformIcon from "@/components/common/Platform/PlatformIcon.vue";
1212
import { ROUTES } from "@/plugins/router";
1313
import romApi from "@/services/api/rom";
1414
import storeAuth from "@/stores/auth";
15+
import storeCollections from "@/stores/collections";
1516
import storeDownload from "@/stores/download";
1617
import storeGalleryFilter from "@/stores/galleryFilter";
1718
import storeRoms, { type SimpleRom } from "@/stores/roms";
@@ -33,6 +34,7 @@ const { filteredRoms, selectedRoms, fetchingRoms, fetchTotalRoms } =
3334
storeToRefs(romsStore);
3435
const auth = storeAuth();
3536
const galleryFilterStore = storeGalleryFilter();
37+
const collectionsStore = storeCollections();
3638
3739
const HEADERS = [
3840
{
@@ -60,19 +62,19 @@ const HEADERS = [
6062
key: "first_release_date",
6163
},
6264
{
63-
title: "Rating",
65+
title: "",
6466
align: "start",
6567
sortable: true,
6668
key: "average_rating",
6769
},
6870
{
69-
title: "Languages",
71+
title: "🔠",
7072
align: "start",
7173
sortable: false,
7274
key: "languages",
7375
},
7476
{
75-
title: "Regions",
77+
title: "🌎",
7678
align: "start",
7779
sortable: false,
7880
key: "regions",
@@ -159,7 +161,7 @@ function updateOptions({ sortBy }: { sortBy: SortBy }) {
159161
/>
160162
</template>
161163
<template #item.name="{ item }">
162-
<v-list-item :min-width="400" class="px-0 py-2">
164+
<v-list-item :min-width="400" class="px-0 py-2 d-flex game-list-item">
163165
<template #prepend>
164166
<PlatformIcon
165167
v-if="showPlatformIcon"
@@ -171,37 +173,97 @@ function updateOptions({ sortBy }: { sortBy: SortBy }) {
171173
<RAvatarRom :rom="item" />
172174
</template>
173175
<v-row no-gutters>
174-
<v-col>{{ item.name }}</v-col>
176+
<v-col>
177+
{{ item.name }}
178+
<v-icon
179+
v-if="collectionsStore.isFavorite(item)"
180+
size="small"
181+
color="primary"
182+
class="ml-1"
183+
>
184+
mdi-star
185+
</v-icon>
186+
</v-col>
175187
</v-row>
176188
<v-row no-gutters>
177189
<v-col class="text-primary">
178190
{{ item.fs_name }}
179191
</v-col>
180192
</v-row>
181193
<template #append>
182-
<MissingFromFSIcon
183-
v-if="item.missing_from_fs"
184-
:text="`Missing from filesystem: ${item.fs_path}/${item.fs_name}`"
185-
class="mr-1 mb-1 px-1"
186-
chip
187-
chip-density="compact"
188-
/>
189194
<v-chip
190195
v-if="item.hasheous_id"
191-
class="translucent text-white mr-1 mb-1 px-1"
192-
density="compact"
196+
class="bg-romm-green text-white mr-1 px-1 item-chip"
197+
size="x-small"
193198
title="Verified with Hasheous"
194199
>
195200
<v-icon>mdi-check-decagram-outline</v-icon>
196201
</v-chip>
202+
<v-chip
203+
v-if="item.igdb_id"
204+
class="mr-1 pa-0 item-chip"
205+
size="x-small"
206+
title="IGDB match"
207+
>
208+
<v-avatar size="20" rounded>
209+
<v-img src="/assets/scrappers/igdb.png" />
210+
</v-avatar>
211+
</v-chip>
212+
<v-chip
213+
v-if="item.ss_id"
214+
class="mr-1 pa-0 item-chip"
215+
size="x-small"
216+
title="ScreenScraper match"
217+
>
218+
<v-avatar size="20" rounded>
219+
<v-img src="/assets/scrappers/ss.png" />
220+
</v-avatar>
221+
</v-chip>
222+
<v-chip
223+
v-if="item.moby_id"
224+
class="mr-1 pa-0 item-chip"
225+
size="x-small"
226+
title="MobyGames match"
227+
>
228+
<v-avatar size="20" rounded>
229+
<v-img src="/assets/scrappers/moby.png" />
230+
</v-avatar>
231+
</v-chip>
232+
<v-chip
233+
v-if="item.launchbox_id"
234+
class="mr-1 pa-0 item-chip"
235+
size="x-small"
236+
title="LaunchBox match"
237+
>
238+
<v-avatar size="20" style="background: #185a7c">
239+
<v-img src="/assets/scrappers/launchbox.png" />
240+
</v-avatar>
241+
</v-chip>
242+
<v-chip
243+
v-if="item.ra_id"
244+
class="mr-1 pa-0 item-chip"
245+
size="x-small"
246+
title="RetroAchievements match"
247+
>
248+
<v-avatar size="20" rounded>
249+
<v-img src="/assets/scrappers/ra.png" />
250+
</v-avatar>
251+
</v-chip>
197252
<v-chip
198253
v-if="item.siblings.length > 0 && showSiblings"
199-
class="translucent text-white mr-1 mb-1 px-1"
200-
density="compact"
254+
class="translucent text-white mr-1 px-1 item-chip"
255+
size="x-small"
201256
:title="`${item.siblings.length} sibling(s)`"
202257
>
203258
<v-icon>mdi-card-multiple-outline</v-icon>
204259
</v-chip>
260+
<MissingFromFSIcon
261+
v-if="item.missing_from_fs"
262+
:text="`Missing from filesystem: ${item.fs_path}/${item.fs_name}`"
263+
class="mr-1 px-1 item-chip"
264+
chip
265+
chipSize="x-small"
266+
/>
205267
</template>
206268
</v-list-item>
207269
</template>
@@ -281,7 +343,6 @@ function updateOptions({ sortBy }: { sortBy: SortBy }) {
281343
</template>
282344
<template #item.actions="{ item }">
283345
<v-btn-group density="compact">
284-
<FavBtn :rom="item" />
285346
<v-btn
286347
:disabled="
287348
downloadStore.value.includes(item.id) || item.missing_from_fs
@@ -320,7 +381,35 @@ function updateOptions({ sortBy }: { sortBy: SortBy }) {
320381
font-size: 75%;
321382
opacity: 75%;
322383
}
384+
323385
.v-data-table {
324386
width: calc(100% - 16px) !important;
325387
}
388+
389+
@media (max-width: 2160px) {
390+
.item-chip {
391+
transform: scale(-1, 1);
392+
}
393+
}
394+
</style>
395+
396+
<style>
397+
.game-list-item .v-list-item__append {
398+
margin-left: auto;
399+
display: grid;
400+
grid-template-rows: 24px;
401+
grid-auto-flow: column;
402+
flex-shrink: 0;
403+
}
404+
405+
@media (max-width: 2160px) {
406+
.game-list-item .v-list-item__append {
407+
grid-template-rows: 24px 24px;
408+
transform: scale(-1, 1);
409+
}
410+
}
411+
412+
.game-list-item .v-list-item__append .v-list-item__spacer {
413+
display: none;
414+
}
326415
</style>

frontend/src/utils/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ export function formatBytes(bytes: number, decimals = 2) {
149149
const dm = Math.max(0, decimals);
150150
const sizes = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
151151
const i = Math.floor(Math.log(bytes) / Math.log(k));
152-
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + " " + sizes[i];
152+
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;
153153
}
154154

155155
/**

0 commit comments

Comments
 (0)