UI improvements (#726)

* Use rating stars in movie
* Make multiset button more obvious
* Hide select all/none buttons where not selectable
* Make add the default multi-set mode
This commit is contained in:
WithoutPants
2020-08-14 09:41:01 +10:00
committed by GitHub
parent a39666467e
commit 44c32a91d3
6 changed files with 19 additions and 14 deletions

View File

@@ -361,7 +361,7 @@ export const ListFilter: React.FC<IListFilterProps> = (
}
function renderMore() {
const options = [renderSelectAll(), renderSelectNone()];
const options = [renderSelectAll(), renderSelectNone()].filter((o) => o);
if (props.otherOperations) {
props.otherOperations

View File

@@ -27,6 +27,7 @@ import {
TextUtils,
DurationUtils,
} from "src/utils";
import { RatingStars } from "src/components/Scenes/SceneDetails/RatingStars";
import { MovieScenesPanel } from "./MovieScenesPanel";
import { MovieScrapeDialog } from "./MovieScrapeDialog";
@@ -517,14 +518,16 @@ export const Movie: React.FC = () => {
isEditing,
onChange: setDirector,
})}
{TableUtils.renderHtmlSelect({
title: "Rating",
value: rating ?? "",
isEditing,
onChange: (value: string) =>
setRating(Number.parseInt(value, 10)),
selectOptions: ["", "1", "2", "3", "4", "5"],
})}
<tr>
<td>Rating</td>
<td>
<RatingStars
value={rating}
disabled={!isEditing}
onSetRating={(value) => setRating(value)}
/>
</td>
</tr>
</tbody>
</Table>

View File

@@ -22,10 +22,10 @@ export const EditScenesDialog: React.FC<IListOperationProps> = (
const [studioId, setStudioId] = useState<string>();
const [performerMode, setPerformerMode] = React.useState<
GQL.BulkUpdateIdMode
>(GQL.BulkUpdateIdMode.Set);
>(GQL.BulkUpdateIdMode.Add);
const [performerIds, setPerformerIds] = useState<string[]>();
const [tagMode, setTagMode] = React.useState<GQL.BulkUpdateIdMode>(
GQL.BulkUpdateIdMode.Set
GQL.BulkUpdateIdMode.Add
);
const [tagIds, setTagIds] = useState<string[]>();

View File

@@ -56,6 +56,7 @@ export const SceneList: React.FC<ISceneList> = ({
const listData = useScenesList({
zoomable: true,
selectable: true,
otherOperations,
renderContent,
renderEditDialog: renderEditScenesDialog,

View File

@@ -64,7 +64,7 @@ const MultiSet: React.FunctionComponent<IMultiSetProps> = (
<InputGroup.Prepend>
<Button
size="sm"
variant="secondary"
variant="primary"
onClick={() => props.onSetMode(nextMode())}
title={getModeText()}
disabled={props.disabled}

View File

@@ -62,6 +62,7 @@ interface IListHookOptions<T, E> {
subComponent?: boolean;
filterHook?: (filter: ListFilterModel) => ListFilterModel;
zoomable?: boolean;
selectable?: boolean;
defaultZoomIndex?: number;
otherOperations?: IListHookOperation<T>[];
renderContent: (
@@ -426,8 +427,8 @@ const useList = <QueryResult extends IQueryResult, QueryData extends IDataItem>(
<ListFilter
subComponent={options.subComponent}
onFilterUpdate={updateQueryParams}
onSelectAll={onSelectAll}
onSelectNone={onSelectNone}
onSelectAll={options.selectable ? onSelectAll : undefined}
onSelectNone={options.selectable ? onSelectNone : undefined}
zoomIndex={options.zoomable ? zoomIndex : undefined}
onChangeZoom={options.zoomable ? onChangeZoom : undefined}
otherOperations={otherOperations}