diff --git a/app/src/main/frontend/components/general/MetadataCompletenessIndicator.tsx b/app/src/main/frontend/components/general/MetadataCompletenessIndicator.tsx new file mode 100644 index 0000000..bc2eaff --- /dev/null +++ b/app/src/main/frontend/components/general/MetadataCompletenessIndicator.tsx @@ -0,0 +1,27 @@ +import GameDto from "Frontend/generated/org/gameyfin/app/games/dto/GameDto"; +import {useMemo} from "react"; +import {CircularProgress} from "@heroui/react"; +import {metadataCompleteness} from "Frontend/util/utils"; + +interface MetadataCompletenessIndicatorProps { + game: GameDto; +} + +export default function MetadataCompletenessIndicator({game}: MetadataCompletenessIndicatorProps) { + const completeness = useMemo(() => metadataCompleteness(game), [game]); + + const color = useMemo(() => { + return completeness > 80 ? "success" : completeness > 50 ? "warning" : "danger"; + }, [completeness]); + + return
+ +

{completeness}%

+
; +} \ No newline at end of file diff --git a/app/src/main/frontend/components/general/library/LibraryManagementGames.tsx b/app/src/main/frontend/components/general/library/LibraryManagementGames.tsx index a6579c0..e211946 100644 --- a/app/src/main/frontend/components/general/library/LibraryManagementGames.tsx +++ b/app/src/main/frontend/components/general/library/LibraryManagementGames.tsx @@ -26,6 +26,8 @@ import {useMemo, useState} from "react"; import EditGameMetadataModal from "Frontend/components/general/modals/EditGameMetadataModal"; import MatchGameModal from "Frontend/components/general/modals/MatchGameModal"; import {GameAdminDto} from "Frontend/dtos/GameDtos"; +import MetadataCompletenessIndicator from "Frontend/components/general/MetadataCompletenessIndicator"; +import {metadataCompleteness} from "Frontend/util/utils"; interface LibraryManagementGamesProps { library: LibraryDto; @@ -67,6 +69,9 @@ export default function LibraryManagementGames({library}: LibraryManagementGames case "downloadCount": cmp = a.metadata.downloadCount - b.metadata.downloadCount; break; + case "completeness": + cmp = metadataCompleteness(a) - metadataCompleteness(b); + break; default: return 0; // No sorting if the column is not recognized } @@ -160,6 +165,7 @@ export default function LibraryManagementGames({library}: LibraryManagementGames Added to library Download count Path + Completeness {/* width={1} keeps the column as far to the right as possible*/} Actions @@ -182,6 +188,9 @@ export default function LibraryManagementGames({library}: LibraryManagementGames {item.metadata.path} + + +