Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 25 additions & 26 deletions ui/v2.5/src/components/Galleries/GalleryGridCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
useCardWidth,
useContainerDimensions,
} from "../Shared/GridCard/GridCard";
import { PatchComponent } from "src/patch";

interface IGalleryCardGrid {
galleries: GQL.SlimGalleryDataFragment[];
Expand All @@ -15,30 +16,28 @@ interface IGalleryCardGrid {

const zoomWidths = [280, 340, 480, 640];

export const GalleryCardGrid: React.FC<IGalleryCardGrid> = ({
galleries,
selectedIds,
zoomIndex,
onSelectChange,
}) => {
const [componentRef, { width: containerWidth }] = useContainerDimensions();
const cardWidth = useCardWidth(containerWidth, zoomIndex, zoomWidths);
export const GalleryCardGrid: React.FC<IGalleryCardGrid> = PatchComponent(
"GalleryCardGrid",
({ galleries, selectedIds, zoomIndex, onSelectChange }) => {
const [componentRef, { width: containerWidth }] = useContainerDimensions();
const cardWidth = useCardWidth(containerWidth, zoomIndex, zoomWidths);

return (
<div className="row justify-content-center" ref={componentRef}>
{galleries.map((gallery) => (
<GalleryCard
key={gallery.id}
cardWidth={cardWidth}
gallery={gallery}
zoomIndex={zoomIndex}
selecting={selectedIds.size > 0}
selected={selectedIds.has(gallery.id)}
onSelectedChanged={(selected: boolean, shiftKey: boolean) =>
onSelectChange(gallery.id, selected, shiftKey)
}
/>
))}
</div>
);
};
return (
<div className="row justify-content-center" ref={componentRef}>
{galleries.map((gallery) => (
<GalleryCard
key={gallery.id}
cardWidth={cardWidth}
gallery={gallery}
zoomIndex={zoomIndex}
selecting={selectedIds.size > 0}
selected={selectedIds.has(gallery.id)}
onSelectedChanged={(selected: boolean, shiftKey: boolean) =>
onSelectChange(gallery.id, selected, shiftKey)
}
/>
))}
</div>
);
}
);
57 changes: 27 additions & 30 deletions ui/v2.5/src/components/Groups/GroupCardGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
useCardWidth,
useContainerDimensions,
} from "../Shared/GridCard/GridCard";
import { PatchComponent } from "src/patch";

interface IGroupCardGrid {
groups: GQL.ListGroupDataFragment[];
Expand All @@ -17,34 +18,30 @@ interface IGroupCardGrid {

const zoomWidths = [210, 250, 300, 375];

export const GroupCardGrid: React.FC<IGroupCardGrid> = ({
groups,
selectedIds,
zoomIndex,
onSelectChange,
fromGroupId,
onMove,
}) => {
const [componentRef, { width: containerWidth }] = useContainerDimensions();
const cardWidth = useCardWidth(containerWidth, zoomIndex, zoomWidths);
export const GroupCardGrid: React.FC<IGroupCardGrid> = PatchComponent(
"GroupCardGrid",
({ groups, selectedIds, zoomIndex, onSelectChange, fromGroupId, onMove }) => {
const [componentRef, { width: containerWidth }] = useContainerDimensions();
const cardWidth = useCardWidth(containerWidth, zoomIndex, zoomWidths);

return (
<div className="row justify-content-center" ref={componentRef}>
{groups.map((p) => (
<GroupCard
key={p.id}
cardWidth={cardWidth}
group={p}
zoomIndex={zoomIndex}
selecting={selectedIds.size > 0}
selected={selectedIds.has(p.id)}
onSelectedChanged={(selected: boolean, shiftKey: boolean) =>
onSelectChange(p.id, selected, shiftKey)
}
fromGroupId={fromGroupId}
onMove={onMove}
/>
))}
</div>
);
};
return (
<div className="row justify-content-center" ref={componentRef}>
{groups.map((p) => (
<GroupCard
key={p.id}
cardWidth={cardWidth}
group={p}
zoomIndex={zoomIndex}
selecting={selectedIds.size > 0}
selected={selectedIds.has(p.id)}
onSelectedChanged={(selected: boolean, shiftKey: boolean) =>
onSelectChange(p.id, selected, shiftKey)
}
fromGroupId={fromGroupId}
onMove={onMove}
/>
))}
</div>
);
}
);
58 changes: 28 additions & 30 deletions ui/v2.5/src/components/Images/ImageGridCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
useCardWidth,
useContainerDimensions,
} from "../Shared/GridCard/GridCard";
import { PatchComponent } from "src/patch";

interface IImageCardGrid {
images: GQL.SlimImageDataFragment[];
Expand All @@ -16,34 +17,31 @@ interface IImageCardGrid {

const zoomWidths = [280, 340, 480, 640];

export const ImageGridCard: React.FC<IImageCardGrid> = ({
images,
selectedIds,
zoomIndex,
onSelectChange,
onPreview,
}) => {
const [componentRef, { width: containerWidth }] = useContainerDimensions();
const cardWidth = useCardWidth(containerWidth, zoomIndex, zoomWidths);
export const ImageGridCard: React.FC<IImageCardGrid> = PatchComponent(
"ImageGridCard",
({ images, selectedIds, zoomIndex, onSelectChange, onPreview }) => {
const [componentRef, { width: containerWidth }] = useContainerDimensions();
const cardWidth = useCardWidth(containerWidth, zoomIndex, zoomWidths);

return (
<div className="row justify-content-center" ref={componentRef}>
{images.map((image, index) => (
<ImageCard
key={image.id}
cardWidth={cardWidth}
image={image}
zoomIndex={zoomIndex}
selecting={selectedIds.size > 0}
selected={selectedIds.has(image.id)}
onSelectedChanged={(selected: boolean, shiftKey: boolean) =>
onSelectChange(image.id, selected, shiftKey)
}
onPreview={
selectedIds.size < 1 ? (ev) => onPreview(index, ev) : undefined
}
/>
))}
</div>
);
};
return (
<div className="row justify-content-center" ref={componentRef}>
{images.map((image, index) => (
<ImageCard
key={image.id}
cardWidth={cardWidth}
image={image}
zoomIndex={zoomIndex}
selecting={selectedIds.size > 0}
selected={selectedIds.has(image.id)}
onSelectedChanged={(selected: boolean, shiftKey: boolean) =>
onSelectChange(image.id, selected, shiftKey)
}
onPreview={
selectedIds.size < 1 ? (ev) => onPreview(index, ev) : undefined
}
/>
))}
</div>
);
}
);
54 changes: 26 additions & 28 deletions ui/v2.5/src/components/Performers/PerformerCardGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
useCardWidth,
useContainerDimensions,
} from "../Shared/GridCard/GridCard";
import { PatchComponent } from "src/patch";

interface IPerformerCardGrid {
performers: GQL.PerformerDataFragment[];
Expand All @@ -16,32 +17,29 @@ interface IPerformerCardGrid {

const zoomWidths = [240, 300, 375, 470];

export const PerformerCardGrid: React.FC<IPerformerCardGrid> = ({
performers,
selectedIds,
zoomIndex,
onSelectChange,
extraCriteria,
}) => {
const [componentRef, { width: containerWidth }] = useContainerDimensions();
const cardWidth = useCardWidth(containerWidth, zoomIndex, zoomWidths);
export const PerformerCardGrid: React.FC<IPerformerCardGrid> = PatchComponent(
"PerformerCardGrid",
({ performers, selectedIds, zoomIndex, onSelectChange, extraCriteria }) => {
const [componentRef, { width: containerWidth }] = useContainerDimensions();
const cardWidth = useCardWidth(containerWidth, zoomIndex, zoomWidths);

return (
<div className="row justify-content-center" ref={componentRef}>
{performers.map((p) => (
<PerformerCard
key={p.id}
cardWidth={cardWidth}
performer={p}
zoomIndex={zoomIndex}
selecting={selectedIds.size > 0}
selected={selectedIds.has(p.id)}
onSelectedChanged={(selected: boolean, shiftKey: boolean) =>
onSelectChange(p.id, selected, shiftKey)
}
extraCriteria={extraCriteria}
/>
))}
</div>
);
};
return (
<div className="row justify-content-center" ref={componentRef}>
{performers.map((p) => (
<PerformerCard
key={p.id}
cardWidth={cardWidth}
performer={p}
zoomIndex={zoomIndex}
selecting={selectedIds.size > 0}
selected={selectedIds.has(p.id)}
onSelectedChanged={(selected: boolean, shiftKey: boolean) =>
onSelectChange(p.id, selected, shiftKey)
}
extraCriteria={extraCriteria}
/>
))}
</div>
);
}
);
59 changes: 28 additions & 31 deletions ui/v2.5/src/components/Scenes/SceneCardsGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
useCardWidth,
useContainerDimensions,
} from "../Shared/GridCard/GridCard";
import { PatchComponent } from "src/patch";

interface ISceneCardsGrid {
scenes: GQL.SlimSceneDataFragment[];
Expand All @@ -18,36 +19,32 @@ interface ISceneCardsGrid {

const zoomWidths = [280, 340, 480, 640];

export const SceneCardsGrid: React.FC<ISceneCardsGrid> = ({
scenes,
queue,
selectedIds,
zoomIndex,
onSelectChange,
fromGroupId,
}) => {
const [componentRef, { width: containerWidth }] = useContainerDimensions();
export const SceneCardsGrid: React.FC<ISceneCardsGrid> = PatchComponent(
"SceneCardsGrid",
({ scenes, queue, selectedIds, zoomIndex, onSelectChange, fromGroupId }) => {
const [componentRef, { width: containerWidth }] = useContainerDimensions();

const cardWidth = useCardWidth(containerWidth, zoomIndex, zoomWidths);
const cardWidth = useCardWidth(containerWidth, zoomIndex, zoomWidths);

return (
<div className="row justify-content-center" ref={componentRef}>
{scenes.map((scene, index) => (
<SceneCard
key={scene.id}
width={cardWidth}
scene={scene}
queue={queue}
index={index}
zoomIndex={zoomIndex}
selecting={selectedIds.size > 0}
selected={selectedIds.has(scene.id)}
onSelectedChanged={(selected: boolean, shiftKey: boolean) =>
onSelectChange(scene.id, selected, shiftKey)
}
fromGroupId={fromGroupId}
/>
))}
</div>
);
};
return (
<div className="row justify-content-center" ref={componentRef}>
{scenes.map((scene, index) => (
<SceneCard
key={scene.id}
width={cardWidth}
scene={scene}
queue={queue}
index={index}
zoomIndex={zoomIndex}
selecting={selectedIds.size > 0}
selected={selectedIds.has(scene.id)}
onSelectedChanged={(selected: boolean, shiftKey: boolean) =>
onSelectChange(scene.id, selected, shiftKey)
}
fromGroupId={fromGroupId}
/>
))}
</div>
);
}
);
Loading