Skip to content

Commit 49f57c8

Browse files
committed
Revert "Merge pull request #14 from gitcoinco/card-update"
This reverts commit a326d24, reversing changes made to e5216aa.
1 parent a326d24 commit 49f57c8

File tree

8 files changed

+16
-6222
lines changed

8 files changed

+16
-6222
lines changed

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,13 @@
1919
"ethers": "^6.13.2",
2020
"express": "^4.18.2",
2121
"express-rate-limit": "^6.0.5",
22-
"graphql": "^16.10.0",
2322
"graphql-request": "^6.1.0",
2423
"helmet": "^6.0.0",
2524
"jsdom": "^25.0.1",
2625
"jsonwebtoken": "^9.0.0",
2726
"next": "14.2.13",
2827
"postcss": "^8",
29-
"puppeteer": "^23.11.1",
28+
"puppeteer": "^23.5.3",
3029
"puppeteer-core": "^23.6.0",
3130
"react": "^18",
3231
"react-dom": "^18",

pnpm-lock.yaml

Lines changed: 0 additions & 5692 deletions
This file was deleted.

src/app/api/getAttestation/attestationUtils.ts

Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Donation } from "@/app/types";
2-
import { Alts, getCardSvg, ProjectCount } from "../media/card2";
2+
import { Alts, getCardSvg, ProjectCount } from "../media/card";
33
import { JSDOM } from "jsdom";
44
import puppeteer from "puppeteer";
55
import { getEnsName } from "./ens";
@@ -27,7 +27,7 @@ export async function fetchImageAndEns(
2727
}
2828

2929
setRoundAndChainDetails(document, sortedDonations);
30-
setSimpleTopRoundName(document, sortedDonations);
30+
setTopRoundName(document, sortedDonations);
3131

3232
const ensName = await getEnsName(donations[0].donorAddress);
3333
setWalletAddress(document, ensName || donations[0].donorAddress);
@@ -74,13 +74,13 @@ function sortDonationsByAmount(donations: Donation[]): Donation[] {
7474
}
7575

7676
function singularify(document: Document, elementId: string): void {
77-
// const element = document.getElementById(elementId);
78-
// const textContent = element!.textContent ?? "";
79-
// const words = textContent.split(" ");
80-
// const singularWords = words.map((word) =>
81-
// word.endsWith("s") ? word.slice(0, -1) : word,
82-
// );
83-
// element!.textContent = singularWords.join(" ");
77+
const element = document.getElementById(elementId);
78+
const textContent = element!.textContent ?? "";
79+
const words = textContent.split(" ");
80+
const singularWords = words.map((word) =>
81+
word.endsWith("s") ? word.slice(0, -1) : word,
82+
);
83+
element!.textContent = singularWords.join(" ");
8484
}
8585

8686
function setRoundAndChainDetails(
@@ -167,20 +167,6 @@ function setTopRoundName(document: Document, donations: Donation[]): void {
167167
}
168168
}
169169

170-
function setSimpleTopRoundName(document: Document, donations: Donation[]): void {
171-
const topRound = findTopRound(donations);
172-
const roundName = donations.find(
173-
(donation) => donation.roundId === topRound.roundId,
174-
)?.application?.round?.roundMetadata?.name || "";
175-
176-
const maxCharacters = 26;
177-
const truncatedName = roundName.length > maxCharacters
178-
? roundName.substring(0, maxCharacters - 3) + "..."
179-
: roundName;
180-
181-
setElementTextContent(document, "top-round-0", truncatedName);
182-
}
183-
184170
function setWalletAddress(document: Document, ensOrAddress: string): void {
185171
setElementTextContentAndFontSize(
186172
document,
@@ -296,12 +282,12 @@ function renderProjectDetails(
296282
setElementTextContent(
297283
document,
298284
`project${index}`,
299-
trunc(30, donation.application?.project?.name) || "",
285+
trunc(23, donation.application?.project?.name) || "",
300286
);
301287
setElementTextContent(
302288
document,
303289
`round${index}`,
304-
trunc(50, donation.application?.round?.roundMetadata.name) || "",
290+
trunc(30, donation.application?.round?.roundMetadata.name) || "",
305291
);
306292

307293
const circle = document.getElementById(`logo${index}`);
@@ -436,12 +422,12 @@ async function generateBase64Image(dom: JSDOM): Promise<string> {
436422

437423
const page = await browser.newPage();
438424
await page.setContent(dom.serialize());
439-
await page.setViewport({ width: 1200, height: 600 });
425+
await page.setViewport({ width: 800, height: 800 });
440426

441427
const pngBuffer = await page.screenshot({
442428
type: "png",
443429
encoding: "binary",
444-
clip: { x: 0, y: 0, width: 1200, height: 600 },
430+
clip: { x: 0, y: 0, width: 800, height: 800 },
445431
omitBackground: true,
446432
});
447433

src/app/api/getAttestation/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { NextResponse, NextRequest } from "next/server";
22
import { createDelegationRequest } from "@/services/CreateDelegationRequest";
33
import { fetchDonationsByTransactionHashes } from "@/lib/indexer/queries";
4-
import { backgroundMapper, cardBackgrounds } from "../media/card2";
4+
import { backgroundMapper, cardBackgrounds } from "../media/card";
55
import { fetchImageAndEns } from "./attestationUtils";
66
import { allowedOrigins } from "@/app/config";
77

src/app/api/media/card2.ts

Lines changed: 0 additions & 308 deletions
This file was deleted.

src/app/api/test-card/route.ts

Lines changed: 0 additions & 171 deletions
This file was deleted.

src/app/config.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// NOTE: Update this file anytime a new allo is deployed.
22

33
import { AddressLike } from "ethers";
4-
import dotenv from "dotenv";
5-
dotenv.config();
64

75
type EASConfig = {
86
eas: AddressLike;
@@ -143,7 +141,6 @@ export const allowedOrigins = [
143141
"http://localhost:3000",
144142
"https://grants-stack-explorer-staging.vercel.app",
145143
"https://explorer.gitcoin.co",
146-
"https://explorer-git-update-attestations-grants-stack.vercel.app",
147144
];
148145

149146
export const config = {

vercel.json

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,5 @@
44
"memory": 3008,
55
"maxDuration": 60
66
}
7-
},
8-
"build": {
9-
"env": {
10-
"PUPPETEER_SKIP_DOWNLOAD": "true",
11-
"PUPPETEER_EXECUTABLE_PATH": "/usr/bin/chromium"
12-
}
13-
},
14-
"headers": [
15-
{
16-
"source": "/api/(.*)",
17-
"headers": [
18-
{ "key": "Access-Control-Allow-Credentials", "value": "true" },
19-
{ "key": "Access-Control-Allow-Origin", "value": "*" },
20-
{ "key": "Access-Control-Allow-Methods", "value": "GET,OPTIONS,PATCH,DELETE,POST,PUT" },
21-
{ "key": "Access-Control-Allow-Headers", "value": "X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version" }
22-
]
23-
}
24-
]
7+
}
258
}

0 commit comments

Comments
 (0)