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

Move all PPOProjectCard methods into one enum and callback #2190

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

Conversation

stevestreza-ksr
Copy link
Contributor

📲 What

This PR refactors PPOProjectCard to use a single enum and callback for handling user actions.

🤔 Why

Follow up from #2186. We wanted to merge that PR but there was an outstanding comment about refactoring an action into a new enum, so this continues that discussion.

🛠 How

The initial suggestion was to extend PPOProjectCardModel.Action to include sending a creator message and viewing backing details. That enum is coming from GraphQL and relates specifically to button actions, so it doesn't strictly make sense to extend that.

Instead I created a new enum that handles all the actions, and replaced the existing APIs with this. This isn't the only choice, though. We could do any of the following:

  1. We could leave the methods as is, and not make any changes like this.
  2. We could make an enum that has cases for viewBackerDetails, sendMessage, and buttonAction(PPOProjectCardModel.Action). Maybe renaming PPOProjectCardModel.Action to PPOProjectCardModel.ButtonAction in the process.
  3. We could make a separate callback for each option. (I think this is probably not an ideal outcome especially since we will be adding more cases in the future.)

✅ Acceptance criteria

Tests should pass.

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.

1 participant