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

161-feature-donors-page-and-leaderboard #163

Open
wants to merge 48 commits into
base: staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
55e0a42
added resources to readme and favicon and new preview picture
codingshot Aug 29, 2024
220791e
Added Leaderboard card
Jikugodwill Oct 9, 2024
ed40356
Added trophy
Jikugodwill Oct 9, 2024
0e9e2aa
Started working on UI
Jikugodwill Oct 9, 2024
f3586d1
Refactor LeaderboardCard component to dynamically set icon color base…
Jikugodwill Oct 14, 2024
ed56eb3
Refactor LeaderboardPage component to update selectedTab state and ad…
Jikugodwill Oct 14, 2024
3106055
Refactor button component to add sec-brand-filled variant
Jikugodwill Oct 14, 2024
051ab03
Refactor LeaderboardPage component to add activities tab and display …
Jikugodwill Oct 14, 2024
6eeaea9
updated UI for mobile responsiveness
Jikugodwill Oct 16, 2024
40f2ff1
Refactor LeaderboardPage component to update activity card layout and…
Jikugodwill Oct 16, 2024
63731ec
completed final UI fixes
Jikugodwill Oct 17, 2024
959a4b7
Creatd filter chip
Jikugodwill Oct 17, 2024
cad0abc
exported filter-chip from components
Jikugodwill Oct 17, 2024
b68d61e
updated filterchip instead of button
Jikugodwill Oct 17, 2024
5c98750
fixed breakpoints
Jikugodwill Oct 17, 2024
3264fca
imported filterchip to index in components
Jikugodwill Oct 17, 2024
7489046
updatd timeAgo function
Jikugodwill Oct 18, 2024
fc86155
reverted client file in api/potlock/generated
Jikugodwill Oct 18, 2024
1b6069f
updates on UI breakpoints
Jikugodwill Oct 18, 2024
add1d01
Added final breakpoints
Jikugodwill Oct 18, 2024
a796bd8
leaderboard card fix
Jikugodwill Oct 18, 2024
ce03e05
UI fixes
Jikugodwill Oct 18, 2024
d9aa75e
Final UI updates
Jikugodwill Oct 18, 2024
b9559d4
Merge branch 'staging' of https://github.com/PotLock/potlock-nextjs-a…
carina-akaia Oct 21, 2024
3d39dc0
Added Leaderboard
Jikugodwill Oct 22, 2024
8ee30ea
UI fix
Jikugodwill Oct 22, 2024
d81f3de
more UI fixes
Jikugodwill Oct 22, 2024
6f63a69
fixed padding for filterchip
Jikugodwill Oct 22, 2024
3f02720
more UI updates
Jikugodwill Oct 22, 2024
9587e75
Merge branch 'staging' of https://github.com/PotLock/potlock-nextjs-a…
Jikugodwill Oct 22, 2024
f20241c
fmt
Jikugodwill Oct 22, 2024
a92ccd2
Made changes from commit
Jikugodwill Oct 22, 2024
c0bc3bc
made changes to page width and nav width
Jikugodwill Oct 22, 2024
cfd45b4
removed padding on larger devices
Jikugodwill Oct 22, 2024
7ef2f46
updated scrolls
Jikugodwill Oct 22, 2024
cc67ff6
put scroll back
Jikugodwill Oct 22, 2024
25e3e10
fix tabs width
M-Rb3 Oct 22, 2024
d3b20ec
moved max-width down
Jikugodwill Oct 22, 2024
76c74c2
Merge branch '161-feature-donors-page-and-leaderboard' of https://git…
Jikugodwill Oct 22, 2024
aacbc78
fix cards width
M-Rb3 Oct 22, 2024
36552fd
Merge branch '161-feature-donors-page-and-leaderboard' of https://git…
M-Rb3 Oct 22, 2024
7d61cd4
Merge branch 'staging' of https://github.com/PotLock/potlock-nextjs-a…
Jikugodwill Oct 28, 2024
ccd3372
Merge branches '161-feature-donors-page-and-leaderboard' and 'staging…
Jikugodwill Nov 8, 2024
25f285e
added hook
Jikugodwill Nov 8, 2024
06ed323
imported hook to leaderboard page
Jikugodwill Nov 11, 2024
d46a4ba
Added actuall donors data
Jikugodwill Nov 11, 2024
5b5a74f
Added code for donors data
Jikugodwill Nov 13, 2024
7ef42c4
Merge branch 'staging' of https://github.com/PotLock/potlock-nextjs-a…
Jikugodwill Nov 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"graylisted",
"hookform",
"kubb",
"Leaderboard",
"linktree",
"mpdao",
"NADABOT",
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ You can see original features <https://potlock.notion.site/All-Features-Potlock-

Core contracts can be found at <https://github.com/PotLock/core> and documentation <https://docs.potlock.io/contracts/contracts-overview>

You can see original features <https://potlock.notion.site/All-Features-Potlock-NextJS-App-5f543fa8b31840aa88bf5b8cf57ead3d?pvs=4>

