Skip to content

Commit

Permalink
Merge pull request #10 from 2077-Collective/main
Browse files Browse the repository at this point in the history
Updates from 2077 idea board
  • Loading branch information
seichris authored Dec 20, 2024
2 parents 1cd3775 + 4814ae0 commit 0ffa0b1
Show file tree
Hide file tree
Showing 14 changed files with 6,970 additions and 5,625 deletions.
32 changes: 0 additions & 32 deletions .env.example

This file was deleted.

23 changes: 0 additions & 23 deletions .github/ISSUE_TEMPLATE/feature_request.md

This file was deleted.

29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE/idea.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: Idea
about: Suggest an idea benefiting Ethereum
title: ''
labels: idea, open
assignees: ''

---

## User story

As X I want to X, so I can X.

## Solution


## How does it benefit the Ethereum ecosystem?


### Why does this not exist yet?


## Tasks

- [ ]
- [ ]
- [ ]

## Notes
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ yarn-error.log*

# vercel
.vercel

#env
.env*
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Your issue now appears on [roadmap.betterhq.org](https://roadmap.betterhq.org/)

---

## How to set up Better for your organization
## How to set up Better for your organization.

Better mirrors your [Github issues](https://github.com/better-feedback/roadmap/issues) to a [hosted website](https://roadmap.betterhq.org/), which allows your community to vote on them, fund them as bounties and claim the pooled funds for implementing them. Issues can range from feature requests, to content marketing ideas and DAO grant proposals.

Expand Down
1 change: 0 additions & 1 deletion next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
Expand Down
14 changes: 7 additions & 7 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ export const nearChainConfig = {

export const siteConfig = {
enabledChains: ["near" , "polygon"],
projectName: "2077 Bounties",
title: "2077 Bounties",
metaDescription: "2077 Bounties",
url: "https://ideas.8o.vc/",
metaImg: "https://raw.githubusercontent.com/better-feedback/better-app/1926cf0a2327e629128f65e57edeee7440294e0b/public/metaTagImg.jpg?token=AF6ZD6A7XI4IS7I3MRLDQSDCTY6QK",
projectName: "2077 Idea Board",
title: "2077 Idea Board",
metaDescription: "2077 Idea Board",
url: "https://ideas.2077.xyz/",
metaImg: "https://raw.githubusercontent.com/2077-Collective/better-2077/1926cf0a2327e629128f65e57edeee7440294e0b/public/metaTagImg.jpg?token=AF6ZD6A7XI4IS7I3MRLDQSDCTY6QK",
externalLinks: {
docs: "https://github.com/better-feedback/better-2077#readme",
docs: "https://github.com/2077-Collective/better-2077#readme",
discord: "wwwwRFa6aj",
twitter: "betterdao",
twitter: "2077Collective",
},
};

Expand Down
5 changes: 4 additions & 1 deletion src/features/api-routes/handlers/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@ export class ApiError extends Error {
}

export function apiErrorHandler(res: NextApiResponse, error: any) {
console.error("API Error:", error);

const { statusCode = 0, message } = error;

console.error(error);

if (statusCode === 500 || statusCode === 0) {
return res.status(500).json({ error: "Internal Server Error" });
}
return res.status(statusCode).json({ error: message });
return res.status(statusCode).json({ error: message, details: error.toString() });

}
21 changes: 14 additions & 7 deletions src/features/bounties/hooks/useGetBountyQuery.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
import { ethers } from "ethers";
import { useQuery } from "react-query";
// import { useQuery } from "react-query";
import { useContractRead } from "wagmi";

import * as betterBounty from "../../../utils/solidity/BetterBounty.json";

const { data, isError, isLoading } = useContractRead({
addressOrName: process.env.NEXT_PUBLIC_POLYGON_CONTRACT_ADDRESS as string,
contractInterface: betterBounty.abi,
functionName: "bountyCount",
});
export function useGetBountyQuery() {
return useContractRead({
addressOrName: process.env.NEXT_PUBLIC_POLYGON_CONTRACT_ADDRESS as string,
contractInterface: betterBounty.abi,
functionName: "bountyCount",
});
}

// const { data, isError, isLoading } = useContractRead({
// addressOrName: process.env.NEXT_PUBLIC_POLYGON_CONTRACT_ADDRESS as string,
// contractInterface: betterBounty.abi,
// functionName: "bountyCount",
// });
24 changes: 17 additions & 7 deletions src/features/bounties/solidity/getBounty.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
import * as betterBounty from "../../../utils/solidity/BetterBounty.json";
import { useContractRead } from "wagmi";

export default async function getBounty(bountyId: string) {
const chain = localStorage.getItem("wallet-chain");
if (chain === "near") return;

const bounty = await useContractRead({
export function useGetBounty(bountyId: string) {
const { data, isError, isLoading } = useContractRead({
addressOrName: process.env.NEXT_PUBLIC_POLYGON_CONTRACT_ADDRESS as string,
contractInterface: betterBounty.abi,
functionName: "getBountyById",
args: bountyId,
args: [bountyId],
});


return { data, isError, isLoading };
}

export function getBounty(bountyId: string) {
const chain = localStorage.getItem("wallet-chain");
if (chain === "near") return null;

// This function can't directly use the hook, but it can be used to prepare data for the hook
return {
addressOrName: process.env.NEXT_PUBLIC_POLYGON_CONTRACT_ADDRESS as string,
contractInterface: betterBounty.abi,
functionName: "getBountyById",
args: [bountyId],
};
}
7 changes: 4 additions & 3 deletions src/features/common/components/add-issue-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ const AddIssueModal = ({ setIsModalOpen }: AddIssueModalProps) => {
setIsLoading(true);
try {
let isGithubAuth = user != undefined
let userId = user ? user?.sub : getWalletId()
// let userId = user ? user?.sub : getWalletId()
let userId = user ? (user.nickname || user.name || user.sub) : getWalletId();

const result = await axios.post("/api/issues/addIssue", {
userId,
Expand All @@ -61,7 +62,7 @@ const AddIssueModal = ({ setIsModalOpen }: AddIssueModalProps) => {
setIsModalOpen(false)
} catch (e) {
setIsLoading(false);

console.error("Error submitting issue:", e.response?.data || e.message);
console.log(e)
}

Expand All @@ -73,7 +74,7 @@ const AddIssueModal = ({ setIsModalOpen }: AddIssueModalProps) => {
}} className="rounded-md p-4 bg-white dark:bg-zinc-900 flex flex-col dark:text-white w-[90vw] h-[80vh] lg:w-[50vw] ">
<div className="flex items-center justify-between">

<span className="font-bold mb-4">Add Issue</span>
<span className="font-bold mb-4">Add Idea</span>
<AiOutlineClose className="text-[1.5rem] cursor-pointer" onClick={() => setIsModalOpen(false)} />
</div>
<FormInput onChange={(e) => setTitle(e.target?.value)} placeholder="Issue Title" />
Expand Down
7 changes: 3 additions & 4 deletions src/features/common/components/footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const EXTERNAL_LINKS = [
link: config.site.url,
},
{
label: "Add new issue",
label: "Add new idea",
link: `https://github.com/${config.github.repoOwner}/${config.github.repoName}/issues/new/choose`,
},
];
Expand All @@ -37,11 +37,10 @@ export function Footer() {
<div className="border-gray-100 dark:border-zinc-800 border-b-2" />
<div className="grid grid-cols-1 gap-8 sm:gap-2 sm:grid-cols-3 p-4 text-gray-500 dark:text-zinc-500">
<div>
Powered by{" "}
<a href="https://betterhq.org/" target="_blank" rel="noreferrer">
Better
Powered by Better
</a>{" "}
© 2022
© 2024
</div>
<div>
<div className="mb-2 font-medium uppercase">
Expand Down
10 changes: 9 additions & 1 deletion src/pages/api/issues/addIssue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,23 @@ export default async function handler(
) {
try {
const { userId, title, body, isGithubAuth } = req.body;
console.log("Received request body:", req.body);

if (!title || !body) {
throw new ApiError(400, "Title and body are required");
}

const accessToken = (isGithubAuth
? await getUserAccessKey(userId)
: process.env.GITHUB_PAT) as any;

console.log("Access token retrieved:", accessToken ? "Token exists" : "Token is missing");

const octokit = new Octokit({
auth: !isGithubAuth ? accessToken : accessToken?.identities[0].access_token ,
});


console.log("Octokit instance created");

const newIssue = await octokit.rest.issues.create({
owner: process.env.NEXT_PUBLIC_REPO_OWNER as string,
Expand All @@ -35,6 +42,7 @@ export default async function handler(

res.status(200).json({ message: newIssue.data });
} catch (error) {
console.error("Error in addIssue handler:", error);
apiErrorHandler(res, error);
}
}
Loading

0 comments on commit 0ffa0b1

Please sign in to comment.