Skip to content

Conversation

@gogonzo
Copy link
Contributor

@gogonzo gogonzo commented Feb 14, 2023

closes #173 #174 #167
Tested on: chrome, safari and firefox with default shiny, BS3-5. No major styling/js issues.

In this PR we've changed the way how the labels are created and updated. Basically, counts are the separate shiny/html elements which have their own id, which they are identified by.

  1. We introduced new shiny inputs to create and update values of the labels:
  • countBar - creates n ui elements for each choice with progressbar and text label
  • countBar - creates a ui html element with progressbar and text label
  • make_count_text - composes the label $choice ($filtered/$unfiltered)
  1. We've created respective update* methods to keep the labels up to date
  • updateCountBars
  • updateCountBar
  • updateCountText
  1. To update the counts without triggering reactive cycle we created two js handlers which change a bar and a label found using id.

  2. Instead of observeEvent(filtered_counts(), ...) we used renderUI(... filtered_counts()) which serves as the observer for the visible item only!

  3. In the ChoicesFilterState we applied this to trigger change of the selection only when the picker is closed - closing pickerInput labels (counts ) are too reactive #167

Untitled Diagram drawio (2)

You can find examples in #165 and one can use also teal.gallery::launch_app.

updateable count labels
@gogonzo gogonzo added the core label Feb 14, 2023
gogonzo and others added 14 commits February 14, 2023 13:40
fix name and remove unneeded method
pickerInput applied only when closed!
correct id of input
- add docs
- add asserts
- fix reactivity in choicesFS
fix reactivity and pickerInput labels
All reactivity fixed
fix LogicalFilterState reactivity
logs
fix styling
test:
make_count_text, countLabel, countBar
hehe
tests
thanks @asbates

---------

Co-authored-by: Andrew Bates <andrew.bates@atorusresearch.com>
… 174_checkbox_counts@filter_panel_refactor@main
tidyup css
@gogonzo gogonzo marked this pull request as ready for review February 16, 2023 09:26
include updateCountText to the docs
@asbates
Copy link
Contributor

asbates commented Feb 16, 2023

I would consider having the progress bars CSS as the following.

  • Add border radius to right side of unfiltered bar to match the left side
  • Use variables where possible to maintain user theme if they have one set. (var(--color, othercolor) will use --color if available, otherwise othercolor.
  • Instead of built in css lightblue, use Shiny's default primary color to better match theme.
.progress-bar.state-count-bar-filtered {
  background-color: var(--bs-primary, rgb(51, 122, 183));
  opacity: 0.8;
  color: var(--bs-body-color, var(--dark, #333333));
  overflow: visible;
  text-align: left;
  white-space: nowrap;
}

.progress-bar.state-count-bar-unfiltered {
  background-color: var(--bs-primary, rgb(51, 122, 183));
  opacity: 0.439;
  border-top-right-radius: var(--bs-border-radius, .375rem);
  border-bottom-right-radius: var(--bs-border-radius, .375rem);
}

@donyunardi
Copy link
Contributor

Thanks for working on this @gogonzo. I think this is looking great already. The js handler solution works great on addressing our reactive cycle issue.

@lcd2yyz
Could you please look at this PR, specifically the progress bar?

Comment on lines +262 to +272
.progress-bar.state-count-bar-filtered {
background-color: lightblue !important;
color: var(--bs-body-color, var(--dark, #333333));
overflow: visible;
text-align: left;
white-space: nowrap;
}

.progress-bar.state-count-bar-unfiltered {
background-color: rgba(173, 216, 230, 0.439) !important;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@asbates do you know how to apply alpha/opacity to the background only? Opacity affects text and background in the same time which means that it could be barely visible,

image

Suggested change
.progress-bar.state-count-bar-filtered {
background-color: lightblue !important;
color: var(--bs-body-color, var(--dark, #333333));
overflow: visible;
text-align: left;
white-space: nowrap;
}
.progress-bar.state-count-bar-unfiltered {
background-color: rgba(173, 216, 230, 0.439) !important;
}
.progress-bar.state-count-bar-filtered {
background-color: var(--bs-primary, rgb(51, 122, 183));
opacity: 0.8;
color: var(--bs-body-color, var(--dark, #333333));
overflow: visible;
text-align: left;
white-space: nowrap;
}
.progress-bar.state-count-bar-unfiltered {
background-color: var(--bs-primary, rgb(51, 122, 183));
opacity: 0.439;
border-top-right-radius: var(--bs-border-radius, .375rem);
border-bottom-right-radius: var(--bs-border-radius, .375rem);
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not. Bootstrap uses hex for color variables and as of now there isn't a way to add alpha to an existing hex color. (apparently this is in the works). So setting opacity on the whole bars is probably not the way to go. The text looked light to me but I wanted to bring it up just in case it was just me.

meaningful output name
Copy link
Contributor

@mhallal1 mhallal1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue created while reviewing this: #203

remove docs of inexisting argument
Copy link
Contributor

@mhallal1 mhallal1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally and on BEE with multiple apps and conditions.
Works as expected.

… 174_checkbox_counts@filter_panel_refactor@main
@mhallal1 mhallal1 self-assigned this Feb 21, 2023
remove unused exclude from the function.
@gogonzo
Copy link
Contributor Author

gogonzo commented Feb 22, 2023

After addressing all comments from @chlebowa and @BLAZEWIM I'm using @mhallal1 approval. If you still see the room for improvement please create an issue 👍

@gogonzo gogonzo merged commit c473bba into filter_panel_refactor@main Feb 22, 2023
@gogonzo gogonzo deleted the 174_checkbox_counts@filter_panel_refactor@main branch February 22, 2023 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants