Move project into different files

This commit is contained in:
2025-12-15 16:44:25 +01:00
parent 7dda78712a
commit 7ba1b9cd4c
4 changed files with 472 additions and 384 deletions

138
ui.R Normal file
View File

@@ -0,0 +1,138 @@
ui <- function() {
page_fillable(
h1("Kriminalstatistik Hamburg",
style = "color: #003063; font-weight: bold;",
class = "ms-4 display-4"),# ms-4 sorgt für den Abstand links
navset_card_tab(
nav_panel("Karte",
page_sidebar(
layout_columns(
leafletOutput("hhmap"),
card(
div(
# h3 oder div dient als Block-Element und richtet seinen Inhalt (das span) rechtsbündig aus
style = "text-align: right; width: 100%; ",
# Der Text wird in ein span verpackt und erhält die Border.
# Ein span nimmt nur den Platz ein, den der Inhalt benötigt (inline).
tags$span(
"2024",
style = "
border: 1px solid rgba(40,70,94,0.1);
border-radius: 5px;
padding: 5px 10px 5px 10px;
background-color: #eeeeee;
"
# padding ist der abstand an leerer Fläche in der reihenfolge top right bottom left
# farbe rgba ist die exakte Farbe der Trennlinien und Card-Umrandungen aus der App
)
),
div(
class = "d-flex align-items-end gap-2",
h5(strong("Bezirk:"), style = "margin-bottom: 0;"),
textOutput("txt_map_selection_bezirk"),
),
div(
class = "d-flex align-items-end gap-2",
h5(strong("Stadtteil:"), style = "margin-bottom: 0;"),
textOutput("txt_map_selection_stadtteil"),
),
plotOutput("grph_top3"),
#tableOutput("tbl_2024"),
),
col_widths = c(8, 4),
),
sidebar = sidebar(
radioButtons(
inputId = "rd_maptype",
label = "Kartentyp",
choices = c("Bezirke", "Stadtteile"),
selected = "Bezirke"
),
selectizeInput(
inputId = "search",
label = tags$span(icon("search"),"Suche"),
choices = NULL,
selected = NULL,
multiple = FALSE, # Hier wahrscheinlich nur Einzelauswahl gewünscht
options = list(
placeholder = "Anfangen zu tippen...",
openOnFocus = FALSE,
allowEmptyOption = TRUE,
selectOnTab = FALSE,
plugins = list('dropdown_header')
)
),
selectizeInput(
inputId = "heatmap",
label = "Wähle eine Straftat:",
choices = list_of_crimes,
selected = NULL,
options = list(
placeholder = "Keine Auswahl",
plugins = list('clear_button')
)
)
),
)
),
nav_panel("Vergleich",
layout_sidebar(
sidebar = sidebar(
title = "Vergleichs-Optionen",
radioButtons(
"vergleichs_modus",
"Wählen Sie den Vergleichstyp:",
choices = c(
"Straftat vs. Orte" = "ort_vergleich",
"Ort vs. Straftaten" = "straftat_vergleich"
),
selected = "ort_vergleich"
),
tags$hr(),
# 2. Dynamische Input-Felder für die Orte und Straftaten
uiOutput("vergleichs_inputs"),
# 3. Gemeinsamer Input: Das Jahr
selectizeInput(
"vergleichs_jahr",
"Jahr wählen:",
choices = c(2024, 2023),
selected = 2024
),
),
card(
card_header(uiOutput("vergleichs_titel")), # Dynamischer Titel
plotOutput("vergleichs_plot")
)
)
),
nav_panel("Wiki",
accordion(
accordion_panel(
title = "Diebstahl",
#icon =
"Unter Diebstahl sind alle Diebsthal-Delikte nach §239."
),
accordion_panel(
title = "Gewaltkriminalität",
#icon =
"Gewaltkriminalität ist doof."
),
accordion_panel(
title = "Was ganz langes.",
#icon
"Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet."
)
)
),
id = "tab"
)
)
}