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/table #2003

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Feat/table #2003

wants to merge 1 commit into from

Conversation

BLuEScioN
Copy link
Collaborator

@BLuEScioN BLuEScioN commented Feb 12, 2025

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

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Description

Adds the table component for our design system.
This PR will be followed by PRs for the additions to the table component:

  • Pagination
  • Tx table
  • Block table with its unique implementation for handling grouping

NB: I included a TxsTable component as I was writing that to sanity check my implementation worked and I was using it in the table storybook. None of this is going to be shown anyway so I'd prefer to just leave that component in this PR, as I will be using it pretty soon in a follow up PR for the txs page

To check the table implementation, please check out the storybook deployment link. There are a lot of table configurations available in the storybook control panel

Issue ticket number and link

#1995
#1996
#1998

Checklist:

  • I have performed a self-review of my code.
  • I have tested the change on desktop and mobile.
  • I have added thorough tests where applicable.
  • I've added analytics and error logging where applicable.

Screenshots (if appropriate):

Copy link

vercel bot commented Feb 12, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
explorer-storybook ❌ Failed (Inspect) Mar 4, 2025 9:05pm
hiro-explorer ❌ Failed (Inspect) Mar 4, 2025 9:05pm

@BLuEScioN BLuEScioN requested a review from He1DAr February 17, 2025 00:48
@andresgalante
Copy link
Member

Thanks for putting this together, Nick!

In my experience, large monolithic components like this table can be tough to maintain and not flexible enough to accommodate future changes. I’d suggest breaking this down into smaller, composable parts for the different variations of filters or rows. That would make it easier to extend and also much simpler to review.

@BLuEScioN
Copy link
Collaborator Author

Thanks for putting this together, Nick!

In my experience, large monolithic components like this table can be tough to maintain and not flexible enough to accommodate future changes. I’d suggest breaking this down into smaller, composable parts for the different variations of filters or rows. That would make it easier to extend and also much simpler to review.

Hey Andy, thanks for the review. Can you please be more specific about which parts of the table is monolithic in nature? I agree that the table implementation should be as composable and flexible as possible to support multiple table variations, and this is what I set out to do in this PR.

In this PR, I have not implemented any table filters yet. From the way that I am thinking about the table so far, I don't think that any table filter logic added here on out would need to be part of the core table code.

The implementation of the row rendering logic is not contained inside the table. The table accepts a column defintion array in which table consumers specify what their columns look like, inlcuding a cellrenderer function, which tells the table how to render the cells in the column. In the table examples directory, you can see src/common/components/table/table-examples/TxTableCellRenderers.tsx. That file shows that all the logic required to rendering a particular tables rows/columns is independent from the underlying table code.

@ginny-d
Copy link

ginny-d commented Mar 3, 2025

@BLuEScioN I added my comments on Storybook
Let me know if you have any questions

Two things I didn't revise because I didn't know if they were ready for review:

  • Empty states
Screenshot 2025-03-03 at 13 35 47 Screenshot 2025-03-03 at 14 39 10

@BLuEScioN
Copy link
Collaborator Author

@BLuEScioN I added my comments on Storybook Let me know if you have any questions

Two things I didn't revise because I didn't know if they were ready for review:

  • Empty states
Screenshot 2025-03-03 at 13 35 47 * [Dynamic/responsiveness for smaller viewports](https://www.figma.com/design/zR7MN402tgacWXm63OQLms/Stacks-Explorer-Design-System-%5BRedesign%5D?node-id=2626-10958&t=y2zwp8rAZp2J9tu4-1) Screenshot 2025-03-03 at 14 39 10

I did implement the empty state. As we discussed, we are not adding the ripple styles that you have in figma. Note that I did change the text that you had from "This account has no transactions yet." to "No results found". I did this because "This account has no transactions yet." might only apply to account pages, where as "No results found" is more general. The text is configurable in the code.

Yes the responsive styles are ready to review, for the table. This PR is only trying to implement the table designs. The only reason that I have the tx table 90% implemented is because I needed to see if the table was capable of working for our intended use cases. It would be best to use the simple table to provide feedback for this PR

@ginny-d
Copy link

ginny-d commented Mar 4, 2025

@BLuEScioN I added my comments on Storybook Let me know if you have any questions
Two things I didn't revise because I didn't know if they were ready for review:

  • Empty states
Screenshot 2025-03-03 at 13 35 47 * [Dynamic/responsiveness for smaller viewports](https://www.figma.com/design/zR7MN402tgacWXm63OQLms/Stacks-Explorer-Design-System-%5BRedesign%5D?node-id=2626-10958&t=y2zwp8rAZp2J9tu4-1) Screenshot 2025-03-03 at 14 39 10

I did implement the empty state. As we discussed, we are not adding the ripple styles that you have in figma. Note that I did change the text that you had from "This account has no transactions yet." to "No results found". I did this because "This account has no transactions yet." might only apply to account pages, where as "No results found" is more general. The text is configurable in the code.

Yes the responsive styles are ready to review, for the table. This PR is only trying to implement the table designs. The only reason that I have the tx table 90% implemented is because I needed to see if the table was capable of working for our intended use cases. It would be best to use the simple table to provide feedback for this PR

Empty state:

  • Got it. My comment was based on the 'No results found' preview looking different from the design. I wasn’t sure why some elements were missing since I don’t have the full context.
Screenshot 2025-03-04 at 11 41 14 Screenshot 2025-03-04 at 11 41 24

Responsiveness:
Understood, thanks for providing additional context.

@andresgalante Since these PRs share the same name as the designs and reference them, it might be helpful to note in the PRs what is not included or will be addressed later. This way, I can avoid annotating missing elements unnecessarily.

@BLuEScioN BLuEScioN requested a review from ginny-d March 4, 2025 16:44
@ginny-d
Copy link

ginny-d commented Mar 4, 2025

Approving and noting here what's not included in this PR for future reference:

  • First item (first column) of a table should be a link/clickable
  • Let's move the contract tag to the "To" column to avoid undesired column wrapping. In practice, this "human readable" contract name would replace the Contract ID (but it would still link to it). See styling here, which is the same as the timestamp tag style, only underlined because it's a link
  • Adjust the table container top padding from 12px to 2px so the spacing for the header row is more balanced
  • IDs and alphanumeric truncations should use a standard 4 characters at the front and 5 characters at the end
  • The timestamp style is different. See Figma link
  • Empty states styling
  • "New transactions added" banner is lacking hover state
  • Adding Tenure reasons (block found, tenure change, tenure extension) to Tenure tx in their title
  • Column sorting action should be triggered by hovering on the full label, as opposed to only the icon
  • Table optimisation for smaller viewports

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🆕 New
Development

Successfully merging this pull request may close these issues.

4 participants