(WIP) Implement library management game view

Small changes to DirectDownloadPlugin
This commit is contained in:
grimsi
2025-05-21 14:10:18 +02:00
parent 4c5788ea90
commit 83fb5ea1d0
11 changed files with 63 additions and 10 deletions
+2 -2
View File
@@ -53,8 +53,8 @@ dependencies {
// Persistence & I/O
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("com.github.paulcwarren:spring-content-fs-boot-starter:3.0.17") K
implementation("commons-io:commons-io:2.18.0")
implementation("com.github.paulcwarren:spring-content-fs-boot-starter:3.0.17")
implementation("commons-io:commons-io:2.18.0")
// SSO
implementation("org.springframework.boot:spring-boot-starter-oauth2-client")
@@ -1,5 +1,5 @@
import React, {useEffect} from "react";
import {PluginManagementSection} from "Frontend/components/general/PluginManagementSection";
import {PluginManagementSection} from "Frontend/components/general/plugin/PluginManagementSection";
import {initializePluginState, pluginState} from "Frontend/state/PluginState";
import {useSnapshot} from "valtio/react";
@@ -18,7 +18,7 @@ import {
import PluginState from "Frontend/generated/org/pf4j/PluginState";
import React, {ReactNode} from "react";
import PluginDetailsModal from "Frontend/components/general/modals/PluginDetailsModal";
import PluginLogo from "Frontend/components/general/PluginLogo";
import PluginLogo from "Frontend/components/general/plugin/PluginLogo";
import PluginTrustLevel from "Frontend/generated/de/grimsi/gameyfin/core/plugins/management/PluginTrustLevel";
import {PluginEndpoint} from "Frontend/generated/endpoints";
import PluginDto from "Frontend/generated/de/grimsi/gameyfin/core/plugins/dto/PluginDto";
@@ -0,0 +1,52 @@
import LibraryDto from "Frontend/generated/de/grimsi/gameyfin/libraries/dto/LibraryDto";
import {useEffect, useState} from "react";
import {LibraryEndpoint} from "Frontend/generated/endpoints";
import GameDto from "Frontend/generated/de/grimsi/gameyfin/games/dto/GameDto";
import {Button, Table, TableBody, TableCell, TableColumn, TableHeader, TableRow} from "@heroui/react";
import {CheckCircle, Pencil, Trash} from "@phosphor-icons/react";
interface LibraryManagementGamesProps {
library: LibraryDto;
}
export default function LibraryManagementGames({library}: LibraryManagementGamesProps) {
const [games, setGames] = useState<GameDto[]>([]);
useEffect(() => {
LibraryEndpoint.getGamesInLibrary(library.id).then((games) => {
setGames(games);
})
}, []);
return <div className="flex flex-col gap-4">
<h1 className="text-2xl font-bold">Manage games in library</h1>
<Table removeWrapper isStriped isHeaderSticky>
<TableHeader>
<TableColumn allowsSorting>Game</TableColumn>
<TableColumn allowsSorting>Added to library</TableColumn>
<TableColumn>Path</TableColumn>
<TableColumn>Actions</TableColumn>
</TableHeader>
<TableBody emptyContent="This library is empty." items={games}>
{(item) => (
<TableRow key={item.id}>
<TableCell>
{item.title} ({item.release !== undefined ? new Date(item.release).getFullYear() : "unknown"})
</TableCell>
<TableCell>
{new Date(item.createdAt).toLocaleString()}
</TableCell>
<TableCell>
{item.path}
</TableCell>
<TableCell className="flex flex-row gap-2">
<Button isIconOnly size="sm" isDisabled={true}><CheckCircle/></Button>
<Button isIconOnly size="sm" isDisabled={true}><Pencil/></Button>
<Button isIconOnly size="sm" isDisabled={true} color="danger"><Trash/></Button>
</TableCell>
</TableRow>
)}
</TableBody>
</Table>
</div>;
}
@@ -3,7 +3,7 @@ import {addToast, Button, Link, Modal, ModalBody, ModalContent, ModalFooter, Mod
import {Form, Formik} from "formik";
import PluginConfigElement from "Frontend/generated/de/grimsi/gameyfin/pluginapi/core/PluginConfigElement";
import Input from "Frontend/components/general/input/Input";
import PluginLogo from "Frontend/components/general/PluginLogo";
import PluginLogo from "Frontend/components/general/plugin/PluginLogo";
import Markdown from "react-markdown";
import remarkBreaks from "remark-breaks";
import {PluginEndpoint} from "Frontend/generated/endpoints";
@@ -6,7 +6,8 @@ import {LibraryEndpoint} from "Frontend/generated/endpoints";
import LibraryHeader from "Frontend/components/general/covers/LibraryHeader";
import {Button, Tab, Tabs} from "@heroui/react";
import {ArrowLeft} from "@phosphor-icons/react";
import LibraryManagementDetails from "Frontend/components/general/LibraryManagementDetails";
import LibraryManagementDetails from "Frontend/components/general/library/LibraryManagementDetails";
import LibraryManagementGames from "Frontend/components/general/library/LibraryManagementGames";
export default function LibraryManagementView() {
@@ -38,7 +39,7 @@ export default function LibraryManagementView() {
<LibraryManagementDetails library={library}/>
</Tab>
<Tab title="Games">
<p>Games</p>
<LibraryManagementGames library={library}/>
</Tab>
<Tab title="Unmatched paths">
<p>Unmatched paths</p>
@@ -27,8 +27,8 @@ class DirectDownloadPlugin(wrapper: PluginWrapper) : ConfigurableGameyfinPlugin(
override val configMetadata: List<PluginConfigElement> = listOf(
PluginConfigElement(
key = "compressionMode",
name = "Compression mode for generated ZIP files (\"none\" = default, \"fast\", \"best\")",
description = "Higher compression uses more CPU but saves bandwidth",
name = "Compression mode (\"none\" = default, \"fast\", \"best\")",
description = "Higher compression modes are more resource intensive, but save bandwidth",
)
)
@@ -1,4 +1,4 @@
Plugin-Version: 1.0.0-alpha3
Plugin-Version: 1.0.0-alpha4
Plugin-Class: de.grimsi.gameyfin.plugins.directdownload.DirectDownloadPlugin
Plugin-Id: de.grimsi.gameyfin.directdownload
Plugin-Name: Direct Download