Core contracts can be found at <https://github.com/PotLock/core> and documentation <https://docs.potlock.io/contracts/contracts-overview>

## Development

### Getting Started
Expand Down
14 changes: 14 additions & 0 deletions src/common/api/indexer/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
V1AccountsRetrieveParams,
V1AccountsUpvotedListsRetrieveParams,
V1DonateContractConfigRetrieveParams,
V1DonorsRetrieveParams,
V1ListsRandomRegistrationRetrieveParams,
V1ListsRegistrationsRetrieveParams,
V1ListsRetrieveParams,
Expand All @@ -27,6 +28,19 @@ export const useStats = () => {
return { ...queryResult, data: queryResult.data?.data };
};

/**
*
https://dev.potlock.io/api/schema/swagger-ui/#/v1/v1_donors_retrieve
*/

export const useDonors = ({ ...params }: V1DonorsRetrieveParams) => {
const queryResult = swrHooks.useV1DonorsRetrieve(
params,
POTLOCK_REQUEST_CONFIG,
);
return { ...queryResult, data: queryResult.data?.data.results };
};

/**
* https://dev.potlock.io/api/schema/swagger-ui/#/v1/v1_donate_contract_config_retrieve
*/
Expand Down
17 changes: 17 additions & 0 deletions src/common/assets/svgs/Trophy.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const Trophy = (props: any) => {
return (
<svg
{...props}
viewBox="0 0 19 18"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M4.66797 18V16H8.66797V12.9C7.8513 12.7167 7.12214 12.3708 6.48047 11.8625C5.8388 11.3542 5.36797 10.7167 5.06797 9.95C3.81797 9.8 2.77214 9.25417 1.93047 8.3125C1.0888 7.37083 0.667969 6.26667 0.667969 5V4C0.667969 3.45 0.863802 2.97917 1.25547 2.5875C1.64714 2.19583 2.11797 2 2.66797 2H4.66797V0H14.668V2H16.668C17.218 2 17.6888 2.19583 18.0805 2.5875C18.4721 2.97917 18.668 3.45 18.668 4V5C18.668 6.26667 18.2471 7.37083 17.4055 8.3125C16.5638 9.25417 15.518 9.8 14.268 9.95C13.968 10.7167 13.4971 11.3542 12.8555 11.8625C12.2138 12.3708 11.4846 12.7167 10.668 12.9V16H14.668V18H4.66797ZM4.66797 7.8V4H2.66797V5C2.66797 5.63333 2.8513 6.20417 3.21797 6.7125C3.58464 7.22083 4.06797 7.58333 4.66797 7.8ZM14.668 7.8C15.268 7.58333 15.7513 7.22083 16.118 6.7125C16.4846 6.20417 16.668 5.63333 16.668 5V4H14.668V7.8Z"
fill={props.fill || "#91321B`"}
/>
</svg>
);
};

export default Trophy;
2 changes: 1 addition & 1 deletion src/common/ui/components/atoms/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const buttonVariants = cva(
),

"standard-outline": cn(
"bg-white hover:bg-[var(--neutral-50)",
"bg-white hover:bg-[var(--neutral-50) outline-none focus:shadow-[0px_0px_0px_1px_rgba(0,0,0,0.22)_inset,0px_-1px_0px_0px_rgba(15,15,15,0.15)_inset,0px_1px_2px_-0.5px_rgba(5,5,5,0.08)]",
"shadow-[0px_0px_0px_1px_rgba(0,0,0,0.22)_inset,0px_-1px_0px_0px_rgba(15,15,15,0.15)_inset,0px_1px_2px_-0.5px_rgba(5,5,5,0.08)]",
"disabled:text-[#c7c7c7] disabled:shadow-[0px_0px_0px_1px_rgba(15,15,15,0.15)_inset]",
),
Expand Down
79 changes: 79 additions & 0 deletions src/common/ui/components/filter-chip.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import * as React from "react";

import { Slot } from "@radix-ui/react-slot";
import { type VariantProps, cva } from "class-variance-authority";

import { cn } from "../utils";

