diff --git a/src/components/Members.tsx b/src/components/Members.tsx index 5323d9a..5786e01 100644 --- a/src/components/Members.tsx +++ b/src/components/Members.tsx @@ -3,61 +3,61 @@ import { Contract, JsonRpcProvider } from "ethers"; import { useEffect, useState } from "react"; type ContractFunctionFragment = { - type: string; - name: string; - inputs: { name: string; type: string; internalType: string }[]; - outputs: { name: string; type: string; internalType: string }[]; - stateMutability: string; + type: string; + name: string; + inputs: { name: string; type: string; internalType: string }[]; + outputs: { name: string; type: string; internalType: string }[]; + stateMutability: string; }; async function fetchTokenURIs( - contractAddress: string, - abi: ContractFunctionFragment[], - address: string, + contractAddress: string, + abi: ContractFunctionFragment[], + address: string, ) { - const provider = new JsonRpcProvider( - "https://eth-holesky.g.alchemy.com/v2/EBEf6F0QcKepxVRoTYFdUsIj7iHd6NMo", - ); - const contract = new Contract(contractAddress, abi, provider); - try { - const uris = await contract.getTokenUrisForAddress(address); - return uris as string[]; - } catch (error) { - console.error("Error during call tokenURI:", error); - return null; - } + const provider = new JsonRpcProvider( + "https://eth-holesky.g.alchemy.com/v2/EBEf6F0QcKepxVRoTYFdUsIj7iHd6NMo", + ); + const contract = new Contract(contractAddress, abi, provider); + try { + const uris = await contract.getTokenUrisForAddress(address); + return uris as string[]; + } catch (error) { + console.error("Error during call tokenURI:", error); + return null; + } } async function loadABI(): Promise { - const abi: ContractFunctionFragment[] = [ - { - type: "function", - name: "getTokenUrisForAddress", - inputs: [{ name: "user", type: "address", internalType: "address" }], - outputs: [{ name: "", type: "string[]", internalType: "string[]" }], - stateMutability: "view", - }, - ]; - return abi; + const abi: ContractFunctionFragment[] = [ + { + type: "function", + name: "getTokenUrisForAddress", + inputs: [{ name: "user", type: "address", internalType: "address" }], + outputs: [{ name: "", type: "string[]", internalType: "string[]" }], + stateMutability: "view", + }, + ]; + return abi; } function parseUriToImage(uris: string[] | null, name: string) { - if (uris && uris.length > 0) { - const lastUri = uris[uris.length - 1]; - const base64String = lastUri.split(",")[1]; - - try { - let decodedImageUri = JSON.parse(atob(base64String)).image as string; - if (name !== "Alessandro Cavaliere") { - decodedImageUri = decodedImageUri.replace("svg+xml", "png"); - } - return decodedImageUri; - } catch (error) { - console.error("Error during of parsing URI:", error); - return null; - } - } - return null; + if (uris && uris.length > 0) { + const lastUri = uris[uris.length - 1]; + const base64String = lastUri.split(",")[1]; + + try { + let decodedImageUri = JSON.parse(atob(base64String)).image as string; + if (name !== "Alessandro Cavaliere") { + decodedImageUri = decodedImageUri.replace("svg+xml", "png"); + } + return decodedImageUri; + } catch (error) { + console.error("Error during of parsing URI:", error); + return null; + } + } + return null; } ("use client"); @@ -67,100 +67,100 @@ import { ExternalLink, Github } from "lucide-react"; import { Badge } from "./ui/babdge"; export type Member = { - name: string; - github: string; - handle: string; - university: string; - categories: string[]; - address: string; - link_etherscan: string; + name: string; + github: string; + handle: string; + university: string; + categories: string[]; + address: string; + link_etherscan: string; }; interface MemberCardProps { - member: Member; - imageUrl?: string; + member: Member; + imageUrl?: string; } export function MemberCard({ member, imageUrl }: MemberCardProps) { - return ( -
- {/* Header with Image and Basic Info */} -
-
- {/* Avatar */} - -
- {member.name} -
-
- -
-
- - {/* Name and Handle */} -
- -

- {member.name} -

-
- {/* Role */} -

- {member.university} -

- - - @{member.handle} - - -
-
-
- - {/* Content */} -
- {/* Categories */} -
-

Categories

-
- {member.categories.map((category) => { - const bg = memberCategories[category] || "var(--btn-regular-bg)"; - return ( - - {category} - - ); - })} -
-
- - {/* Etherscan Link */} - {/* + {/* Header with Image and Basic Info */} +
+
+ {/* Avatar */} + +
+ {member.name} +
+
+ +
+
+ + {/* Name and Handle */} +
+ +

+ {member.name} +

+
+ {/* Role */} +

+ {member.university} +

+ + + @{member.handle} + + +
+
+
+ + {/* Content */} +
+ {/* Categories */} +
+

Categories

+
+ {member.categories.map((category) => { + const bg = memberCategories[category] || "var(--btn-regular-bg)"; + return ( + + {category} + + ); + })} +
+
+ + {/* Etherscan Link */} + {/* */} -
- - {/* Decorative gradient overlay */} -
-
-
-
- ); + + + {/* Decorative gradient overlay */} +
+
+
+ + ); } export default function MembersGrid() { - const [images, setImages] = useState>({}); - const [isLoading, setIsLoading] = useState(true); - - useEffect(() => { - async function fetchAllImages() { - try { - const abi = await loadABI(); - - const results = await Promise.all( - members.map(async (member) => { - const uris = await fetchTokenURIs( - contractAddress, - abi, - member.address, - ); - const image = parseUriToImage(uris, member.name); - return { - key: member.github, - image: image || "/public/logo.png", - }; - }), - ); - - const imagesMap: Record = {}; - for (const result of results) { - imagesMap[result.key] = result.image; - } - - setImages(imagesMap); - } catch (error) { - console.error("Errore durante il caricamento delle immagini:", error); - } finally { - setIsLoading(false); - } - } - - fetchAllImages(); - }, []); - - if (isLoading) { - return ( -
-
-
- ); - } - - return ( -
- {members.map((member) => ( - - ))} -
- ); + const [images, setImages] = useState>({}); + const [isLoading, setIsLoading] = useState(true); + + useEffect(() => { + async function fetchAllImages() { + try { + const abi = await loadABI(); + + const results = await Promise.all( + members.map(async (member) => { + const uris = await fetchTokenURIs( + contractAddress, + abi, + member.address, + ); + const image = parseUriToImage(uris, member.name); + return { + key: member.github, + image: image || "/public/logo.png", + }; + }), + ); + + const imagesMap: Record = {}; + for (const result of results) { + imagesMap[result.key] = result.image; + } + + setImages(imagesMap); + } catch (error) { + console.error("Errore durante il caricamento delle immagini:", error); + } finally { + setIsLoading(false); + } + } + + fetchAllImages(); + }, []); + + if (isLoading) { + return ( +
+
+
+ ); + } + + return ( +
+ {members.map((member) => ( + + ))} +
+ ); } diff --git a/src/content/spec/about.md b/src/content/spec/about.md index fa6d9b6..803018b 100644 --- a/src/content/spec/about.md +++ b/src/content/spec/about.md @@ -1,3 +1,13 @@ # About Hello, we are ByteTheCookies (BTC), a passionate CTF team formed by students from the [University of Salerno](https://www.unisa.it/) after participating in the CyberChallenge 2024. Our mission is to push the boundaries of our skills and knowledge in the ever-evolving field of IT security. We thrive on solving complex challenges, learning from each other, and staying ahead of the curve in cybersecurity. Whether it’s cryptography, reverse engineering, web exploitation, or any other domain, we are committed to continuous growth and excellence. + +## Contacts + +For any inquiries, feel free to reach out via email at team@bytethecookies.org. You can also connect with us on our [Discord server](https://discord.gg/6fRmDyVDbs) to join the community. + +## Follow Us + +- **GitHub**: +- **X**: +- **LinkedIn**: