mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 12:54:38 +03:00
Add zoom slider to other grid views (#4674)
* bring zoom slider to other list views * updated 0 index to scale more proportionally
This commit is contained in:
@@ -79,7 +79,7 @@ export const GalleryCard: React.FC<IProps> = (props) => {
|
|||||||
let preferredCardWidth: number;
|
let preferredCardWidth: number;
|
||||||
switch (zoomValue) {
|
switch (zoomValue) {
|
||||||
case 0:
|
case 0:
|
||||||
preferredCardWidth = 240;
|
preferredCardWidth = 280;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
preferredCardWidth = 340;
|
preferredCardWidth = 340;
|
||||||
@@ -95,7 +95,7 @@ export const GalleryCard: React.FC<IProps> = (props) => {
|
|||||||
preferredCardWidth!
|
preferredCardWidth!
|
||||||
);
|
);
|
||||||
setCardWidth(fittedCardWidth);
|
setCardWidth(fittedCardWidth);
|
||||||
}, [props, props.containerWidth, props.zoomIndex]);
|
}, [props.containerWidth, props.zoomIndex]);
|
||||||
|
|
||||||
function maybeRenderScenePopoverButton() {
|
function maybeRenderScenePopoverButton() {
|
||||||
if (props.gallery.scenes.length === 0) return;
|
if (props.gallery.scenes.length === 0) return;
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ interface IProps {
|
|||||||
sceneNumber?: number;
|
sceneNumber?: number;
|
||||||
selecting?: boolean;
|
selecting?: boolean;
|
||||||
selected?: boolean;
|
selected?: boolean;
|
||||||
|
zoomIndex?: number;
|
||||||
onSelectedChanged?: (selected: boolean, shiftKey: boolean) => void;
|
onSelectedChanged?: (selected: boolean, shiftKey: boolean) => void;
|
||||||
fromGroupId?: string;
|
fromGroupId?: string;
|
||||||
onMove?: (srcIds: string[], targetId: string, after: boolean) => void;
|
onMove?: (srcIds: string[], targetId: string, after: boolean) => void;
|
||||||
@@ -52,6 +53,7 @@ export const GroupCard: React.FC<IProps> = ({
|
|||||||
containerWidth,
|
containerWidth,
|
||||||
selecting,
|
selecting,
|
||||||
selected,
|
selected,
|
||||||
|
zoomIndex,
|
||||||
onSelectedChanged,
|
onSelectedChanged,
|
||||||
fromGroupId,
|
fromGroupId,
|
||||||
onMove,
|
onMove,
|
||||||
@@ -71,15 +73,30 @@ export const GroupCard: React.FC<IProps> = ({
|
|||||||
}, [fromGroupId, group.containing_groups]);
|
}, [fromGroupId, group.containing_groups]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!containerWidth || ScreenUtils.isMobile()) return;
|
if (!containerWidth || zoomIndex === undefined || ScreenUtils.isMobile())
|
||||||
|
return;
|
||||||
|
|
||||||
let preferredCardWidth = 250;
|
let zoomValue = zoomIndex;
|
||||||
|
let preferredCardWidth: number;
|
||||||
|
switch (zoomValue) {
|
||||||
|
case 0:
|
||||||
|
preferredCardWidth = 210;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
preferredCardWidth = 250;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
preferredCardWidth = 300;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
preferredCardWidth = 375;
|
||||||
|
}
|
||||||
let fittedCardWidth = calculateCardWidth(
|
let fittedCardWidth = calculateCardWidth(
|
||||||
containerWidth,
|
containerWidth,
|
||||||
preferredCardWidth!
|
preferredCardWidth!
|
||||||
);
|
);
|
||||||
setCardWidth(fittedCardWidth);
|
setCardWidth(fittedCardWidth);
|
||||||
}, [containerWidth]);
|
}, [containerWidth, zoomIndex]);
|
||||||
|
|
||||||
function maybeRenderScenesPopoverButton() {
|
function maybeRenderScenesPopoverButton() {
|
||||||
if (group.scenes.length === 0) return;
|
if (group.scenes.length === 0) return;
|
||||||
@@ -150,7 +167,7 @@ export const GroupCard: React.FC<IProps> = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<GridCard
|
<GridCard
|
||||||
className="group-card"
|
className={`group-card zoom-${zoomIndex}`}
|
||||||
objectId={group.id}
|
objectId={group.id}
|
||||||
onMove={onMove}
|
onMove={onMove}
|
||||||
url={`/groups/${group.id}`}
|
url={`/groups/${group.id}`}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { useContainerDimensions } from "../Shared/GridCard/GridCard";
|
|||||||
interface IGroupCardGrid {
|
interface IGroupCardGrid {
|
||||||
groups: GQL.GroupDataFragment[];
|
groups: GQL.GroupDataFragment[];
|
||||||
selectedIds: Set<string>;
|
selectedIds: Set<string>;
|
||||||
|
zoomIndex: number;
|
||||||
onSelectChange: (id: string, selected: boolean, shiftKey: boolean) => void;
|
onSelectChange: (id: string, selected: boolean, shiftKey: boolean) => void;
|
||||||
fromGroupId?: string;
|
fromGroupId?: string;
|
||||||
onMove?: (srcIds: string[], targetId: string, after: boolean) => void;
|
onMove?: (srcIds: string[], targetId: string, after: boolean) => void;
|
||||||
@@ -14,6 +15,7 @@ interface IGroupCardGrid {
|
|||||||
export const GroupCardGrid: React.FC<IGroupCardGrid> = ({
|
export const GroupCardGrid: React.FC<IGroupCardGrid> = ({
|
||||||
groups,
|
groups,
|
||||||
selectedIds,
|
selectedIds,
|
||||||
|
zoomIndex,
|
||||||
onSelectChange,
|
onSelectChange,
|
||||||
fromGroupId,
|
fromGroupId,
|
||||||
onMove,
|
onMove,
|
||||||
@@ -26,6 +28,7 @@ export const GroupCardGrid: React.FC<IGroupCardGrid> = ({
|
|||||||
key={p.id}
|
key={p.id}
|
||||||
containerWidth={width}
|
containerWidth={width}
|
||||||
group={p}
|
group={p}
|
||||||
|
zoomIndex={zoomIndex}
|
||||||
selecting={selectedIds.size > 0}
|
selecting={selectedIds.size > 0}
|
||||||
selected={selectedIds.has(p.id)}
|
selected={selectedIds.has(p.id)}
|
||||||
onSelectedChanged={(selected: boolean, shiftKey: boolean) =>
|
onSelectedChanged={(selected: boolean, shiftKey: boolean) =>
|
||||||
|
|||||||
@@ -184,6 +184,7 @@ export const GroupList: React.FC<IGroupList> = ({
|
|||||||
{filter.displayMode === DisplayMode.Grid && (
|
{filter.displayMode === DisplayMode.Grid && (
|
||||||
<GroupCardGrid
|
<GroupCardGrid
|
||||||
groups={result.data?.findGroups.groups ?? []}
|
groups={result.data?.findGroups.groups ?? []}
|
||||||
|
zoomIndex={filter.zoomIndex}
|
||||||
selectedIds={selectedIds}
|
selectedIds={selectedIds}
|
||||||
onSelectChange={onSelectChange}
|
onSelectChange={onSelectChange}
|
||||||
fromGroupId={fromGroupId}
|
fromGroupId={fromGroupId}
|
||||||
@@ -225,6 +226,7 @@ export const GroupList: React.FC<IGroupList> = ({
|
|||||||
selectable={selectable}
|
selectable={selectable}
|
||||||
>
|
>
|
||||||
<ItemList
|
<ItemList
|
||||||
|
zoomable
|
||||||
view={view}
|
view={view}
|
||||||
otherOperations={otherOperations}
|
otherOperations={otherOperations}
|
||||||
addKeybinds={addKeybinds}
|
addKeybinds={addKeybinds}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ export const ImageCard: React.FC<IImageCardProps> = (
|
|||||||
let preferredCardWidth: number;
|
let preferredCardWidth: number;
|
||||||
switch (zoomValue) {
|
switch (zoomValue) {
|
||||||
case 0:
|
case 0:
|
||||||
preferredCardWidth = 240;
|
preferredCardWidth = 280;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
preferredCardWidth = 340;
|
preferredCardWidth = 340;
|
||||||
@@ -66,7 +66,7 @@ export const ImageCard: React.FC<IImageCardProps> = (
|
|||||||
preferredCardWidth!
|
preferredCardWidth!
|
||||||
);
|
);
|
||||||
setCardWidth(fittedCardWidth);
|
setCardWidth(fittedCardWidth);
|
||||||
}, [props, props.containerWidth, props.zoomIndex]);
|
}, [props.containerWidth, props.zoomIndex]);
|
||||||
|
|
||||||
const file = useMemo(
|
const file = useMemo(
|
||||||
() =>
|
() =>
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ interface IPerformerCardProps {
|
|||||||
ageFromDate?: string;
|
ageFromDate?: string;
|
||||||
selecting?: boolean;
|
selecting?: boolean;
|
||||||
selected?: boolean;
|
selected?: boolean;
|
||||||
|
zoomIndex?: number;
|
||||||
onSelectedChanged?: (selected: boolean, shiftKey: boolean) => void;
|
onSelectedChanged?: (selected: boolean, shiftKey: boolean) => void;
|
||||||
extraCriteria?: IPerformerCardExtraCriteria;
|
extraCriteria?: IPerformerCardExtraCriteria;
|
||||||
}
|
}
|
||||||
@@ -48,6 +49,7 @@ export const PerformerCard: React.FC<IPerformerCardProps> = ({
|
|||||||
ageFromDate,
|
ageFromDate,
|
||||||
selecting,
|
selecting,
|
||||||
selected,
|
selected,
|
||||||
|
zoomIndex,
|
||||||
onSelectedChanged,
|
onSelectedChanged,
|
||||||
extraCriteria,
|
extraCriteria,
|
||||||
}) => {
|
}) => {
|
||||||
@@ -72,15 +74,30 @@ export const PerformerCard: React.FC<IPerformerCardProps> = ({
|
|||||||
const [cardWidth, setCardWidth] = useState<number>();
|
const [cardWidth, setCardWidth] = useState<number>();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!containerWidth || ScreenUtils.isMobile()) return;
|
if (!containerWidth || zoomIndex === undefined || ScreenUtils.isMobile())
|
||||||
|
return;
|
||||||
|
|
||||||
let preferredCardWidth = 300;
|
let zoomValue = zoomIndex;
|
||||||
|
let preferredCardWidth: number;
|
||||||
|
switch (zoomValue) {
|
||||||
|
case 0:
|
||||||
|
preferredCardWidth = 240;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
preferredCardWidth = 300;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
preferredCardWidth = 375;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
preferredCardWidth = 470;
|
||||||
|
}
|
||||||
let fittedCardWidth = calculateCardWidth(
|
let fittedCardWidth = calculateCardWidth(
|
||||||
containerWidth,
|
containerWidth,
|
||||||
preferredCardWidth!
|
preferredCardWidth!
|
||||||
);
|
);
|
||||||
setCardWidth(fittedCardWidth);
|
setCardWidth(fittedCardWidth);
|
||||||
}, [containerWidth]);
|
}, [containerWidth, zoomIndex]);
|
||||||
|
|
||||||
function onToggleFavorite(v: boolean) {
|
function onToggleFavorite(v: boolean) {
|
||||||
if (performer.id) {
|
if (performer.id) {
|
||||||
@@ -246,7 +263,7 @@ export const PerformerCard: React.FC<IPerformerCardProps> = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<GridCard
|
<GridCard
|
||||||
className="performer-card"
|
className={`performer-card zoom-${zoomIndex}`}
|
||||||
url={`/performers/${performer.id}`}
|
url={`/performers/${performer.id}`}
|
||||||
width={cardWidth}
|
width={cardWidth}
|
||||||
pretitleIcon={
|
pretitleIcon={
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ interface IPerformerCardGrid {
|
|||||||
export const PerformerCardGrid: React.FC<IPerformerCardGrid> = ({
|
export const PerformerCardGrid: React.FC<IPerformerCardGrid> = ({
|
||||||
performers,
|
performers,
|
||||||
selectedIds,
|
selectedIds,
|
||||||
|
zoomIndex,
|
||||||
onSelectChange,
|
onSelectChange,
|
||||||
extraCriteria,
|
extraCriteria,
|
||||||
}) => {
|
}) => {
|
||||||
@@ -25,6 +26,7 @@ export const PerformerCardGrid: React.FC<IPerformerCardGrid> = ({
|
|||||||
key={p.id}
|
key={p.id}
|
||||||
containerWidth={width}
|
containerWidth={width}
|
||||||
performer={p}
|
performer={p}
|
||||||
|
zoomIndex={zoomIndex}
|
||||||
selecting={selectedIds.size > 0}
|
selecting={selectedIds.size > 0}
|
||||||
selected={selectedIds.has(p.id)}
|
selected={selectedIds.has(p.id)}
|
||||||
onSelectedChanged={(selected: boolean, shiftKey: boolean) =>
|
onSelectedChanged={(selected: boolean, shiftKey: boolean) =>
|
||||||
|
|||||||
@@ -329,6 +329,7 @@ export const PerformerList: React.FC<IPerformerList> = ({
|
|||||||
selectable
|
selectable
|
||||||
>
|
>
|
||||||
<ItemList
|
<ItemList
|
||||||
|
zoomable
|
||||||
view={view}
|
view={view}
|
||||||
otherOperations={otherOperations}
|
otherOperations={otherOperations}
|
||||||
addKeybinds={addKeybinds}
|
addKeybinds={addKeybinds}
|
||||||
|
|||||||
@@ -474,7 +474,7 @@ export const SceneCard = PatchComponent(
|
|||||||
let preferredCardWidth: number;
|
let preferredCardWidth: number;
|
||||||
switch (zoomValue) {
|
switch (zoomValue) {
|
||||||
case 0:
|
case 0:
|
||||||
preferredCardWidth = 240;
|
preferredCardWidth = 280;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
preferredCardWidth = 340; // this value is intentionally higher than 320
|
preferredCardWidth = 340; // this value is intentionally higher than 320
|
||||||
@@ -490,7 +490,7 @@ export const SceneCard = PatchComponent(
|
|||||||
preferredCardWidth!
|
preferredCardWidth!
|
||||||
);
|
);
|
||||||
setCardWidth(fittedCardWidth);
|
setCardWidth(fittedCardWidth);
|
||||||
}, [props, props.containerWidth, props.zoomIndex]);
|
}, [props.containerWidth, props.zoomIndex]);
|
||||||
|
|
||||||
const cont = configuration?.interface.continuePlaylistDefault ?? false;
|
const cont = configuration?.interface.continuePlaylistDefault ?? false;
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ interface IProps {
|
|||||||
hideParent?: boolean;
|
hideParent?: boolean;
|
||||||
selecting?: boolean;
|
selecting?: boolean;
|
||||||
selected?: boolean;
|
selected?: boolean;
|
||||||
|
zoomIndex?: number;
|
||||||
onSelectedChanged?: (selected: boolean, shiftKey: boolean) => void;
|
onSelectedChanged?: (selected: boolean, shiftKey: boolean) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,21 +79,38 @@ export const StudioCard: React.FC<IProps> = ({
|
|||||||
hideParent,
|
hideParent,
|
||||||
selecting,
|
selecting,
|
||||||
selected,
|
selected,
|
||||||
|
zoomIndex,
|
||||||
onSelectedChanged,
|
onSelectedChanged,
|
||||||
}) => {
|
}) => {
|
||||||
const [updateStudio] = useStudioUpdate();
|
const [updateStudio] = useStudioUpdate();
|
||||||
const [cardWidth, setCardWidth] = useState<number>();
|
const [cardWidth, setCardWidth] = useState<number>();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!containerWidth || ScreenUtils.isMobile()) return;
|
if (!containerWidth || zoomIndex === undefined || ScreenUtils.isMobile())
|
||||||
|
return;
|
||||||
|
|
||||||
let preferredCardWidth = 340;
|
let zoomValue = zoomIndex;
|
||||||
|
console.log(zoomValue);
|
||||||
|
let preferredCardWidth: number;
|
||||||
|
switch (zoomValue) {
|
||||||
|
case 0:
|
||||||
|
preferredCardWidth = 280;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
preferredCardWidth = 340;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
preferredCardWidth = 420;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
preferredCardWidth = 560;
|
||||||
|
}
|
||||||
let fittedCardWidth = calculateCardWidth(
|
let fittedCardWidth = calculateCardWidth(
|
||||||
containerWidth,
|
containerWidth,
|
||||||
preferredCardWidth!
|
preferredCardWidth!
|
||||||
);
|
);
|
||||||
setCardWidth(fittedCardWidth);
|
setCardWidth(fittedCardWidth);
|
||||||
}, [containerWidth]);
|
}, [containerWidth, zoomIndex]);
|
||||||
|
|
||||||
function onToggleFavorite(v: boolean) {
|
function onToggleFavorite(v: boolean) {
|
||||||
if (studio.id) {
|
if (studio.id) {
|
||||||
@@ -216,7 +234,7 @@ export const StudioCard: React.FC<IProps> = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<GridCard
|
<GridCard
|
||||||
className="studio-card"
|
className={`studio-card zoom-${zoomIndex}`}
|
||||||
url={`/studios/${studio.id}`}
|
url={`/studios/${studio.id}`}
|
||||||
width={cardWidth}
|
width={cardWidth}
|
||||||
title={studio.name}
|
title={studio.name}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ interface IStudioCardGrid {
|
|||||||
studios: GQL.StudioDataFragment[];
|
studios: GQL.StudioDataFragment[];
|
||||||
fromParent: boolean | undefined;
|
fromParent: boolean | undefined;
|
||||||
selectedIds: Set<string>;
|
selectedIds: Set<string>;
|
||||||
|
zoomIndex: number;
|
||||||
onSelectChange: (id: string, selected: boolean, shiftKey: boolean) => void;
|
onSelectChange: (id: string, selected: boolean, shiftKey: boolean) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -14,6 +15,7 @@ export const StudioCardGrid: React.FC<IStudioCardGrid> = ({
|
|||||||
studios,
|
studios,
|
||||||
fromParent,
|
fromParent,
|
||||||
selectedIds,
|
selectedIds,
|
||||||
|
zoomIndex,
|
||||||
onSelectChange,
|
onSelectChange,
|
||||||
}) => {
|
}) => {
|
||||||
const [componentRef, { width }] = useContainerDimensions();
|
const [componentRef, { width }] = useContainerDimensions();
|
||||||
@@ -24,6 +26,7 @@ export const StudioCardGrid: React.FC<IStudioCardGrid> = ({
|
|||||||
key={studio.id}
|
key={studio.id}
|
||||||
containerWidth={width}
|
containerWidth={width}
|
||||||
studio={studio}
|
studio={studio}
|
||||||
|
zoomIndex={zoomIndex}
|
||||||
hideParent={fromParent}
|
hideParent={fromParent}
|
||||||
selecting={selectedIds.size > 0}
|
selecting={selectedIds.size > 0}
|
||||||
selected={selectedIds.has(studio.id)}
|
selected={selectedIds.has(studio.id)}
|
||||||
|
|||||||
@@ -135,6 +135,7 @@ export const StudioList: React.FC<IStudioList> = ({
|
|||||||
return (
|
return (
|
||||||
<StudioCardGrid
|
<StudioCardGrid
|
||||||
studios={result.data.findStudios.studios}
|
studios={result.data.findStudios.studios}
|
||||||
|
zoomIndex={filter.zoomIndex}
|
||||||
fromParent={fromParent}
|
fromParent={fromParent}
|
||||||
selectedIds={selectedIds}
|
selectedIds={selectedIds}
|
||||||
onSelectChange={onSelectChange}
|
onSelectChange={onSelectChange}
|
||||||
@@ -187,6 +188,7 @@ export const StudioList: React.FC<IStudioList> = ({
|
|||||||
selectable
|
selectable
|
||||||
>
|
>
|
||||||
<ItemList
|
<ItemList
|
||||||
|
zoomable
|
||||||
view={view}
|
view={view}
|
||||||
otherOperations={otherOperations}
|
otherOperations={otherOperations}
|
||||||
addKeybinds={addKeybinds}
|
addKeybinds={addKeybinds}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ export const TagCard: React.FC<IProps> = ({
|
|||||||
let preferredCardWidth: number;
|
let preferredCardWidth: number;
|
||||||
switch (zoomValue) {
|
switch (zoomValue) {
|
||||||
case 0:
|
case 0:
|
||||||
preferredCardWidth = 240;
|
preferredCardWidth = 280;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
preferredCardWidth = 340;
|
preferredCardWidth = 340;
|
||||||
|
|||||||
Reference in New Issue
Block a user