Skip to content

Commit

Permalink
Merge pull request #45 from SanjayShetty01/fix-button
Browse files Browse the repository at this point in the history
making the button work in r modulues
  • Loading branch information
SanjayShetty01 authored Oct 27, 2024
2 parents b3687a0 + 92e6726 commit e169686
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 46 deletions.
4 changes: 1 addition & 3 deletions app/main.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ server <- function(id) {

overviewModule$yieldTabServer("tab1")

levelData <- setupModule$incomeTabServer("tab2")

dashboardBody$mainBodyServer("submit_portfolio")
levelData <- setupModule$incomeTabServer("tab2", parent = session)

dashboardModule$shopAnalysisServer("tab3", data = levelData)
})
Expand Down
3 changes: 0 additions & 3 deletions app/view/components/cardBox.R

This file was deleted.

26 changes: 1 addition & 25 deletions app/view/dashboardBody.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,7 @@ mainBody <- function(ns) {
"portfolio_setup",
shiny::br(),
shiny::br(),
setupModule$incomeTabUI(ns("tab2")),

shiny::fixedRow(
shiny::column(
width = 6,
offset = 3,
shinyWidgets::actionBttn(
inputId = "submit_portfolio",
label = "Calculate Results",
style = "material-flat",
color = "primary"
) |>
htmltools::tagAppendAttributes(style = "width: inherit;")
))

setupModule$incomeTabUI(ns("tab2"))
),

bs4Dash::tabItem(
Expand All @@ -40,13 +26,3 @@ mainBody <- function(ns) {
)
)
}

#' @export
mainBodyServer <- function(id) {
shiny::moduleServer(id, function(input, output, server){
shiny::observeEvent(input$submit_portfolio, {
bs4Dash::updateTabItems(session = server, inputId = "sidebar-tabs",
selected = "dashboard")
})
})
}
31 changes: 16 additions & 15 deletions app/view/setupModule.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,29 @@ incomeTabUI <- function(id){
style = "justify-content: space-between;")
),

# shiny::fixedRow(
# shiny::column(
# width = 6,
# offset = 3,
# shinyWidgets::actionBttn(
# inputId = "submit_portfolio",
# label = "Calculate Results",
# style = "material-flat",
# color = "primary"
# ) |>
# htmltools::tagAppendAttributes(style = "width: inherit;")
# ))
shiny::fixedRow(
shiny::column(
width = 6,
offset = 3,
shinyWidgets::actionBttn(
inputId = ns("submit_portfolio"),
label = "Calculate Results",
style = "material-flat",
color = "primary"
) |>
htmltools::tagAppendAttributes(style = "width: inherit;")
))
)
}


#' @export
incomeTabServer <- function(id){
incomeTabServer <- function(id, parent){
shiny::moduleServer(id, function(input, output, server){
shiny::observeEvent(input$submit_portfolio, {
shiny::updateTabsetPanel(inputId = "sidebar-tabs",
selected = "dashboard")
shiny::updateTabsetPanel(session = parent,
inputId = "sidebar-tabs",
selected = "dashboard")
})

return(
Expand Down

0 comments on commit e169686

Please sign in to comment.