Skip to content

Commit 91ac04a

Browse files
committed
Removed: disabled condition from connect wallet button component anmd formatted the code
1 parent c0579f5 commit 91ac04a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+823
-818
lines changed

src/app/(user)/contributor/dashboard/page.tsx

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { Card } from "@/components/ui/card";
2-
import CardWrapper from "@/components/ui/contributor/dashboard/card-wrapper";
3-
import BountyTable from "@/components/ui/contributor/dashboard/table";
4-
import WalletCard from "@/components/ui/maintainer/escrow-requests/wallet-card";
5-
import { getServerSessionID } from "@/lib/actions";
1+
import { Card } from '@/components/ui/card';
2+
import CardWrapper from '@/components/ui/contributor/dashboard/card-wrapper';
3+
import BountyTable from '@/components/ui/contributor/dashboard/table';
4+
import WalletCard from '@/components/ui/maintainer/escrow-requests/wallet-card';
5+
import { getServerSessionID } from '@/lib/actions';
66

77
export default async function Page() {
88
const userID = await getServerSessionID();
@@ -14,7 +14,7 @@ export default async function Page() {
1414
return (
1515
<main className="flex-1 overflow-x-hidden overflow-y-auto bg-gray-50 h-full">
1616
<div className="container mx-auto px-6 py-8">
17-
<div className="flex justify-between items-center mb-6">
17+
<div className="flex justify-between items-center mb-6">
1818
<h1 className="text-3xl font-semibold text-gray-800">Dashboard</h1>
1919
<WalletCard />
2020
</div>
@@ -30,4 +30,4 @@ export default async function Page() {
3030
</div>
3131
</main>
3232
);
33-
}
33+
}

src/app/(user)/contributor/layout.tsx

+11-9
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
import Sidebar from "@/components/ui/sidebar";
2-
import { Gem, LayoutDashboardIcon } from "lucide-react";
1+
import Sidebar from '@/components/ui/sidebar';
2+
import { Gem, LayoutDashboardIcon } from 'lucide-react';
33

44
const links = [
5-
{ name: "Dashboard", href: "/contributor/dashboard", icon: <LayoutDashboardIcon /> },
6-
{ name: "Open Bounties", href: "/contributor/open-bounties", icon: <Gem /> }
7-
]
5+
{
6+
name: 'Dashboard',
7+
href: '/contributor/dashboard',
8+
icon: <LayoutDashboardIcon />,
9+
},
10+
{ name: 'Open Bounties', href: '/contributor/open-bounties', icon: <Gem /> },
11+
];
812

913
export default function Layout({ children }: { children: React.ReactNode }) {
1014
return (
@@ -13,10 +17,8 @@ export default function Layout({ children }: { children: React.ReactNode }) {
1317
<Sidebar links={links} />
1418
</div>
1519
<div className="flex-grow md:overflow-y-auto">
16-
<div className="md:pt-[56px] h-screen">
17-
{children}
18-
</div>
20+
<div className="md:pt-[56px] h-screen">{children}</div>
1921
</div>
2022
</>
2123
);
22-
}
24+
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import EscrowRequestTable from "@/components/ui/maintainer/escrow-requests/table";
1+
import EscrowRequestTable from '@/components/ui/maintainer/escrow-requests/table';
22

33
export default function Page() {
44
return (
@@ -9,5 +9,5 @@ export default function Page() {
99
<EscrowRequestTable />
1010
</div>
1111
</main>
12-
)
13-
}
12+
);
13+
}

src/app/(user)/layout.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import Header from "@/components/ui/header";
1+
import Header from '@/components/ui/header';
22

33
export default function Layout({ children }: { children: React.ReactNode }) {
44
return (
55
<div className="flex h-screen flex-col md:flex-row md:overflow-hidden">
6-
<Header />
7-
{children}
8-
</div>
6+
<Header />
7+
{children}
8+
</div>
99
);
10-
}
10+
}
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,51 @@
1-
import { db } from "@/db/db";
2-
import { NextRequest, NextResponse } from "next/server";
1+
import { db } from '@/db/db';
2+
import { NextRequest, NextResponse } from 'next/server';
33

