Skip to content

Commit

Permalink
frontend changes for Linea - chains.ts and navigation.ts should be un…
Browse files Browse the repository at this point in the history
…commented on release
  • Loading branch information
manishiwa committed Nov 17, 2023
1 parent 8ff4b56 commit 0beaa1a
Show file tree
Hide file tree
Showing 7 changed files with 100 additions and 86 deletions.
55 changes: 22 additions & 33 deletions components/layout/CategoryMetrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,6 @@ export default function CategoryMetrics({
data: any[];
};

const ContractUrls = {
arbitrum: "https://arbiscan.io/address/",
optimism: "https://optimistic.etherscan.io/address/",
zksync_era: "https://explorer.zksync.io/address/",
polygon_zkevm: "https://zkevm.polygonscan.com/address/",
imx: "https://immutascan.io/address/",
base: "https://basescan.org/address/",
zora: "https://explorer.zora.energy/address/",
gitcoin_pgn: "https://explorer.publicgoods.network/address/",
};
const { isSidebarOpen } = useUIContext();
const [selectedMode, setSelectedMode] = useState("gas_fees_");
const [selectedCategory, setSelectedCategory] = useState(
Expand Down Expand Up @@ -136,16 +126,12 @@ export default function CategoryMetrics({

const [selectedChains, setSelectedChains] = useState<{
[key: string]: boolean;
}>({
arbitrum: true,
zksync_era: true,
optimism: true,
polygon_zkevm: true,
imx: true,
base: true,
zora: true,
gitcoin_pgn: true,
});
}>(
Object.entries(AllChainsByKeys).reduce((acc, [key, chain]) => {
if (AllChainsByKeys[key].chainType === "L2") acc[key] = true;
return acc;
}, {}),
);

const [contracts, setContracts] = useState<{ [key: string]: ContractInfo }>(
{},
Expand Down Expand Up @@ -2316,19 +2302,22 @@ export default function CategoryMetrics({
</div>

<div className="flex items-center w-[57%] justify-end ">
<Link
href={
ContractUrls[sortedContracts[key].chain] +
"" +
sortedContracts[key].address
}
target="_blank"
>
<Icon
icon="material-symbols:link"
className="w-[30px] h-[30px]"
/>
</Link>
{master && (
<Link
href={
master.chains[sortedContracts[key].chain]
.block_explorer +
"address/" +
sortedContracts[key].address
}
target="_blank"
>
<Icon
icon="material-symbols:link"
className="w-[30px] h-[30px]"
/>
</Link>
)}
</div>
</div>
</div>
Expand Down
4 changes: 1 addition & 3 deletions components/layout/ChainAnimations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,7 @@ export default function ChainAnimations({
<animated.div
key={chain}
className={`relative flex flex-row flex-grow h-full items-center rounded-full text-xs font-medium hover:cursor-pointer z-0 ${
["arbitrum", "imx", "gitcoin_pgn", "zkSync Era", "all_l2s"].includes(
chain,
)
AllChainsByKeys[chain].darkTextOnBackground === true
? "text-white dark:text-black"
: "text-white"
} ${
Expand Down
72 changes: 24 additions & 48 deletions components/layout/OverviewMetrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,6 @@ type ContractInfo = {
txcount_share: number;
};

const ContractUrls = {
arbitrum: "https://arbiscan.io/address/",
optimism: "https://optimistic.etherscan.io/address/",
zksync_era: "https://explorer.zksync.io/address/",
polygon_zkevm: "https://zkevm.polygonscan.com/address/",
imx: "https://immutascan.io/address/",
base: "https://basescan.org/address/",
zora: "https://explorer.zora.energy/address/",
gitcoin_pgn: "https://explorer.publicgoods.network/address/",
};

export default function OverviewMetrics({
data,
showEthereumMainnet,
Expand Down Expand Up @@ -1468,12 +1457,8 @@ export default function OverviewMetrics({
<>
<div
className={`flex flex-row flex-grow h-full items-center rounded-full text-xs font-medium ${
[
"arbitrum",
"imx",
"gitcoin_pgn",
"all_l2s",
].includes(chainKey)
AllChainsByKeys[chainKey].darkTextOnBackground ===
true
? "text-white dark:text-black"
: "text-white"
} ${
Expand Down Expand Up @@ -1522,12 +1507,8 @@ export default function OverviewMetrics({
) : (
<div
className={`flex flex-row flex-grow h-full items-center rounded-full text-xs font-medium ${
[
"arbitrum",
"imx",
"gitcoin_pgn",
"all_l2s",
].includes(chainKey)
AllChainsByKeys[chainKey].darkTextOnBackground ===
true
? "text-white dark:text-black"
: "text-white"
} ${AllChainsByKeys[chainKey].backgrounds[theme][1]}`}
Expand Down Expand Up @@ -1661,21 +1642,13 @@ export default function OverviewMetrics({
? "text-xs"
: "text-sm font-semibold"
} ${
[
"arbitrum",
"imx",
"gitcoin_pgn",
"all_l2s",
].includes(chainKey)
AllChainsByKeys[chainKey]
.darkTextOnBackground === true
? "text-black"
: "text-white"
}`
: [
"arbitrum",
"imx",
"gitcoin_pgn",
"all_l2s",
].includes(chainKey)
: AllChainsByKeys[chainKey]
.darkTextOnBackground === true
? i > 4
? "text-white/60 text-xs"
: "text-black text-xs"
Expand Down Expand Up @@ -2508,19 +2481,22 @@ export default function OverviewMetrics({
</div>

<div className="flex items-center w-[57%] justify-end ">
<Link
href={
ContractUrls[sortedContracts[key].chain] +
"" +
sortedContracts[key].address
}
target="_blank"
>
<Icon
icon="material-symbols:link"
className="w-[30px] h-[30px]"
/>
</Link>
{master && (
<Link
href={
master.chains[sortedContracts[key].chain]
.block_explorer +
"address/" +
sortedContracts[key].address
}
target="_blank"
>
<Icon
icon="material-symbols:link"
className="w-[30px] h-[30px]"
/>
</Link>
)}
</div>
</div>
</div>
Expand Down
5 changes: 5 additions & 0 deletions icons/gtp.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@
"width": 15,
"height": 15
},
"linea-logo-monochrome": {
"body": "<g clip-path='url(#clip0_4148_14743)'><path d='M10.966 13.9999H1V3.10938H3.28024V11.8893H10.966V13.9988V13.9999Z' fill='currentColor'/><path d='M10.966 5.21895C12.0893 5.21895 13 4.27451 13 3.10948C13 1.94444 12.0893 1 10.966 1C9.84266 1 8.93201 1.94444 8.93201 3.10948C8.93201 4.27451 9.84266 5.21895 10.966 5.21895Z' fill='currentColor'/></g><defs><clipPath id='clip0_4148_14743'><rect width='12' height='13' fill='white' transform='translate(1 1)'/></clipPath></defs>",
"width": 15,
"height": 15
},
"house": {
"body": "\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M11.4374 1.11009C11.7684 0.852628 12.2319 0.852628 12.5629 1.11009L20.8129 7.52675C21.0362 7.70042 21.1668 7.96745 21.1668 8.25033V18.3337C21.1668 19.063 20.8771 19.7625 20.3614 20.2782C19.8456 20.7939 19.1462 21.0837 18.4168 21.0837H5.5835C4.85415 21.0837 4.15468 20.7939 3.63895 20.2782C3.12323 19.7625 2.8335 19.063 2.8335 18.3337V8.25033C2.8335 7.96745 2.9641 7.70042 3.18738 7.52675L11.4374 1.11009ZM4.66683 8.69865V18.3337C4.66683 18.5768 4.76341 18.8099 4.93531 18.9818C5.10722 19.1538 5.34038 19.2503 5.5835 19.2503H18.4168C18.6599 19.2503 18.8931 19.1538 19.065 18.9818C19.2369 18.8099 19.3335 18.5768 19.3335 18.3337V8.69865L12.0002 2.99495L4.66683 8.69865Z\" fill=\"url(#paint0_linear_1121_7867)\"/>\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M8.3335 10.9997C8.3335 10.4934 8.7439 10.083 9.25016 10.083H14.7502C15.2564 10.083 15.6668 10.4934 15.6668 10.9997V20.1663C15.6668 20.6726 15.2564 21.083 14.7502 21.083C14.2439 21.083 13.8335 20.6726 13.8335 20.1663V11.9163H10.1668V20.1663C10.1668 20.6726 9.75642 21.083 9.25016 21.083C8.7439 21.083 8.3335 20.6726 8.3335 20.1663V10.9997Z\" fill=\"url(#paint1_linear_1121_7867)\"/>\n <defs>\n <linearGradient id=\"paint0_linear_1121_7867\" x1=\"12.0002\" y1=\"0.916992\" x2=\"12.0002\" y2=\"21.0837\" gradientUnits=\"userSpaceOnUse\">\n <stop stop-color=\"#10808C\"/>\n <stop offset=\"1\" stop-color=\"#1DF7EF\"/>\n </linearGradient>\n <linearGradient id=\"paint1_linear_1121_7867\" x1=\"12.0002\" y1=\"10.083\" x2=\"12.0002\" y2=\"21.083\" gradientUnits=\"userSpaceOnUse\">\n <stop stop-color=\"#FE5468\"/>\n <stop offset=\"1\" stop-color=\"#FFDF27\"/>\n </linearGradient>\n </defs>\n ",
"width": 24,
Expand Down
37 changes: 36 additions & 1 deletion lib/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const AllChains = [
light: ["bg-[#293305]", "bg-[#293305]"],
dark: ["bg-[#C1C1C1]", "bg-[#C1C1C1]"],
},
darkTextOnBackground: false,
},
{
label: "Arbitrum",
Expand All @@ -42,6 +43,7 @@ export const AllChains = [
light: ["bg-[#2ECEE8]", "bg-[#2ECEE8]"],
dark: ["bg-[#1DF7EF]", "bg-[#1DF7EF]"],
},
darkTextOnBackground: true,
},
{
label: "Aztec V2",
Expand All @@ -60,8 +62,8 @@ export const AllChains = [
light: ["bg-[#000000]", "bg-[#000000]"],
dark: ["bg-[#000000]", "bg-[#000000]"],
},
darkTextOnBackground: false,
},

{
label: "Immutable X",
icon: "/icons/immutablex.png",
Expand All @@ -83,6 +85,7 @@ export const AllChains = [
light: ["bg-[#08373C]", "bg-[#08373C]"],
dark: ["bg-[#3AFCC9]", "bg-[#3AFCC9]"],
},
darkTextOnBackground: true,
},
{
label: "Polygon zkEVM",
Expand All @@ -105,6 +108,7 @@ export const AllChains = [
light: ["bg-[#800094]", "bg-[#800094]"],
dark: ["bg-[#AD0DC5]", "bg-[#AD0DC5]"],
},
darkTextOnBackground: false,
},
{
label: "Loopring",
Expand All @@ -126,6 +130,7 @@ export const AllChains = [
light: ["bg-[#000000]", "bg-[#000000]"],
dark: ["bg-[#000000]", "bg-[#000000]"],
},
darkTextOnBackground: false,
},
{
label: "OP Mainnet",
Expand All @@ -148,6 +153,7 @@ export const AllChains = [
light: ["bg-[#DD3408]", "bg-[#DD3408]"],
dark: ["bg-[#FE5468]", "bg-[#FE5468]"],
},
darkTextOnBackground: false,
},
{
label: "zkSync Era",
Expand All @@ -170,6 +176,7 @@ export const AllChains = [
light: ["bg-[#390094]", "bg-[#390094]"],
dark: ["bg-[#7C32F4]", "bg-[#7C32F4]"],
},
darkTextOnBackground: false,
},
{
label: "Base",
Expand All @@ -192,6 +199,7 @@ export const AllChains = [
light: ["bg-[#2151F5]", "bg-[#2151F5]"],
dark: ["bg-[#2151F5]", "bg-[#2151F5]"],
},
darkTextOnBackground: false,
},
{
label: "Public Goods Network",
Expand All @@ -214,6 +222,7 @@ export const AllChains = [
light: ["bg-[#B9EE75]", "bg-[#B9EE75]"],
dark: ["bg-[#D7FD7B]", "bg-[#D7FD7B]"],
},
darkTextOnBackground: true,
},
{
label: "Zora",
Expand All @@ -236,7 +245,31 @@ export const AllChains = [
light: ["bg-[#2FB9F4]", "bg-[#2FB9F4]"],
dark: ["bg-[#2FB9F4]", "bg-[#2FB9F4]"],
},
darkTextOnBackground: false,
},
// {
// label: "Linea",
// icon: "/icons/linea.png",
// key: "linea",
// urlKey: "linea",
// chainType: "L2",
// ecosystem: ["all-chains"],
// description:
// "Linea is a developer-friendly ZK Rollup, marked as the next stage of ConsenSys zkEVM, which aims to enhance the Ethereum network by facilitating a new wave of decentralized applications. Public launch was in August 2023.",
// border: {
// light: ["border-[#9CE5FF]", "border-[#9CE5FF]"],
// dark: ["border-[#A9E9FF]", "border-[#A9E9FF]"],
// },
// colors: {
// light: ["#9CE5FF", "#9CE5FF"], // dark purple
// dark: ["#A9E9FF", "#A9E9FF"], // dark purple
// },
// backgrounds: {
// light: ["bg-[#9CE5FF]", "bg-[#9CE5FF]"],
// dark: ["bg-[#A9E9FF]", "bg-[#A9E9FF]"],
// },
// darkTextOnBackground: true,
// },
{
label: "Multiple",
icon: null,
Expand All @@ -258,6 +291,7 @@ export const AllChains = [
light: ["bg-[#cdd8d3]", "bg-[#cdd8d3]"],
dark: ["bg-[#cdd8d3]", "bg-[#cdd8d3]"],
},
darkTextOnBackground: false,
},
{
label: "All L2s",
Expand All @@ -279,6 +313,7 @@ export const AllChains = [
light: ["bg-[#FFDF27]", "bg-[#FE5468]"],
dark: ["bg-[#FFDF27]", "bg-[#FE5468]"],
},
darkTextOnBackground: false,
},
];

Expand Down
11 changes: 11 additions & 0 deletions lib/navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,17 @@ export const navigationItems: NavigationItem[] = [
rootKey: "chainsOptimism",
urlKey: "zksync-era",
},
// {
// label: "Linea",
// category: "zk-rollup",
// page: {
// description: "",
// },
// icon: "gtp:linea-logo-monochrome",
// key: "linea",
// rootKey: "chainsLinea",
// urlKey: "linea",
// },
{
label: "Immutable X",
category: "validium",
Expand Down
2 changes: 1 addition & 1 deletion lib/urls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const ChainURLs = {
base: "https://api.growthepie.xyz/v1/chains/base.json",
gitcoin_pgn: "https://api.growthepie.xyz/v1/chains/gitcoin_pgn.json",
zora: "https://api.growthepie.xyz/v1/chains/zora.json",

linea: "https://api.growthepie.xyz/v1/chains/linea.json",
// mock urls
// ethereum: "http://localhost:3000/mock/v1/chains/ethereum.json",
// arbitrum: "http://localhost:3000/mock/v1/chains/arbitrum.json",
Expand Down

1 comment on commit 0beaa1a

@vercel
Copy link

@vercel vercel bot commented on 0beaa1a Nov 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.