reflex icon indicating copy to clipboard operation
reflex copied to clipboard

[REF-3423] The `rx.progress` always displays 100% bar.

Open btbf opened this issue 1 year ago β€’ 4 comments

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 image

Specifics (please complete the following information):

  • Python Version: Python 3.11.7
  • Reflex Version: 0.5.7
  • OS: Windows
  • Browser (Optional):

REF-3423

btbf avatar Jul 20 '24 08:07 btbf

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 avatar Jul 20 '24 09:07 Lendemor

@Lendemor Thank you very much for the valuable information.

rx._x.progress(value=cul, width='200px') After modifying the code, it worked successfully

image

btbf avatar Jul 20 '24 09:07 btbf

I'm new, and this seems like a good first issue to tackle. Can someone assign this to me?

theViz343 avatar Aug 20 '24 05:08 theViz343

@theViz343 just assigned you - let us know if you have any questions!

picklelo avatar Aug 20 '24 16:08 picklelo

As of 0.6.0, rx.progress is now the radix themes component, so this issue is resolved.

masenf avatar Oct 07 '24 17:10 masenf