Skip to content

Commit 26f0863

Browse files
Merge pull request #50 from code4rena-dev/leo95oliveira/contest-tile-tags-update
Bug Fix - Displaying Ethereum logo for EVM and EVM Types
2 parents 6b49c24 + 195440d commit 26f0863

File tree

5 files changed

+32
-12
lines changed

5 files changed

+32
-12
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@code4rena/components-library",
3-
"version": "3.1.1",
3+
"version": "3.1.2",
44
"description": "Code4rena's official components library ",
55
"types": "./dist/lib.d.ts",
66
"exports": {

src/lib/ContestTile/CompactTemplate.tsx

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,13 @@ const IsContest = ({title, isDarkTile = true, contestData, sponsorUrl, sponsorIm
6262
const [contestTimelineObject, setContestTimelineObject] = useState<ContestSchedule | undefined>();
6363
const [hasBotRace, setHasBotRace] = useState(contestData ? !!contestData.botFindingsRepo : false);
6464
let ecosystemLogoName: string = "";
65-
if (ecosystem && (ecosystem === "Polkadot" || ecosystem === "Ethereum")) {
66-
ecosystemLogoName = `logo-${ecosystem.toLowerCase()}`
65+
const evmTypes = new Set([
66+
"EVM", "Ethereum", "Arbitrum", "Avax", "BSC", "Optimism", "Polygon", "zkSync"
67+
]);
68+
if (ecosystem && (ecosystem === "Polkadot")) {
69+
ecosystemLogoName = 'logo-polkadot'
70+
} else if (evmTypes.has(ecosystem ?? "")) {
71+
ecosystemLogoName = 'logo-ethereum';
6772
}
6873

6974
const updateContestTileStatus = useCallback(() => {
@@ -188,8 +193,13 @@ const IsBounty = ({title, isDarkTile = true, bountyData, sponsorUrl, sponsorImag
188193
}) => {
189194
const { amount, bountyUrl, ecosystem, languages } = bountyData;
190195
let ecosystemLogoName: string = "";
191-
if (ecosystem && (ecosystem === "Polkadot" || ecosystem === "Ethereum")) {
192-
ecosystemLogoName = `logo-${ecosystem.toLowerCase()}`
196+
const evmTypes = new Set([
197+
"EVM", "Ethereum", "Arbitrum", "Avax", "BSC", "Optimism", "Polygon", "zkSync"
198+
]);
199+
if (ecosystem && (ecosystem === "Polkadot")) {
200+
ecosystemLogoName = 'logo-polkadot'
201+
} else if (evmTypes.has(ecosystem ?? "")) {
202+
ecosystemLogoName = 'logo-ethereum';
193203
}
194204

195205
return (

src/lib/ContestTile/ContestTile.stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ const defaultArgs = {
3939
contestType: "Open Audit",
4040
isUserCertified: false,
4141
contestId: 321,
42-
ecosystem: "Ethereum" as ContestEcosystem,
43-
languages: ["Rust"] as CodingLanguage[],
42+
ecosystem: "EVM" as ContestEcosystem,
43+
languages: ["Solidity"] as CodingLanguage[],
4444
contestUrl: "https://code4rena.com/audits/2023-07-axelar-network#top",
4545
contestRepo: "https://github.com/code-423n4/2023-07-axelar",
4646
findingsRepo: "https://github.com/code-423n4/2023-07-axelar",

src/lib/ContestTile/ContestTile.types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export enum ContestTileVariant {
88
COMPACT_DARK = "COMPACT_DARK"
99
}
1010

11-
export type ContestEcosystem = "Algorand" | "Aptos" | "Blast" | "Cosmos" | "Ethereum" | "EVM" | "NEAR" | "Polkadot" | "Scroll" | "Sei" | "Solana" | "StarkNet" | "Stellar" | "Sui" | "Other";
11+
export type ContestEcosystem = "Algorand" | "Aptos" | "Blast" | "Cosmos" | "EVM" | "NEAR" | "Polkadot" | "Scroll" | "Sei" | "Solana" | "StarkNet" | "Stellar" | "Sui" | "Other";
1212

1313
export type CodingLanguage = "Cairo" | "GO" | "HUFF" | "Ink" | "Move" | "Noir" | "Other" | "Rain" | "Rust" | "Rust evm" | "Solidity" | "Vyper" | "Yui";
1414

src/lib/ContestTile/DefaultTemplate.tsx

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,13 @@ function IsContest({
253253
}) {
254254
const { contestUrl, amount, findingsRepo, startDate, endDate, ecosystem, languages } = contestData;
255255
let ecosystemLogoName: string = "";
256-
if (ecosystem && (ecosystem === "Polkadot" || ecosystem === "Ethereum")) {
257-
ecosystemLogoName = `logo-${ecosystem.toLowerCase()}`
256+
const evmTypes = new Set([
257+
"EVM", "Ethereum", "Arbitrum", "Avax", "BSC", "Optimism", "Polygon", "zkSync"
258+
]);
259+
if (ecosystem && (ecosystem === "Polkadot")) {
260+
ecosystemLogoName = 'logo-polkadot'
261+
} else if (evmTypes.has(ecosystem ?? "")) {
262+
ecosystemLogoName = 'logo-ethereum';
258263
}
259264

260265
return (
@@ -403,8 +408,13 @@ function IsBounty({
403408
const { bountyUrl, amount, startDate, ecosystem, languages } = bountyData;
404409
const endDate = "2999-01-01T00:00:00Z"
405410
let ecosystemLogoName: string = "";
406-
if (ecosystem && (ecosystem === "Polkadot" || ecosystem === "Ethereum")) {
407-
ecosystemLogoName = `logo-${ecosystem.toLowerCase()}`
411+
const evmTypes = new Set([
412+
"EVM", "Ethereum", "Arbitrum", "Avax", "BSC", "Optimism", "Polygon", "zkSync"
413+
]);
414+
if (ecosystem && (ecosystem === "Polkadot")) {
415+
ecosystemLogoName = 'logo-polkadot'
416+
} else if (evmTypes.has(ecosystem ?? "")) {
417+
ecosystemLogoName = 'logo-ethereum';
408418
}
409419

410420
return (

0 commit comments

Comments
 (0)