Projekt

Obecné

Profil

Stáhnout (1.84 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 6d10fe14 Dominik Poch
12
/**
13
 * Creates an annotation screen.
14
 * @returns The annotation screen.
15
 */
16
function Annotation() {
17 7595035c Lukáš Vlček
    const router = useRouter();
18 048b4bc0 Lukáš Vlček
    const { id, final } = router.query;
19 7595035c Lukáš Vlček
20 048b4bc0 Lukáš Vlček
    console.log(id, final);
21
22
    if (!id || typeof id !== 'string' || typeof final !== 'string') {
23 7652cf88 Lukáš Vlček
        /*(async () => {
24 7595035c Lukáš Vlček
            await router.push('/documents');
25 7652cf88 Lukáš Vlček
        })(); // TODO*/
26
27
        return <p>Načítání...</p>;
28 7595035c Lukáš Vlček
    }
29
30 048b4bc0 Lukáš Vlček
    console.log('ok');
31
32 7652cf88 Lukáš Vlček
    const annotationId: string = Array.isArray(id) ? id[0] : id;
33 048b4bc0 Lukáš Vlček
    const isFinal: boolean = final === 'true';
34 7595035c Lukáš Vlček
35 6d10fe14 Dominik Poch
    return (
36 048b4bc0 Lukáš Vlček
        <AnnotationProvider annotationId={annotationId} isFinal={isFinal}>
37 4bc99591 Lukáš Vlček
            <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 c057279b Lukáš Vlček
                    </div>
50 4bc99591 Lukáš Vlček
                </MainLayout>
51
            </TagCategoryProvider>
52 c057279b Lukáš Vlček
        </AnnotationProvider>
53 6d10fe14 Dominik Poch
    );
54
}
55
56
export default Annotation;