Conversation
|
I have read the CLA Document and I hereby sign the CLA osenan seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. |
|
I have read the CLA Document and I hereby sign the CLA |
Code Coverage SummaryDiff against mainResults for commit: c541422 Minimum allowed coverage is ♻️ This comment has been updated with latest results |
Unit Tests Summary 1 files 8 suites 13s ⏱️ Results for commit c541422. ♻️ This comment has been updated with latest results. |
Unit Test Performance Difference
Additional test case details
Results for commit 3c6d5b1 ♻️ This comment has been updated with latest results. |
llrs-roche
left a comment
There was a problem hiding this comment.
The app currently uses the secondary color to generate the badge:
I am not sure we need to reuse badge_dropdown() given that it doesn't generate a dropdown. Instead we might want a new function to generate the UI. There was a comment to show a lock on the UI to convey the user they cannot change that. I think it would be helpful as secondary colors might be used for less important buttons but still functional ones.
I haven't run the tests (yet)
| #' @param fixed (`logical(1)`) Whether to return a badge with dropdown (default) or simple fixed badge if set to TRUE | ||
| #' @keywords internal | ||
| badge_dropdown <- function(id, label, content) { | ||
| badge_dropdown <- function(id, label, content, badge_context = "primary", fixed = FALSE) { |
There was a problem hiding this comment.
I like the description of the new badge_context argument and I see it inherits the color from teal.
But do we need the fixed = FALSE argument? If it is fixed there is no dropdown so we might want to use a different function that generates the UI.
| badge_dropdown <- function(id, label, content) { | ||
| badge_dropdown <- function(id, label, content, badge_context = "primary", fixed = FALSE) { | ||
| checkmate::assert_character(badge_context) | ||
| checkmate::assert_logical(fixed) |
There was a problem hiding this comment.
Not only logical but also to be of length one and not accept NA values
| checkmate::assert_logical(fixed) | |
| checkmate::assert_flag(fixed) |
| class = "badge bg-primary rounded-pill badge-dropdown", | ||
| style = "cursor: pointer;", | ||
| class = sprintf("badge bg-%s rounded-pill badge-dropdown", badge_context), | ||
| style = ifelse(fixed, "", "cursor: pointer"), |
There was a problem hiding this comment.
Not important but I think there was some recommendations to use if instead of ifelse for these cases:
| style = ifelse(fixed, "", "cursor: pointer"), | |
| style = if (fixed) "" else "cursor: pointer", |
| if (isTRUE(args$fixed) || length(choices()) <= 1) { | ||
| if (!length(choices()) || isTRUE(args$fixed)) { | ||
| NULL | ||
| } else if (length(choices()) == 1 && isFALSE(args$fixed)) { |
There was a problem hiding this comment.
Do we need this new conditional? Wouldn't it be catch up by the latest else clause?
| htmltools::tags$div( | ||
| if (missing(container)) { | ||
| badge_dropdown(id = ns("inputs"), label = badge_label, htmltools::tagList(content)) | ||
| if (isTRUE(attr(picks$variables, "fixed")) && isTRUE(attr(picks$datasets, "fixed"))) { |
There was a problem hiding this comment.
I would iterate through the whole elements of picks and check with is_pick_fixed() from #48
Maybe datasets and variables are fixed but values are not.
Se also my comment about fixed = TRUE and that we might want to have a different function to generate the UI below this: badge_locked() ? . If we don't I would only have one call and use badge_dropdown(..., fixed = all(locked)) to avoid an extra if else.
|
Thank you for the review @llrs-roche! |
It fixed #33
The solution has changed the
badge_dropdowninternal function that creates the badge that contains the picks dropdown. For cases where there is fixed dataset and variable, it has been changed to a different style and removed the icon. Thus, the user is not confused whether this variable can be changed. In addition, if the app developer wants I allowed for single choice with ui display.This app shows both scenarios:
To verify the behavior I have added more tests.