Skip to content

Staging -> Main#409

Merged
akaia-shadowfox merged 18 commits intomainfrom
staging
Jun 12, 2025
Merged

Staging -> Main#409
akaia-shadowfox merged 18 commits intomainfrom
staging

Conversation

@akaia-shadowfox
Copy link
Copy Markdown
Collaborator

@akaia-shadowfox akaia-shadowfox commented Jun 12, 2025

Summary by CodeRabbit

  • New Features

    • Introduced a new campaign editor component for creating and editing campaigns, including improved image upload and callback handling.
    • Added a new route for campaign settings pages.
    • Enhanced the file upload experience with new hooks and result types.
  • Bug Fixes

    • Corrected typos in variable names related to campaign amounts for improved consistency.
    • Refined error handling and messaging in campaign settings.
  • Refactor

    • Standardized data fetching behavior across hooks with a shared configuration.
    • Replaced the campaign form with the new campaign editor in relevant pages and exports.
    • Improved internal code structure and naming for campaign-related components and hooks.
  • Chores

    • Removed unnecessary console logs and improved error logging for cleaner output.
    • Updated documentation comments and formatting for clarity.

@akaia-shadowfox akaia-shadowfox self-assigned this Jun 12, 2025
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 12, 2025

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

Name Status Preview Comments Updated (UTC)
potlock-next-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 12, 2025 4:12pm

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 12, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This update introduces a standardized SWR configuration for data-fetching hooks, refactors campaign form components by replacing CampaignForm with CampaignEditor, enhances file upload handling via Pinata, and improves type safety in contract client functions. Additional changes include minor UI text updates, typo corrections, and removal of debugging logs.

Changes

Files / Areas Change Summary
src/common/constants.ts Added CONTRACT_SWR_CONFIG constant for SWR configuration.
src/common/api/coingecko/hooks.ts
src/common/blockchains/near-protocol/hooks.ts
src/common/contracts/core/campaigns/hooks.ts
src/common/contracts/ref-finance/ref-exchange/hooks.ts
src/common/contracts/tokens/fungible/hooks.ts
Updated all useSWR calls to use the new CONTRACT_SWR_CONFIG for standardized caching and revalidation behavior.
src/common/contracts/core/campaigns/client.ts Refactored contract API functions to use explicit parameter type aliases, concise arrow functions, and explicit generic types; removed cache option.
src/common/contracts/core/pot/client.ts Removed MemoryCache import and cache option from contract API initialization.
src/common/services/pinata/client.ts Added FileUploadResult type and new uploadFile function; removed error handling from upload.
src/common/services/pinata/hooks.ts Refactored useFileUpload to accept an onSuccess callback, removed file state, updated upload logic to use uploadFile, and improved error handling.
src/common/services/pinata/index.ts Exported all types from ./client in addition to ./hooks.
src/entities/campaign/components/editor.tsx Renamed CampaignForm to CampaignEditor, updated props, refactored image upload logic to use new file upload hook, improved UI and structure.
src/entities/campaign/components/CampaignSettings.tsx Switched from CampaignForm to CampaignEditor, improved close callback handling, fixed typos, and refined error handling/UI formatting.
src/entities/campaign/components/CampaignBanner.tsx
src/entities/campaign/components/CampaignProgressBar.tsx
Fixed typo: renamed minAmountFLoat to minAmountFloat throughout both components.
src/entities/campaign/hooks/forms.ts Enhanced useCampaignForm with onUpdateSuccess callback, added cover image upload handler, improved submission logic, and updated return value.
src/entities/campaign/index.ts Replaced export of CampaignForm with export of editor module.
src/entities/campaign/models/effects.ts Updated imports to use nearProtocolClient for wallet and RPC access.
src/entities/campaign/models/schema.ts Changed comment style and improved spacing in campaign schemas; no logic changes.
src/pages/campaign/create.tsx Switched to rendering CampaignEditor instead of CampaignForm.
src/pages/campaigns.tsx Updated hero section text, layout, and heading structure for improved clarity.
src/pathnames.ts Added CAMPAIGN_BY_ID_SETTINGS route selector for campaign settings paths.
src/common/services/images.ts
src/common/services/ipfs.ts
src/features/donation/models/effects/group-list-donation.ts
src/features/profile-setup/components/form.tsx
src/pages/feed/index.tsx
src/pages/pot/[potId]/applications.tsx
Removed or improved logging (console.log/error) and error handling for cleaner output.
src/common/_config/staging.env-config.ts Disabled "Profile configuration" feature flag in staging environment.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant CampaignEditor
  participant useFileUpload
  participant PinataClient

  User->>CampaignEditor: Selects cover image file
  CampaignEditor->>useFileUpload: handleFileInputChange(file)
  useFileUpload->>PinataClient: uploadFile(file)
  PinataClient-->>useFileUpload: { ipfsHash, url }
  useFileUpload-->>CampaignEditor: onSuccess({ ipfsHash, url })
  CampaignEditor->>Form: set cover_image_url to uploaded url
