Bulk update scenes (#92)

* Add bulk update functionality

* Restore multiselect fixes from previous branch

* Prevent unsetting of studios/tags

* Detect when slice fields are omitted and ignore
This commit is contained in:
WithoutPants
2019-10-28 00:05:31 +11:00
committed by Leopere
parent 70ce01c604
commit 0655223c38
13 changed files with 754 additions and 61 deletions

View File

@@ -2,6 +2,7 @@ import {
Button,
ButtonGroup,
Card,
Checkbox,
Divider,
Elevation,
H4,
@@ -19,11 +20,14 @@ import { SceneHelpers } from "./helpers";
interface ISceneCardProps {
scene: GQL.SlimSceneDataFragment;
selected: boolean | undefined;
onSelectedChanged: (selected : boolean, shiftKey : boolean) => void;
}
export const SceneCard: FunctionComponent<ISceneCardProps> = (props: ISceneCardProps) => {
const [previewPath, setPreviewPath] = useState<string | undefined>(undefined);
const videoHoverHook = VideoHoverHook.useVideoHover({resetOnMouseLeave: false});
function maybeRenderRatingBanner() {
if (!props.scene.rating) { return; }
@@ -115,6 +119,8 @@ export const SceneCard: FunctionComponent<ISceneCardProps> = (props: ISceneCardP
setPreviewPath("");
}
var shiftKey = false;
return (
<Card
className="grid-item"
@@ -122,6 +128,12 @@ export const SceneCard: FunctionComponent<ISceneCardProps> = (props: ISceneCardP
onMouseEnter={onMouseEnter}
onMouseLeave={onMouseLeave}
>
<Checkbox
className="card-select"
checked={props.selected}
onChange={() => props.onSelectedChanged(!props.selected, shiftKey)}
onClick={(event: React.MouseEvent<HTMLInputElement, MouseEvent>) => { shiftKey = event.shiftKey; event.stopPropagation(); } }
/>
<Link to={`/scenes/${props.scene.id}`} className="image previewable">
{maybeRenderRatingBanner()}
<video className="preview" loop={true} poster={props.scene.paths.screenshot || ""} ref={videoHoverHook.videoEl}>