UI: Add checkbox to scenes List view (#1642)

This commit is contained in:
EnameEtavir
2021-08-18 04:56:52 +02:00
committed by GitHub
parent 680af72dcf
commit 9803684535
3 changed files with 34 additions and 2 deletions

View File

@@ -9,6 +9,7 @@
* Added not equals/greater than/less than modifiers for resolution criteria. ([#1568](https://github.com/stashapp/stash/pull/1568)) * Added not equals/greater than/less than modifiers for resolution criteria. ([#1568](https://github.com/stashapp/stash/pull/1568))
### 🎨 Improvements ### 🎨 Improvements
* Added checkboxes to scene list view. ([#1642](https://github.com/stashapp/stash/pull/1642))
* Added keyboard shortcuts for scene queue navigation. ([#1635](https://github.com/stashapp/stash/pull/1635)) * Added keyboard shortcuts for scene queue navigation. ([#1635](https://github.com/stashapp/stash/pull/1635))
* Made performer scrape menu scrollable. ([#1634](https://github.com/stashapp/stash/pull/1634)) * Made performer scrape menu scrollable. ([#1634](https://github.com/stashapp/stash/pull/1634))
* Improve Studio UI. ([#1629](https://github.com/stashapp/stash/pull/1629)) * Improve Studio UI. ([#1629](https://github.com/stashapp/stash/pull/1629))

View File

@@ -217,7 +217,14 @@ export const SceneList: React.FC<ISceneList> = ({
} }
if (filter.displayMode === DisplayMode.List) { if (filter.displayMode === DisplayMode.List) {
return ( return (
<SceneListTable scenes={result.data.findScenes.scenes} queue={queue} /> <SceneListTable
scenes={result.data.findScenes.scenes}
queue={queue}
selectedIds={selectedIds}
onSelectChange={(id, selected, shiftKey) =>
listData.onSelectChange(id, selected, shiftKey)
}
/>
); );
} }
if (filter.displayMode === DisplayMode.Wall) { if (filter.displayMode === DisplayMode.Wall) {

View File

@@ -1,7 +1,7 @@
// @ts-nocheck // @ts-nocheck
/* eslint-disable jsx-a11y/control-has-associated-label */ /* eslint-disable jsx-a11y/control-has-associated-label */
import React from "react"; import React from "react";
import { Table, Button } from "react-bootstrap"; import { Table, Button, Form } from "react-bootstrap";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import * as GQL from "src/core/generated-graphql"; import * as GQL from "src/core/generated-graphql";
import { NavUtils, TextUtils } from "src/utils"; import { NavUtils, TextUtils } from "src/utils";
@@ -11,6 +11,8 @@ import { FormattedMessage } from "react-intl";
interface ISceneListTableProps { interface ISceneListTableProps {
scenes: GQL.SlimSceneDataFragment[]; scenes: GQL.SlimSceneDataFragment[];
queue?: SceneQueue; queue?: SceneQueue;
selectedIds: Set<string>;
onSelectChange: (id: string, selected: boolean, shiftKey: boolean) => void;
} }
export const SceneListTable: React.FC<ISceneListTableProps> = ( export const SceneListTable: React.FC<ISceneListTableProps> = (
@@ -44,8 +46,29 @@ export const SceneListTable: React.FC<ISceneListTableProps> = (
? props.queue.makeLink(scene.id, { sceneIndex: index }) ? props.queue.makeLink(scene.id, { sceneIndex: index })
: `/scenes/${scene.id}`; : `/scenes/${scene.id}`;
let shiftKey = false;
return ( return (
<tr key={scene.id}> <tr key={scene.id}>
<td>
<Form.Control
type="checkbox"
checked={props.selectedIds.has(scene.id)}
onChange={() =>
props.onSelectChange!(
scene.id,
!props.selectedIds.has(scene.id),
shiftKey
)
}
onClick={(
event: React.MouseEvent<HTMLInputElement, MouseEvent>
) => {
// eslint-disable-next-line prefer-destructuring
shiftKey = event.shiftKey;
event.stopPropagation();
}}
/>
</td>
<td> <td>
<Link to={sceneLink}> <Link to={sceneLink}>
<img <img
@@ -97,6 +120,7 @@ export const SceneListTable: React.FC<ISceneListTableProps> = (
<Table striped bordered> <Table striped bordered>
<thead> <thead>
<tr> <tr>
<th />
<th /> <th />
<th className="text-left"> <th className="text-left">
<FormattedMessage id="title" /> <FormattedMessage id="title" />