Skip to content

Feature: Status Badge - Icon for Widget Generator#8

Open
Jellopuff wants to merge 4 commits into
Mainfrom
feature/status-badge
Open

Feature: Status Badge - Icon for Widget Generator#8
Jellopuff wants to merge 4 commits into
Mainfrom
feature/status-badge

Conversation

@Jellopuff
Copy link
Copy Markdown
Collaborator

Added a yellow hourglass icon badge to the main card which indicates that a response is being generated. When a response is not being generated, a transparent badge takes its place to keep page spacing consistent.
Screenshot 2024-02-07 201013

Comment thread ChainGenerator/Components/Widgets/WidgetGenerator.razor Outdated
@csullivan18 csullivan18 self-requested a review February 8, 2024 21:46
Copy link
Copy Markdown
Collaborator

@csullivan18 csullivan18 left a comment

Choose a reason for hiding this comment

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

This looks great! The only other recommendation I would have is to rather than use the if/else statement on the WidgetGen page, you could actually add another parameter onto the MudBadge component that accepts the refreshInProgress (bool) variable and handles the if inside the component. Just helps make the html side a little cleaner, but what you have is still correct. If you have any questions just let me know!

Copy link
Copy Markdown
Owner

@Unskilledcrab Unskilledcrab left a comment

Choose a reason for hiding this comment

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

Minor changes requested but a clever implementation and workaround for the issues you faced!

Comment thread ChainGenerator/Components/Widgets/WidgetGenerator.razor
Comment on lines +4 to +21
<!-- The badge icon which indicates an ongoing refresh -->
@if (refreshInProgress)
{
<MudBadge Origin="Origin.TopLeft"
Color="Color.Warning"
Overlap="true"
Bordered="false"
Icon="@badgeIcon">
</MudBadge>
}
else //Uses a transparent badge to keep the card formatting consistent
{
<MudBadge Origin="Origin.TopLeft"
Color="Color.Transparent"
Overlap="true"
Bordered="false">
</MudBadge>
}
Copy link
Copy Markdown
Owner

@Unskilledcrab Unskilledcrab Feb 9, 2024

Choose a reason for hiding this comment

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

This is a great start and heading in the right direction but looking at the documentation I believe this component should wrap the card component. That is probably why you were facing issues with the formatting being inconsistent

    <MudBadge Origin="Origin.TopLeft"
              Visible="refreshInProgress"   <--- replacing color parameter
              Overlap="true"    <--- not sure if this would still be needed
              Bordered="false"
              Icon="@badgeIcon">

        <!-- The main card that contains the widget generator -->
        <MudCard Outlined="true">
               .....
        </MudCard>

    </MudBadge>

There also looks like there is a Visible property that we can take advantage of on the badge component

Please also note: In the documentation there is a "show code" button you can press to see examples of how it is used in practice:

image

Copy link
Copy Markdown
Owner

@Unskilledcrab Unskilledcrab left a comment

Choose a reason for hiding this comment

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

This is really close. But I take a look back at my last comment. The badge component should be wrapping the entire card component

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Adding a status badge to generator widgets when they are generating

3 participants