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

feat: MetricCard prototype #2942

Merged
merged 16 commits into from
Mar 28, 2024
Merged

feat: MetricCard prototype #2942

merged 16 commits into from
Mar 28, 2024

Conversation

zeucapua
Copy link
Contributor

@zeucapua zeucapua commented Mar 13, 2024

Description

Implement MetricCard component that takes in stats returned by the useFetchMetricStats hook and the stat type (eg. 'stars', 'forks'). It parses the data and renders the graph, using Apache Echarts (TBD if to be replaced with a new chart library). Other parts of the card (number, percentage vs last period, button) are not implemented in this PR.

What type of PR is this? (check all applicable)

  • 🍕 Feature
  • 🐛 Bug Fix
  • 📝 Documentation Update
  • 🎨 Style
  • 🧑‍💻 Code Refactor
  • 🔥 Performance Improvements
  • ✅ Test
  • 🤖 Build
  • 🔁 CI
  • 📦 Chore (Release)
  • ⏩ Revert

Related Tickets & Documents

Closes #2870

Mobile & Desktop Screenshots/Recordings

image

Steps to QA

Added to documentation?

  • 📜 README.md
  • 📓 docs.opensauced.pizza
  • 🍕 dev.to/opensauced
  • 📕 storybook
  • 🙅 no documentation needed

[optional] Are there any post-deployment tasks we need to perform?

[optional] What gif best describes this PR or how it makes you feel?

andre-braugher-statistics-is-so-beautiful-gif

Copy link

netlify bot commented Mar 13, 2024

Deploy Preview for oss-insights ready!

Name Link
🔨 Latest commit 1710061
🔍 Latest deploy log https://app.netlify.com/sites/oss-insights/deploys/6605b97c6f82df0008c7f8a8
😎 Deploy Preview https://deploy-preview-2942--oss-insights.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Mar 13, 2024

Deploy Preview for design-insights ready!

Name Link
🔨 Latest commit 1710061
🔍 Latest deploy log https://app.netlify.com/sites/design-insights/deploys/6605b97c64659f0008721d0f
😎 Deploy Preview https://deploy-preview-2942--design-insights.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@zeucapua zeucapua changed the title init MetricCard feat: MetricCard prototype Mar 13, 2024
@isabensusan
Copy link
Member

we are putting this on hold for a sec until we figure out devstats and the API endpoint

@zeucapua zeucapua added the on hold Work that is on hold for some reason label Mar 21, 2024
@zeucapua zeucapua marked this pull request as ready for review March 22, 2024 20:16
@zeucapua zeucapua requested a review from isabensusan March 22, 2024 20:23
Copy link
Member

@nickytonline nickytonline left a comment

Choose a reason for hiding this comment

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

The MetricCard component needs Storybook stories. There are plenty of examples in the repo for graphs, e.g. https://github.com/open-sauced/app/blob/758fb0b7f928ff35e7d71a49e6e6012f2f8b3d02/components/Graphs/MostUsedLanguagesGraph/most-used-languages-graph.stories.tsx

This way we can see the component as it's currently not on any page.

@zeucapua zeucapua added repo-pages and removed on hold Work that is on hold for some reason labels Mar 22, 2024
Copy link
Member

@jpmcb jpmcb left a comment

Choose a reason for hiding this comment

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

Looking at the Storybook, looks solid!! 👏🏼 👏🏼

@zeucapua zeucapua requested a review from nickytonline March 25, 2024 17:51
@nickytonline
Copy link
Member

nickytonline commented Mar 25, 2024

Just wondering if the graphs are supposed to be centered vertically with the value or align with the bottom? cc: @isabensusan

CleanShot 2024-03-25 at 15 43 30@2x

CleanShot 2024-03-25 at 15 45 35

@nickytonline
Copy link
Member

I get a 404 when I visit https://deploy-preview-2942--oss-insights.netlify.app/s/open-sauced/app. Do I need to be added to the feature flag?

@isabensusan
Copy link
Member

If we can make the chart as tall as the number is, and align it to the bottom, it'd be perfect. But I think @zeucapua mentioned this is a bit gnarly to workout, so if it becomes a big blocker, I'm good to merge as is

@nickytonline
Copy link
Member

If we can make the chart as tall as the number is, and align it to the bottom, it'd be perfect. But I think @zeucapua mentioned this is a bit gnarly to workout, so if it becomes a big blocker, I'm good to merge as is

I wonder if it's just a question of trimming the canvase height.

CleanShot 2024-03-26 at 16 51 10

components/Graphs/MetricCard.tsx Outdated Show resolved Hide resolved
@zeucapua
Copy link
Contributor Author

zeucapua commented Mar 26, 2024

In terms of chart alignment, the line chart is weird since it starts at 1, so there's a gap at the actual bottom, so it feels like it's hovering above the bar chart.

I can play around with the canvas to match the height of the number. I'll ping if it's too big of a blocker.

@zeucapua zeucapua requested a review from nickytonline March 26, 2024 22:50
@zeucapua
Copy link
Contributor Author

Going to punt on the chart height, the canvas height and actual graph height aren't the same, and I can't manually change the chart height. Might need to pivot to another chart library. Would love to pair on this at some point @nickytonline

@nickytonline
Copy link
Member

Going to punt on the chart height, the canvas height and actual graph height aren't the same, and I can't manually change the chart height. Might need to pivot to another chart library. Would love to pair on this at some point @nickytonline

We can look at another library potentially, but also, we can have a relative container and potentially move the chart that we'd give an absolute position to move it so it looks good. Anyways, we can chat about it.

@bdougie
Copy link
Member

bdougie commented Mar 27, 2024

Probably worth humanizing the numbers. The 4 digit number is pushing the boundaries of the chart.

Screen Shot 2024-03-27 at 2 13 09 PM

@zeucapua
Copy link
Contributor Author

Humanized & abbreviated!
image

Copy link
Member

@nickytonline nickytonline left a comment

Choose a reason for hiding this comment

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

We can pair next week on the graph alignment. 🚢

@brandonroberts brandonroberts merged commit 1a57714 into beta Mar 28, 2024
13 checks passed
@brandonroberts brandonroberts deleted the feat/kpi-card-proto branch March 28, 2024 19:39
open-sauced bot pushed a commit that referenced this pull request Mar 28, 2024
## [2.13.0-beta.4](v2.13.0-beta.3...v2.13.0-beta.4) (2024-03-28)

### 🍕 Features

* `MetricCard` prototype ([#2942](#2942)) ([1a57714](1a57714))
open-sauced bot pushed a commit that referenced this pull request Mar 28, 2024
## [2.13.0](v2.12.1...v2.13.0) (2024-03-28)

### 🐛 Bug Fixes

* enable edit and changing of name of contributor insight ([#3055](#3055)) ([970cd86](970cd86))
* redirect /hub/insights/new to login if not authenticated ([#2935](#2935)) ([55a73df](55a73df))

### 🍕 Features

* `MetricCard` prototype ([#2942](#2942)) ([1a57714](1a57714))
* prototype Stars Chart for Repo pages ([#3040](#3040)) ([cc74f8d](cc74f8d))
* **insights and lists:** unify UX for insights and lists ([#2582](#2582)) ([cbcfd20](cbcfd20))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: Prototype for new KPI card with small chart
6 participants