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() { function renderMore() {
const options = [renderSelectAll(), renderSelectNone()]; const options = [renderSelectAll(), renderSelectNone()].filter((o) => o);
if (props.otherOperations) { if (props.otherOperations) {
props.otherOperations props.otherOperations

View File

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

View File

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

View File

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

View File

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

View File

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