Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for setting dynamic suffix on MetricCard (e.g., currency) #3235

Closed
jetienne opened this issue Sep 11, 2024 · 2 comments
Closed
Assignees
Labels
Enhancement Not necessarily a feature, but something has improved Good first issue Good for newcomers Help wanted We could use some help with this

Comments

@jetienne
Copy link

Feature

I would like the ability to dynamically set the suffix on a MetricCard based on the resource or record being displayed. For instance, when displaying a monetary amount, the suffix should reflect the currency of the related record.

Use case:
In my current use case, we display the total amount of a Deal, and I need to append the correct currency symbol (e.g., $, €, etc.) to the value shown on the MetricCard. However, it seems there is currently no way to access the resource or record within the MetricCard to set the suffix dynamically.

Here's a proposed solution:

class Avo::Cards::Revenue < Avo::Cards::MetricCard
  self.suffix = = lambda { resource.record.currency }
@Paul-Bob Paul-Bob added the Enhancement Not necessarily a feature, but something has improved label Sep 11, 2024
Copy link
Contributor

This issue has been marked as stale because there was no activity for the past 15 days.

@github-actions github-actions bot added the Stale label Sep 27, 2024
@Paul-Bob Paul-Bob removed the Stale label Sep 27, 2024
@Paul-Bob Paul-Bob self-assigned this Sep 29, 2024
@adrianthedev adrianthedev added Help wanted We could use some help with this Good first issue Good for newcomers labels Sep 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Not necessarily a feature, but something has improved Good first issue Good for newcomers Help wanted We could use some help with this
Projects
Status: Done
Development

No branches or pull requests

3 participants