Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 6d10fe14

Přidáno uživatelem Dominik Poch před asi 2 roky(ů)

Refactored directory structure

Refactored directory structure and changed structure of layouts of the annotation screen

Zobrazit rozdíly:

webapp/components/annotation/annotationPanel.tsx
2 2
 * Creates a panel in the annotation screen that contains a list of annotations.
3 3
 * @returns Panel with a list of annotations.
4 4
 */
5
function AnnotationPanel() {
5
export function AnnotationPanel() {
6 6
    return (
7 7
        <div>
8 8
            <p>Panel with a list of annotations</p>
9 9
        </div>
10 10
    );
11 11
}
12

  
13
export default AnnotationPanel;
webapp/components/annotation/documentAnnotationView.tsx
2 2
 * Creates an annotation view of a document.
3 3
 * @returns The annotation view.
4 4
 */
5
function DocumentAnnotationView() {
5
export function DocumentAnnotationView() {
6 6
    return (
7 7
        <div>
8 8
            <p>Main view with a rendered document</p>
9 9
        </div>
10 10
    );
11 11
}
12

  
13
export default DocumentAnnotationView;
webapp/components/annotation/tagPanel.tsx
2 2
 * Creates a panel in the annotation screen that contains a list of tag.
3 3
 * @returns Panel with a list of tags.
4 4
 */
5
function TagPanel() {
5
export function TagPanel() {
6 6
    return (
7 7
        <div>
8 8
            <p>Panel with a list of tags</p>
9 9
        </div>
10 10
    );
11 11
}
12

  
13
export default TagPanel;
webapp/components/modals/addDocument.tsx
9 9
 * Creates a modal window that loads documents to the app.
10 10
 * @returns The modal window.
11 11
 */
12
function AddDocument() {
12
export function AddDocument() {
13 13
    const [visible, setVisible] = useState(true);
14 14

  
15 15
    /**
......
86 86
        </Modal>
87 87
    );
88 88
}
89

  
90
export default AddDocument;
webapp/components/models/layoutProps.tsx
1
import React from 'react';
2

  
3
/**
4
 * Props prepared for a react stucture that is passed to a layout.
5
 */
6
export type LayoutProps = {
7
    children: React.ReactNode;
8
};
webapp/components/navigation/adminNavBar.tsx
1
/**
2
 * Creates a navigation bar of an admin.
3
 * @returns Navigation bar of an admin.
4
 */
5
export function AdminNavBar() {
6
    return (
7
        <div>
8
            <p>Navigation bar of an admin.</p>
9
        </div>
10
    );
11
}
webapp/components/navigation/userNavBar.tsx
2 2
 * Creates a navigation bar of a normal user (annotator).
3 3
 * @returns Navigation bar of a user.
4 4
 */
5
function UserNavBar() {
5
export function UserNavBar() {
6 6
    return (
7 7
        <div>
8 8
            <p>Navigation bar of a normal user.</p>
9 9
        </div>
10 10
    );
11 11
}
12

  
13
export default UserNavBar;
webapp/components/types/layoutProps.tsx
1
import React from 'react';
2

  
3
/**
4
 * Props prepared for a react stucture that is passed to a layout.
5
 */
6
export type LayoutProps = {
7
    children: React.ReactNode;
8
};
webapp/layouts/annotationLayout.tsx
1
import { Layout } from 'antd';
2
import AnnotationPanel from '../components/annotation/annotationPanel';
3
import DocumentAnnotationView from '../components/annotation/documentAnnotationView';
4
import TagPanel from '../components/annotation/tagPanel';
5
import 'antd/dist/antd.css';
6
import styles from '/styles/annotation.module.scss';
7
import UserNavBar from '../components/navigation/userNavBar';
8

  
9
const { Header, Content, Footer, Sider } = Layout;
10

  
11
/**
12
 * Creates a layout of a document annotation screen. It contains a panel with a list of tags and a panel with a list of annotations.
13
 * @returns Annotation layout.
14
 */
15
function AnnotationLayout() {
16
    return (
17
        <Layout>
18
            <Header>
19
                <UserNavBar />
20
            </Header>
21
            <Layout hasSider>
22
                <Sider className={styles.leftSidePanel}>
23
                    <TagPanel />
24
                </Sider>
25
                <Content className={styles.mainView}>
26
                    <DocumentAnnotationView />
27
                </Content>
28
                <Sider className={styles.rightSidePanel}>
29
                    <AnnotationPanel />
30
                </Sider>
31
            </Layout>
32
            <Footer></Footer>
33
        </Layout>
34
    );
35
}
36

  
37
export default AnnotationLayout;
webapp/layouts/loginLayout.tsx
2 2
import Image from 'next/image';
3 3
import styles from '/styles/login.module.scss';
4 4
import { Col, Container, Row, Stack } from 'react-bootstrap';
5
import { LayoutProps } from 'antd';
5
import { LayoutProps } from '../components/models/layoutProps';
6 6

  
7 7
/**
8 8
 * Creates layout of a login screen.
webapp/layouts/mainLayout.tsx
1
import { LayoutProps } from '../components/models/layoutProps';
2
import { Layout } from 'antd';
3
import { UserNavBar } from '../components/navigation/userNavBar';
4
import { AdminNavBar } from '../components/navigation/adminNavBar';
5
import 'antd/dist/antd.css';
6

  
7
const { Header, Content, Footer } = Layout;
8

  
9
/**
10
 * Creates layout of main screens.
11
 * @param props Html structure of a login form.
12
 * @returns The login screen.
13
 */
14
export function MainLayout(props: LayoutProps) {
15
    return (
16
        <Layout>
17
            <Header>
18
                {/**
19
                 @todo: Select correct navigation bar
20
                 {user && <UserNavBar />}
21
                 {admin && <AdminNavBar />}
22
                **/}
23
            </Header>
24
            <Content>
25
                <main>{props.children}</main>
26
            </Content>
27
            <Footer></Footer>
28
        </Layout>
29
    );
30
}
webapp/pages/annotation.tsx
1
import AnnotationLayout from '../layouts/annotationLayout';
2

  
3
/**
4
 * Creates an annotation screen.
5
 * @returns The annotation screen.
6
 */
7
function Annotation() {
8
    return <AnnotationLayout />;
9
}
10

  
11
export default Annotation;
webapp/pages/annotation/index.tsx
1
import { Layout } from 'antd';
2
import { AnnotationPanel } from '../../components/annotation/annotationPanel';
3
import { DocumentAnnotationView } from '../../components/annotation/documentAnnotationView';
4
import { TagPanel } from '../../components/annotation/tagPanel';
5
import { MainLayout } from '../../layouts/mainLayout';
6
import 'antd/dist/antd.css';
7
import styles from '/styles/annotation.module.scss';
8

  
9
const { Content, Sider } = Layout;
10

  
11
/**
12
 * Creates an annotation screen.
13
 * @returns The annotation screen.
14
 */
15
function Annotation() {
16
    return (
17
        <MainLayout>
18
            <Layout hasSider>
19
                <Sider className={styles.leftSidePanel}>
20
                    <TagPanel />
21
                </Sider>
22
                <Content className={styles.mainView}>
23
                    <DocumentAnnotationView />
24
                </Content>
25
                <Sider className={styles.rightSidePanel}>
26
                    <AnnotationPanel />
27
                </Sider>
28
            </Layout>
29
        </MainLayout>
30
    );
31
}
32

  
33
export default Annotation;

Také k dispozici: Unified diff