44
type Params = {
55
params: {
6-
repositoryId: string
7-
issueNumber: string
8-
}
9-
}
6+
repositoryId: string;
7+
issueNumber: string;
8+
};
9+
};
1010

1111
export async function GET(req: NextRequest, { params }: Params) {
1212
// Access the issueNumber from the request parameters: api/bounties/[issueNumber]
1313
const { issueNumber, repositoryId } = params;
1414

15-
if(!issueNumber || isNaN(parseInt(issueNumber))){
16-
return NextResponse.json(
17-
{ message: "Invalid data" },
18-
{ status: 400 }
19-
);
15+
if (!issueNumber || isNaN(parseInt(issueNumber))) {
16+
return NextResponse.json({ message: 'Invalid data' }, { status: 400 });
2017
}
2118

2219
try {
2320
const bounty = await db.bounty.findUnique({
2421
where: {
2522
issueNumber_repositoryId: {
2623
issueNumber: parseInt(issueNumber),
27-
repositoryId: parseInt(repositoryId)
28-
}
24+
repositoryId: parseInt(repositoryId),
25+
},
2926
},
3027
select: {
3128
amount: true,
32-
}
33-
})
34-
35-
if(!bounty){
29+
},
30+
});
31+
32+
if (!bounty) {
3633
return NextResponse.json({
3734
isBounty: false,
38-
bounty: null
35+
bounty: null,
3936
});
4037
}
41-
42-
console.log("Bounty Comment: ", bounty);
38+
39+
console.log('Bounty Comment: ', bounty);
4340
return NextResponse.json({
4441
isBounty: true,
45-
bounty: bounty.amount
42+
bounty: bounty.amount,
4643
});
4744
} catch (error) {
48-
console.error("Error checking bounty comment: ", error);
45+
console.error('Error checking bounty comment: ', error);
4946
return NextResponse.json(
50-
{ message: "Error checking bounty comment" },
51-
{ status: 500 });
47+
{ message: 'Error checking bounty comment' },
48+
{ status: 500 }
49+
);
5250
}
53-
}
51+
}

src/app/api/bounties/route.ts

+11-18
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,39 @@ import { db } from '@/db/db';
22
import { bountyCreateSchema } from '@/lib/validations';
33
import { NextRequest, NextResponse } from 'next/server';
44

5-
65
// TODO: Use try/catch block to catch errors
76
export async function POST(req: NextRequest) {
87
const responseData = await req.json();
98
const parsedResponse = bountyCreateSchema.safeParse(responseData);
109

11-
if(!parsedResponse.success){
12-
console.error(parsedResponse.error)
13-
return NextResponse.json(
14-
{ message: "Invalid data" },
15-
{ status: 400 }
16-
);
10+
if (!parsedResponse.success) {
11+
console.error(parsedResponse.error);
12+
return NextResponse.json({ message: 'Invalid data' }, { status: 400 });
1713
}
1814

1915
const data = parsedResponse.data;
20-
16+
2117
// Create Bounty Record
2218
const bounty = await db.bounty.create({
2319
data: {
2420
author: {
25-
connect: { id: data.authorId }
21+
connect: { id: data.authorId },
2622
},
2723
repository: {
28-
connect: { id: data.repositoryId }
24+
connect: { id: data.repositoryId },
2925
},
3026
issueNumber: data.issueNumber,
3127
title: data.title,
32-
amount: data.bounty
33-
}
28+
amount: data.bounty,
29+
},
3430
});
3531

36-
if(!bounty){
32+
if (!bounty) {
3733
return NextResponse.json(
38-
{ message: "Failed to create bounty" },
34+
{ message: 'Failed to create bounty' },
3935
{ status: 500 }
4036
);
4137
}
4238

43-
return NextResponse.json(
44-
{ message: "Bounty Set" },
45-
{ status: 200 }
46-
);
39+
return NextResponse.json({ message: 'Bounty Set' }, { status: 200 });
4740
}

0 commit comments

Comments
 (0)