Loading

Possibly related PRs

  • #408: Refactors campaign contracts client types and form upload logic, directly overlapping with this PR.
  • #388: Adds/updates campaign contract client methods and types, overlapping in the same files and functions.
  • #357: Refactors campaign contract client functions, overlapping in function signatures and type usage.

Suggested reviewers

  • Ebube111

Poem

A bunny hopped with code so neat,
Replaced old forms with something sweet.
Campaigns now edit, upload, and flow,
With SWR configs in tow.
Typos fixed, the logs are gone—
Onward, PotLock, code hops on!
🐇✨


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c4ed41b and 8da426d.

📒 Files selected for processing (29)
  • src/common/_config/staging.env-config.ts (1 hunks)
  • src/common/api/coingecko/hooks.ts (2 hunks)
  • src/common/blockchains/near-protocol/hooks.ts (3 hunks)
  • src/common/constants.ts (2 hunks)
  • src/common/contracts/core/campaigns/client.ts (1 hunks)
  • src/common/contracts/core/campaigns/hooks.ts (5 hunks)
  • src/common/contracts/core/pot/client.ts (1 hunks)
  • src/common/contracts/ref-finance/ref-exchange/hooks.ts (1 hunks)
  • src/common/contracts/tokens/fungible/hooks.ts (3 hunks)
  • src/common/services/images.ts (1 hunks)
  • src/common/services/ipfs.ts (0 hunks)
  • src/common/services/pinata/client.ts (1 hunks)
  • src/common/services/pinata/hooks.ts (1 hunks)
  • src/common/services/pinata/index.ts (1 hunks)
  • src/entities/campaign/components/CampaignBanner.tsx (5 hunks)
  • src/entities/campaign/components/CampaignProgressBar.tsx (5 hunks)
  • src/entities/campaign/components/CampaignSettings.tsx (7 hunks)
  • src/entities/campaign/components/editor.tsx (11 hunks)
  • src/entities/campaign/hooks/forms.ts (8 hunks)
  • src/entities/campaign/index.ts (1 hunks)
  • src/entities/campaign/models/effects.ts (1 hunks)
  • src/entities/campaign/models/schema.ts (3 hunks)
  • src/features/donation/models/effects/group-list-donation.ts (0 hunks)
  • src/features/profile-setup/components/form.tsx (1 hunks)
  • src/pages/campaign/create.tsx (2 hunks)
  • src/pages/campaigns.tsx (1 hunks)
  • src/pages/feed/index.tsx (0 hunks)
  • src/pages/pot/[potId]/applications.tsx (0 hunks)
  • src/pathnames.ts (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@akaia-shadowfox akaia-shadowfox marked this pull request as ready for review June 12, 2025 16:04
@akaia-shadowfox akaia-shadowfox removed the request for review from Ebube111 June 12, 2025 16:04
@akaia-shadowfox akaia-shadowfox merged commit 8ef4aa2 into main Jun 12, 2025
1 of 5 checks passed
@akaia-shadowfox akaia-shadowfox deleted the staging branch June 12, 2025 16:10
@akaia-shadowfox akaia-shadowfox restored the staging branch June 12, 2025 16:10
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.

2 participants