Projekt

Obecné

Profil

Stáhnout (1.91 KB) Statistiky
| Větev: | Tag: | Revize:
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
import AnnotationLayout from '../../layouts/AnnotationLayout';
12

    
13
/**
14
 * Creates an annotation screen.
15
 * @returns The annotation screen.
16
 */
17
function Annotation() {
18
    const router = useRouter();
19
    const { id, final } = router.query;
20

    
21
    console.log(id, final);
22

    
23
    if (!id || typeof id !== 'string' || typeof final !== 'string') {
24
        /*(async () => {
25
            await router.push('/documents');
26
        })(); // TODO*/
27

    
28
        return <p>Načítání...</p>;
29
    }
30

    
31
    console.log('ok');
32

    
33
    const annotationId: string = Array.isArray(id) ? id[0] : id;
34
    const isFinal: boolean = final === 'true';
35

    
36
    return (
37
        <AnnotationProvider annotationId={annotationId} isFinal={isFinal}>
38
            <TagCategoryProvider>
39
                <AnnotationLayout>
40
                    <div className={styles.layoutWrapper}>
41
                        <div className={styles.tags}>
42
                            <TagPanel />
43
                        </div>
44
                        <div className={styles.document}>
45
                            <DocumentAnnotationView />
46
                        </div>
47
                        <div className={styles.annotations}>
48
                            <AnnotationPanel />
49
                        </div>
50
                    </div>
51
                </AnnotationLayout>
52
            </TagCategoryProvider>
53
        </AnnotationProvider>
54
    );
55
}
56

    
57
export default Annotation;
    (1-1/1)