// TODO: add correct hover effects
const filterChipVariants = cva(
cn(
"flex text-sm leading-[157%] items-center justify-center text-[#292929] gap-2 font-medium whitespace-nowrap px-12px py-6px",
"no-underline cursor-pointer transition-all duration-200 ease-in-out w-fit rounded-md",
"border-none focus:shadow-button-focus disabled:cursor-not-allowed",
),

{
variants: {
variant: {
// Brand
"brand-filled": cn(
"bg-#fce9d5 shadow-amber outline-none translate-y-[-1.5px] text-#91321B font-bold border border-#f4b37d border-solid hover:translate-y-0 focus:shadow-#f4b37d",
"hover:shadow-[0px_0px_0px_1px_rgba(244, 179, 125, 1)_inset,0px_1px_1px_1px_rgba(252, 233, 213, 1)_inset,0px_0px_0px_2px_rgba(252, 233, 213, 1)_inset]",
"disabled:text-[#a6a6a6] disabled:shadow-[0px_0px_0px_1px_rgba(15,15,15,0.15)_inset] disabled:bg-[var(--neutral-100)]",
),

"brand-plain": cn(
"text-[color:var(--primary-600)] p-0 hover:text-[color:var(--Primary-400)]",
"disabled:text-[#a6a6a6] disabled:shadow-[0px_0px_0px_1px_rgba(15,15,15,0.15)_inset] disabled:bg-[var(--neutral-100)]",
),

"brand-outline": cn(
"bg-white hover:bg-[var(--neutral-50) outline-none focus:shadow-[0px_0px_0px_1px_rgba(0,0,0,0.22)_inset,0px_-1px_0px_0px_rgba(15,15,15,0.15)_inset,0px_1px_2px_-0.5px_rgba(5,5,5,0.08)]",
"shadow-[0px_0px_0px_1px_rgba(0,0,0,0.22)_inset,0px_-1px_0px_0px_rgba(15,15,15,0.15)_inset,0px_1px_2px_-0.5px_rgba(5,5,5,0.08)]",
"disabled:text-[#c7c7c7] disabled:shadow-[0px_0px_0px_1px_rgba(15,15,15,0.15)_inset]",
),
},

size: {
default: "px-4 py-[9px]",
icon: "h-10 w-10",
},

font: {
default: "font-medium",
bold: "font-bold",
semibold: "font-semibold",
},
},

defaultVariants: {
font: "default",
variant: "brand-filled",
size: "default",
},
},
);

export interface FilterChipProps
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
VariantProps<typeof filterChipVariants> {
asChild?: boolean;
}

const FilterChip = React.forwardRef<HTMLButtonElement, FilterChipProps>(
({ className, variant, font, size, asChild = false, ...props }, ref) => {
const Comp = asChild ? Slot : "button";
return (
<Comp
className={cn(filterChipVariants({ variant, size, font, className }))}
ref={ref}
{...props}
/>
);
},
);

FilterChip.displayName = "FilterChip";

export { FilterChip, filterChipVariants };
1 change: 1 addition & 0 deletions src/common/ui/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* See https://atomicdesign.bradfrost.com/chapter-2/
*/
export * from "./dropdown-menu";
export * from "./filter-chip";
export * from "./InfiniteScroll";
export * from "./popover";
export * from "./scroll-area";
Expand Down
3 changes: 1 addition & 2 deletions src/modules/core/components/Nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ const links = [
},

{ label: "Feed", url: routesPath.FEED, disabled: false },
// { label: "Donors", url: routesPath.DONORS, disabled: false },

{ label: "Donors", url: routesPath.DONORS, disabled: false },
{
label: "Lists",
url: routesPath.LIST,
Expand Down
61 changes: 61 additions & 0 deletions src/modules/donation/components/DonationLeaderboardEntry.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import Image from "next/image";

import Trophy from "@/common/assets/svgs/Trophy";

export type DonationLeaderboardEntryProps = {
rank: number;
image: string;
name: string;
amount: number;
type: "donor" | "sponsor";
};

export const DonationLeaderboardEntry: React.FC<
DonationLeaderboardEntryProps
> = ({ rank, image, name, amount, type }) => {
const bgClass =
rank === 1
? "bg-gradient-to-r from-orange-400 to-red-500 text-white"
: rank === 2
? "bg-gradient-to-r from-#F7F7F7 to-#DBDBDB"
: "bg-gradient-to-r from-#FCE9D5 to-#F8D3B0";

const rankText = ["1st", "2nd", "3rd"][rank - 1];
const iconClass =
rank === 1
? "fill-yellow-400"
: rank === 2
? "fill-gray-400"
: "fill-red-800";

return (
<div
className={`w-288px overflow-hidden rounded-2xl border border-gray-200 pb-4`}
>
<div className={`flex items-center justify-between p-4 ${bgClass}`}>
<div>
<Trophy className={`h-6 w-6 ${iconClass}`} />
</div>
<span className="text-lg font-bold">{rankText}</span>
</div>
<div className="p-20px flex flex-col items-center">
<Image
src={image ?? ""}
alt={name}
className="mb-12px h-20 w-20 rounded-full"
width={80}
height={80}
/>
<p className="font-500 text-#292929 font-14px mb-2 text-center">
{name}
</p>
<p className="font-600 text-center text-2xl">
{amount}{" "}
<span className="text-#292929 font-600 text-sm">
NEAR {type === "donor" ? "Donated" : "Sponsored"}
</span>
</p>
</div>
</div>
);
};
1 change: 1 addition & 0 deletions src/modules/donation/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export * from "./constants";
export * from "./components/breakdowns";
export * from "./components/buttons";
export * from "./components/DonationLeaderboardEntry";
export * from "./components/DonationSybilWarning";
export * from "./hooks";
export * from "./models/schemas";
Expand Down
Loading
Loading