Titles for object list header

main
Boris Sekachev 6 years ago
parent 3ec2fc42ea
commit 251d38db5b

@ -10,6 +10,7 @@ import Text from 'antd/lib/typography/Text';
import AnnotationsFiltersInput from 'components/annotation-page/annotations-filters-input'; import AnnotationsFiltersInput from 'components/annotation-page/annotations-filters-input';
import { StatesOrdering } from 'reducers/interfaces'; import { StatesOrdering } from 'reducers/interfaces';
import { Tooltip } from 'antd';
interface StatesOrderingSelectorComponentProps { interface StatesOrderingSelectorComponentProps {
statesOrdering: StatesOrdering; statesOrdering: StatesOrdering;
@ -56,6 +57,8 @@ interface Props {
statesLocked: boolean; statesLocked: boolean;
statesCollapsed: boolean; statesCollapsed: boolean;
statesOrdering: StatesOrdering; statesOrdering: StatesOrdering;
switchLockAllShortcut: string;
switchHiddenAllShortcut: string;
changeStatesOrdering(value: StatesOrdering): void; changeStatesOrdering(value: StatesOrdering): void;
lockAllStates(): void; lockAllStates(): void;
unlockAllStates(): void; unlockAllStates(): void;
@ -71,6 +74,8 @@ function ObjectListHeader(props: Props): JSX.Element {
statesLocked, statesLocked,
statesCollapsed, statesCollapsed,
statesOrdering, statesOrdering,
switchLockAllShortcut,
switchHiddenAllShortcut,
changeStatesOrdering, changeStatesOrdering,
lockAllStates, lockAllStates,
unlockAllStates, unlockAllStates,
@ -89,19 +94,25 @@ function ObjectListHeader(props: Props): JSX.Element {
</Row> </Row>
<Row type='flex' justify='space-between' align='middle'> <Row type='flex' justify='space-between' align='middle'>
<Col span={2}> <Col span={2}>
{ statesLocked <Tooltip title={`Switch lock property for all ${switchLockAllShortcut}`}>
? <Icon type='lock' onClick={unlockAllStates} /> { statesLocked
: <Icon type='unlock' onClick={lockAllStates} />} ? <Icon type='lock' onClick={unlockAllStates} />
: <Icon type='unlock' onClick={lockAllStates} />}
</Tooltip>
</Col> </Col>
<Col span={2}> <Col span={2}>
{ statesHidden <Tooltip title={`Switch hidden property for all ${switchHiddenAllShortcut}`}>
? <Icon type='eye-invisible' onClick={showAllStates} /> { statesHidden
: <Icon type='eye' onClick={hideAllStates} />} ? <Icon type='eye-invisible' onClick={showAllStates} />
: <Icon type='eye' onClick={hideAllStates} />}
</Tooltip>
</Col> </Col>
<Col span={2}> <Col span={2}>
{ statesCollapsed <Tooltip title='Expand/collapse all'>
? <Icon type='caret-down' onClick={expandAllStates} /> { statesCollapsed
: <Icon type='caret-up' onClick={collapseAllStates} />} ? <Icon type='caret-down' onClick={expandAllStates} />
: <Icon type='caret-up' onClick={collapseAllStates} />}
</Tooltip>
</Col> </Col>
<StatesOrderingSelector <StatesOrderingSelector
statesOrdering={statesOrdering} statesOrdering={statesOrdering}

@ -8,7 +8,6 @@ import { StatesOrdering } from 'reducers/interfaces';
import ObjectItemContainer from 'containers/annotation-page/standard-workspace/objects-side-bar/object-item'; import ObjectItemContainer from 'containers/annotation-page/standard-workspace/objects-side-bar/object-item';
import ObjectListHeader from './objects-list-header'; import ObjectListHeader from './objects-list-header';
interface Props { interface Props {
listHeight: number; listHeight: number;
statesHidden: boolean; statesHidden: boolean;
@ -16,6 +15,8 @@ interface Props {
statesCollapsed: boolean; statesCollapsed: boolean;
statesOrdering: StatesOrdering; statesOrdering: StatesOrdering;
sortedStatesID: number[]; sortedStatesID: number[];
switchLockAllShortcut: string;
switchHiddenAllShortcut: string;
changeStatesOrdering(value: StatesOrdering): void; changeStatesOrdering(value: StatesOrdering): void;
lockAllStates(): void; lockAllStates(): void;
unlockAllStates(): void; unlockAllStates(): void;
@ -33,6 +34,8 @@ function ObjectListComponent(props: Props): JSX.Element {
statesCollapsed, statesCollapsed,
statesOrdering, statesOrdering,
sortedStatesID, sortedStatesID,
switchLockAllShortcut,
switchHiddenAllShortcut,
changeStatesOrdering, changeStatesOrdering,
lockAllStates, lockAllStates,
unlockAllStates, unlockAllStates,
@ -49,6 +52,8 @@ function ObjectListComponent(props: Props): JSX.Element {
statesLocked={statesLocked} statesLocked={statesLocked}
statesCollapsed={statesCollapsed} statesCollapsed={statesCollapsed}
statesOrdering={statesOrdering} statesOrdering={statesOrdering}
switchLockAllShortcut={switchLockAllShortcut}
switchHiddenAllShortcut={switchHiddenAllShortcut}
changeStatesOrdering={changeStatesOrdering} changeStatesOrdering={changeStatesOrdering}
lockAllStates={lockAllStates} lockAllStates={lockAllStates}
unlockAllStates={unlockAllStates} unlockAllStates={unlockAllStates}

@ -6,6 +6,7 @@ import React from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { GlobalHotKeys, ExtendedKeyMapOptions } from 'react-hotkeys'; import { GlobalHotKeys, ExtendedKeyMapOptions } from 'react-hotkeys';
import { formatShortcuts } from 'utils/shortcuts';
import ObjectsListComponent from 'components/annotation-page/standard-workspace/objects-side-bar/objects-list'; import ObjectsListComponent from 'components/annotation-page/standard-workspace/objects-side-bar/objects-list';
import { import {
updateAnnotationsAsync, updateAnnotationsAsync,
@ -15,7 +16,6 @@ import {
copyShape as copyShapeAction, copyShape as copyShapeAction,
propagateObject as propagateObjectAction, propagateObject as propagateObjectAction,
} from 'actions/annotation-actions'; } from 'actions/annotation-actions';
import { CombinedState, StatesOrdering, ObjectType } from 'reducers/interfaces'; import { CombinedState, StatesOrdering, ObjectType } from 'reducers/interfaces';
interface StateToProps { interface StateToProps {
@ -410,6 +410,8 @@ class ObjectsListContainer extends React.PureComponent<Props, State> {
{...this.props} {...this.props}
statesOrdering={statesOrdering} statesOrdering={statesOrdering}
sortedStatesID={sortedStatesID} sortedStatesID={sortedStatesID}
switchHiddenAllShortcut={formatShortcuts(keyMap.SWITCH_ALL_HIDDEN)}
switchLockAllShortcut={formatShortcuts(keyMap.SWITCH_ALL_LOCK)}
changeStatesOrdering={this.onChangeStatesOrdering} changeStatesOrdering={this.onChangeStatesOrdering}
lockAllStates={this.onLockAllStates} lockAllStates={this.onLockAllStates}
unlockAllStates={this.onUnlockAllStates} unlockAllStates={this.onUnlockAllStates}

Loading…
Cancel
Save