|
1 | 1 | const advertisements = [ |
2 | 2 | { |
3 | | - name: 'celenium_api', |
4 | | - modal: 'api', |
5 | | - icon: 'slash', |
6 | | - header: 'Try out Celenium API', |
7 | | - body: 'The power of Celestia: Scalable, Secure and Modular Blockchain.', |
8 | | - footer: 'Get started', |
| 3 | + name: "celenium_api", |
| 4 | + modal: "api", |
| 5 | + icon: "slash", |
| 6 | + header: "Try out Celenium API", |
| 7 | + body: "The power of Celestia: Scalable, Secure and Modular Blockchain.", |
| 8 | + footer: "Get started", |
9 | 9 | weight: 0.4, |
10 | 10 | }, |
11 | 11 | { |
12 | | - name: 'faucet', |
13 | | - internalLink: '/faucet', |
14 | | - icon: 'drop', |
15 | | - header: 'Celenium Faucet', |
16 | | - body: 'Free TIA for the Celestia testnets!', |
17 | | - footer: 'Get Tokens', |
| 12 | + name: "faucet", |
| 13 | + internalLink: "/faucet", |
| 14 | + icon: "drop", |
| 15 | + header: "Celenium Faucet", |
| 16 | + body: "Free TIA for the Celestia testnets!", |
| 17 | + footer: "Get Tokens", |
18 | 18 | weight: 0.2, |
19 | | - }, |
20 | | - { |
21 | | - name: 'celestials', |
22 | | - link: 'https://celestials.id/?utm_source=celenium_banner', |
23 | | - icon: 'celestials', |
24 | | - header: 'Celestials ID', |
25 | | - body: 'Celestia Modular usernames with unique, generative artworks', |
26 | | - footer: 'Pick your id', |
| 19 | + }, |
| 20 | + { |
| 21 | + name: "celestials", |
| 22 | + link: "https://celestials.id/?utm_source=celenium_banner", |
| 23 | + icon: "celestials", |
| 24 | + header: "Celestials ID", |
| 25 | + body: "Celestia Modular usernames with unique, generative artworks", |
| 26 | + footer: "Pick your id", |
27 | 27 | weight: 0.2, |
28 | 28 | }, |
29 | 29 | { |
30 | | - name: 'lumina', |
31 | | - modal: 'lightNode', |
32 | | - icon: 'lumina', |
33 | | - header: 'Your Own Node', |
34 | | - body: 'Easily launch a node right in your browser or on your phone.', |
35 | | - footer: 'Run Light Node', |
| 30 | + name: "lumina", |
| 31 | + modal: "lightNode", |
| 32 | + icon: "lumina", |
| 33 | + header: "Your Own Node", |
| 34 | + body: "Easily launch a node right in your browser or on your phone.", |
| 35 | + footer: "Run Light Node", |
36 | 36 | weight: 0.2, |
37 | 37 | }, |
38 | 38 | { |
39 | | - name: 'celestia_update', |
40 | | - link: 'https://blog.celestia.org/ginger/', |
41 | | - icon: 'zap', |
42 | | - header: 'Celestia Upgrade', |
43 | | - body: 'Mainnet update scheduled for 28.01.2025.', |
44 | | - footer: 'View Docs', |
| 39 | + name: "celestia_update", |
| 40 | + link: "https://blog.celestia.org/ginger/", |
| 41 | + icon: "zap", |
| 42 | + header: "Celestia Upgrade", |
| 43 | + body: "Mainnet update scheduled for 28.01.2025.", |
| 44 | + footer: "View Docs", |
| 45 | + weight: 0, |
| 46 | + }, |
| 47 | + { |
| 48 | + name: "celenium_survey", |
| 49 | + link: "https://t.co/4nBFExP2VR", |
| 50 | + icon: "validator", |
| 51 | + header: "Celenium survey", |
| 52 | + body: "Please take 5 minutes of your time and answer a few questions.", |
| 53 | + footer: "Take the survey", |
45 | 54 | weight: 0, |
46 | 55 | }, |
47 | 56 | { |
48 | | - name: 'celenium_survey', |
49 | | - link: 'https://t.co/4nBFExP2VR', |
50 | | - icon: 'validator', |
51 | | - header: 'Celenium survey', |
52 | | - body: 'Please take 5 minutes of your time and answer a few questions.', |
53 | | - footer: 'Take the survey', |
| 57 | + name: "lotus_upgrade", |
| 58 | + link: "https://blog.celestia.org/lotus", |
| 59 | + icon: "lotus", |
| 60 | + header: "Lotus Upgrade", |
| 61 | + body: "Welcome the Lotus upgrade: native TIA interop and reduced issuance.", |
| 62 | + footer: "Read More", |
54 | 63 | weight: 0, |
55 | 64 | }, |
56 | 65 | ] |
57 | 66 |
|
58 | 67 | export function getRandomAdv() { |
59 | | - const randomNum = Math.random() |
| 68 | + const randomNum = Math.random() |
60 | 69 |
|
61 | | - let cumWeight = 0 |
62 | | - for (let ad of advertisements.filter(el => el.weight <= 1)) { |
63 | | - cumWeight += ad.weight |
64 | | - if (randomNum <= cumWeight) { |
65 | | - return ad |
66 | | - } |
67 | | - } |
| 70 | + let cumWeight = 0 |
| 71 | + for (let ad of advertisements.filter((el) => el.weight <= 1)) { |
| 72 | + cumWeight += ad.weight |
| 73 | + if (randomNum <= cumWeight) { |
| 74 | + return ad |
| 75 | + } |
| 76 | + } |
68 | 77 | } |
69 | 78 |
|
70 | 79 | export function getAdvByName(name) { |
71 | 80 | let adv = {} |
72 | | - advertisements.forEach(el => { |
| 81 | + advertisements.forEach((el) => { |
73 | 82 | if (el.name === name) { |
74 | 83 | adv = el |
75 | 84 | } |
|
0 commit comments