Projekt

Obecné

Profil

Stáhnout (1.91 KB) Statistiky
| Větev: | Tag: | Revize:
1 c73aecde Dominik Poch
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 6d10fe14 Dominik Poch
import 'antd/dist/antd.css';
6 c73aecde Dominik Poch
import styles from '/styles/Annotation.module.scss';
7 acb8a961 Dominik Poch
import AnnotationProvider from '../../contexts/AnnotationContext';
8 4bc99591 Lukáš Vlček
import TagCategoryProvider from '../../contexts/TagCategoryContext';
9
10 7595035c Lukáš Vlček
import { useRouter } from 'next/router';
11 6a250c18 Lukáš Vlček
import AnnotationLayout from '../../layouts/AnnotationLayout';
12 6d10fe14 Dominik Poch
13
/**
14
 * Creates an annotation screen.
15
 * @returns The annotation screen.
16
 */
17
function Annotation() {
18 7595035c Lukáš Vlček
    const router = useRouter();
19 048b4bc0 Lukáš Vlček
    const { id, final } = router.query;
20 7595035c Lukáš Vlček
21 048b4bc0 Lukáš Vlček
    console.log(id, final);
22
23
    if (!id || typeof id !== 'string' || typeof final !== 'string') {
24 7652cf88 Lukáš Vlček
        /*(async () => {
25 7595035c Lukáš Vlček
            await router.push('/documents');
26 7652cf88 Lukáš Vlček
        })(); // TODO*/
27
28
        return <p>Načítání...</p>;
29 7595035c Lukáš Vlček
    }
30
31 048b4bc0 Lukáš Vlček
    console.log('ok');
32
33 7652cf88 Lukáš Vlček
    const annotationId: string = Array.isArray(id) ? id[0] : id;
34 048b4bc0 Lukáš Vlček
    const isFinal: boolean = final === 'true';
35 7595035c Lukáš Vlček
36 6d10fe14 Dominik Poch
    return (
37 048b4bc0 Lukáš Vlček
        <AnnotationProvider annotationId={annotationId} isFinal={isFinal}>
38 4bc99591 Lukáš Vlček
            <TagCategoryProvider>
39 6a250c18 Lukáš Vlček
                <AnnotationLayout>
40 4bc99591 Lukáš Vlček
                    <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 c057279b Lukáš Vlček
                    </div>
51 6a250c18 Lukáš Vlček
                </AnnotationLayout>
52 4bc99591 Lukáš Vlček
            </TagCategoryProvider>
53 c057279b Lukáš Vlček
        </AnnotationProvider>
54 6d10fe14 Dominik Poch
    );
55
}
56
57
export default Annotation;