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

feat: integrate contract registries #370

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

feat: integrate contract registries #370

wants to merge 3 commits into from

Conversation

ctrlc03
Copy link
Collaborator

@ctrlc03 ctrlc03 commented Oct 1, 2024

Integrate contract registries into the interface.

To fix:

  • Selected count doesn't change after approval in ApplicationsToApprove.tsx @kittybest can you help with this please?
Screenshot 2024-10-01 at 13 49 23

To finish:

  • Project search
  • Ballot
  • Results

re #263

Copy link

vercel bot commented Oct 1, 2024

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

Name Status Preview Comments Updated (UTC)
maci-platform ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 14, 2024 2:45pm

@ctrlc03 ctrlc03 self-assigned this Oct 1, 2024
@ctrlc03 ctrlc03 marked this pull request as draft October 1, 2024 13:53
@ctrlc03 ctrlc03 force-pushed the feat/registries branch 2 times, most recently from 9bb935c to 45c5ce0 Compare October 3, 2024 09:06
@ctrlc03 ctrlc03 force-pushed the feat/registries branch 2 times, most recently from 9210c61 to fd9de9a Compare October 3, 2024 10:41
@ctrlc03 ctrlc03 marked this pull request as ready for review October 3, 2024 15:03
Copy link
Collaborator

@0xmad 0xmad left a comment

Choose a reason for hiding this comment

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

@ctrlc03 thanks, just some comments and questions

packages/interface/src/hooks/useRegistry.ts Outdated Show resolved Hide resolved
packages/interface/src/hooks/useRegistry.ts Outdated Show resolved Hide resolved
packages/interface/src/utils/fetchApplications.ts Outdated Show resolved Hide resolved
packages/interface/src/utils/fetchProjects.ts Outdated Show resolved Hide resolved
packages/interface/src/utils/registry.ts Outdated Show resolved Hide resolved
packages/interface/src/utils/registry.ts Outdated Show resolved Hide resolved
packages/interface/src/utils/registry.ts Outdated Show resolved Hide resolved
@@ -29,7 +26,7 @@ import { getSemaphoreProof } from "~/utils/semaphore";

import type { IVoteArgs, MaciContextType, MaciProviderProps } from "./types";
import type { PCD } from "@pcd/pcd-types";
import type { EIP1193Provider } from "viem";
import type { IPollData } from "~/utils/fetchPoll";
Copy link
Contributor

Choose a reason for hiding this comment

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

I would suggest to put the IPollData to the ~/utils/types

@@ -410,15 +408,14 @@ export const MaciProvider: React.FC<MaciProviderProps> = ({ children }: MaciProv

/// check the poll data and tally data
useEffect(() => {
setIsLoading(true);

// if we have the subgraph url then it means we can get the poll data through there
if (config.maciSubgraphUrl) {
Copy link
Contributor

Choose a reason for hiding this comment

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

check if the user provided the maci subgraph url here, do we need a callback reminding user to provide the url if they don't? (instead of fetching the contract data as a backup method, we just remind them to provide the url)

isApproved?: boolean;
isLoading?: boolean;
}

export const ApplicationItem = ({
id,
index,
Copy link
Contributor

Choose a reason for hiding this comment

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

why rename id to index?

deleteBallot: () => void;
ballotContains: (id: string) => Vote | undefined;
ballotContains: (index: number) => Vote | undefined;
Copy link
Contributor

Choose a reason for hiding this comment

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

ballotContains should also be receiving projectIndex? maybe we should name the arguments in consistency

() => (rawReturn.data && rawReturn.data.length > 0) || (refetchedData && refetchedData.length > 0),
[rawReturn.data, refetchedData],
);
// determine whether the project is approved ornot
Copy link
Contributor

Choose a reason for hiding this comment

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

typo: approved or not


<i className="text-sm">Applications can be edited and approved until the Application period ends.</i>
</p>
<i className="text-sm">Applications can be edited and approved until the Application period ends.</i>
Copy link
Contributor

Choose a reason for hiding this comment

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

we cannot edit now, right? thinking about remove the "edited" wording, add it back only after we have this function?

* @param id - the application ID
* @returns the application
*/
export async function fetchApplicationById(registryAddress: string, id: string): Promise<IRequest> {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't quite understand the difference between fetchApplicationById and fetchApplicationByProjectId?(=> what's the difference between project id and application id?) for me to imagine the need of the organizer, should be

  1. fetch application by recipient address (since the payout page might need this, or in the future if we wanna build a page for the applicants to manage their uploaded application)
  2. fetch application by project id = application id (for display single application detail on the /projects/:projectId page
  3. fetch application by request id (? (maybe be used on the organizer managing applications page?)

/**
* Whether it was approved or not
*/
initialized?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

just a question: why this is called initialized instead of something like isApproved?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

3 participants