Skip to content

Conversation

@barbaraperic
Copy link
Collaborator

📝 Description

This PR adds CSV export functionality to the service providers table, allowing users to download provider data for offline analysis.

See Issue #185

  • Type: New feature

🛠️ Key Changes

  • Added CSV export button to the service providers table
  • CSV file includes all relevant provider information with a timestamped filename (service-providers-YYYY-MM-DD.csv)

Added Dependencies:

  • react-csv for CSV generation
  • prop-types (peer dependency for react-csv)
  • @types/react-csv for TypeScript support

📌 To-Do Before Merging

  • Verify design with Filipa

📸 Screenshots

Screenshot 2026-01-14 at 12 46 22

🔖 Resources

react-csv NPM library

@barbaraperic barbaraperic requested a review from Copilot January 14, 2026 13:59
@barbaraperic barbaraperic self-assigned this Jan 14, 2026
@vercel
Copy link

vercel bot commented Jan 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
filecoin-cloud Ready Ready Preview, Comment Jan 14, 2026 3:05pm

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds CSV export functionality to the service providers table, enabling users to download provider data with a timestamped filename for offline analysis. The implementation introduces a new export button, mapping utilities for data transformation, and refactors shared constants.

Changes:

  • Added CSV export button with download functionality using react-csv library
  • Created utility function to map provider data to CSV format
  • Refactored CURIO_GITHUB_URL constant to shared location and created useExplorerUrl hook

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
src/components/SoftwareVersion.tsx Refactored to use centralized CURIO_GITHUB_URL constant
src/components/ProviderOverview.tsx Refactored to use new useExplorerUrl hook for explorer URL retrieval
src/app/service-providers/utils/mapProviderToCsvRow.ts New utility function to transform provider data to CSV format (contains critical bugs)
src/app/service-providers/hooks/useExplorerUrl.ts New custom hook to encapsulate explorer URL logic
src/app/service-providers/constants/providers.ts New constants file with centralized CURIO_GITHUB_URL
src/app/service-providers/components/ServiceProvidersTable.tsx Integrated CSV export functionality into table component
src/app/service-providers/components/ExportToCsvLink.tsx New component rendering CSV download link
package.json Added react-csv, prop-types, and @types/react-csv dependencies
package-lock.json Lock file updates for new dependencies

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +82 to +88
const csvData = useMemo(() => {
return table
.getFilteredRowModel()
.rows.map((row) =>
mapProviderToCsvRow({ provider: row.original, explorerUrl }),
)
}, [table, explorerUrl])
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

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

The dependency array includes table which is recreated on every render, causing unnecessary recalculations of csvData. The dependency should be table.getFilteredRowModel().rows or the table's state properties that affect filtering (e.g., columnFilters, searchQuery) to ensure csvData only updates when the filtered data actually changes.

Copilot uses AI. Check for mistakes.
ID: String(provider.id),
Provider: provider.name,
'Provider Address': `${explorerUrl}${provider.serviceProviderAddress}`,
'Service URL': provider.serviceUrl.toString(),
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

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

Calling toString() on a URL object is unnecessary since the schema defines serviceUrl as z.url() which already returns a string. The .toString() call can be removed for clarity.

Copilot uses AI. Check for mistakes.
Comment on lines +69 to +72
return (
serviceStatus.charAt(0).toUpperCase() +
serviceStatus.slice(1).toLowerCase()
)
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

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

This code will fail if serviceStatus is an empty string (when the fallback value '-' is used), because charAt(0) would return an empty string. The logic should check if serviceStatus is '-' before attempting the transformation, or apply title case transformation only to non-dash values.

Copilot uses AI. Check for mistakes.
@BigLep
Copy link
Contributor

BigLep commented Jan 14, 2026

@barbaraperic : A couple of things:

  • Provider Address should be the address (e.g., 0x8c8c7a9BE47ed491B33B941fBc0276BD2ec25E7) not the url to a block explorer
  • Lets not add any cormatting around numbers (e.g., commas). The reason is we want this data to bias towards computer parsable. We're not optimizing for human readability. Humans can do number formating in their csv viewer (e.g., Excel)

@BigLep BigLep moved this from 📌 Triage to ⌨️ In Progress in FOC Jan 15, 2026
@barbaraperic
Copy link
Collaborator Author

@barbaraperic : A couple of things:

  • Provider Address should be the address (e.g., 0x8c8c7a9BE47ed491B33B941fBc0276BD2ec25E7) not the url to a block explorer
  • Lets not add any cormatting around numbers (e.g., commas). The reason is we want this data to bias towards computer parsable. We're not optimizing for human readability. Humans can do number formating in their csv viewer (e.g., Excel)

Thank you!

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

Labels

Projects

Status: ⌨️ In Progress

Development

Successfully merging this pull request may close these issues.

3 participants