File size: 3,385 Bytes
6739f59
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
from datetime import datetime
import dash
from dash import dcc, html
import dash_bootstrap_components as dbc


class Layout:
    def __init__(self):
        pass

    def build_menu(self):
        navbar = dbc.Navbar(
            dbc.Container(
                [
                    html.A(
                        # Use row and col to control vertical alignment of logo / brand
                        dbc.Row(
                            [
                                dbc.Col(html.Img("logo.svg")),
                            ],
                            align="center",
                            className="g-0",
                        ),
                        href="https://humanitics.ai",
                        style={"textDecoration": "none"},
                    ),
                    dbc.NavbarToggler(id="navbar-toggler", n_clicks=0),
                    dbc.Collapse(
                        html.Div(
                            id="navbar-menu",
                        ),
                        id="navbar-collapse",
                        is_open=False,
                        navbar=True,
                    ),
                ]
            )
        )
        return navbar

    def build_footer(self):
        footer_container = html.Div(
            [
                html.Div(
                    [
                        f"© {datetime.now().year} Made with ❤️ by ",
                        html.A(
                            "Humanitics",
                            href="https://humanitics.ai",
                            target="_blank",
                            className="fw-semibold",
                        ),
                    ],
                    className="",
                ),
                html.Div(
                    html.A(
                        "Terms & Conditions",
                        href="https://humanitics.ai/terms",
                        target="_blank",
                        className="footer-link me-4",
                    ),
                    className="",
                ),
            ],
            className="footer-container d-flex align-items-center justify-content-between py-2 flex-md-row flex-column",
        )
        footer = html.Footer(
            html.Div(footer_container, className="container-xxl"),
            className="content-footer footer bg-footer-theme",
            id="loaded",
        )
        return footer

    def render(self):
        content = html.Div(
            dash.page_container,
            className="container-xxl flex-grow-1 container-p-y",
            id="content",
        )
        content_backdrop = html.Div(className="content-backdrop fade")
        content_wrapper = html.Div(
            [
                html.Div(id="navbar-menu"),
                content,
                self.build_footer(),
                content_backdrop,
            ],
            className="content-wrapper",
        )
        layout_page = html.Div(
            content_wrapper,
            className="layout-page",
        )

        layout_container = html.Div(
            [layout_page, dcc.Location(id="url")],
            className="layout-container",
        )
        layout = html.Div(
            layout_container,
            className="layout-wrapper layout-navbar-full layout-horizontal layout-without-menu",
        )
        return layout