Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
bsekachev committed Feb 9, 2024
1 parent ac3d77e commit 5f49a7c
Show file tree
Hide file tree
Showing 37 changed files with 75 additions and 75 deletions.
2 changes: 1 addition & 1 deletion cvat-core/src/annotations-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ async function runSingleFrameChain(
// Ignore deleted frames
if (!frameData.deleted) {
// Get annotations according to filter
const states: ObjectState[] = await getAnnotations(instance, frame, false, filters, null);
const states: ObjectState[] = await getAnnotations(instance, frame, false, filters);
const frameCollectionIDs = states.reduce<IDsToHandle>((acc, val) => {
if (val.objectType === ObjectType.SHAPE) {
acc.shapes.push(val.clientID as number);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1121,7 +1121,7 @@ class CanvasWrapperComponent extends React.PureComponent<Props> {
<Dropdown
destroyPopupOnHide
trigger={['click']}
placement='topCenter'
placement='top'
overlay={<ImageSetupsContent />}
>
<UpOutlined className='cvat-canvas-image-setups-trigger' />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default function ConflictLabel(props: Props): ReactPortal {
return ReactDOM.createPortal(
<CVATTooltip
title={text}
visible={tooltipVisible}
open={tooltipVisible}
>
<Tag
style={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { Row, Col } from 'antd/lib/grid';
import { CloseOutlined } from '@ant-design/icons';
import { Comment } from '@ant-design/compatible';
import Text from 'antd/lib/typography/Text';
import Title from 'antd/lib/typography/Title';
import Button from 'antd/lib/button';
import Input from 'antd/lib/input';
import moment from 'moment';
Expand Down Expand Up @@ -137,7 +136,7 @@ export default function IssueDialog(props: Props): JSX.Element {
>
<Row className='cvat-issue-dialog-header' justify='space-between'>
<Col>
<Title level={4}>{typeof id === 'number' ? `Issue #${id}` : 'Issue'}</Title>
<Text strong>{typeof id === 'number' ? `Issue ID ${id}` : 'Issue'}</Text>
</Col>
<Col>
<CVATTooltip title='Collapse the chat'>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ export function ExtraControlsControl(): JSX.Element {

return (
<CustomPopover
visible={visible}
onVisibleChange={setVisible}
open={visible}
onOpenChange={setVisible}
trigger={initialized ? 'hover' : 'click'} // trigger='hover' allows to close the popover by body click
placement='right'
overlayStyle={{ display: initialized ? '' : 'none' }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default function withVisibilityHandling(WrappedComponent: typeof Popover,
}}
trigger={['click']}
overlayClassName={overlayClassNames.join(' ').trim()}
onVisibleChange={(_visible: boolean) => {
onOpenChange={(_visible: boolean) => {
if (_visible) {
const [element] = window.document.getElementsByClassName(popoverClassName);
if (element) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,7 @@ class OpenCVControlComponent extends React.PureComponent<Props & DispatchToProps
placement='right'
overlayClassName='cvat-opencv-control-popover'
content={this.renderContent()}
onVisibleChange={(visible: boolean) => {
onOpenChange={(visible: boolean) => {
const { initializationProgress } = this.state;
if (!visible || initializationProgress >= 0) return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function LabelKeySelectorPopover(props: LabelKeySelectorPopoverProps): JSX.Eleme

return (
<Popover
destroyTooltipOnHide={{ keepParent: false }}
destroyTooltipOnHide
trigger='click'
content={(
<MemoizedContent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function PropagateConfirmComponent(): JSX.Element {
}}
onCancel={() => dispatch(switchPropagateVisibility(false))}
title='Confirm propagation'
visible={visible}
open={visible}
destroyOnClose
okButtonProps={{ disabled: !propagateFrames }}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export default function RemoveConfirmComponent(): JSX.Element | null {
okText='Yes'
cancelText='Cancel'
title={title}
visible={visible}
open={visible}
cancelButtonProps={{
autoFocus: true,
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@
padding: $grid-unit-size;
border-radius: $grid-unit-size;
background: $background-color-2;
width: 34 * $grid-unit-size;
width: 32 * $grid-unit-size;

> div {
margin-top: $grid-unit-size;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// SPDX-License-Identifier: MIT

import React from 'react';
import ReactDOM from 'react-dom';
import { createRoot } from 'react-dom/client';
import { withRouter, RouteComponentProps } from 'react-router';

import Modal from 'antd/lib/modal';
Expand All @@ -18,7 +18,6 @@ import Menu, { MenuInfo } from 'components/dropdown-menu';

import { getCore, JobStage } from 'cvat-core-wrapper';
import AnnotationsActionsModalContent from '../annotations-actions/annotations-actions-modal';
import { createRoot } from 'react-dom/client';

const core = getCore();

Expand Down Expand Up @@ -201,7 +200,7 @@ function AnnotationMenuComponent(props: Props & RouteComponentProps): JSX.Elemen
<Menu.Item
key={Actions.RUN_ACTIONS}
onClick={() => {
const div = window.document.createElement('div')
const div = window.document.createElement('div');
window.document.body.append(div);
const root = createRoot(div);
root.render(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ function FiltersModalComponent(): JSX.Element {
return (
<Modal
className={visible ? 'cvat-filters-modal cvat-filters-modal-visible' : 'cvat-filters-modal'}
visible={visible}
open={visible}
closable={false}
width={800}
destroyOnClose
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function LeftGroup(props: Props): JSX.Element {

return (
<>
<Modal className='cvat-saving-job-modal' title='Saving changes on the server' visible={saving} footer={[]} closable={false}>
<Modal className='cvat-saving-job-modal' title='Saving changes on the server' open={saving} footer={[]} closable={false}>
<Text>CVAT is saving your annotations, please wait </Text>
<LoadingOutlined />
</Modal>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import React, { useState, useEffect, useCallback } from 'react';

import copy from 'copy-to-clipboard';
import { Row, Col } from 'antd/lib/grid';
import Icon, { LinkOutlined, DeleteOutlined } from '@ant-design/icons';
import Slider from 'antd/lib/slider';
Expand Down Expand Up @@ -128,8 +129,8 @@ function PlayerNavigation(props: Props): JSX.Element {
</Row>
<Row justify='center'>
<Col className='cvat-player-filename-wrapper'>
<CVATTooltip title={frameFilename}>
<Text type='secondary'>{frameFilename}</Text>
<CVATTooltip title={`${frameFilename} (click to copy)`}>
<Text onClick={() => copy(frameFilename)} type='secondary'>{frameFilename}</Text>
</CVATTooltip>
</Col>
<Col offset={1}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function ChangePasswordComponent(props: ChangePasswordPageComponentProps): JSX.E
okType='primary'
okText='Submit'
footer={null}
visible={visible}
open={visible}
destroyOnClose
onCancel={onClose}
>
Expand Down
2 changes: 1 addition & 1 deletion cvat-ui/src/components/cloud-storages-page/top-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default function StoragesTopBar(props: Props): JSX.Element {
/>
<div>
<SortingComponent
visible={visibility.sorting}
open={visibility.sorting}
onVisibleChange={(visible: boolean) => (
setVisibility({ ...defaultVisibility, sorting: visible })
)}
Expand Down
2 changes: 1 addition & 1 deletion cvat-ui/src/components/common/cvat-tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function CVATTooltip(props: TooltipProps): JSX.Element {
const { children, ...rest } = props;

return (
<Tooltip destroyTooltipOnHide={{ keepParent: false }} mouseLeaveDelay={0} {...rest}>
<Tooltip destroyTooltipOnHide mouseLeaveDelay={0} {...rest}>
{children}
</Tooltip>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ function ExportBackupModal(): JSX.Element {
return (
<Modal
title={<Text strong>{`Export ${instanceType}`}</Text>}
visible={!!instance}
open={!!instance}
onCancel={closeModal}
onOk={() => form.submit()}
className={`cvat-modal-export-${instanceType.split(' ')[0]}`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ function ExportDatasetModal(props: StateToProps): JSX.Element {
return (
<Modal
title={<Text strong>{`Export ${instanceType} as a dataset`}</Text>}
visible={!!instance}
open={!!instance}
onCancel={closeModal}
onOk={() => form.submit()}
className={`cvat-modal-export-${instanceType.split(' ')[0]}`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function SettingsModal(props: SettingsModalProps): JSX.Element {
return (
<Modal
title='Settings'
visible={visible}
open={visible}
onCancel={onClose}
width={800}
className='cvat-settings-modal'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ function ImportBackupModal(): JSX.Element {
{`Create ${instanceType} from backup`}
</Text>
)}
visible={modalVisible}
open={modalVisible}
onCancel={closeModal}
onOk={() => form.submit()}
className='cvat-modal-import-backup'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ function ImportDatasetModal(props: StateToProps): JSX.Element {
}
</>
)}
visible={!!instance}
open={!!instance}
onCancel={closeModal}
onOk={() => form.submit()}
className='cvat-modal-import-dataset'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function ImportDatasetStatusModal(): JSX.Element {
return (
<Modal
title={`Importing a dataset for the project #${importingId}`}
visible={importing}
open={importing}
closable={false}
footer={null}
className='cvat-modal-import-dataset-status'
Expand Down
1 change: 1 addition & 0 deletions cvat-ui/src/components/jobs-page/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
border-color: #f5f5f5;
margin-left: $grid-unit-size;
margin-top: $grid-unit-size;
transition: all 2s;

.ant-card-cover {
flex: 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function ModelRunnerDialog(props: StateToProps & DispatchToProps): JSX.Element {
return (
<Modal
destroyOnClose
visible={visible}
open={visible}
footer={[]}
onCancel={(): void => closeDialog()}
maskClosable
Expand Down
2 changes: 1 addition & 1 deletion cvat-ui/src/components/models-page/deployed-model-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export default function DeployedModelItem(props: Props): JSX.Element {
<Modal
className='cvat-model-info-modal'
title='Model'
visible={isModalShown}
open={isModalShown}
onCancel={onCloseModel}
footer={null}
>
Expand Down
2 changes: 1 addition & 1 deletion cvat-ui/src/components/move-task-modal/move-task-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ function MoveTaskModal({

return (
<Modal
visible={visible}
open={visible}
onCancel={onCancel}
onOk={submitMove}
okButtonProps={{ disabled: isUpdating }}
Expand Down
2 changes: 1 addition & 1 deletion cvat-ui/src/components/organization-page/top-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ function OrganizationTopBar(props: Props): JSX.Element {
</Row>
<Modal
className='cvat-organization-invitation-modal'
visible={visibleInviteModal}
open={visibleInviteModal}
onCancel={() => {
setVisibleInviteModal(false);
form.resetFields(['users']);
Expand Down
60 changes: 30 additions & 30 deletions cvat-ui/src/components/project-page/project-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -288,37 +288,37 @@ export default function ProjectPageComponent(): JSX.Element {
}}
/>
</div>
<Dropdown
trigger={['click']}
destroyPopupOnHide
overlay={(
<CvatDropdownMenuPaper>
<Button
type='primary'
icon={<PlusOutlined />}
className='cvat-create-task-button'
onClick={() => history.push(`/tasks/create?projectId=${id}`)}
>
Create a new task
</Button>
<Button
type='primary'
icon={<span className='anticon'><MultiPlusIcon /></span>}
className='cvat-create-multi-tasks-button'
onClick={() => history.push(`/tasks/create?projectId=${id}&many=true`)}
>
Create multi tasks
</Button>
</CvatDropdownMenuPaper>
)}
>
<Button
type='primary'
className='cvat-create-task-dropdown'
icon={<PlusOutlined />}
/>
</Dropdown>
</div>
<Dropdown
trigger={['click']}
destroyPopupOnHide
overlay={(
<CvatDropdownMenuPaper>
<Button
type='primary'
icon={<PlusOutlined />}
className='cvat-create-task-button'
onClick={() => history.push(`/tasks/create?projectId=${id}`)}
>
Create a new task
</Button>
<Button
type='primary'
icon={<span className='anticon'><MultiPlusIcon /></span>}
className='cvat-create-multi-tasks-button'
onClick={() => history.push(`/tasks/create?projectId=${id}&many=true`)}
>
Create multi tasks
</Button>
</CvatDropdownMenuPaper>
)}
>
<Button
type='primary'
className='cvat-create-task-dropdown'
icon={<PlusOutlined />}
/>
</Dropdown>
</Col>
</Row>
{ tasksFetching ? (
Expand Down
7 changes: 4 additions & 3 deletions cvat-ui/src/components/project-page/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//
// SPDX-License-Identifier: MIT

@import '../../base.scss';
@import '../../base';

.cvat-project-page {
overflow-y: auto;
Expand All @@ -29,12 +29,13 @@
}

display: flex;
margin-right: $grid-unit-size * 4;
}

.cvat-project-page-tasks-search-bar {
width: $grid-unit-size * 32;
}

margin-right: $grid-unit-size * 4;
}
}
}
Expand Down Expand Up @@ -65,7 +66,7 @@
}

.ant-menu.cvat-project-actions-menu {
box-shadow: 0 0 17px rgba(0, 0, 0, 0.2);
box-shadow: 0 0 17px rgba(0, 0, 0, 20%);

> li:hover {
background-color: $hover-menu-color;
Expand Down
Loading

0 comments on commit 5f49a7c

Please sign in to comment.