From ee672500a4bc5bf5ab8f0bab85a251ee8694321e Mon Sep 17 00:00:00 2001 From: Pablo Alayeto <55535804+Pabl0cks@users.noreply.github.com> Date: Mon, 26 Feb 2024 11:39:44 +0100 Subject: [PATCH] Load initial data for grants and hide dark mode toggle (#39) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Carlos Sánchez --- packages/local_db/seed.sample.json | 184 +++++++++++++++----- packages/local_db/utils.ts | 7 +- packages/nextjs/app/layout.tsx | 2 +- packages/nextjs/components/Footer.tsx | 2 - packages/nextjs/services/database/schema.ts | 4 +- 5 files changed, 152 insertions(+), 47 deletions(-) diff --git a/packages/local_db/seed.sample.json b/packages/local_db/seed.sample.json index 10c1afc..9fb89f5 100644 --- a/packages/local_db/seed.sample.json +++ b/packages/local_db/seed.sample.json @@ -127,47 +127,151 @@ } }, "grants": { - "fWmHtS89edfHhVwOOYOz": { - "askAmount": 0.5, - "builder": "0x55b9CB0bCf56057010b9c471e7D42d60e1111EEa", - "description": "This is long description for 1st grant", - "status": "completed", - "timestamp": 1660983774000, - "title": "1s Test grant" - }, - "eOp1CMm83N1LzlVhcLZu": { - "askAmount": 0.5, - "builder": "0x60583563D5879C2E59973E5718c7DE2147971807", - "title": "2nd Test grant", - "description": "This is long description", - "status": "completed", - "timestamp": 1660993774000 - }, - "5nwkdmFIAecWO2XUyyWP": { - "askAmount": 0.1, - "builder": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8", - "title": "3rd Test grant", - "description": "This is long description for 3rd grant", - "status": "completed", - "timestamp": 1660983774000 - }, - "9ZoLxv5ay18mnGn6BwqG": { - "askAmount": 0.25, - "builder": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8", - "title": "4th Test grant", - "description": "This is long description for 3rd grant", - "status": "proposed", - "timestamp": 1660983774000 + "g9EmnJROMeqydxP1BGSx": { + "askAmount": 0.25, + "builder": "0x55fF7E28e7cd43C104dC89Aa69285E0E6EBa064e", + "title": "Buidl Guild English Auction", + "description": "English auction platform where users can create an auction on NFTs.", + "link": "https://app.buidlguidl.com/build/g9EmnJROMeqydxP1BGSx", + "status": "completed", + "timestamp": 1706627065000 + }, + "fhiWGoHrfdGM2iuFZTGT": { + "askAmount": 0.25, + "builder": "0x2F142f9F52af0845B7b8b1353E349Ca1Cb8EFE92", + "title": "15 Puzzle", + "description": "The famous sliding puzzle with 15 squares. Base starter writes your moves to the blockchain.", + "link": "https://app.buidlguidl.com/build/fhiWGoHrfdGM2iuFZTGT", + "status": "completed", + "timestamp": 1706656049000 + }, + "EkbuyFm9gYwn27nja7m3": { + "askAmount": 0.25, + "builder": "0x2b30efBA367D669c9cd7723587346a79b67A42DB", + "title": "0xPoker", + "description": "A Commit and Reveal Poker Game! Live on the Optimism chain =) Took inspiration from the RockPaperScissors", + "link": "https://app.buidlguidl.com/build/EkbuyFm9gYwn27nja7m3", + "status": "completed", + "timestamp": 1706690199000 + }, + "MINVRoKfXZOgO6nsxUp0": { + "askAmount": 0.25, + "builder": "0x5D70E3b540f58beCd10B74f6c0958b31e3190DA7", + "title": "Duel - Bet dApp", + "description": "This dApp allows users to make bets on the future price of Ethereum (ETH). Users can: - Create bets: Choose a future date and ETH price, and stake an amount of ETH. - Resolve bets: When the chosen date arrives, bets can be finalized according to the ETH price at the target date. - Win or lose: If the ETH price is above the chosen price when the bet is chosen as \"Higher\", the user wins the bet and receives the staked ETH plus winnings. I will be glad to hear your feedbacks. Have fun!\n", + "link": "https://app.buidlguidl.com/build/MINVRoKfXZOgO6nsxUp0", + "status": "completed", + "timestamp": 1706815801000 + }, + "nLsqcBkuoNb8nWVAuJg0": { + "askAmount": 0.25, + "builder": "0x1CeF0e6072810013487f7632350f9336AD6CADAD", + "title": "Public Good supportUs", + "description": "Decentralized public goods funding application. Campaign owners can set funds needed", + "link": "https://app.buidlguidl.com/build/nLsqcBkuoNb8nWVAuJg0", + "status": "completed", + "timestamp": 1706860595000 + }, + "BeyVyZuAvbFnUWjVbJ7U": { + "askAmount": 0.25, + "builder": "0xC6e64eBeFaFaB3d646adadca5D93A7c44f62544f", + "title": "ZeroTrust Accounts", + "description": "ZeroTrust Accounts will provide a decentralized, secure, and self-sovereign approach to Ethereum smart contract accounts", + "link": "https://app.buidlguidl.com/build/BeyVyZuAvbFnUWjVbJ7U", + "status": "completed", + "timestamp": 1706892428000 + }, + "6JZBiYsLbfZ06SrQGyGz": { + "askAmount": 0.25, + "builder": "0x3b529ac4F8dc0C40Fec0f1192029755275A0c3Cd", + "title": "Event Management Dapp", + "description": "An app to create, manage, and sell tickets for events and buy them along with many functionalities", + "link": "https://app.buidlguidl.com/build/6JZBiYsLbfZ06SrQGyGz", + "status": "completed", + "timestamp": 1706940527000 + }, + "ItKedxWVEaX9OcCrphMu": { + "askAmount": 0.25, + "builder": "0xbE7fD3889C01F032184544DC0005F0d47daCcf09", + "title": "Switch Dapp", + "description": "Switch is a web app for sending deferred transactions. The user has a simple UI for setting a transaction which will be triggered and excecuted later based on speficied: 1) Time delay or 2) On-chain variable output. Implements Chainlink Functions and Automation.", + "link": "https://app.buidlguidl.com/build/ItKedxWVEaX9OcCrphMu", + "status": "completed", + "timestamp": 1707065464000 + }, + "ZW4MfCMCU209bKP8Va8M": { + "askAmount": 0.25, + "builder": "0x8757F328371E571308C1271BD82B91882253FDd1", + "title": "D-Auction Platform", + "description": "Decentralized Auction Platform named D-Auction is a smart contract-based solution for conducting decentralized auctions of non-fungible tokens (NFTs). This platform allows users to create auctions for their NFTs, participate in bidding, and claim ownership of the NFTs upon winning the auctions", + "link": "https://app.buidlguidl.com/build/ZW4MfCMCU209bKP8Va8M", + "status": "completed", + "timestamp": 1707065465000 + }, + "i2ChwolQO0qR1Qbp0qCQ": { + "askAmount": 0.25, + "builder": "0xdDE7B987A01717EEfCcA1Dc5280c164E2cCD133e", + "title": "DEGEN-STATION", + "description": "Degen Station is a raffle contract that allows for any individual to stake a certain amount of Eth with hopes of winning the grand prize which is 96% of the total stakes in the contract. Winners of each batch are also rewarded with an nft which. The is also a in built point system which is expected to tract users usage so that can be rewarded with the protocol tokens when it goes life.", + "link": "https://app.buidlguidl.com/build/i2ChwolQO0qR1Qbp0qCQ", + "status": "completed", + "timestamp": 1705910401000 + }, + "UeQnRI5ISO93XHYcVTRj": { + "askAmount": 0.25, + "builder": "0x38D9cFf58D233AF0B9c1434EEDE012009D23c971", + "title": "External Contract UI", + "description": "A tool to improve the developer experience on scaffold-eth 2 by providing a tool to interact with external contract addresses", + "link": "https://app.buidlguidl.com/build/UeQnRI5ISO93XHYcVTRj", + "status": "completed", + "timestamp": 1705910402000 + }, + "nEjaQfkyzMgt3vcbAqLd": { + "askAmount": 0.25, + "builder": "0x63191383EDbd8531C442868d87555f1EA2f6ad4E", + "title": "Querying Smart Contract Parameters From TheGraph", + "description": "Basic understanding of the \ud83d\udea9 Challenge #3: The Graph with basic explanations that are going to be helpful for the newcomers.", + "link": "https://app.buidlguidl.com/build/nEjaQfkyzMgt3vcbAqLd", + "status": "completed", + "timestamp": 1705910403000 + }, + "AuyB2d2IydtOEvePeyNN": { + "askAmount": 0.25, + "builder": "0xFC7BC662fA06137F769366A46B19924371E880bd", + "title": "\ud83e\udd57 Food Mart", + "description": "An online restaurant food application that enables wallet integration, with images stored on IPFS. Additionally, the web app provides the option to view the calorie count per serving for each dish.", + "link": "https://app.buidlguidl.com/build/AuyB2d2IydtOEvePeyNN", + "status": "completed", + "timestamp": 1705910404000 + }, + "H7AtTDtQOQ0h6wRT1A0G": { + "askAmount": 0.25, + "builder": "0xfbCE2693FBEd73E3D464d662235DC5ADC5454C01", + "title": "Revolution Roulette", + "description": "On chain russian roulette with unique items as powerups. Settle minor bets with some fun on optimism \ud83d\ude0e", + "link": "https://app.buidlguidl.com/build/H7AtTDtQOQ0h6wRT1A0G", + "status": "completed", + "timestamp": 1705910405000 + }, + "xQ7KIxSjvUqOVjPUl3R2": { + "askAmount": 0.25, + "builder": "0xC863DFEE737C803c93aF4b6b27029294f6a56eB5", + "title": "Scaffold-XOC", + "description": "The open-source frontend for the first decentralized stablecoin pegged to the Mexican Peso ($MXN). This dapp is La Dao's playground to grow DeFi in Mexico", + "link": "https://app.buidlguidl.com/build/xQ7KIxSjvUqOVjPUl3R2", + "status": "completed", + "timestamp": 1705910406000 + }, + "LQane0FtluzI8l3kwQGL": { + "askAmount": 0.25, + "builder": "0x5638Bf706056d01b2DaB817915244B3E21a56FE8", + "title": "Voting App", + "description": "A polling app that allows users to create polls, vote, and view the results on topics that matter to them. Built with solidity and nextjs, it features transparent voting mechanisms and real-time results visualization.", + "link": "https://app.buidlguidl.com/build/LQane0FtluzI8l3kwQGL", + "status": "completed", + "timestamp": 1705910407000 + } }, - "7kTh6xnk2338O0gJyzt6": { - "askAmount": 1, - "builder": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8", - "title": "5th Test grant", - "description": "This is long description for 5th grant", - "status": "approved", - "timestamp": 1660983774000 - } - }, "events": [ { "type": "build.submit", diff --git a/packages/local_db/utils.ts b/packages/local_db/utils.ts index 53d6d86..6393df8 100644 --- a/packages/local_db/utils.ts +++ b/packages/local_db/utils.ts @@ -16,8 +16,13 @@ async function importCollectionData( database: Firestore, collectionName: string, data: Record, + ignoreId: boolean = false, ) { for (const [id, docData] of Object.entries(data)) { + if (ignoreId) { + await database.collection(collectionName).add(docData); + continue; + } await database.collection(collectionName).doc(id).set(docData); } } @@ -64,7 +69,7 @@ export const importSeed = async (database: Firestore) => { importCollectionData(database, "config", seedToImport.config), importCollectionData(database, "cohorts", seedToImport.cohorts), importCollectionData(database, "notifications", seedToImport.notifications), - importCollectionData(database, "grants", seedToImport.grants), + importCollectionData(database, "grants", seedToImport.grants, true), ]); console.log("Seed completed successfully! 🌱"); diff --git a/packages/nextjs/app/layout.tsx b/packages/nextjs/app/layout.tsx index 9ee5c34..f5a6379 100644 --- a/packages/nextjs/app/layout.tsx +++ b/packages/nextjs/app/layout.tsx @@ -77,7 +77,7 @@ const ScaffoldEthApp = ({ children }: { children: React.ReactNode }) => { className={`${ppEditorial.variable} ${spaceMono.variable} ${spaceGrotesk.variable} scroll-smooth`} > - + {children} diff --git a/packages/nextjs/components/Footer.tsx b/packages/nextjs/components/Footer.tsx index bd6a68a..1ae5811 100644 --- a/packages/nextjs/components/Footer.tsx +++ b/packages/nextjs/components/Footer.tsx @@ -3,7 +3,6 @@ import Link from "next/link"; import { hardhat } from "viem/chains"; import { MagnifyingGlassIcon } from "@heroicons/react/24/outline"; import { HeartIcon } from "@heroicons/react/24/outline"; -import { SwitchTheme } from "~~/components/SwitchTheme"; import { BuidlGuidlLogo } from "~~/components/assets/BuidlGuidlLogo"; import { Faucet } from "~~/components/scaffold-eth"; import { useTargetNetwork } from "~~/hooks/scaffold-eth/useTargetNetwork"; @@ -30,7 +29,6 @@ export const Footer = () => { )} -
diff --git a/packages/nextjs/services/database/schema.ts b/packages/nextjs/services/database/schema.ts index 85e01ba..a04700e 100644 --- a/packages/nextjs/services/database/schema.ts +++ b/packages/nextjs/services/database/schema.ts @@ -44,10 +44,8 @@ export type GrantData = { description: string; askAmount: number; builder: string; + link?: string; timestamp: number; - // TODO Check if firebase has it bydefault - // updated timestamp; - // proposed and submited timestamp are imp status: "proposed" | "approved" | "submitted" | "completed" | "rejected"; };