Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add plugins support to the top bar of annotation page #6212

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion cvat-ui/src/components/annotation-page/top-bar/top-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import React from 'react';
import Input from 'antd/lib/input';
import { Col, Row } from 'antd/lib/grid';

import { ActiveControl, ToolsBlockerState, Workspace } from 'reducers';
import {
ActiveControl, ToolsBlockerState, Workspace, CombinedState,
} from 'reducers';
import { usePlugins } from 'utils/hooks';
import LeftGroup from './left-group';
import PlayerButtons from './player-buttons';
import PlayerNavigation from './player-navigation';
Expand Down Expand Up @@ -68,6 +71,7 @@ interface Props {
}

export default function AnnotationTopBarComponent(props: Props): JSX.Element {
const plugins = usePlugins((state: CombinedState) => state.plugins.components.annotationPage.header.player, props);
const {
saving,
undoAction,
Expand Down Expand Up @@ -182,6 +186,14 @@ export default function AnnotationTopBarComponent(props: Props): JSX.Element {
/>
</Row>
</Col>
<Col className='cvat-annotation-header-plugins'>
{
plugins.map(({ component: Component }, index) => (
<Component targetProps={props} key={index} />
))
}
</Col>

<RightGroup
workspace={workspace}
jobInstance={jobInstance}
Expand Down
5 changes: 5 additions & 0 deletions cvat-ui/src/reducers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,11 @@ export interface PluginsState {
};
router: PluginComponent[];
loggedInModals: PluginComponent[];
annotationPage: {
header: {
player: PluginComponent[],
};
};
}
}

Expand Down
5 changes: 5 additions & 0 deletions cvat-ui/src/reducers/plugins-reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ const defaultState: PluginsState = {
},
router: [],
loggedInModals: [],
annotationPage: {
header: {
player: [],
},
},
},
};

Expand Down