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

116. Implement application overview card and table #125

Merged

Conversation

dandheedge
Copy link
Contributor

Close #116

@dandheedge dandheedge self-assigned this Mar 5, 2024
Copy link

vercel bot commented Mar 5, 2024

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

Name Status Preview Comments Updated (UTC)
rollups-explorer-mainnet ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 26, 2024 9:55am
rollups-explorer-sepolia ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 26, 2024 9:55am
rollups-explorer-workshop ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 26, 2024 9:55am

variables: {
orderBy: ApplicationOrderByInput.IdAsc,
limit: 20,
after: "1",
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need the after variable here? This will get applications after the first one. Also, I see that on sepolia, certain owners (like 0xf05d57a5bed2d1b529c56001fc5810cc9afc0335) have more than 20 applications:

Screenshot 2024-03-12 at 22 19 50

I think we'll need pagination for the UserApplicationsTable component.

Copy link
Contributor

Choose a reason for hiding this comment

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

Another thing that I noticed but I'm not sure if it's something we should address is that on sunodo-generated dapp, the explorer api graphql (at http://localhost:8080/explorer-api/graphql) and ApplicationsConnection query doesn't support the timestamp field. So, in this case I'm getting a 400 error with message:

"Cannot query field \"timestamp\" on type \"Application\"."

Here's a screenshot:
Screenshot 2024-03-12 at 22 27 49

And here's the same but on sepolia:
Screenshot 2024-03-12 at 22 19 50

CC @brunomenezes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do we need the after variable here? This will get applications after the first one. Also, I see that on sepolia, certain owners (like 0xf05d57a5bed2d1b529c56001fc5810cc9afc0335) have more than 20 applications:

Screenshot 2024-03-12 at 22 19 50

I think we'll need pagination for the UserApplicationsTable component.

@nevendyulgerov, initially, I want to keep it simple just to display the 20 applications a user has. Do you think we need another pagination component for UserApplicationsTable, or can we display all the data at once? My concern with adding another pagination component is that the query parameters might become bloated.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Another thing that I noticed but I'm not sure if it's something we should address is that on sunodo-generated dapp, the explorer api graphql (at http://localhost:8080/explorer-api/graphql) and ApplicationsConnection query doesn't support the timestamp field. So, in this case I'm getting a 400 error with message:

The rollups-explorer (UI and API) docker images available are probably old, but they work together. The latest ones (0.9.0 and 0.4.0) are merged on Sunodo's base code, but I am not sure if they have already released the new version, 0.11.0. So using a local dev rollups-explorer running in parallel with sunodo-cli (i.e. sunodo run) you may have expected troubles. Here is what I do, if you are on a Mac and installed Sunodo-cli using homebrew you can go to /opt/homebrew/Cellar/sunodo/SUNODO_VERSION_HERE/libexec/lib/node_modules/@sunodo/cli/dist/node/docker-compose-explorer.yaml and replace the tags for API and UI. In the rollups-explorer project's root you can do a docker buildx bake that will build a cartesi/rollups-explorer tag devel so you can add that tag in the Sunodo docker-compose file I mentioned and you have the "dev" version running if that is necessary.

@nevendyulgerov, initially, I want to keep it simple just to display the 20 applications a user has. Do you think we need another pagination component for UserApplicationsTable, or can we display all the data at once? My concern with adding another pagination component is that the query parameters might become bloated.

@dandheedge, Let me add two cents here. This is a list displayed "temporarily" i.e. only related to the account address of the connected wallet, so without a connected wallet it should not have a list to show. Nevertheless, pagination is important.

that said:

  1. What would be the pros/cons of having the pagination tracked by the query-params?
  2. What would be the pros/cons of having the pagination not tracked on the query-params but only in its own local component/hook?
  3. Why would you choose one over another?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The rollups-explorer (UI and API) docker images available are probably old, but they work together. The latest ones (0.9.0 and 0.4.0) are merged on Sunodo's base code, but I am not sure if they have already released the new version, 0.11.0. So using a local dev rollups-explorer running in parallel with sunodo-cli (i.e. sunodo run) you may have expected troubles. Here is what I do, if you are on a Mac and installed Sunodo-cli using homebrew you can go to /opt/homebrew/Cellar/sunodo/SUNODO_VERSION_HERE/libexec/lib/node_modules/@sunodo/cli/dist/node/docker-compose-explorer.yaml and replace the tags for API and UI. In the rollups-explorer project's root you can do a docker buildx bake that will build a cartesi/rollups-explorer tag devel so you can add that tag in the Sunodo docker-compose file I mentioned and you have the "dev" version running if that is necessary.

@brunomenezes here are my thoughts on your question:

Pagination Tracked by Query-Params

Pros

  • Users can bookmark or share URLs that maintain the state of the application.

Cons

  • In the /applications page, the page already have the query-params for All Applications table. Adding more pagination with tracked query-params will increase the complexity on the url and the state handling as well.

Pagination With Local Hook

Pros

  • Simplifies state management within the component and results in a cleaner URL.
  • Stake Application has already implemented this method, suggesting it is a reliable approach.

Cons

  • Users cannot bookmark or share URLs that preserve the application's state.

I prefer using a local hook for pagination since the table only displays data related to the user's connected address, avoiding unnecessary complexity.

Copy link
Contributor

@nevendyulgerov nevendyulgerov left a comment

Choose a reason for hiding this comment

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

Nice work so far on this task, @dandheedge . I think we need to address some issues with the data for user-owned applications.

apps/web/graphql/queries.graphql Outdated Show resolved Hide resolved
apps/web/graphql/queries.graphql Outdated Show resolved Hide resolved
apps/web/graphql/queries.graphql Outdated Show resolved Hide resolved
Copy link
Collaborator

@brunomenezes brunomenezes left a comment

Choose a reason for hiding this comment

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

Rebase the branch.

<Table.Td>
<Tooltip label="Inputs">
<Link
href={`/applications/${appId}`}
Copy link
Collaborator

Choose a reason for hiding this comment

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

@dandheedge, I saw you rebase and have Neven's latest code changes related to the App's inputs. This link needs to be updated accordingly.

@brunomenezes brunomenezes merged commit 13eae66 into main Apr 29, 2024
8 checks passed
@brunomenezes brunomenezes deleted the feature/116-implement-application-overview-card-and-table branch April 29, 2024 22:38
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.

Implement Application Overview Card and Table
3 participants