mirror of
https://github.com/BrenBroZAYT/gameyfin.git
synced 2026-06-13 16:40:01 +00:00
717a423449
* Migrate to TailwindCSS v4 (#740) * Remove "material-tailwind" dependencies due to incompatibility of Stepper component with Tailwind v4 * Clean up Tailwind configs before upgrade * Run HeroUI upgrade * Run TailwindCSS upgrade * Replace PostCSS with Vite * Migrate custom styles to v4 * Remove tailwind.config.ts * Add heroui.ts Add tailwind vite plugin * Fix small UI color inconsistency * Fix theming system Rename purple theme to pink * Re-implement stepper in HeroUI * Fix RoleChip colors * Migrate icon names (#743) * Add migration script for phosphor-icons * Migrate icon usages * Update version to 2.2.0-preview * Revert accidental rename of menu title * Bump stefanzweifel/git-auto-commit-action from 6 to 7 (#750) Bumps [stefanzweifel/git-auto-commit-action](https://github.com/stefanzweifel/git-auto-commit-action) from 6 to 7. - [Release notes](https://github.com/stefanzweifel/git-auto-commit-action/releases) - [Changelog](https://github.com/stefanzweifel/git-auto-commit-action/blob/master/CHANGELOG.md) - [Commits](https://github.com/stefanzweifel/git-auto-commit-action/compare/v6...v7) --- updated-dependencies: - dependency-name: stefanzweifel/git-auto-commit-action dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Improve library scanning (#749) * Update script to generate example libraries using SteamSpy API * Refactor library scanning process * Display Flyway startup log by default * Fix race condition in CompanyService * Fix race condition in ImageService Remove obsolete table * Fix SMTP config requiring an email as username (#755) * Disable length limit for config values (#757) * Deprecate DockerHub image (#759) * Remove deprecation warning from web UI * Reworked the CICD pipelines * Optimize container image (#761) * Fix Gradle warning * Rework Docker image to improve layer caching * Bump stefanzweifel/git-auto-commit-action from 6 to 7 (#765) Bumps [stefanzweifel/git-auto-commit-action](https://github.com/stefanzweifel/git-auto-commit-action) from 6 to 7. - [Release notes](https://github.com/stefanzweifel/git-auto-commit-action/releases) - [Changelog](https://github.com/stefanzweifel/git-auto-commit-action/blob/master/CHANGELOG.md) - [Commits](https://github.com/stefanzweifel/git-auto-commit-action/compare/v6...v7) --- updated-dependencies: - dependency-name: stefanzweifel/git-auto-commit-action dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Multi platform support (#764) * Remove migrate-phosphor-icons.js since migration has been successful * Refactor GameMetadata into separate files * Add Platform enum * Implement platform support in Plugin API * Implement platform support in Steam Plugin * Implement platform support in IGDB Plugin * Add database migration for platform support * Implement platform support in GameService * Implement platform support on most endpoints and features, some are still missing Implemented platform support in all bundled plugins (although not finished polishing yet) * Implement platforms in UI * Make GameRequest platform aware * Return headerImages from IGDB * Implement proper PlatformMapper for IGDB plugin * Fix various smaller issues and inconsistencies * Replace placeholder in LibraryOverviewCard (#767) * Bump actions/download-artifact from 5 to 6 (#769) * Bump actions/upload-artifact from 4 to 5 (#770) * Multi platform support (#773) * Fix bug in Plugin API related to state loading/saving * Hide Flyway query logs by default * Extend migration script for multi platform tables * Plugins now store their data and state in ./plugindata * Add "plugindata" directory to entrypoint scripts * Improve download handling (#756) * Process download in background thread to avoid session timeout affecting it * Increase default session timeout to 24h * Use virtual thread pool for download task in background * Make KSP extensions.idx generation more robust * Implement download bandwidth limiter Implement SliderInput Refactor NumberInput * Implement download bandwidth throttling Implement real-time download monitoring * Improve UI for DownloadManagement Track more stats in SessionStats * Update Hilla Use React 19 * Implement real-time graph to track bandwidth usage Implement downloaded data sum over last day Small bug fixes Small refactorings * Update docker-compose.example.yml * Improve DownloadSessionCard (#784) * Fix unit on y-axis of download graph * Show game size and library in tooltip Make game chips interactive in DownloadSessionCard (leads to game page when clicked) Optimize graph settings * Migrate torrent plugin to libtorrent (#775) * Disable TorrentDownloadPlugin in Alpine based Docker image * Improve test coverage (#785) * Fix potential divide by zero bug * Add mockk dependency * Add tests for org.gameyfin.app.core.download * Add tests for Filesytem package Fix DownloadServiceTest * Fix FilesystemServiceTest * Add tests for "job" package * Upgrade Gradle wrapper Enable Gradle config cache * Added more tests * Added tests for the "security" package * Add tests for "game" package * Fix AsyncFileTailer not shutting down properly on Windows * Fix GameServiceTest * Added tests for "libraries" package * Added tests for "media" package * Fix warning in ImageService * Add tests fpr "messages" package Make sure transport is closed even in case an exception is thrown * Add tests for "platforms" package * Add tests for "requests" package * Moved "token" package to "core" package (from "shared") * Add tests for "token" package * Fix issue in RoleEnum.safeValueOf() throwing Exception * Fix potential issue in UserEndpoint.getUserInfo() when auth is null * Added tests for "user" package * Migrate package for "token" in FE * Publish test report in CI * Fix workflow permissions * Remove test because of timing issue in CI * Replaced "unmatched paths" with "ignored paths" (#791) * Use new "AutoComplete" component (#793) * Use ArrayInputAutocomplete in EditGameMetadataModal * Add test for getEnumPropertyValues --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
136 lines
7.9 KiB
TypeScript
136 lines
7.9 KiB
TypeScript
import GameDto from "Frontend/generated/org/gameyfin/app/games/dto/GameDto";
|
|
import {
|
|
Accordion,
|
|
AccordionItem,
|
|
Button,
|
|
Modal,
|
|
ModalBody,
|
|
ModalContent,
|
|
ModalFooter,
|
|
ModalHeader
|
|
} from "@heroui/react";
|
|
import {Form, Formik} from "formik";
|
|
import Input from "Frontend/components/general/input/Input";
|
|
import React, {useEffect, useState} from "react";
|
|
import GameUpdateDto from "Frontend/generated/org/gameyfin/app/games/dto/GameUpdateDto";
|
|
import GameEnumPropertyValuesDto from "Frontend/generated/org/gameyfin/app/games/dto/GameEnumPropertyValuesDto";
|
|
import {deepDiff} from "Frontend/util/utils";
|
|
import {GameEndpoint} from "Frontend/generated/endpoints";
|
|
import TextAreaInput from "Frontend/components/general/input/TextAreaInput";
|
|
import * as Yup from "yup";
|
|
import GameCoverPicker from "Frontend/components/general/input/GameCoverPicker";
|
|
import DatePickerInput from "Frontend/components/general/input/DatePickerInput";
|
|
import ArrayInput from "Frontend/components/general/input/ArrayInput";
|
|
import GameHeaderPicker from "Frontend/components/general/input/GameHeaderPicker";
|
|
import ArrayInputAutocomplete from "Frontend/components/general/input/ArrayInputAutocomplete";
|
|
import {useSnapshot} from "valtio/react";
|
|
import {platformState} from "Frontend/state/PlatformState";
|
|
|
|
interface EditGameMetadataModalProps {
|
|
game: GameDto;
|
|
isOpen: boolean;
|
|
onOpenChange: () => void;
|
|
}
|
|
|
|
export default function EditGameMetadataModal({game, isOpen, onOpenChange}: EditGameMetadataModalProps) {
|
|
const availablePlatforms = useSnapshot(platformState).available;
|
|
const [propertyEnumValues, setPropertyEnumValues] = useState<GameEnumPropertyValuesDto>();
|
|
|
|
useEffect(() => {
|
|
GameEndpoint.getEnumPropertyValues().then(setPropertyEnumValues);
|
|
}, []);
|
|
|
|
return propertyEnumValues && (
|
|
<Modal isOpen={isOpen} onOpenChange={onOpenChange} backdrop="opaque" size="3xl">
|
|
<ModalContent>
|
|
{(onClose) => {
|
|
|
|
async function updateGame(values: GameUpdateDto) {
|
|
//@ts-ignore
|
|
const changed = deepDiff(game, values) as GameUpdateDto;
|
|
if (Object.keys(changed).length === 0) return;
|
|
|
|
changed.id = game.id;
|
|
await GameEndpoint.updateGame(changed);
|
|
onClose();
|
|
}
|
|
|
|
return (
|
|
<Formik initialValues={game}
|
|
enableReinitialize={true}
|
|
onSubmit={updateGame}
|
|
validationSchema={Yup.object({
|
|
title: Yup.string().required("Title is required")
|
|
})}
|
|
>
|
|
{(formik: any) => (
|
|
<Form>
|
|
<ModalHeader className="flex flex-col gap-1">
|
|
Update game metadata
|
|
</ModalHeader>
|
|
<ModalBody>
|
|
<Input key="metadata.path" name="metadata.path" label="Path"
|
|
isDisabled className="mb-0"/>
|
|
<div className="flex flex-row gap-4 h-44">
|
|
<GameCoverPicker key="coverUrl" name="coverUrl" game={game}/>
|
|
<GameHeaderPicker key="headerUrl" name="headerUrl" game={game}/>
|
|
</div>
|
|
<div className="flex flex-row gap-4">
|
|
<Input key="title" name="title" label="Title" isRequired/>
|
|
<DatePickerInput key="release" name="release" label="Release"
|
|
className="w-fit"/>
|
|
</div>
|
|
<ArrayInputAutocomplete options={Array.from(availablePlatforms)}
|
|
name="platforms" label="Platforms"/>
|
|
<TextAreaInput key="summary" name="summary" label="Summary (HTML)"/>
|
|
<TextAreaInput key="comment" name="comment" label="Comment (Markdown)"/>
|
|
<Accordion variant="splitted"
|
|
itemClasses={{
|
|
base: "-mx-2",
|
|
content: "max-h-80 overflow-y-auto",
|
|
}}>
|
|
<AccordionItem key="additional-metadata"
|
|
aria-label="Additional Metadata"
|
|
title="Additional Metadata">
|
|
<ArrayInput key="developers" name="developers" label="Developers"/>
|
|
<ArrayInput key="publishers" name="publishers" label="Publishers"/>
|
|
<ArrayInputAutocomplete options={propertyEnumValues.genres}
|
|
defaultSelected={game.genres}
|
|
key="genres" name="genres" label="Genres"/>
|
|
<ArrayInputAutocomplete options={propertyEnumValues.themes}
|
|
defaultSelected={game.themes}
|
|
key="themes" name="themes" label="Themes"/>
|
|
<ArrayInputAutocomplete options={propertyEnumValues.features}
|
|
defaultSelected={game.features}
|
|
key="features" name="features"
|
|
label="Features"/>
|
|
<ArrayInputAutocomplete options={propertyEnumValues.perspectives}
|
|
defaultSelected={game.perspectives}
|
|
key="perspectives" name="perspectives"
|
|
label="Perspectives"/>
|
|
<ArrayInput key="keywords" name="keywords" label="Keywords"/>
|
|
</AccordionItem>
|
|
</Accordion>
|
|
</ModalBody>
|
|
<ModalFooter>
|
|
<Button variant="light" onPress={onClose}>
|
|
Cancel
|
|
</Button>
|
|
<Button
|
|
color="primary"
|
|
isLoading={formik.isSubmitting}
|
|
isDisabled={formik.isSubmitting || !formik.dirty}
|
|
type="submit"
|
|
>
|
|
{formik.isSubmitting ? "" : "Save"}
|
|
</Button>
|
|
</ModalFooter>
|
|
</Form>
|
|
)}
|
|
</Formik>
|
|
)
|
|
}}
|
|
</ModalContent>
|
|
</Modal>
|
|
);
|
|
} |