Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Main #99

Open
wants to merge 711 commits into
base: main
Choose a base branch
from
Open

Main #99

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
711 commits
Select commit Hold shift + click to select a range
32a8a72
fix cache purge per request limit
0xStrobe Dec 23, 2022
e813a13
skip logging if purge is successful
0xStrobe Dec 23, 2022
ce5331a
chore: update llamanodes privacy statement
brenopolanski Dec 23, 2022
5e6fd01
wip
brenopolanski Dec 23, 2022
a428e69
feat: add Tooltip component
brenopolanski Dec 23, 2022
9ff66a4
feat: add useClipboard hook
brenopolanski Dec 23, 2022
74c25be
wip
brenopolanski Dec 23, 2022
da4797c
Merge pull request #258 from brenopolanski/feat/add-llamanodes
0xStrobe Dec 24, 2022
d12bc74
feat: add trackGoal event from fathom
brenopolanski Dec 26, 2022
58602a9
Merge pull request #266 from brenopolanski/feat/wip
Llama0x Dec 26, 2022
7dd62d1
feat: create useAnalytics hook and add fathom events id
brenopolanski Dec 26, 2022
396e6d8
Merge pull request #267 from brenopolanski/wip
Llama0x Dec 26, 2022
ab3c799
fix: move trackGoal from fathom in handleCopy function
brenopolanski Dec 27, 2022
e23d705
Merge pull request #268 from brenopolanski/fix/handle-copy
Llama0x Dec 27, 2022
f6dea21
feat refine event logic on fathom
charlie-eth Dec 27, 2022
021dbcc
Merge pull request #269 from charlie-eth/refine_event_logic
Llama0x Dec 27, 2022
b055d13
feat add new fathom events
charlie-eth Dec 27, 2022
f438e49
Merge pull request #271 from charlie-eth/refine_event_logic
Llama0x Dec 27, 2022
7a2523a
add htmlcoin
denuoweb Dec 21, 2022
d0a06b1
add htmlcoin
denuoweb Dec 21, 2022
5e30dfd
remove chain not yet listed on Defillama website
realdealshaman Dec 27, 2022
303d8d4
Updating ETC Coop's public endpoints
bobsummerwill Dec 23, 2022
da8df47
Create pull_request_template.md
Llama0x Dec 27, 2022
03bb3a7
Add RPC instructions
Llama0x Dec 27, 2022
ee1e682
sepolia
waynebruce0x Dec 28, 2022
2896da8
feat add new fathom events
charlie-eth Dec 28, 2022
28b73ea
tidy comment
charlie-eth Dec 28, 2022
512989e
Merge pull request #273 from charlie-eth/refine_event_logic
Llama0x Dec 28, 2022
08e7f17
Update llamaNodesRpcs.js
Llama0x Jan 3, 2023
7ad5a4b
to line 627
waynebruce0x Jan 3, 2023
484f6e5
done to line 1000
waynebruce0x Jan 3, 2023
b3be359
done to line 1200
waynebruce0x Jan 3, 2023
4c06391
done to 1300
waynebruce0x Jan 3, 2023
73ade5e
Update llamaNodesRpcs.js
Llama0x Jan 3, 2023
7f04109
done
waynebruce0x Jan 4, 2023
df3273e
Merge pull request #272 from DefiLlama/removeDodgyRpcs
Llama0x Jan 4, 2023
e335dab
Remove wrong rpc
rafaeltorres77 Jan 4, 2023
0f5e7b9
Update chain 2020 name
rafaeltorres77 Jan 4, 2023
78fdfca
remove chains not listed on DefiLlama
realdealshaman Jan 8, 2023
e3ca357
Create fr.json
MATsxm Jan 9, 2023
a2348d7
Add BlockPI Public RPC on Ethereum
Mummyhap Jan 9, 2023
fb7441a
add new rpcs
realdealshaman Jan 9, 2023
2f99e40
Update extraRpcs.js
Luigy-Lemon Jan 16, 2023
45e4cde
Add payload.de RPC & privacy policy to the Ethereum extraRpcs.js
cgebe Jan 13, 2023
34f1e70
Add missing commata
cgebe Jan 13, 2023
34020bf
Adding more public RPCs from BlockPI
Mummyhap Jan 10, 2023
705661c
Update extraRpcs.js
BlocksScanIO Jan 5, 2023
eb0f214
feat: remove moralis Rpc comment as they are not supporting RPC endpo…
Jan 11, 2023
480686d
add privacy info to etc rpcs
realdealshaman Jan 17, 2023
a46d428
Merge branch 'bloXroute-Labs-main'
realdealshaman Jan 18, 2023
1c6007f
adding gitshock-chain
Jan 17, 2023
92aa96c
Delete package-lock.json
Jan 17, 2023
e208e1f
add gitshock privacy policy
realdealshaman Jan 18, 2023
9abe01c
Add more Public RPCs from BlockPI (#309)
Mummyhap Jan 18, 2023
03f7a55
add gashawk rpc and privacy policy
realdealshaman Jan 18, 2023
396d8f6
populate search input field with chain name in URL
mintdart Jan 18, 2023
76002ec
added omaxchain rpcs to constants/extraRpcs.js
OMAXCHAIN Jan 21, 2023
bde8e14
Simplify readme
0xngmi Jan 26, 2023
d1d8d6e
Adding Public RPC from BlockPI for Klaytn Testnet (Baobab) (#322)
Mummyhap Jan 30, 2023
39d5b46
Add Omnia endpoints for Aurora, Fantom and ETH Sepolia.
dumitrucatalin Jan 26, 2023
3eac1b5
add Liveplex OracleEVM RPC
salim-mahat Jan 25, 2023
8d2321c
updated rpc url
salim-mahat Jan 30, 2023
4f0b314
update liveplex privacy policy to tracking: yes
realdealshaman Jan 30, 2023
2e3fc6e
Update extraRpcs.js
perltk45 Jan 23, 2023
5857769
tracking for unitedbloc to reflect IP is tracked
realdealshaman Jan 30, 2023
31de08e
add jellypool rpc to meter
realdealshaman Jan 30, 2023
6b503c9
Togglable dark mode.
Ondkloss Jan 31, 2023
0fe8336
Add BlockPI public endpoint for Eth Sepolia and Scroll Pre-Alpha (#324)
Mummyhap Jan 31, 2023
e54acb9
add core blockchain
jackcrypto9527 Feb 2, 2023
b35fab8
update url
salim-mahat Jan 31, 2023
b2434a4
Update extraRpcs.js
salim-mahat Jan 31, 2023
980ba24
tracking status changed
salim-mahat Feb 1, 2023
2500df8
RPC URL Update
salim-mahat Feb 1, 2023
14e030d
Add another RPC for wanchain
lolieatapple Feb 3, 2023
71d1127
Added more RPC url for Bitgert chain
Bitgert Feb 3, 2023
f85b68c
Add OnFinality Moonbeam APIs
Danielvul Feb 9, 2023
7f060ab
RPC endpoint (#328)
0xsign Feb 13, 2023
b647e4e
remove blastapi as returning wrong blockhead
Llama0x Feb 18, 2023
fbc9de9
Merge pull request #289 from MATsxm/patch-1
Llama0x Feb 18, 2023
644244f
Add public RPC for Cronos from BlockPI Network (#373)
Mummyhap Feb 24, 2023
4959b03
update rpcs tracking info
znx-x Feb 23, 2023
81a242e
Update chainIds.json
project2you Feb 22, 2023
4578123
Update extraRpcs.js
project2you Feb 22, 2023
5fdebe0
remove chain not yet listed on Defillama
realdealshaman Feb 24, 2023
856eb36
Update KCC RPC Endpoint
viaweb3 Feb 22, 2023
4540383
Klaytn RPCs update
seongmoolee Feb 21, 2023
e5340b3
add RPC for enuls
MIMIEYES Feb 19, 2023
a763b15
add core blockchain
jackcrypto9527 Feb 2, 2023
ba69819
Add atoshiRPC
wzk235 Feb 2, 2023
cb9aedd
remove chain not yet listed on Defillama
realdealshaman Feb 24, 2023
8810a60
update extrarpc
realdealshaman Feb 24, 2023
0d6e8c7
Update extraRpc.js with OnFinality endpoints
Danielvul Feb 14, 2023
85810cb
Remove tracking:unspecified
Danielvul Feb 20, 2023
6f6c27e
add onfinality trackingdetails
realdealshaman Feb 24, 2023
0bb7f95
Merge branch 'DefiLlama:main' into main
jackcrypto9527 Feb 26, 2023
cc2afdf
add new rpc of core mainnet - infstones
jackcrypto9527 Feb 26, 2023
a2264cf
add rpcs
realdealshaman Feb 27, 2023
9254d17
comment rpc
realdealshaman Feb 27, 2023
679a3fb
Added OnFinality Goerli API
Danielvul Mar 2, 2023
27649b5
Added OnFinality Polygon API
Danielvul Mar 2, 2023
b55b391
Fixed OnFinality Avalanche URL
Danielvul Mar 2, 2023
36bdbd4
Update extraRpcs.js
Bitgert Mar 1, 2023
90f9b8b
build rpcs.json
0xngmi Mar 4, 2023
3305671
Add Sepolia testnet
0xolishell Mar 6, 2023
a4d92f5
Update chainIds.json
OMAXCHAIN Mar 7, 2023
c572027
Add PublicNode RPC Endpoints for Fantom & BSC
3eph1r0th Mar 7, 2023
336f51f
Add Blast
mihaic01 Mar 7, 2023
debcb74
Update PublicNode RPC Endpoint on Avalanche
3eph1r0th Mar 7, 2023
ef62153
Add PublicNode RPC Endpoint for Cronos
3eph1r0th Mar 9, 2023
c7147ce
Merge pull request #387 from mihaic01/patch-1
0xngmi Mar 10, 2023
75ac18d
Merge pull request #391 from 3eph1r0th/patch-6
0xngmi Mar 10, 2023
eb2bc90
Merge pull request #388 from 3eph1r0th/patch-5
0xngmi Mar 10, 2023
e314e3c
Merge pull request #386 from 3eph1r0th/patch-4
0xngmi Mar 10, 2023
8078cd7
Merge pull request #375 from coredao-org/main
0xngmi Mar 10, 2023
9d5c733
apply changes from #357
0xngmi Mar 10, 2023
8ccbae9
fix typo
0xngmi Mar 10, 2023
a597a6a
Merge pull request #385 from OMAXCHAIN/main
0xngmi Mar 10, 2023
60c4fe1
add filecoin link (#390)
0xngmi Mar 10, 2023
5101902
Add bloXroute Polygon RPC
waynechsu Mar 10, 2023
6931eeb
Merge pull request #326 from Ondkloss/feature/darkMode
mintdart Mar 11, 2023
302b84d
fix whitespace-nowrap classname
mintdart Mar 11, 2023
b7ab744
Remove the Omnia RPC on Arbitrum
MeLlamoPablo Mar 13, 2023
61f3efa
Add 48Club BSC RPCs (#389)
48ClubIan Mar 14, 2023
9d7e375
re-add endpoints
0xngmi Mar 14, 2023
8dc5b02
add note on pr
0xngmi Mar 14, 2023
2df95ac
fix syntax
0xngmi Mar 14, 2023
9694fbe
sort
0xngmi Mar 14, 2023
7fc3ce7
sort
0xngmi Mar 14, 2023
d0c1fd2
fix
0xngmi Mar 14, 2023
e7d7cea
working rpc first
0xngmi Mar 14, 2023
be6204a
working rpc first x2
0xngmi Mar 14, 2023
06dee2f
Added Fantom OnFinality endpoint
Danielvul Mar 15, 2023
b3a18d5
Update extraRpcs.js
lite Mar 20, 2023
8dfe6f1
Add an RPC for Edgeware
ShankarWarang Mar 16, 2023
9c94a8b
Add OnFinality RPC endpoint for Karura
deverka Mar 24, 2023
fa9dbe2
Add OnFinality RPC endpoint for Edgeware
deverka Mar 24, 2023
32f3a0c
Add OnFinality RPC endpoint for Darwinia Crab
deverka Mar 24, 2023
72864c3
Remove rpcWorking false flag
deverka Mar 24, 2023
9584944
Add OnFinality RPC endpoint for Acala
deverka Mar 24, 2023
719ce7f
Add BlastAPI to BSC Mainnet, Optimism Goerli, Base Goerli, Scroll Tes…
fmanea Mar 23, 2023
7382811
Add OnFinality RPC endpoint for Gnosis
deverka Mar 22, 2023
8982d99
Add GetBlocks RPC endpoints to the list
JoGetBlock Mar 22, 2023
182249c
Update extraRpcs.js
realdealshaman Mar 24, 2023
dec33a1
Added T.E.A.M Blockchain (#412)
TEAMDAOPSI2 Mar 24, 2023
02b49c4
Add LoopNetwork Mainnet RPC (#398)
ZukeSwap Mar 24, 2023
23e1cf8
add privacy policy
realdealshaman Mar 24, 2023
aba2fc9
add zksync logo to chainlist
realdealshaman Mar 26, 2023
75cd2a5
update
realdealshaman Mar 26, 2023
9e792b4
Add BlastAPI to Scroll Alpha and fix previous Network ID error
fmanea Mar 27, 2023
80d3539
Update extraRpcs.js
pfedan Mar 28, 2023
8bce1ae
Add OnFinality RPC endpoint for Evmos
deverka Mar 27, 2023
6025f4b
Add OnFinality RPC endpoint for Harmony
deverka Mar 31, 2023
9704612
update filecoin rpcs and add tracking info
realdealshaman Mar 31, 2023
e40453e
init
nautsimon Apr 3, 2023
e0a8638
ternary
nautsimon Apr 3, 2023
9bfe120
add icon for zkevm
realdealshaman Apr 3, 2023
62a4e41
Add ETC Testnets
chris-mercer Apr 2, 2023
daf4f6e
Add Ankr's Polygon zkEVM RPC
kaymomin Apr 1, 2023
20abe82
add privacy policy info for iota
realdealshaman Apr 3, 2023
ad4664f
Added ShimmerEVM Testnet RPC (#430)
anistark Apr 3, 2023
76579e9
update arbitrum nova
realdealshaman Apr 3, 2023
154c695
preserve testnet filter
nautsimon Apr 3, 2023
c9674e1
Updates list to include MEV Blocker RPC
avsavsavs Apr 4, 2023
a57d75a
Merge pull request #436 from avsavsavs/patch-1
0xngmi Apr 5, 2023
7d7ddb4
add chain id hex value
stonega Apr 7, 2023
b7ffba4
Change BlockPI Public Scroll testnet endpoint from pre-alpha to alph…
Mummyhap Apr 10, 2023
3d016fe
Add Filecoin API And ChainupCloud Policy
0xcrypto-j1awei Apr 10, 2023
1c9a484
Add Croswap Arbitrum RPC & Add privacy to Croswap Cronos RPC
HankWyatt Apr 4, 2023
d6a3abe
1. add privacyStatement of unifra
shu-unifra Apr 7, 2023
5bef92f
Add Croswap Arbitrum RPC & Add privacy to Croswap Cronos RPC
HankWyatt Apr 4, 2023
4828fcc
Add Markr Go Network (#443)
0xstt Apr 11, 2023
941a47c
Update gateway.fm RPCs for Gnosis and Chiado
annadanchenko Apr 13, 2023
61da517
update etc-network.info ERIGON RPCs & privacy statement
DRIgnazGortngschirl Apr 12, 2023
477a845
Update extraRpcs.js - add filecoin mainnet RPC node by sftprotocol
lite Apr 11, 2023
1d059b5
Update extraRpcs.js
realdealshaman Apr 13, 2023
9d48a3e
Add OnFinality RPC Endpoint for Arbitrum
deverka Apr 13, 2023
808bf2c
Add gateway.fm RPC for Ethereum, Goerli, Fantom, Polygon zkEVM
annadanchenko Apr 14, 2023
655416d
Update OnFinality Privacy Policy
deverka Apr 14, 2023
8ee2c87
resort and correct RPC URL etc-network.info
DRIgnazGortngschirl Apr 13, 2023
0da7b6b
add gateway privacy policy
realdealshaman Apr 14, 2023
96a4ebd
Merge pull request #434 from simonmahns/main
mintdart Apr 16, 2023
f9b6945
Merge pull request #439 from stonega/main
mintdart Apr 16, 2023
c41c780
Add OnFinality Endpoint for Optimism
deverka Apr 17, 2023
f24016e
Update extraRpcs.js
Mummyhap Apr 18, 2023
ff95275
update Clover RPC Endpoint
BOBOKaa Apr 18, 2023
9c68570
Fix OnFinality Privacy Policy Description
deverka Apr 17, 2023
e13dbb3
Add Taho Connector
0xDaedalus Apr 14, 2023
2641868
feat: add init code to AdBanner component
brenopolanski Apr 19, 2023
ceae06e
feat: add handle functions
brenopolanski Apr 19, 2023
dbaa342
feat: add AdBanner to home page
brenopolanski Apr 19, 2023
d7716b8
Update extraRpcs.js
DenisCarriere Apr 17, 2023
ab89c57
Update chainIds.json
DenisCarriere Apr 17, 2023
249455c
Add Testnet
DenisCarriere Apr 18, 2023
9d20d81
re-add old rpc
DenisCarriere Apr 18, 2023
53cf436
Update chainIds.json
realdealshaman Apr 19, 2023
0cd1acd
add privacy policy for eosnetwork
realdealshaman Apr 19, 2023
93a139f
wip
brenopolanski Apr 19, 2023
b364605
refactor: some tweaks
brenopolanski Apr 19, 2023
3c62c1c
feat: set the interval duration in miliseconds when the carousel is c…
brenopolanski Apr 20, 2023
c3c54ff
feat: add props
brenopolanski Apr 20, 2023
92edb38
feat: add links
brenopolanski Apr 20, 2023
0645a33
refactor: some tweaks
brenopolanski Apr 20, 2023
a375dba
wip
brenopolanski Apr 20, 2023
e0563e6
Fix className prop name
BitOfUniverse Apr 20, 2023
445882f
Fix SVG prop names
BitOfUniverse Apr 20, 2023
e6f18dd
Merge pull request #460 from brenopolanski/feat/ads-banner
charlie-eth Apr 20, 2023
1c890bf
Longer timer
charlie-eth Apr 20, 2023
7065ca6
Update timer on ad
charlie-eth Apr 20, 2023
63bd162
add ad track id from fathom
charlie-eth Apr 20, 2023
94f8468
Merge pull request #461 from BitOfUniverse/main
charlie-eth Apr 20, 2023
e9e9b8b
feat: add fathom ids
brenopolanski Apr 20, 2023
38d57e5
feat: add function to shuffle banners
brenopolanski Apr 20, 2023
a6d1678
refactor: change ads folder to banners
brenopolanski Apr 20, 2023
2f86a2a
Merge pull request #463 from brenopolanski/refactor/ads
charlie-eth Apr 20, 2023
4611c18
Update useAnalytics.js
charlie-eth Apr 20, 2023
89e48ad
Update Oasys Chain ID and RPC
fromreto Apr 20, 2023
a099197
Update chainIds.json
realdealshaman Apr 20, 2023
d07a59f
Jfinchain and J2O supported
dome Apr 20, 2023
d388339
add privacyStatement
dome Apr 20, 2023
1b3180f
add missing comma
realdealshaman Apr 20, 2023
a00db02
feat: add startTransition prop
brenopolanski Apr 20, 2023
148557c
wip
brenopolanski Apr 20, 2023
f9080fc
wip
brenopolanski Apr 20, 2023
92ba6da
Merge pull request #465 from brenopolanski/refactor/adbanner-tweaks
charlie-eth Apr 20, 2023
75a6db0
Force redeploy
charlie-eth Apr 20, 2023
f9e2efa
Add chain.love rpc for filecoin (#466)
GlacierWalrus Apr 21, 2023
367638a
responsive banners
mintdart Apr 24, 2023
b84bc3c
update ad banner styles
mintdart Apr 24, 2023
e9336ee
update banner styles
mintdart Apr 24, 2023
2ac3dd6
update llamanodes banner
mintdart Apr 26, 2023
cc50137
add eth-sepolia of unifra
shu-unifra Apr 27, 2023
ffa6365
Add chain IDs for Zilliqa
JamesHinshelwood Apr 26, 2023
c06bbd3
Update chainIds.json
realdealshaman Apr 28, 2023
468a7c8
Add Tenderly RPCs for Boba ETH Mainnet
wsdt Apr 28, 2023
5bb59cc
Remove light rpc from Boba
wsdt Apr 28, 2023
c7d410e
Update chainIds.json
Arca-Labs Apr 28, 2023
cb212f9
Update extraRpcs.js
Arca-Labs Apr 28, 2023
771f541
Update chainIds.json
realdealshaman May 1, 2023
dcdbf59
add icplaza privacy policy
realdealshaman May 1, 2023
db680a0
add tenderly privacy policy
realdealshaman May 2, 2023
de6c29e
add carbon evm chain logo to mapping
randy75828 May 2, 2023
b9857be
add new rpc
realdealshaman May 4, 2023
92f476d
rearrange rpc order
realdealshaman May 5, 2023
ba1cf72
update rpc list
realdealshaman May 5, 2023
b2d210d
Add OnFinality Endpoint for DFK Chain
deverka May 8, 2023
ee13eed
Add OnFinality Endpoint for Fuse
deverka May 6, 2023
6e0734e
feat: add wallet network LlamaNodes
0xsign May 10, 2023
f718838
Merge pull request #491 from 0xsign/feat/add-network-wallet
mintdart May 12, 2023
0f9d54b
Add PublicNode Ethereum Goerli and Polygon Mumbai
3eph1r0th May 11, 2023
e42cdc9
Add PublicNode Endpoint for Avalanche, Fantom, BNB Chain Testnets
3eph1r0th May 15, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ yarn-error.log*
.env.development.local
.env.test.local
.env.production.local
.env

# vercel
.vercel
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sitemap.xml.js
.next
out
public
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"trailingComma": "all",
"printWidth": 120,
"tabWidth": 2
}
149 changes: 74 additions & 75 deletions LICENCE.md

Large diffs are not rendered by default.

21 changes: 2 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).

## Getting Started

First, run the development server:
Expand All @@ -14,21 +12,6 @@ Open [http://localhost:3000](http://localhost:3000) with your browser to see the

You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.

[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`.

The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
## Adding your RPC

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
If you wish to add your RPC, please follow the [PR template](https://github.com/DefiLlama/chainlist/blob/main/pull_request_template.md)
125 changes: 125 additions & 0 deletions components/AdBanner/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
import * as Fathom from "fathom-client";
import { useEffect, useMemo, useState } from "react";

import { FATHOM_ADS_ID } from "../../hooks/useAnalytics";
import { notTranslation as useTranslations, shuffleArray } from "../../utils";

const BANNERS = [
{
image: "llamanodes.png",
name: "LlamaNodes",
url: "https://llamanodes.com",
},
{
image: "gmx.png",
name: "GMX",
url: "https://app.gmx.io/#/trade/?ref=chainlist",
},
];

export const AdBanner = ({ timer = 15000, startTransition = true, showControls = false }) => {
const t = useTranslations("Common");

const [currentIndex, setCurrentIndex] = useState(0);

const randomBanners = useMemo(() => shuffleArray(BANNERS), []);

useEffect(() => {
const intervalId = setInterval(() => {
if (startTransition) {
return handleNextBanner();
}

return;
}, timer);

return () => clearInterval(intervalId);
}, [currentIndex]);

const handlePrevBanner = () => {
const isFirstBanner = currentIndex === 0;
const newIndex = isFirstBanner ? randomBanners.length - 1 : currentIndex - 1;

setCurrentIndex(newIndex);
};

const handleNextBanner = () => {
const isLastBanner = currentIndex === randomBanners.length - 1;
const newIndex = isLastBanner ? 0 : currentIndex + 1;

setCurrentIndex(newIndex);
};

const srcLarge = `./banners/large/${randomBanners[currentIndex].image}`;
const srcSmall = `./banners/small/${randomBanners[currentIndex].image}`;
const srcName = randomBanners[currentIndex].name;

return (
<div className="flex flex-col w-full h-full justify-center gap-2">
<div className="w-full h-full relative group rounded-[10px]">
<a
href={randomBanners[currentIndex].url}
rel="noopener noreferrer"
target="_blank"
onClick={() => Fathom.trackGoal(FATHOM_ADS_ID[randomBanners[currentIndex].name.toLowerCase()], 0)}
>
<picture className="rounded-[10px] duration-500 w-full h-full">
<source
srcset={srcSmall}
media="(max-width: 420px)"
className="rounded-[10px] duration-500 w-full h-full"
/>
<source
srcset={srcLarge}
media="(max-width: 639px)"
className="rounded-[10px] duration-500 w-full h-full"
/>
<source
srcset={srcSmall}
media="(max-width: 1399px)"
className="rounded-[10px] duration-500 w-full h-full"
/>
<source
srcset={srcLarge}
media="(max-width: 1679px)"
className="rounded-[10px] duration-500 w-full h-full"
/>
<source
srcset={srcSmall}
media="(max-width: 2000px)"
className="rounded-[10px] duration-500 w-full h-full"
/>

<img src={srcLarge} alt={srcName} className="rounded-[10px] duration-500 w-full h-full" />
</picture>
</a>

{/* left arrow */}
{showControls && (
<div
className="hidden group-hover:block absolute top-[50%] -translate-x-0 translate-y-[-50%] left-2 text-xl rounded-full px-2 bg-black/20 text-white cursor-pointer"
onClick={handlePrevBanner}
>
&lsaquo;
</div>
)}

{/* right arrow */}
{showControls && (
<div
className="hidden group-hover:block absolute top-[50%] -translate-x-0 translate-y-[-50%] right-2 text-xl rounded-full px-2 bg-black/20 text-white cursor-pointer"
onClick={handleNextBanner}
>
&rsaquo;
</div>
)}
</div>

<div className="w-full text-center text-xs text-gray-500 dark:text-[#B3B3B3] italic">
<a href="mailto:[email protected]" rel="noopener noreferrer" target="_blank">
{`${t("your-ad-here")}, ${t("contact-us").toLowerCase()}`}
</a>
</div>
</div>
);
};
74 changes: 74 additions & 0 deletions components/Layout/Logo.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading