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

added new contract task type in the admin dashboard #843

Merged
merged 11 commits into from
Oct 6, 2024

Conversation

PoulavBhowmick03
Copy link
Contributor

@PoulavBhowmick03 PoulavBhowmick03 commented Sep 28, 2024

Fixes #836

Please add the labels corresponding to the type of changes your PR introduces:

  • Feature
  • Refactoring (no functional changes, no API changes)

Screenshot

image

Summary by CodeRabbit

  • New Features

    • Introduced a new step type "Contract" for enhanced task management.
    • Added a ContractStep component for inputting contract details.
    • Updated task options to include "Contract".
    • Integrated functionality for creating and updating contracts within the task management flow.
    • Enhanced error handling for contract task operations.
  • Bug Fixes

    • Improved handling of contract-related data in task forms.
  • Documentation

    • Expanded type definitions for creating and updating contracts.

Copy link

vercel bot commented Sep 28, 2024

@PoulavBhowmick03 is attempting to deploy a commit to the LFG Labs Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

coderabbitai bot commented Sep 28, 2024

Walkthrough

The changes introduce a new task type, "Contract," to the admin dashboard, enhancing the existing functionality for managing tasks. This includes updates to type definitions, the addition of a new component for rendering contract details, and modifications to existing components to accommodate the new task type. The implementation allows for the creation of contract-related tasks, aligning with the proposed objectives in the linked issue.

Changes

Files Change Summary
app/admin/quests/create/page.tsx Added handling for a new task type "Contract" in the handleCreateTask function, integrating error handling and calling AdminService.createContract.
components/admin/formSteps/TaskDetailsForm.tsx Introduced conditional rendering for "Contract" steps, adding ContractStep component to handle contract details.
components/admin/taskSteps/contractStep.tsx Added a new ContractStep component to render input fields for contract details, including handling input changes.
constants/admin.ts Added "Contract" to TASK_OPTIONS and defined ContractInput with properties for contract details; updated getDefaultValues to return ContractInput.
services/authService.ts Added asynchronous functions createContract and updateContract for creating and updating contract tasks via API requests, including error handling.
types/frontTypes.d.ts Updated StepMap and TaskType to include the new "Contract" type and defined ContractInputType.

Assessment against linked issues

Objective Addressed Explanation
Add a new task type in the admin dashboard: contract (#836)
Reuse fields from the verify_balance task (#836) It is unclear if the implementation follows this guideline.
Ensure the creation process of the new task type is implemented in the front (#836)

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 8c6d97b and bf2e368.

📒 Files selected for processing (1)
  • components/admin/taskSteps/contractStep.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • components/admin/taskSteps/contractStep.tsx

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Outside diff range and nitpick comments (7)
constants/admin.ts (1)

134-135: LGTM with a minor suggestion

The update to the getDefaultValues function correctly handles the new "Contract" task type. This change is consistent with the existing structure and fulfills the PR objective.

Consider adding a TypeScript return type annotation to the getDefaultValues function for improved type safety:

export const getDefaultValues = (type: TaskType): Record<string, unknown> => {
  // ... existing code ...
};

This change would make the function's return type explicit and consistent across all cases.

types/frontTypes.d.ts (1)

Line range hint 319-337: Summary: Type definitions for the new "Contract" task type are well-integrated.

The changes to types/frontTypes.d.ts provide a solid foundation for implementing the new "contract" task type in the admin dashboard. The additions are consistent with the existing type structure and align well with the PR objectives.

Next steps:

  1. Implement the ContractInput object if not already done.
  2. Update relevant components and functions to handle the new "Contract" task type.
  3. Ensure that the admin dashboard UI is updated to include the option for creating "Contract" tasks.
  4. Add unit tests to cover the new type and its usage.
types/backTypes.d.ts (2)

405-412: LGTM! Consider refining the calls property type.

The CreateContract type aligns well with the PR objectives and is consistent with other "Create" types in the file. Good job on replacing 'contracts' with 'calls' as per the linked issue.

Consider defining a more specific type for the calls property instead of using the broad object type. This could improve type safety and provide better documentation. For example:

calls: {
  [key: string]: {
    inputs: Array<{ name: string; type: string }>;
    outputs: Array<{ name: string; type: string }>;
  };
}

This structure allows for multiple function calls, each with its inputs and outputs defined.


414-421: LGTM! Consider refining the calls property type.

The UpdateContract type is well-structured and consistent with other "Update" types in the file. Making all properties except id optional is a good practice for update operations.

As with the CreateContract type, consider defining a more specific type for the calls property:

calls?: {
  [key: string]: {
    inputs: Array<{ name: string; type: string }>;
    outputs: Array<{ name: string; type: string }>;
  };
}

This will provide better type safety and documentation while maintaining consistency with the CreateContract type.

components/admin/formSteps/TaskDetailsForm.tsx (1)

108-115: LGTM: ContractStep rendering logic

The conditional rendering for the ContractStep component is correctly implemented and consistent with other task types. This addition successfully fulfills the PR objective of adding a new contract task type to the admin dashboard.

For improved maintainability, consider refactoring the task type checks into a separate function or using a switch statement. This would make it easier to add new task types in the future and improve code readability. For example:

const renderTaskStep = (step: StepMap, index: number) => {
  switch (step?.type) {
    case "Quiz":
      return <QuizStep {...props} />;
    case "Discord":
      return <DiscordStep {...props} />;
    // ... other cases ...
    case "Contract":
      return <ContractStep {...props} />;
    default:
      return null;
  }
};

Then you can simply call renderTaskStep(step, currentTask) in the renderTask function.

app/admin/quests/dashboard/[questId]/page.tsx (2)

49-49: LGTM! Consider a minor improvement for consistency.

The addition of the "Contract" type to the StepMap union is correct and aligns with the PR objectives. Well done!

For consistency with other task types, consider renaming the ContractInputType to something like ContractTaskInputType. This would make it clearer that it's specifically for contract tasks and maintain naming consistency with other input types.


Line range hint 1-725: Consider refactoring for improved code organization

While not directly related to the current changes, the file's size and complexity suggest that it might benefit from some refactoring.

Consider breaking down this large component into smaller, more focused components. This could improve readability, maintainability, and testability. Some suggestions:

  1. Extract the form rendering logic (e.g., renderFormStep) into separate components.
  2. Move the task handling functions (handleAddTasks, handleDeleteTasks, handleUpdateTasks) into a custom hook or utility file.
  3. Consider using the React Context API for managing some of the shared state, which could help reduce prop drilling.

These changes would make the code more modular and easier to understand and maintain in the long run.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 499d3f7 and 8cd7973.

📒 Files selected for processing (6)
  • app/admin/quests/dashboard/[questId]/page.tsx (1 hunks)
  • components/admin/formSteps/TaskDetailsForm.tsx (2 hunks)
  • components/admin/taskSteps/contractStep.tsx (1 hunks)
  • constants/admin.ts (2 hunks)
  • types/backTypes.d.ts (1 hunks)
  • types/frontTypes.d.ts (3 hunks)
🔇 Additional comments (13)
components/admin/taskSteps/contractStep.tsx (4)

13-17: Component definition looks good

The ContractStep component is well-defined as a functional component with proper type annotations. The props are correctly destructured, making the code clean and easy to read.


18-48: Component structure and layout look good

The component's structure is well-organized, using a flex layout for proper spacing. Each TextInput is correctly configured with the necessary props, providing a clean and user-friendly interface for entering contract details.

Also applies to: 57-58


61-61: Component export is correct

The ContractStep component is properly exported as the default export, which is the recommended practice for exporting a single component from a file.


1-61: Overall implementation aligns well with PR objectives

The ContractStep component successfully introduces the new 'contract' task type in the admin dashboard as required. It reuses fields from existing task types and adds the new 'calls' field for JSON input. The implementation is clean, follows React best practices, and focuses on the front-end creation process as specified in the PR objectives.

A few points to consider:

  1. Add the missing import for the StepMap type.
  2. Implement JSON validation for the 'calls' input to fully meet the requirements.

Once these minor adjustments are made, the component will fully satisfy the PR objectives and provide a solid foundation for the new contract task type in the admin dashboard.

constants/admin.ts (2)

21-21: LGTM: New task type added successfully

The addition of "Contract" to the TASK_OPTIONS array aligns with the PR objective of introducing a new task type in the admin dashboard.


21-21: Summary: New Contract task type successfully implemented

The changes in this file successfully introduce the new "Contract" task type to the admin dashboard, aligning with the PR objectives. The implementation is consistent with the existing code structure and follows the patterns established for other task types.

Key points:

  1. "Contract" option added to TASK_OPTIONS.
  2. New ContractInput constant defined with appropriate properties.
  3. getDefaultValues function updated to handle the new task type.

While the implementation is functional, consider the suggested improvements to enhance type safety and documentation, particularly for the ContractInput constant and the getDefaultValues function.

Overall, good job on implementing the new feature!

Also applies to: 119-125, 134-135

types/frontTypes.d.ts (3)

328-328: LGTM! Type alias is consistent with other input types.

The addition of the ContractInputType type alias is consistent with the pattern used for other input types and aligns with the changes made to the StepMap type.


337-337: LGTM! Verify usage of the new task type.

The addition of "Contract" to the TaskType union completes the set of changes needed to fully integrate the new "contract" task type into the type system.

To ensure proper integration, please verify the usage of the new "Contract" task type throughout the codebase. Run the following script:

#!/bin/bash
# Description: Verify the usage of the new "Contract" task type

# Test: Search for usage of the "Contract" task type
rg --type typescript '"Contract"'

319-319: LGTM! Verify the existence of ContractInput.

The addition of the Contract type to the StepMap union is consistent with the existing structure and aligns with the PR objective of adding a new "contract" task type.

Please ensure that the ContractInput object is properly defined elsewhere in the codebase. Run the following script to verify its existence:

✅ Verification successful

Re-attempting verification of ContractInput object existence.

The previous script encountered an error due to an unrecognized file type typescript. Let's search for ContractInput without specifying the file type to ensure the definition exists.


Verified: ContractInput object is defined in constants/admin.ts.

The presence of ContractInput ensures that the Contract type is fully integrated into the StepMap union as intended.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence of ContractInput object

# Test: Search for ContractInput definition
rg --type typescript 'const ContractInput = '

Length of output: 70


Script:

#!/bin/bash
# Description: Verify the existence of ContractInput object without specifying file type

# Search for ContractInput definition across all files
rg 'const ContractInput = '

Length of output: 79

types/backTypes.d.ts (1)

405-421: Great job implementing the new contract task type!

The addition of CreateContract and UpdateContract types aligns perfectly with the PR objectives and the requirements from the linked issue. These new types provide a clear structure for creating and updating contract tasks in the admin dashboard.

Key points:

  1. The types are consistent with existing patterns in the file.
  2. The calls field has been implemented as requested, replacing the contracts field.
  3. No existing types were modified, reducing the risk of breaking changes.

These changes lay a solid foundation for implementing the new contract task type in the admin dashboard.

components/admin/formSteps/TaskDetailsForm.tsx (2)

18-18: LGTM: Import statement for ContractStep

The import statement for ContractStep is correctly added and follows the existing pattern for importing task step components.


Line range hint 1-265: Summary: Successfully implemented Contract task type

The changes in this file successfully implement the new Contract task type in the admin dashboard, aligning perfectly with the PR objectives and the requirements outlined in the linked issue #836. The implementation follows the existing patterns and structure of the component, ensuring consistency and maintainability.

Key points:

  1. The ContractStep component is correctly imported.
  2. The rendering logic for the Contract task type is properly integrated into the existing conditional structure.
  3. The changes are minimal and focused, without altering existing functionality.

These modifications effectively extend the TaskDetailsForm component to handle the new Contract task type, fulfilling the goal of adding this feature to the admin dashboard.

app/admin/quests/dashboard/[questId]/page.tsx (1)

Line range hint 559-725: Implement Contract task handling in task management functions

The handleAddTasks, handleDeleteTasks, and handleUpdateTasks functions need to be updated to include logic for the new "Contract" task type. Currently, these functions handle all other task types but omit the "Contract" type.

To ensure consistent behavior and prevent potential errors, please add the necessary logic for Contract tasks in these functions. Here's an example of how you might implement it in the handleAddTasks function:

 } else if (step.type === "Balance") {
   await AdminService.createBalance({
     quest_id: questId.current,
     name: step.data.balance_name,
     desc: step.data.balance_desc,
     contracts: step.data.balance_contracts,
     cta: step.data.balance_cta,
     href: step.data.balance_href,
   });
+} else if (step.type === "Contract") {
+  await AdminService.createContract({
+    quest_id: questId.current,
+    name: step.data.contract_name,
+    desc: step.data.contract_desc,
+    // Add other necessary fields for Contract tasks
+  });
 }

Similar changes should be made to handleDeleteTasks and handleUpdateTasks functions.

To ensure that the AdminService has the necessary methods for Contract tasks, run the following script:

This will help verify if the backend methods for Contract tasks are already in place or if they need to be added.

components/admin/taskSteps/contractStep.tsx Show resolved Hide resolved
components/admin/taskSteps/contractStep.tsx Outdated Show resolved Hide resolved
constants/admin.ts Outdated Show resolved Hide resolved
@Marchand-Nicolas Marchand-Nicolas added the 🔥 Ready for review The PR is now ready for review label Sep 28, 2024
Copy link
Collaborator

@Marchand-Nicolas Marchand-Nicolas left a comment

Choose a reason for hiding this comment

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

Could you just adjust the Calls placeholder (I forgot to add a specification for it in the issue), with:
e.g.: [{ "contract": "0x...", "entry_point": "transfer", "call_data": ["0x..."], "regex": "..." }]

All the code is good! Just a few little things to add:
in services\authService.ts:
add createContract and updateContract just like for the balance quest

in app\admin\quests\dashboard\[questId]\page.tsx:
update handleAddTasks, handleDeleteTasks and handleUpdateTasks by adding the contract task type

After these quick changes, should be good!

@Marchand-Nicolas Marchand-Nicolas added ❌ Change request Change requested from reviewer and removed 🔥 Ready for review The PR is now ready for review labels Sep 28, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (10)
types/backTypes.d.ts (3)

51-51: Approve the addition of calls property with a suggestion for improvement.

The addition of the calls property to the UserTask type aligns well with the PR objectives for introducing the new contract task type. This change allows for storing contract-related data flexibly.

Consider using a more specific type for calls instead of object | null to improve type safety. For example:

calls: Record<string, unknown> | null;

This change would still allow for flexible JSON input while providing better type checking.


406-413: Approve the new CreateContract type with a suggestion for improvement.

The new CreateContract type is well-structured and aligns with the PR objectives. It includes all necessary properties for creating a contract task, including the calls property for JSON input.

For consistency with other types in the file and to improve type safety, consider using a more specific type for the calls property:

export type CreateContract = {
  quest_id: number;
  name: string;
  desc: string;
  href: string;
  cta: string;
  calls: Record<string, unknown>;
};

This change maintains flexibility for JSON input while providing better type checking.


415-422: Approve the new UpdateContract type with a suggestion for improvement.

The new UpdateContract type is well-structured and consistent with other update types in the file. Making all properties except id optional is appropriate for an update operation.

For consistency with the suggested improvement in CreateContract and to improve type safety, consider using a more specific type for the calls property:

export type UpdateContract = {
  id: number;
  name?: string;
  desc?: string;
  href?: string;
  cta?: string;
  calls?: Record<string, unknown>;
};

This change maintains flexibility for JSON input while providing better type checking.

services/authService.ts (3)

359-373: LGTM: createContract function implemented correctly.

The createContract function follows the established pattern for create functions in this file. It correctly uses the CreateContract type for parameters and sends a POST request to the appropriate endpoint.

Consider enhancing the error handling to return the error or a standardized error object, rather than just logging it. This would allow callers to handle errors more effectively.

 } catch (err) {
   console.log("Error creating contract task", err);
+  return { error: "Failed to create contract task" };
 }

375-389: LGTM: updateContract function implemented correctly with minor suggestions.

The updateContract function follows the established pattern for update functions in this file. It correctly uses the UpdateContract type for parameters and sends a POST request to the appropriate endpoint.

  1. Consider enhancing the error handling to return the error or a standardized error object, similar to the suggestion for createContract.
  2. For consistency with other functions in the file, consider using err instead of error in the catch block.
-  } catch (error) {
-    console.log("Error updating contract task", error);
+  } catch (err) {
+    console.log("Error updating contract task", err);
+    return { error: "Failed to update contract task" };
   }

Line range hint 1-573: Overall assessment: New contract task type successfully implemented.

The changes to services/authService.ts effectively introduce the new contract task type. The implementation is consistent with existing patterns in the file, maintaining code structure and conventions. Minor suggestions have been made for error handling and naming consistency to further improve the code quality.

To enhance the maintainability of this growing service file:

  1. Consider grouping related functions (e.g., all contract-related functions) into separate files or modules.
  2. Implement a common error handling utility to standardize error responses across all service functions.
  3. Use a configuration file for API endpoints to centralize URL management.

These refactoring suggestions can be addressed in future PRs to improve the overall architecture of the admin service.

app/admin/quests/dashboard/[questId]/page.tsx (4)

219-230: LGTM with a suggestion: Contract task formatting

The addition of the Contract task type in the tasksFormatter function is consistent with the existing pattern and correctly formats the Contract task data.

However, consider parsing the calls property as JSON if it's expected to be a JSON string. This would ensure that the data is properly structured when used elsewhere in the application.

Consider modifying the contract_calls assignment as follows:

-            contract_calls: task.calls,
+            contract_calls: typeof task.calls === 'string' ? JSON.parse(task.calls) : task.calls,

This change would ensure that the calls data is properly parsed if it's stored as a JSON string in the database.


525-533: LGTM with suggestions: Contract task creation

The addition of the Contract task creation in the handleAddTasks function is consistent with the existing pattern and correctly calls the AdminService.createContract method.

However, consider the following improvements:

  1. Ensure that the calls property is properly formatted as JSON before sending it to the API.
  2. Add error handling specific to the Contract task creation.

Consider modifying the Contract task creation as follows:

 } else if (step.type === "Contract") {
   await AdminService.createContract({
     quest_id: questId.current,
     name: step.data.contract_name,
     desc: step.data.contract_desc,
     href: step.data.contract_href,
     cta: step.data.contract_cta,
-    calls: step.data.calls,
+    calls: JSON.stringify(step.data.contract_calls),
   });
+  } catch (error) {
+    console.error("Error creating Contract task:", error);
+    showNotification("Failed to create Contract task. Please try again.", "error");
 }

These changes ensure that the calls data is properly stringified before sending to the API and provide specific error handling for Contract task creation.


632-640: LGTM with suggestions: Contract task update

The addition of the Contract task update in the handleUpdateTasks function is consistent with the existing pattern and correctly calls the AdminService.updateContract method.

However, consider the following improvements:

  1. Ensure that the calls property is properly formatted as JSON before sending it to the API.
  2. Add error handling specific to the Contract task update.
  3. Use the contract_calls property name consistently with the previous parts of the code.

Consider modifying the Contract task update as follows:

 } else if (step.type === "Contract") {
-  await AdminService.updateContract({
-    id: step.data.id,
-    name: step.data.contract_name,
-    desc: step.data.contract_desc,
-    href: step.data.contract_href,
-    cta: step.data.contract_cta,
-    calls: step.data.calls,
-  });
+  try {
+    await AdminService.updateContract({
+      id: step.data.id,
+      name: step.data.contract_name,
+      desc: step.data.contract_desc,
+      href: step.data.contract_href,
+      cta: step.data.contract_cta,
+      calls: JSON.stringify(step.data.contract_calls),
+    });
+  } catch (error) {
+    console.error("Error updating Contract task:", error);
+    showNotification("Failed to update Contract task. Please try again.", "error");
+  }
 }

These changes ensure that the calls data is properly stringified before sending to the API, provide specific error handling for Contract task updates, and maintain consistency in property naming.


Line range hint 1-840: Overall assessment: Contract task type implementation

The implementation of the new Contract task type in the quest editing functionality is well-integrated and consistent with the existing patterns in the codebase. The changes appropriately extend the type system, task formatting, creation, and update processes to include the new task type.

However, there are a few areas where the implementation could be improved:

  1. Consistency in property naming: Ensure that contract_calls is used consistently instead of calls in some places.
  2. JSON handling: The calls property should be stringified when sending to the API and parsed when receiving from the API to ensure proper data structure.
  3. Error handling: Add specific error handling for Contract task creation and updates.

Addressing these points will enhance the robustness and maintainability of the code.

Consider creating a utility function for handling the JSON conversion of the calls property. This would centralize the logic and make it easier to maintain consistency throughout the codebase. For example:

const handleContractCalls = (calls: any): string => {
  return typeof calls === 'string' ? calls : JSON.stringify(calls);
};

This function could then be used in both the creation and update processes for Contract tasks.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 8cd7973 and 3607c21.

📒 Files selected for processing (4)
  • app/admin/quests/dashboard/[questId]/page.tsx (4 hunks)
  • components/admin/taskSteps/contractStep.tsx (1 hunks)
  • services/authService.ts (3 hunks)
  • types/backTypes.d.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • components/admin/taskSteps/contractStep.tsx
🔇 Additional comments (4)
types/backTypes.d.ts (1)

Line range hint 1-423: Overall implementation aligns well with PR objectives.

The changes to types/backTypes.d.ts provide a solid foundation for implementing the new contract task type in the admin dashboard. The additions of CreateContract and UpdateContract types, along with the modification of the UserTask type, align well with the PR objectives and the requirements outlined in the linked issue.

A few minor suggestions have been made to improve type safety, particularly regarding the calls property. These suggestions, if implemented, would maintain the flexibility required for JSON input while providing better type checking.

To ensure that these type changes are properly utilized throughout the codebase, consider running the following verification script:

This script will help identify areas where the new types and properties are being used, ensuring consistent implementation across the codebase.

services/authService.ts (2)

25-26: LGTM: Import statements updated correctly.

The new types CreateContract and UpdateContract have been properly added to the import list, maintaining consistency with other task types in the file.


552-553: LGTM: AdminService export updated correctly.

The createContract and updateContract functions have been properly added to the AdminService object, maintaining the existing order and structure of the export.

app/admin/quests/dashboard/[questId]/page.tsx (1)

49-49: LGTM: Contract type added to StepMap

The addition of the Contract type to the StepMap union is consistent with the existing pattern and correctly extends the type system to support the new Contract task type.

desc: step.data.contract_desc,
href: step.data.contract_href,
cta: step.data.contract_cta,
calls: step.data.calls,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here, this needs to be an object, not a string. You can simply use JSON.parse()

href: step.data.contract_href,
cta: step.data.contract_cta,
calls: step.data.calls,
});
}
} catch (error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

In this catch, you can add

showNotification(`Error adding ${step.type} task: ${error}`, "error");

So that if there is any issue while parsing the JSON, the user is instantly informed

desc: step.data.contract_desc,
href: step.data.contract_href,
cta: step.data.contract_cta,
calls: step.data.calls,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here for JSON.parse()

@@ -607,6 +629,15 @@ export default function Page({ params }: QuestIdProps) {
cta: step.data.balance_cta,
href: step.data.balance_href,
});
} else if (step.type === "Contract") {
await AdminService.updateContract({
Copy link
Collaborator

Choose a reason for hiding this comment

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

Also you could wrap this call with a try catch and add show

Notification(`Error updating ${step.type} task: ${error}`, "error");

in the catch

Copy link
Collaborator

@Marchand-Nicolas Marchand-Nicolas left a comment

Choose a reason for hiding this comment

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

A few changes and we can merge, well done!

Copy link
Collaborator

@Marchand-Nicolas Marchand-Nicolas left a comment

Choose a reason for hiding this comment

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

Should be good after that!

app/admin/quests/dashboard/[questId]/page.tsx Outdated Show resolved Hide resolved
@PoulavBhowmick03
Copy link
Contributor Author

@Marchand-Nicolas ptal

Copy link
Collaborator

@Marchand-Nicolas Marchand-Nicolas left a comment

Choose a reason for hiding this comment

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

Sorry, it looks like I didn't see it: the contract task is missing from handleCreateTask in app/admin/quests/create/page.tsx

@Marchand-Nicolas
Copy link
Collaborator

Hello @PoulavBhowmick03 OD hack ends on Sunday (6). Everything okay ?

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (8)
types/backTypes.d.ts (4)

53-53: LGTM! Consider using a more specific type for calls.

The addition of the calls property to the UserTask type aligns well with the PR objectives. It allows for storing contract-related data flexibly.

For improved type safety, consider defining a more specific type for calls instead of using object. For example:

calls: Record<string, unknown> | null;

This provides better type inference while still allowing for flexible JSON-like structures.


408-415: LGTM! Consider using a more specific type for calls.

The CreateContract type is well-structured and consistent with other "Create" types in the file. It includes all necessary properties for creating a contract task.

For improved type safety and consistency with the UserTask type, consider using a more specific type for the calls property:

calls: Record<string, unknown>;

This provides better type inference while still allowing for flexible JSON-like structures.


417-424: LGTM! Consider using a more specific type for calls.

The UpdateContract type is well-structured and consistent with other "Update" types in the file. It correctly includes all necessary properties for updating a contract task, with appropriate optionality.

For improved type safety and consistency with the UserTask and CreateContract types, consider using a more specific type for the calls property:

calls?: Record<string, unknown>;

This provides better type inference while still allowing for flexible JSON-like structures.


53-53: Summary: New contract task type successfully implemented in type definitions.

The changes to this file successfully implement the new contract task type as outlined in the PR objectives and linked issue #836. The additions and modifications include:

  1. A new calls property in the UserTask type.
  2. A new CreateContract type for creating contract tasks.
  3. A new UpdateContract type for updating contract tasks.

These changes are well-structured and consistent with existing patterns in the file. They provide the necessary type definitions for implementing the new task type in the admin dashboard.

To ensure full alignment with the PR objectives:

  1. Verify that the backend implementation (which is out of scope for this PR) will be able to handle the calls field as a JSON input.
  2. Ensure that the frontend implementation uses these new types correctly when creating and updating contract tasks.
  3. Consider adding unit tests for these new types to verify their correctness and prevent regressions in future updates.

Also applies to: 408-424

services/authService.ts (3)

Line range hint 361-378: LGTM with a minor suggestion

The createContract function is well-implemented and follows the established pattern for create functions in this file. It correctly sends a POST request to the appropriate endpoint and includes proper error handling.

However, there's a minor inconsistency in the error logging message:

Consider updating the error message for consistency:

- console.log("Error creating contract task", err);
+ console.log("Error while creating contract task", err);

This change would align the error message with the style used in other functions throughout the file.

🧰 Tools
🪛 Biome

[error] 364-364: expected : but instead found createCustomApi

Remove createCustomApi

(parse)


Line range hint 380-402: Resolve merge conflict in updateContract function

There's an unresolved merge conflict in the updateContract function. This will cause syntax errors and prevent the code from running correctly.

Please resolve the merge conflict by removing the conflict markers and keeping the correct implementation. The function should follow the pattern of other update functions in the file. Here's a suggested resolution:

const updateContract = async (params: UpdateContract) => {
  try {
    const response = await fetch(`${baseurl}/admin/tasks/contract/update`, {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
        Authorization: `Bearer ${localStorage.getItem("token")}`,
      },
      body: JSON.stringify(params),
    });
    return await response.json();
  } catch (error) {
    console.log("Error while updating contract task", error);
  }
};

Make sure to test the function after resolving the conflict to ensure it works as expected.

🧰 Tools
🪛 Biome

[error] 378-378: expected , but instead found ;

Remove ;

(parse)


[error] 382-383: Expected a property, a shorthand property, a getter, a setter, or a method but instead found '==='.

Expected a property, a shorthand property, a getter, a setter, or a method here.

(parse)


[error] 383-383: Expected an expression but instead found '==='.

Expected an expression here.

(parse)


[error] 383-383: Expected an expression but instead found '='.

Expected an expression here.

(parse)


[error] 382-383: Invalid assignment to { ======

This expression cannot be assigned to

(parse)


[error] 384-384: expected , but instead found ;

Remove ;

(parse)


[error] 385-386: Expected a catch clause but instead found '}'.

Expected a catch clause here.

(parse)


[error] 382-384: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


Unresolved Merge Conflict Detected in services/authService.ts

A merge conflict remains at line 383 in the updateContract function. Please resolve this conflict to ensure the codebase remains stable and the PR can be approved.

🔗 Analysis chain

Line range hint 1-570: Summary of changes and action items

The changes to services/authService.ts successfully introduce the new contract task type, aligning with the PR objectives. The implementation follows the established patterns for other task types in this file.

Key points to address:

  1. Resolve the merge conflict in the updateContract function.
  2. Consider updating the error logging message in the createContract function for consistency.

Once these items are addressed, the changes will be ready for approval. Great work on implementing the new contract task type!

After resolving the merge conflict, please run the following command to ensure there are no remaining conflict markers:

If this command returns any results, it indicates that there are still unresolved merge conflicts that need to be addressed.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for remaining merge conflict markers
grep -n "<<<<<<< HEAD\|=======\|>>>>>>> " services/authService.ts

Length of output: 79

🧰 Tools
🪛 Biome

[error] 378-378: expected , but instead found ;

Remove ;

(parse)


[error] 382-383: Expected a property, a shorthand property, a getter, a setter, or a method but instead found '==='.

Expected a property, a shorthand property, a getter, a setter, or a method here.

(parse)


[error] 383-383: Expected an expression but instead found '==='.

Expected an expression here.

(parse)


[error] 383-383: Expected an expression but instead found '='.

Expected an expression here.

(parse)


[error] 382-383: Invalid assignment to { ======

This expression cannot be assigned to

(parse)


[error] 384-384: expected , but instead found ;

Remove ;

(parse)


[error] 385-386: Expected a catch clause but instead found '}'.

Expected a catch clause here.

(parse)


[error] 382-384: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)

app/admin/quests/dashboard/[questId]/page.tsx (1)

Line range hint 1-853: Overall assessment: Contract task type implementation is good, with room for improvement.

The implementation of the Contract task type is generally well-done and consistent with existing patterns. However, there are a few areas that could be improved:

  1. JSON parsing: Consider adding error handling for JSON parsing in the createContract function, similar to what's been done in the updateContract function.

  2. Consistency: To maintain consistency, you might want to add similar try-catch blocks for other task types in the handleAddTasks and handleUpdateTasks functions.

  3. Error messages: Consider making error messages more specific to each operation (create, update, delete) for better debugging and user feedback.

To improve overall code quality and maintainability, consider the following:

  1. Extract common task handling logic into separate functions to reduce code duplication.
  2. Implement a more robust error handling strategy, possibly using a custom error class for different types of errors (e.g., NetworkError, ValidationError).
  3. Consider using TypeScript's discriminated unions more effectively to ensure type safety when handling different task types.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 0dc904c and 6a85acf.

📒 Files selected for processing (6)
  • app/admin/quests/dashboard/[questId]/page.tsx (6 hunks)
  • components/admin/formSteps/TaskDetailsForm.tsx (2 hunks)
  • constants/admin.ts (3 hunks)
  • services/authService.ts (5 hunks)
  • types/backTypes.d.ts (2 hunks)
  • types/frontTypes.d.ts (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • components/admin/formSteps/TaskDetailsForm.tsx
  • constants/admin.ts
🧰 Additional context used
🪛 Biome
services/authService.ts

[error] 378-378: expected , but instead found ;

Remove ;

(parse)


[error] 382-383: Expected a property, a shorthand property, a getter, a setter, or a method but instead found '==='.

Expected a property, a shorthand property, a getter, a setter, or a method here.

(parse)


[error] 383-383: Expected an expression but instead found '==='.

Expected an expression here.

(parse)


[error] 383-383: Expected an expression but instead found '='.

Expected an expression here.

(parse)


[error] 382-383: Invalid assignment to { ======

This expression cannot be assigned to

(parse)

🔇 Additional comments (10)
types/frontTypes.d.ts (4)

Line range hint 319-339: Summary: Contract task type successfully added to type definitions

The changes to add the new Contract task type to the type definitions are well-implemented and consistent with the existing structure. All necessary additions have been made to StepMap, ContractInputType, and TaskType.

Next steps:

  1. Run the provided verification scripts to ensure proper definition and usage of the new types.
  2. Review the implementation of the ContractInput const and the components that use the new Contract task type.
  3. Update any relevant documentation or comments to reflect the addition of the new task type.

Great job on expanding the type system to accommodate the new feature!


329-329: LGTM: Addition of ContractInputType

The addition of the ContractInputType as a type alias for typeof ContractInput is consistent with the existing structure and provides the necessary type for the Contract data in the StepMap union.

To ensure the ContractInput is properly defined, let's verify its definition:

#!/bin/bash
# Description: Verify the definition of ContractInput const
rg --type typescript "const ContractInput = \{" -A 10

339-339: LGTM: Addition of Contract to TaskType union

The addition of Contract to the TaskType union is consistent with the existing structure and aligns with the PR objective. This change ensures that Contract can be used as a valid task type throughout the application.

To ensure the new Contract task type is properly utilized, let's verify its usage across the codebase:

✅ Verification successful

** Addition of Contract to TaskType has been successfully verified across the codebase.**

All usages of the new Contract task type are consistent and align with the intended functionality. No issues were found during the verification process.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the new Contract task type
rg --type typescript '"Contract"' -C 2

Length of output: 90


Script:

#!/bin/bash
# Description: Verify the usage of the new Contract task type across all files
rg '"Contract"' -C 2

Length of output: 3090


319-319: LGTM: Addition of Contract type to StepMap

The addition of the Contract type to the StepMap discriminated union is consistent with the existing structure and aligns with the PR objective of adding a new "contract" task type.

To ensure consistency across the codebase, let's verify that the ContractInput type is properly defined:

services/authService.ts (2)

25-26: LGTM: Import statement updated correctly

The import statement has been appropriately updated to include the new types CreateContract and UpdateContract. This change aligns with the new functions being added to the file.


569-570: LGTM: AdminService object updated correctly

The AdminService object has been properly updated to include the new createContract and updateContract functions. This change ensures that these new functions are exported and can be used in other parts of the application, consistent with the pattern for other functions in this service.

app/admin/quests/dashboard/[questId]/page.tsx (4)

49-49: LGTM: New Contract task type added to StepMap.

The addition of the Contract task type to the StepMap union type is correct and consistent with the existing structure.


220-231: LGTM: Contract task type handling added to tasksFormatter.

The implementation for handling the Contract task type in the tasksFormatter function is correct and follows the existing pattern for other task types.


562-562: LGTM: Error handling for task creation.

The error handling for task creation is consistent with the existing pattern and provides useful feedback to the user.


658-670: Improved error handling for updateContract.

The try-catch block for updating the Contract task is a good addition. It provides specific error handling for this task type.

app/admin/quests/dashboard/[questId]/page.tsx Show resolved Hide resolved
@PoulavBhowmick03
Copy link
Contributor Author

@Marchand-Nicolas PTAL

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (1)
app/admin/quests/create/page.tsx (1)

388-395: Provide user feedback on errors during contract task creation

In the catch block, only logging the error to the console may not be sufficient for user experience. Consider displaying a notification to inform the user that an error occurred while creating the contract task.

Apply this diff to display an error notification:

            } catch (error) {
                console.error("Error while creating contract task:", error);
+               showNotification("Error while creating contract task", "error");
            }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 6a85acf and 077bb2b.

📒 Files selected for processing (1)
  • app/admin/quests/create/page.tsx (1 hunks)

app/admin/quests/create/page.tsx Outdated Show resolved Hide resolved
@PoulavBhowmick03
Copy link
Contributor Author

@Marchand-Nicolas

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (4)
app/admin/quests/create/page.tsx (4)

Line range hint 288-294: Correct the error message in the 'Custom' task type validation

In the validation for the 'Custom' task type, the error message incorrectly mentions 'Discord'. It should refer to 'Custom' to match the task type and avoid confusion.

Apply this diff to fix the error message:

          } else if (step.type === "Custom") {
            if (
              step.data.custom_name?.length === 0 ||
              step.data.custom_desc?.length === 0 ||
              step.data.custom_cta?.length === 0 ||
              step.data.custom_href?.length === 0 ||
              step.data.custom_api?.length === 0
            ) {
-             showNotification("Please fill all fields for Discord", "info");
+             showNotification("Please fill all fields for Custom", "info");
              return;
            }
            await AdminService.createCustom({
              quest_id: questId,
              name: step.data.custom_name,
              desc: step.data.custom_desc,
              cta: step.data.custom_cta,
              href: step.data.custom_href,
              api: step.data.custom_api,
            });
          }

Line range hint 380-385: Correct the error message in the 'CustomApi' task type error handling

In the catch block for the 'CustomApi' task type, the error message incorrectly mentions 'balance task'. It should be updated to 'custom API task' to accurately reflect the task type.

Apply this diff to fix the error message:

          } else if (step.type === "CustomApi") {
            try {
              await AdminService.createCustomApi({
                quest_id: questId,
                name: step.data.api_name,
                desc: step.data.api_desc,
                api_url: step.data.api_url,
                cta: step.data.api_cta,
                href: step.data.api_href,
                regex: step.data.api_regex
              });
            } catch (error) {
-             console.error("Error while creating balance task:", error);
+             console.error("Error while creating custom API task:", error);
            }
          }

Line range hint 314-320: Add error handling for 'Domain' task type

The 'Domain' task type lacks error handling to manage exceptions that may occur during the creation of the domain task. For consistency and to handle potential errors gracefully, consider adding a try-catch block similar to other task types.

Apply this diff to add error handling:

          } else if (step.type === "Domain") {
+           try {
              await AdminService.createDomain({
                quest_id: questId,
                name: step.data.domain_name,
                desc: step.data.domain_desc,
              });
+           } catch (error) {
+             console.error("Error while creating domain task:", error);
+             showNotification(`Error adding ${step.type} task: ${error}`, "error");
+           }
          }

Line range hint 317-327: Add validation for required fields in the 'Balance' task type

The 'Balance' task type block does not validate that all necessary fields are provided before calling AdminService.createBalance. Missing required fields can lead to unexpected errors. Consider adding a validation check similar to other task types to prompt the user if any fields are missing.

Apply this diff to add validation:

          } else if (step.type === "Balance") {
+           if (
+             !step.data.balance_name ||
+             !step.data.balance_desc ||
+             !step.data.balance_contracts ||
+             !step.data.balance_cta ||
+             !step.data.balance_href
+           ) {
+             showNotification("Please fill all fields for Balance", "info");
+             return;
+           }
            try {
              await AdminService.createBalance({
                quest_id: questId,
                name: step.data.balance_name,
                desc: step.data.balance_desc,
                contracts: step.data.balance_contracts,
                cta: step.data.balance_cta,
                href: step.data.balance_href,
              });
            } catch (error) {
              console.error("Error while creating balance task:", error);
            }
          }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 077bb2b and 54db25b.

