Skip to content

Commit

Permalink
refine power column
Browse files Browse the repository at this point in the history
  • Loading branch information
DivadNojnarg committed Nov 15, 2023
1 parent ec84907 commit 08aefbc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion inst/showcase/app.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ server <- function(input, output, session) {
main <- mod_poke_select_server("poke_select_1")
mod_poke_info_server("poke_info_1", main$selected, main$is_shiny)
mod_poke_stats_server("poke_stats_1", main$selected, reactive(input$theme))
mod_poke_move_server("poke_move_1", main$selected)
mod_poke_move_server("poke_move_1", main$selected, reactive(input$theme))
}

shinyApp(ui, server)
25 changes: 16 additions & 9 deletions inst/showcase/modules/mod_poke_move.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ mod_poke_move_ui <- function(id) {
uiOutput(ns("poke_moves"), style = "max-height: 400px; overflow-y: scroll;")
}

mod_poke_move_server <- function(id, selected) {
mod_poke_move_server <- function(id, selected, theme) {
moduleServer(id, function(input, output, session) {

ns <- session$ns
Expand All @@ -15,17 +15,24 @@ mod_poke_move_server <- function(id, selected) {

dat <- lapply(moves, function(move) {
list(
name = chip(move$name),
name = move$name,
type = chip(
move$type,
style = sprintf("background: %s", get_type_colors(move$type))
),
power = progress(
value = move$power,
valueLabel = move$power,
maxValue = 150,
showValueLabel = TRUE
style = paste(
sprintf("background: %s", get_type_colors(move$type)),
if (move$type == "normal" && theme() == "dark") "text-color: white"
)
),
power = if (is.na(move$power)) {
"NA"
} else {
progress(
value = move$power,
valueLabel = move$power,
maxValue = 150,
showValueLabel = TRUE
)
},
pp = move$pp,
priority = move$priority,
accuracy = move$accuracy,
Expand Down

0 comments on commit 08aefbc

Please sign in to comment.