Skip to content

Commit

Permalink
Merge pull request #1 from yangfan3211/main
Browse files Browse the repository at this point in the history
🎨 add favorite
  • Loading branch information
leeduckgo authored May 9, 2024
2 parents efd4242 + ad69de4 commit e0bfee1
Show file tree
Hide file tree
Showing 5 changed files with 14,564 additions and 106 deletions.
54 changes: 37 additions & 17 deletions packages/nextjs/components/ImgShow.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,50 @@
import { useState } from "react";
import Link from "next/link";
import { FaHeart, FaRegHeart } from "react-icons/fa";

// Update the component to accept props
export function ImgShow({ images }) {
return (
<>
<main className="grid grid-cols-3 gap-2 p-4 md:gap-4 lg:grid-cols-4 xl:grid-cols-5">
{images.map((img, index) => (
<div key={index} className="relative group overflow-hidden rounded-md">
<Link
className="absolute inset-0 z-10"
href={img.link}
target="_blank" // Opens the link in a new tab
rel="noopener noreferrer" // Security measure for opening links in a new tab
>
<span className="sr-only">View</span>
</Link>
<img
alt={`Image ${index + 1}`}
className="aspect-square object-cover w-full h-full"
height={400}
src={img.image}
width={400}
/>
</div>
<ImageShowItem key={index} img={img} />
))}
</main>
</>
);
}

const ImageShowItem = ({ img }) => {
const [isLiked, setIsLiked] = useState(false);
const toggleLike = () => setIsLiked(!isLiked);
return (
<div className="relative group overflow-hidden rounded-md">
<div className="w-full h-[calc(100%-2rem)]">
<Link
className="absolute top w-full h-[calc(100%-2rem)] inset-0 z-10"
href={img.link}
target="_blank" // Opens the link in a new tab
rel="noopener noreferrer" // Security measure for opening links in a new tab
>
<span className="sr-only">View</span>
</Link>
<img
alt={`Image`}
className="aspect-square object-cover w-full h-full"
height={400}
src={img.image}
width={400}
/>
</div>

<div className="px-2 h-8 w-full bg-sky-500 flex justify-between items-center">
<div className="space-x-2">
<div className="badge badge-outline">collection #1</div>
<div className="badge badge-outline">collection #2</div>
</div>
<button onClick={toggleLike}>{isLiked ? <FaRegHeart /> : <FaHeart />}</button>
</div>
</div>
);
};
244 changes: 155 additions & 89 deletions packages/nextjs/generated/deployedContracts.ts
Original file line number Diff line number Diff line change
@@ -1,130 +1,196 @@
const contracts = {
// modifile here.
10: [
31337: [
{
chainId: "10",
name: "optimism",
chainId: "31337",
name: "localhost",
contracts: {
VectorDBProposalGovernancer: {
address: "0x604dcaEC4E9ad55737F00D87B47ae497d2d78608",
YourContract: {
address: "0x5FbDB2315678afecb367f032d93F642f64180aa3",
abi: [
{
"inputs": [
inputs: [],
stateMutability: "nonpayable",
type: "constructor",
},
{
inputs: [],
name: "chairperson",
outputs: [
{
"internalType": "string",
"name": "_vectorName",
"type": "string"
}
internalType: "address",
name: "",
type: "address",
},
],
"stateMutability": "nonpayable",
"type": "constructor"
stateMutability: "view",
type: "function",
},
{
"anonymous": false,
"inputs": [
inputs: [
{
"indexed": false,
"internalType": "string",
"name": "uuid",
"type": "string"
internalType: "string",
name: "_title",
type: "string",
},
{
"indexed": false,
"internalType": "bool",
"name": "decide",
"type": "bool"
}
internalType: "string",
name: "_content",
type: "string",
},
],
"name": "JudgeSet",
"type": "event"
name: "createProposal",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
"inputs": [
inputs: [
{
"internalType": "string",
"name": "_uuid",
"type": "string"
internalType: "address",
name: "to",
type: "address",
},
{
"internalType": "bool",
"name": "_decide",
"type": "bool"
}
],
"name": "judgeTag",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
name: "delegate",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
"inputs": [
inputs: [
{
internalType: "uint32",
name: "id",
type: "uint32",
},
],
name: "getProposal",
outputs: [
{
"internalType": "string",
"name": "_uuid",
"type": "string"
components: [
{
internalType: "string",
name: "title",
type: "string",
},
{
internalType: "string",
name: "content",
type: "string",
},
{
internalType: "address",
name: "proposaler",
type: "address",
},
{
internalType: "uint256",
name: "voteCount",
type: "uint256",
},
],
internalType: "struct YourContract.Proposal",
name: "",
type: "tuple",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
"internalType": "string",
"name": "_meta_data",
"type": "string"
}
internalType: "address",
name: "voter",
type: "address",
},
],
"name": "tagItem",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
name: "giveRightToVote",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
"anonymous": false,
"inputs": [
inputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
name: "proposals",
outputs: [
{
internalType: "string",
name: "title",
type: "string",
},
{
"indexed": true,
"internalType": "address",
"name": "tagger",
"type": "address"
internalType: "string",
name: "content",
type: "string",
},
{
"indexed": false,
"internalType": "string",
"name": "uuid",
"type": "string"
internalType: "address",
name: "proposaler",
type: "address",
},
{
"indexed": false,
"internalType": "string",
"name": "metadata",
"type": "string"
}
internalType: "uint256",
name: "voteCount",
type: "uint256",
},
],
"name": "TagSet",
"type": "event"
stateMutability: "view",
type: "function",
},
{
"inputs": [],
"name": "chairperson",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
inputs: [
{
internalType: "uint256",
name: "proposal",
type: "uint256",
},
],
"stateMutability": "view",
"type": "function"
name: "vote",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
"inputs": [],
"name": "vectorName",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
inputs: [
{
internalType: "address",
name: "",
type: "address",
},
],
name: "voters",
outputs: [
{
internalType: "uint256",
name: "weight",
type: "uint256",
},
{
internalType: "bool",
name: "voted",
type: "bool",
},
{
internalType: "address",
name: "delegate",
type: "address",
},
{
internalType: "uint256",
name: "vote",
type: "uint256",
},
],
"stateMutability": "view",
"type": "function"
}
stateMutability: "view",
type: "function",
},
],
},
},
Expand Down
1 change: 1 addition & 0 deletions packages/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"react-dom": "^18.2.0",
"react-fast-marquee": "^1.3.5",
"react-hot-toast": "^2.4.0",
"react-icons": "^5.2.1",
"react-markdown": "^9.0.0",
"tailwind-merge": "^2.3.0",
"tailwindcss-animate": "^1.0.7",
Expand Down
Loading

0 comments on commit e0bfee1

Please sign in to comment.