📒 Files selected for processing (1)
  • app/admin/quests/create/page.tsx (1 hunks)

Comment on lines 386 to 399
} else if (step.type === "Contract"){
try {
await AdminService.createContract({
quest_id: questId,
name: step.data.contract_name,
desc: step.data.contract_desc,
href: step.data.contract_href,
cta: step.data.contract_cta,
calls: step.data.contract_calls,
});
} catch (error) {
console.error("Error while creating contract task:", error);
showNotification(`Error adding ${step.type} task: ${error}`, "error");
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Add JSON parsing and error handling for 'calls' field in 'Contract' task type

The 'calls' field in the 'Contract' task type should accept JSON input. Before passing step.data.contract_calls to AdminService.createContract, parse it using JSON.parse to ensure it is valid JSON. If parsing fails, display an error message using showNotification, similar to how it's handled in other task types.

Apply this diff to implement JSON parsing and error handling:

} else if (step.type === "Contract"){
+   try {
+     const calls = JSON.parse(step.data.contract_calls);
+   } catch (e) {
+     showNotification("Invalid JSON in 'calls' field for Contract", "error");
+     return;
+   }
    try {
      await AdminService.createContract({
        quest_id: questId,
        name: step.data.contract_name,
        desc: step.data.contract_desc,
        href: step.data.contract_href,
        cta: step.data.contract_cta,
-       calls: step.data.contract_calls,
+       calls: calls,
      });
    } catch (error) {
      console.error("Error while creating contract task:", error);
      showNotification(`Error adding ${step.type} task: ${error}`, "error");
    }
}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
} else if (step.type === "Contract"){
try {
await AdminService.createContract({
quest_id: questId,
name: step.data.contract_name,
desc: step.data.contract_desc,
href: step.data.contract_href,
cta: step.data.contract_cta,
calls: step.data.contract_calls,
});
} catch (error) {
console.error("Error while creating contract task:", error);
showNotification(`Error adding ${step.type} task: ${error}`, "error");
}
} else if (step.type === "Contract"){
try {
const calls = JSON.parse(step.data.contract_calls);
} catch (e) {
showNotification("Invalid JSON in 'calls' field for Contract", "error");
return;
}
try {
await AdminService.createContract({
quest_id: questId,
name: step.data.contract_name,
desc: step.data.contract_desc,
href: step.data.contract_href,
cta: step.data.contract_cta,
calls: calls,
});
} catch (error) {
console.error("Error while creating contract task:", error);
showNotification(`Error adding ${step.type} task: ${error}`, "error");
}

Copy link
Collaborator

@Marchand-Nicolas Marchand-Nicolas left a comment

Choose a reason for hiding this comment

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

There are several merging issues

const updateContract = async (params: UpdateContract) => {
try {
const response = await fetch(`${baseurl}/admin/tasks/contract/update`, {
=======
Copy link
Collaborator

Choose a reason for hiding this comment

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

Unexpected merge markers

@@ -316,6 +316,7 @@ type StepMap =
| { type: "None"; data: object }
| { type: "Domain"; data: DomainInputType }
| { type: "Balance"; data: BalanceInputType }
| { type: "Contract"; data: ContractInputType };
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove the ";" at the end of this line

Comment on lines +109 to +111
} else if (step?.type === "Contract") {
return (
<ContractStep
Copy link
Collaborator

Choose a reason for hiding this comment

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

Missing closing parenthesis

Copy link
Collaborator

@Marchand-Nicolas Marchand-Nicolas left a comment

Choose a reason for hiding this comment

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

Some issues that makes the code not work

constants/admin.ts Outdated Show resolved Hide resolved
components/admin/taskSteps/contractStep.tsx Outdated Show resolved Hide resolved
app/admin/quests/create/page.tsx Outdated Show resolved Hide resolved
@PoulavBhowmick03
Copy link
Contributor Author

@Marchand-Nicolas PTAL

Copy link
Collaborator

@Marchand-Nicolas Marchand-Nicolas left a comment

Choose a reason for hiding this comment

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

One last thing and we can merge!

<TextInput
onChange={(e) => handleTasksInputChange(e, index)}
value={step.data.contract_calls || ""}
name="calls"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Still not working, because here it should be contract_calls instead of calls

@PoulavBhowmick03
Copy link
Contributor Author

@Marchand-Nicolas

Copy link
Collaborator

@Marchand-Nicolas Marchand-Nicolas left a comment

Choose a reason for hiding this comment

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

Lgtm!

Copy link

vercel bot commented Oct 6, 2024

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

Name Status Preview Comments Updated (UTC)
starknet-quest ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 6, 2024 9:09pm

@Marchand-Nicolas Marchand-Nicolas merged commit 3a57ed7 into lfglabs-dev:testnet Oct 6, 2024
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
❌ Change request Change requested from reviewer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New contract task type in the admin dashboard
2 participants