diff --git a/gameyfin/package-lock.json b/gameyfin/package-lock.json index f8e9dda..d2140cc 100644 --- a/gameyfin/package-lock.json +++ b/gameyfin/package-lock.json @@ -49,6 +49,7 @@ "react-confetti-boom": "^1.0.0", "react-dom": "18.3.1", "react-router": "7.5.2", + "swiper": "^11.2.6", "yup": "^1.6.1" }, "devDependencies": { @@ -16296,6 +16297,25 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/swiper": { + "version": "11.2.6", + "resolved": "https://registry.npmjs.org/swiper/-/swiper-11.2.6.tgz", + "integrity": "sha512-8aXpYKtjy3DjcbzZfz+/OX/GhcU5h+looA6PbAzHMZT6ESSycSp9nAjPCenczgJyslV+rUGse64LMGpWE3PX9Q==", + "funding": [ + { + "type": "patreon", + "url": "https://www.patreon.com/swiperjs" + }, + { + "type": "open_collective", + "url": "http://opencollective.com/swiper" + } + ], + "license": "MIT", + "engines": { + "node": ">= 4.7.0" + } + }, "node_modules/tabbable": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/tabbable/-/tabbable-6.2.0.tgz", diff --git a/gameyfin/package.json b/gameyfin/package.json index fdea4bc..da38758 100644 --- a/gameyfin/package.json +++ b/gameyfin/package.json @@ -44,6 +44,7 @@ "react-confetti-boom": "^1.0.0", "react-dom": "18.3.1", "react-router": "7.5.2", + "swiper": "^11.2.6", "yup": "^1.6.1" }, "devDependencies": { diff --git a/gameyfin/src/main/frontend/components/general/covers/ImageCarousel.tsx b/gameyfin/src/main/frontend/components/general/covers/ImageCarousel.tsx new file mode 100644 index 0000000..13e436c --- /dev/null +++ b/gameyfin/src/main/frontend/components/general/covers/ImageCarousel.tsx @@ -0,0 +1,65 @@ +import {Autoplay, Virtual} from 'swiper/modules'; +import {Swiper, SwiperSlide} from "swiper/react"; +import {Image} from "@heroui/react"; + +import "swiper/css"; +import "swiper/css/navigation"; +import "swiper/css/pagination"; +import "swiper/css/autoplay"; + +interface ImageCarouselProps { + imageIds: number[]; +} + +interface SlideData { + isActive: boolean; + isVisible: boolean; + isPrev: boolean; + isNext: boolean; +} + +export default function ImageCarousel({imageIds}: ImageCarouselProps) { + + return ( +
+ + + {`Game + + {imageIds.map((imageId, index) => ( + + {({isNext}: SlideData) => ( + {`Game + )} + + ))} + + {`Game + + +
+ ); +} \ No newline at end of file diff --git a/gameyfin/src/main/frontend/main.css b/gameyfin/src/main/frontend/main.css index a945a33..f5d84c1 100644 --- a/gameyfin/src/main/frontend/main.css +++ b/gameyfin/src/main/frontend/main.css @@ -16,7 +16,7 @@ /* Overwrite default Hilla styles (e.g. loading indicator) */ :root { - --lumo-primary-color: theme('colors.primary'); + --lumo-primary-color: theme(colors.primary); } /* List box drag & drop */ @@ -27,5 +27,5 @@ } .react-aria-DropIndicator[data-drop-target] { - outline: 1px solid theme('colors.primary'); + outline: 1px solid theme(colors.primary); } \ No newline at end of file diff --git a/gameyfin/src/main/frontend/views/GameView.tsx b/gameyfin/src/main/frontend/views/GameView.tsx index 05c4328..2c539be 100644 --- a/gameyfin/src/main/frontend/views/GameView.tsx +++ b/gameyfin/src/main/frontend/views/GameView.tsx @@ -4,6 +4,7 @@ import {GameEndpoint} from "Frontend/generated/endpoints"; import {useParams} from "react-router"; import {GameCover} from "Frontend/components/general/covers/GameCover"; import ComboButton, {ComboButtonOption} from "Frontend/components/general/input/ComboButton"; +import ImageCarousel from "Frontend/components/general/covers/ImageCarousel"; export default function GameView() { const {gameId} = useParams(); @@ -37,9 +38,13 @@ export default function GameView() { return (game && (
{game.imageIds !== undefined && game.imageIds.length > 0 && -
- Game screenshot +
+ Game screenshot +
}
@@ -55,9 +60,16 @@ export default function GameView() {
-
-

Summary

-

{game.summary}

+
+
+

Summary

+

{game.summary}

+
+
+

Screenshots

+ {game.imageIds !== undefined && game.imageIds.length > 0 && + } +