Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions app/bot-commands/devpool-docs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,10 @@ const DevPoolDocs = () => {

<div className="grid grid-cols-1 sm:grid-cols-2 gap-3">
{[
{ cmd: '/bug', desc: 'Mark bug-report issues' },
{ cmd: '/impact', desc: 'Flag high-impact PRs' },
{ cmd: '/doc', desc: 'Mark documentation PRs' },
{ cmd: '/test', desc: 'Mark testing PRs' },
{ cmd: '/bug @username', desc: 'Mark bug-report issues' },
{ cmd: '/impact @username', desc: 'Flag high-impact PRs' },
{ cmd: '/doc @username', desc: 'Mark documentation PRs' },
{ cmd: '/test @username', desc: 'Mark testing PRs' },
].map((b, i) => (
<div
// biome-ignore lint: lint/suspicious/noArrayIndexKey
Expand Down
55 changes: 33 additions & 22 deletions app/components/dashboard-components/leaderboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,19 @@ import { FaSort, FaSortDown, FaSortUp } from 'react-icons/fa'; // Import sorting
import { MdCode, MdMonetizationOn } from 'react-icons/md';
import ParticipantAvatar from './ParticipantAvatar';

type LeaderboardProfile = {
full_name?: string | null;
github_username: string;
bounty: number | string;
solutions?: number | string;
pull_requests_merged?: number | string;
};

type LeaderboardApiResponse = {
leaderboard: LeaderboardProfile[];
message: string;
};

export type TUserData = {
fullName: string;
username: string;
Expand All @@ -39,31 +52,34 @@ const Leaderboard = ({ user }: { user: AuthUser | null }) => {
const fetchLeaderboard = async () => {
try {
setLeaderboardLoading(true);
const result = await make_api_call<{
message: string;
profiles: {
full_name: string | null;
github_username: string;
bounty: number;
solutions: number;
}[];
}>({
url: `${process.env.NEXT_PUBLIC_BACKEND_URL}/registrations`,
const result = await make_api_call<LeaderboardApiResponse>({
url: `${process.env.NEXT_PUBLIC_BACKEND_URL}/leaderboard`,
method: 'GET',
headers: {
Authorization: `Bearer ${user?.accessToken}`,
},
});

const formattedData: TUserData[] = (result.data?.profiles ?? []).map(
(profile) => ({
const profiles = result.data?.leaderboard || [];

const formattedData: TUserData[] = profiles
.filter(
(profile) =>
profile.github_username && profile.github_username !== '',
)
.map((profile) => ({
fullName: profile.full_name || '',
username: profile.github_username,
bounty: profile.bounty,
bounty: Number(profile.bounty || 0),
accountActive: true,
_count: { Solution: profile.solutions.toString() },
}),
);
_count: {
Solution: (
profile.pull_requests_merged ||
profile.solutions ||
0
).toString(),
},
}));

formattedData.sort((a, b) => b.bounty - a.bounty);

Expand Down Expand Up @@ -332,13 +348,8 @@ const Leaderboard = ({ user }: { user: AuthUser | null }) => {
</div>
<div>
<div className={`${classes.cardText} font-semibold`}>
{data.fullName || data.username}
@{data.username}
</div>
{data.username && (
<div className={`${classes.cardText} text-sm`}>
@{data.username}
</div>
)}
</div>
</div>
{currentView === 'leaderboard' && (
Expand Down
31 changes: 12 additions & 19 deletions app/components/repo-components/IssueCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ const IssueCard = (props: IssuesData) => {
title,
url,
language,
// bounty,
// difficulty,
bounty,
difficulty,
isClaimed,
claimedByList,
// multiplierActive,
Expand Down Expand Up @@ -74,15 +74,22 @@ const IssueCard = (props: IssuesData) => {
</Link>
</CardTitle>
<div className="flex flex-shrink-0 gap-2 sm:ml-4">
{/* <Badge
<Badge
className={`${
difficultyColorMap[difficulty] ||
'border-gray-400/50 bg-gray-200/50 text-gray-900 backdrop-blur-sm'
} font-medium text-xs sm:text-sm transition-all duration-200 hover:scale-105 focus:scale-105 px-3 py-1.5`}
aria-label={`Difficulty: ${difficulty}`}
>
{difficulty}
</Badge> */}
</Badge>
<Badge
className="bg-yellow-100/50 border-yellow-300/50 text-yellow-900 backdrop-blur-sm font-medium text-md sm:text-base transition-all duration-200 hover:scale-105 focus:scale-105 px-3.5 py-1.5 flex items-center gap-1.5"
aria-label={`Bounty: ${bounty} points`}
>
<Coins className="h-5 w-5" />
{bounty}
</Badge>
{/* {multiplierActive && multiplierValue && (
<Badge
className="transition-all scale-[1.05] bg-yellow-100 border-yellow-300 text-yellow-800 text-xs sm:text-sm font-medium px-2 py-1.5 backdrop-blur-sm"
Expand Down Expand Up @@ -141,22 +148,8 @@ const IssueCard = (props: IssuesData) => {
<div className="sm:ml-4 flex flex-wrap items-center gap-3">
{/* <div
className="flex items-center group"
aria-label={`Bounty: ${effectiveBounty} points`}
aria-label={`Bounty: ${bounty} points`}
>
<Coins
className={cn(
'mr-1.5 h-5 w-5 text-gray-600 transition-colors duration-200',
)}
color="var(--color-orange-400)"
aria-hidden="true"
/>
<span
className={cn(
'font-extrabold text-base sm:text-lg text-orange-400 transition-all duration-200',
)}
>
{effectiveBounty}
</span>
{multiplierActive &&
multiplierValue &&
bounty !== effectiveBounty && (
Expand Down
9 changes: 8 additions & 1 deletion app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,14 @@ const Dashboard = () => {
value="live-activity"
className="flex-grow overflow-y-auto"
>
<Logtable />
{/* <Logtable /> */}
<div
className={`flex h-full w-full items-center justify-center rounded-3xl ${classes.cardBg} ${classes.cardBorder} p-8 text-center backdrop-blur-md`}
>
<p className={`text-2xl font-bold ${classes.cardText}`}>
Coming Soon
</p>
</div>
</TabsContent>
<TabsContent
value="leaderboard"
Expand Down
71 changes: 35 additions & 36 deletions app/repo/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ function shuffleArray<T>(arr: T[]): T[] {
}

type IssueFilterType = 'all' | 'claimed' | 'unclaimed' | 'completed' | 'active';
// type IssueSortType = 'newest' | 'oldest' | 'bounty-high' | 'bounty-low';
type IssueSortType = 'newest' | 'oldest';
type IssueSortType = 'newest' | 'oldest' | 'bounty-high' | 'bounty-low';

const ReposPage = () => {
const { classes } = useTheme();
Expand Down Expand Up @@ -185,32 +184,32 @@ const ReposPage = () => {
}

switch (issueSort) {
// case 'bounty-high':
// filtered.sort((a, b) => {
// const bountyA =
// a.multiplierActive && a.multiplierValue
// ? a.bounty * a.multiplierValue
// : a.bounty;
// const bountyB =
// b.multiplierActive && b.multiplierValue
// ? b.bounty * b.multiplierValue
// : b.bounty;
// return bountyB - bountyA;
// });
// break;
// case 'bounty-low':
// filtered.sort((a, b) => {
// const bountyA =
// a.multiplierActive && a.multiplierValue
// ? a.bounty * a.multiplierValue
// : a.bounty;
// const bountyB =
// b.multiplierActive && b.multiplierValue
// ? b.bounty * b.multiplierValue
// : b.bounty;
// return bountyA - bountyB;
// });
// break;
case 'bounty-high':
filtered.sort((a, b) => {
const bountyA =
a.multiplierActive && a.multiplierValue
? a.bounty * a.multiplierValue
: a.bounty;
const bountyB =
b.multiplierActive && b.multiplierValue
? b.bounty * b.multiplierValue
: b.bounty;
return bountyB - bountyA;
});
break;
case 'bounty-low':
filtered.sort((a, b) => {
const bountyA =
a.multiplierActive && a.multiplierValue
? a.bounty * a.multiplierValue
: a.bounty;
const bountyB =
b.multiplierActive && b.multiplierValue
? b.bounty * b.multiplierValue
: b.bounty;
return bountyA - bountyB;
});
break;
case 'oldest':
filtered.sort((a, b) => a.id.localeCompare(b.id));
break;
Expand Down Expand Up @@ -239,10 +238,10 @@ const ReposPage = () => {

const sortBadgeText = useMemo(() => {
switch (issueSort) {
// case 'bounty-high':
// return 'Bounty: High to Low';
// case 'bounty-low':
// return 'Bounty: Low to High';
case 'bounty-high':
return 'Bounty: High to Low';
case 'bounty-low':
return 'Bounty: Low to High';
case 'oldest':
return 'Oldest First';
case 'newest':
Expand Down Expand Up @@ -409,7 +408,7 @@ const ReposPage = () => {
<CheckSquare className="ml-2 h-4 w-4 text-gray-600" />
)}
</DropdownMenuItem>
{/* <DropdownMenuItem
<DropdownMenuItem
onClick={() => setIssueSort('bounty-high')}
className={cn(
'cursor-pointer hover:bg-white/40 data-highlighted:bg-white/40',
Expand All @@ -420,8 +419,8 @@ const ReposPage = () => {
{issueSort === 'bounty-high' && (
<CheckSquare className="ml-2 h-4 w-4 text-gray-600" />
)}
</DropdownMenuItem> */}
{/* <DropdownMenuItem
</DropdownMenuItem>
<DropdownMenuItem
onClick={() => setIssueSort('bounty-low')}
className={cn(
'cursor-pointer hover:bg-white/40 data-highlighted:bg-white/40',
Expand All @@ -432,7 +431,7 @@ const ReposPage = () => {
{issueSort === 'bounty-low' && (
<CheckSquare className="ml-2 h-4 w-4 text-gray-600" />
)}
</DropdownMenuItem> */}
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
);
Expand Down
6 changes: 4 additions & 2 deletions app/store/useRepositoryStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ export interface IssueDataAPI {
title: string;
issue_url: string;
claimants?: Array<{ username: string }>;
bounty: number;
difficulty: string;
}

interface RepositoryState {
Expand Down Expand Up @@ -124,8 +126,8 @@ export const useRepositoryStore = create<RepositoryState>((set, get) => ({
title: issue.title,
url: issue.issue_url,
language: [],
bounty: 0,
difficulty: '',
bounty: issue.bounty || 0,
difficulty: issue.difficulty || 'Easy',
isClaimed: (issue.claimants && issue.claimants.length > 0) || false,
claimedByList:
issue.claimants?.map((c: { username: string }) => c.username) || [],
Expand Down
Loading