// Copyright (C) 2020 Intel Corporation
//
// SPDX-License-Identifier: MIT
import './styles.scss';
import React, { useEffect } from 'react';
import {
Layout,
Spin,
Result,
} from 'antd';
import { Workspace } from 'reducers/interfaces';
import AnnotationTopBarContainer from 'containers/annotation-page/top-bar/top-bar';
import StatisticsModalContainer from 'containers/annotation-page/top-bar/statistics-modal';
import StandardWorkspaceComponent from './standard-workspace/standard-workspace';
import AttributeAnnotationWorkspace from './attribute-annotation-workspace/attribute-annotation-workspace';
interface Props {
job: any | null | undefined;
fetching: boolean;
getJob(): void;
saveLogs(): void;
workspace: Workspace;
}
export default function AnnotationPageComponent(props: Props): JSX.Element {
const {
job,
fetching,
getJob,
saveLogs,
workspace,
} = props;
useEffect(() => {
saveLogs();
const root = window.document.getElementById('root');
if (root) {
root.style.minHeight = '768px';
}
return () => {
saveLogs();
if (root) {
root.style.minHeight = '';
}
};
}, []);
if (job === null) {
if (!fetching) {
getJob();
}
return ;
}
if (typeof (job) === 'undefined') {
return (
);
}
return (
{ workspace === Workspace.STANDARD ? (
) : (
)}
);
}