Skip to content

Commit

Permalink
Applied comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Boris Sekachev committed Apr 7, 2021
1 parent 65f0760 commit 1d54500
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function LabelItemComponent(props: Props): JSX.Element {
{' '}
</div>
</Col>
<Col span={11}>
<Col span={12}>
<CVATTooltip title={labelName}>
<Text strong className='cvat-text'>
{labelName}
Expand All @@ -92,7 +92,7 @@ function LabelItemComponent(props: Props): JSX.Element {
</Button>
</LabelKeySelectorPopover>
</Col>
<Col span={3} offset={1}>
<Col span={2} offset={1}>
{statesLocked ? (
<LockFilled {...classes.lock.enabled} onClick={unlockStates} />
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ function LabelsListComponent(): JSX.Element {
const labelIDs = labels.map((label: any): number => label.id);

const [keyToLabelMapping, setKeyToLabelMapping] = useState<Record<string, number>>(
Object.fromEntries(
labelIDs.slice(0, 10).map((labelID: number, idx: number) => [idx + 1 > 9 ? 0 : idx + 1, labelID]),
),
Object.fromEntries(labelIDs.slice(0, 10).map((labelID: number, idx: number) => [(idx + 1) % 10, labelID])),
);

const updateLabelShortcutKey = useCallback(
Expand All @@ -48,7 +46,7 @@ function LabelsListComponent(): JSX.Element {
if (key in keyToLabelMappingCopy) {
// try to find a new key for the other label
for (let i = 0; i < 10; i++) {
const adjustedI = i + 1 > 9 ? 0 : i + 1;
const adjustedI = (i + 1) % 10;
if (!(adjustedI in keyToLabelMappingCopy)) {
keyToLabelMappingCopy[adjustedI] = keyToLabelMappingCopy[key];
break;
Expand Down

0 comments on commit 1d54500

Please sign in to comment.