1
|
import { AnnotationPanel } from '../../components/annotation/AnnotationPanel';
|
2
|
import { DocumentAnnotationView } from '../../components/annotation/DocumentAnnotationView';
|
3
|
import { TagPanel } from '../../components/annotation/TagPanel';
|
4
|
import { MainLayout } from '../../layouts/MainLayout';
|
5
|
import 'antd/dist/antd.css';
|
6
|
import styles from '/styles/Annotation.module.scss';
|
7
|
import AnnotationProvider from '../../contexts/AnnotationContext';
|
8
|
import TagCategoryProvider from '../../contexts/TagCategoryContext';
|
9
|
|
10
|
import { useRouter } from 'next/router';
|
11
|
|
12
|
/**
|
13
|
* Creates an annotation screen.
|
14
|
* @returns The annotation screen.
|
15
|
*/
|
16
|
function Annotation() {
|
17
|
const router = useRouter();
|
18
|
const { id, final } = router.query;
|
19
|
|
20
|
console.log(id, final);
|
21
|
|
22
|
if (!id || typeof id !== 'string' || typeof final !== 'string') {
|
23
|
/*(async () => {
|
24
|
await router.push('/documents');
|
25
|
})(); // TODO*/
|
26
|
|
27
|
return <p>Načítání...</p>;
|
28
|
}
|
29
|
|
30
|
console.log('ok');
|
31
|
|
32
|
const annotationId: string = Array.isArray(id) ? id[0] : id;
|
33
|
const isFinal: boolean = final === 'true';
|
34
|
|
35
|
return (
|
36
|
<AnnotationProvider annotationId={annotationId} isFinal={isFinal}>
|
37
|
<TagCategoryProvider>
|
38
|
<MainLayout>
|
39
|
<div className={styles.layoutWrapper}>
|
40
|
<div className={styles.tags}>
|
41
|
<TagPanel />
|
42
|
</div>
|
43
|
<div className={styles.document}>
|
44
|
<DocumentAnnotationView />
|
45
|
</div>
|
46
|
<div className={styles.annotations}>
|
47
|
<AnnotationPanel />
|
48
|
</div>
|
49
|
</div>
|
50
|
</MainLayout>
|
51
|
</TagCategoryProvider>
|
52
|
</AnnotationProvider>
|
53
|
);
|
54
|
}
|
55
|
|
56
|
export default Annotation;
|