[REF-3423] The `rx.progress` always displays 100% bar.
Describe the bug
When the values of the dictionary expanded with rx.foreach are assigned to the value of rx.progress, the progress bar displays 100% regardless of the actual value.
To Reproduce Steps to reproduce the behavior:
import reflex as rx
from typing import List, Dict
from .templates import template
class ForeachState(rx.State):
user: List[Dict[str,int]] = [
{"value":1, "max":100},
{"value":30, "max":200},
{"value":150, "max":500},
{"value":600, "max":1000},
]
def progress_box(user: Dict[str,int]):
cul = (user['value'] / user['max']) * 100
return rx.box(
rx.text(f"{cul}%"),
rx.progress(value=cul, width='200px')
)
@template(route="/test",)
def foreach_example() -> rx.Component:
return rx.box(
rx.foreach(ForeachState.user, progress_box),
)
Expected behavior I want to display a progress bar that reflects the percentage according to each value.
Screenshots
Specifics (please complete the following information):
- Python Version: Python 3.11.7
- Reflex Version: 0.5.7
- OS: Windows
- Browser (Optional):
rx.progress is our implementation of Radix Progress Primitives and might have a bug.
We also have the Progress bar from Radix Themes under rx._x.progress <- this one display the bar a bit differently, but it's working.
@Lendemor Thank you very much for the valuable information.
rx._x.progress(value=cul, width='200px')
After modifying the code, it worked successfully
I'm new, and this seems like a good first issue to tackle. Can someone assign this to me?
@theViz343 just assigned you - let us know if you have any questions!
As of 0.6.0, rx.progress is now the radix themes component, so this issue is resolved.