2023-06-17 16:44:51 +00:00
|
|
|
from pathlib import Path
|
|
|
|
from typing import List
|
|
|
|
from shiny import App, ui, Inputs, Outputs, Session
|
|
|
|
from shiny.types import NavSetArg
|
2023-06-27 21:28:09 +00:00
|
|
|
from src import mod_welcome, mod_searchable
|
2023-06-21 16:56:22 +00:00
|
|
|
from src.util import load_html_str_from_file
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
|
|
footer_html: str = load_html_str_from_file(os.path.join("www", "footer.html"))
|
2023-06-17 14:00:36 +00:00
|
|
|
|
2023-06-17 16:44:51 +00:00
|
|
|
|
|
|
|
def nav_controls() -> List[NavSetArg]:
|
|
|
|
return [
|
2023-06-28 00:08:32 +00:00
|
|
|
ui.nav(ui.h5("Intro"), mod_welcome.welcome_ui("intro"), value="intro"),
|
2023-06-27 21:28:09 +00:00
|
|
|
ui.nav(ui.h5("Analyse"), "Analyse"),
|
2023-06-28 00:08:32 +00:00
|
|
|
ui.nav(ui.h5("Suchmaschine"), mod_searchable.searchable_ui("search_engine"), value="search_engine"),
|
2023-06-17 16:44:51 +00:00
|
|
|
ui.nav_control(
|
|
|
|
ui.a(
|
|
|
|
ui.h5("AG-Link"),
|
|
|
|
href="https://ag-link.xyz",
|
|
|
|
target="_blank",
|
|
|
|
),
|
|
|
|
),
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
app_ui = ui.page_navbar(
|
|
|
|
*nav_controls(),
|
2023-06-21 17:00:59 +00:00
|
|
|
# create gap ----
|
|
|
|
ui.nav_spacer(),
|
|
|
|
|
|
|
|
# right hand side ----
|
|
|
|
ui.nav_menu(
|
|
|
|
"Mehr Infos",
|
|
|
|
ui.nav_control(
|
|
|
|
ui.a(
|
|
|
|
"No G20 Studie",
|
|
|
|
href="https://g20.protestinstitut.eu/",
|
|
|
|
target="_blank",
|
|
|
|
),
|
|
|
|
),
|
|
|
|
align="right",
|
|
|
|
),
|
2023-07-12 13:09:12 +00:00
|
|
|
selected="intro",
|
2023-06-17 16:44:51 +00:00
|
|
|
fluid=False,
|
|
|
|
title=ui.div(ui.img(src="favicon.ico", width="75dpi", height="75dpi"),
|
2023-06-23 16:41:26 +00:00
|
|
|
ui.h1("Copbird")),
|
2023-06-17 16:44:51 +00:00
|
|
|
lang="de",
|
|
|
|
window_title="Copbird",
|
|
|
|
collapsible=True,
|
|
|
|
bg="#ba289f",
|
|
|
|
inverse=True,
|
|
|
|
id="Intro",
|
2023-06-21 16:56:22 +00:00
|
|
|
footer=ui.div(ui.HTML(footer_html), inline=False),
|
2023-06-17 14:00:36 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2023-06-17 16:44:51 +00:00
|
|
|
def server(input: Inputs, output: Outputs, session: Session):
|
2023-06-28 00:08:32 +00:00
|
|
|
mod_welcome.welcome_server("intro")
|
|
|
|
mod_searchable.searchable_server("search_engine")
|
2023-06-17 16:44:51 +00:00
|
|
|
|
2023-06-17 14:00:36 +00:00
|
|
|
|
2023-06-17 16:44:51 +00:00
|
|
|
static_dir = Path(__file__).parent / "www"
|
2023-06-17 14:00:36 +00:00
|
|
|
|
2023-06-17 16:44:51 +00:00
|
|
|
app = App(app_ui, server, static_assets=static_dir)
|