mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
* Update localforage, remove query-string * Update fontawesome and flag-icons * Update formatjs * Update axios and videojs * Update apollo client and graphql * Update bootstrap and react * Update polyfills * Update vite * Update ESLint * Update stylelint * Update configs * Rebuild yarn.lock
51 lines
1.5 KiB
TypeScript
51 lines
1.5 KiB
TypeScript
import React from "react";
|
|
import { useFindImages } from "src/core/StashService";
|
|
import Slider from "@ant-design/react-slick";
|
|
import { ListFilterModel } from "src/models/list-filter/filter";
|
|
import { getSlickSliderSettings } from "src/core/recommendations";
|
|
import { RecommendationRow } from "../FrontPage/RecommendationRow";
|
|
import { FormattedMessage } from "react-intl";
|
|
import { ImageCard } from "./ImageCard";
|
|
|
|
interface IProps {
|
|
isTouch: boolean;
|
|
filter: ListFilterModel;
|
|
header: string;
|
|
}
|
|
|
|
export const ImageRecommendationRow: React.FC<IProps> = (props: IProps) => {
|
|
const result = useFindImages(props.filter);
|
|
const cardCount = result.data?.findImages.count;
|
|
|
|
if (!result.loading && !cardCount) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<RecommendationRow
|
|
className="images-recommendations"
|
|
header={props.header}
|
|
link={
|
|
<a href={`/images?${props.filter.makeQueryParameters()}`}>
|
|
<FormattedMessage id="view_all" />
|
|
</a>
|
|
}
|
|
>
|
|
<Slider
|
|
{...getSlickSliderSettings(
|
|
cardCount ? cardCount : props.filter.itemsPerPage,
|
|
props.isTouch
|
|
)}
|
|
>
|
|
{result.loading
|
|
? [...Array(props.filter.itemsPerPage)].map((i) => (
|
|
<div key={`_${i}`} className="image-skeleton skeleton-card"></div>
|
|
))
|
|
: result.data?.findImages.images.map((i) => (
|
|
<ImageCard key={i.id} image={i} zoomIndex={1} />
|
|
))}
|
|
</Slider>
|
|
</RecommendationRow>
|
|
);
|
|
};
|