-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
361 additions
and
239 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 7 additions & 8 deletions
15
packages/interface/src/features/projects/components/ProjectAwarded.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
packages/interface/src/features/results/components/ResultItem.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import Image from "next/image"; | ||
import Link from "next/link"; | ||
import { useEffect } from "react"; | ||
|
||
import { useProjectMetadata } from "~/features/projects/hooks/useProjects"; | ||
|
||
import type { IRecipientWithVotes } from "~/utils/types"; | ||
|
||
export interface IResultItemProps { | ||
pollId: string; | ||
rank: number; | ||
project: IRecipientWithVotes; | ||
} | ||
|
||
export const ResultItem = ({ pollId, rank, project }: IResultItemProps): JSX.Element => { | ||
const metadata = useProjectMetadata(project.metadataUrl); | ||
|
||
useEffect(() => { | ||
if (metadata.data) { | ||
return; | ||
} | ||
|
||
// eslint-disable-next-line no-console | ||
metadata.refetch().catch(console.error); | ||
}, [metadata]); | ||
|
||
return ( | ||
<Link href={`/rounds/${pollId}/${project.id}`}> | ||
<div className="flex cursor-pointer leading-8 hover:bg-blue-50"> | ||
<div className="my-1 w-8 flex-none justify-center"> | ||
{rank === 1 && <Image alt="gold" height="26" src="/gold.svg" width="26" />} | ||
|
||
{rank === 2 && <Image alt="silver" height="26" src="/silver.svg" width="26" />} | ||
|
||
{rank === 3 && <Image alt="bronze" height="26" src="/bronze.svg" width="26" />} | ||
</div> | ||
|
||
<div className="w-6 flex-none text-center">{rank}</div> | ||
|
||
<div className="mx-2 flex-1">{metadata.data?.name}</div> | ||
|
||
<div className="w-24 flex-none text-end">{`${project.votes} votes`}</div> | ||
</div> | ||
</Link> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { config } from "~/config"; | ||
import { api } from "~/utils/api"; | ||
|
||
import type { UseTRPCInfiniteQueryResult } from "@trpc/react-query/shared"; | ||
import type { IRecipient } from "~/utils/types"; | ||
|
||
const seed = 0; | ||
export function useProjects(registryAddress: string): UseTRPCInfiniteQueryResult<IRecipient[], unknown, unknown> { | ||
return api.projects.projects.useInfiniteQuery( | ||
{ registryAddress, limit: config.pageSize, seed }, | ||
{ | ||
getNextPageParam: (_, pages) => pages.length, | ||
}, | ||
); | ||
} |
Oops, something went wrong.