Skip to content

Commit

Permalink
error search
Browse files Browse the repository at this point in the history
  • Loading branch information
Olerinskaia committed Dec 23, 2024
1 parent 50cc5e7 commit 5082e72
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 47 deletions.
57 changes: 22 additions & 35 deletions app/javascript/component/componentDescription/WidgetConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export default class WidgetConfig {
icon: 'eth.svg',
innovation: true,
blockProducerName: 'Validator',

},
{
tag: 'bsc',
Expand All @@ -26,7 +25,6 @@ export default class WidgetConfig {
start: Date.parse('2020-08-29'),
innovation: true,
blockProducerName: 'Validator',

},
{
tag: 'arbitrum',
Expand All @@ -42,43 +40,32 @@ export default class WidgetConfig {
},
];
}

static getBlockchainMap() {
return this.getBlockchainInfo().reduce((map, blockchain) => {
map[blockchain.chainId] = blockchain;
return map;
}, {});
}

static getProperty(chainId, property) {
const blockchain = this.getBlockchainMap()[chainId];
return blockchain ? blockchain[property] : null;
}

static getNetwork(chainId) {
const blockchainsInfo = this.getBlockchainInfo();
let network;
blockchainsInfo.forEach(element => {
if (element.chainId === chainId) {
network = element.network;
}
});
return network;
return this.getProperty(chainId, 'network');
}

static getCurrency(chainId) {
const blockchainsInfo = this.getBlockchainInfo();
let currency;
blockchainsInfo.forEach(element => {
if (element.chainId === chainId) {
currency = element.currency;
}
});
return currency;
return this.getProperty(chainId, 'currency');
}

static getBlockProducerName(chainId) {
const blockchainsInfo = this.getBlockchainInfo();
let blockProducerName;
blockchainsInfo.forEach(element => {
if (element.chainId === chainId) {
blockProducerName = element.blockProducerName;
}
});
return blockProducerName;
} static getName(chainId) {
const blockchainsInfo = this.getBlockchainInfo();
let name;
blockchainsInfo.forEach(element => {
if (element.chainId === chainId) {
name = element.name;
}
});
return name;
return this.getProperty(chainId, 'blockProducerName');
}

static getName(chainId) {
return this.getProperty(chainId, 'name');
}
}
8 changes: 4 additions & 4 deletions app/views/binance/network/nft.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
return {
topElement: response => response.EVM.Transfers,
chainId: response => response.EVM.Transfers[0]?.ChainId,
title: response => `Top traded NFT tokens in ${WidgetConfig.getName(response.EVM.Transfers[0]?.ChainId)}`,
title: response => `Top traded NFT tokens in ${WidgetConfig.getName(response.EVM.Transfers[0]?.ChainId) || 'network'}`,
id: 'TopTransferNFT',
columns: [
{
Expand Down Expand Up @@ -104,7 +104,7 @@
return {
topElement: response => response.EVM.Transfers,
chainId: response => response.EVM.Transfers[0]?.ChainId,
title: response => `Top transferred NFT tokens in ${WidgetConfig.getName(response.EVM.Transfers[0]?.ChainId)}`,
title: response => `Top transferred NFT tokens in ${WidgetConfig.getName(response.EVM.Transfers[0]?.ChainId) || 'network'}`,
id: 'NFTTransfersByDatePie',
columns: [
{
Expand Down Expand Up @@ -156,7 +156,7 @@
return {
topElement: response => response.EVM.DEXTrades,
chainId: response => response.EVM.DEXTrades[0]?.ChainId,
title: response => `Top traded NFT tokens in ${WidgetConfig.getName(response.EVM.DEXTrades[0]?.ChainId)}`,
title: response => `Top traded NFT tokens in ${WidgetConfig.getName(response.EVM.DEXTrades[0]?.ChainId) || 'network'}`,
id: 'TopTradedNFTTokens',
columns: [
{
Expand Down Expand Up @@ -199,7 +199,7 @@
return {
topElement: response => response.EVM.DEXTrades,
chainId: response => response.EVM.DEXTrades[0]?.ChainId,
title: response => `Top traded NFT tokens in ${WidgetConfig.getName(response.EVM.DEXTrades[0]?.ChainId)}`,
title: response => `Top traded NFT tokens in ${WidgetConfig.getName(response.EVM.DEXTrades[0]?.ChainId) || 'network'}`,
id: 'TopTradedNFTTokensPie',
columns: [
{
Expand Down
8 changes: 4 additions & 4 deletions app/views/ethereum/network/nft.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
return {
topElement: response => response.EVM.Transfers,
chainId: response => response.EVM.Transfers[0]?.ChainId,
title: response => `Top traded NFT tokens in ${WidgetConfig.getName(response.EVM.Transfers[0]?.ChainId)}`,
title: response => `Top traded NFT tokens in ${WidgetConfig.getName(response.EVM.Transfers[0]?.ChainId) || 'network'}`,
id: 'TopTransferNFT',
columns: [
{
Expand Down Expand Up @@ -105,7 +105,7 @@
return {
topElement: response => response.EVM.Transfers,
chainId: response => response.EVM.Transfers[0]?.ChainId,
title: response => `Top transferred NFT tokens in ${WidgetConfig.getName(response.EVM.Transfers[0]?.ChainId)}`,
title: response => `Top transferred NFT tokens in ${WidgetConfig.getName(response.EVM.Transfers[0]?.ChainId) || 'network'}`,
id: 'NFTTransfersByDatePie',
columns: [
{
Expand Down Expand Up @@ -157,7 +157,7 @@
return {
topElement: response => response.EVM.DEXTrades,
chainId: response => response.EVM.DEXTrades[0]?.ChainId,
title: response => `Top traded NFT tokens in ${WidgetConfig.getName(response.EVM.DEXTrades[0]?.ChainId)}`,
title: response => `Top traded NFT tokens in ${WidgetConfig.getName(response.EVM.DEXTrades[0]?.ChainId) || 'network'}`,
id: 'TopTradedNFTTokens',
columns: [
{
Expand Down Expand Up @@ -200,7 +200,7 @@
return {
topElement: response => response.EVM.DEXTrades,
chainId: response => response.EVM.DEXTrades[0]?.ChainId,
title: response => `Top traded NFT tokens in ${WidgetConfig.getName(response.EVM.DEXTrades[0]?.ChainId)}`,
title: response => `Top traded NFT tokens in ${WidgetConfig.getName(response.EVM.DEXTrades[0]?.ChainId) || 'network'}`,
id: 'TopTradedNFTTokensPie',
columns: [
{
Expand Down
8 changes: 4 additions & 4 deletions app/views/ethereum_streaming/network/nft.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
return {
topElement: response => response.EVM.Transfers,
chainId: response => response.EVM.Transfers[0]?.ChainId,
title: response => `Top traded NFT tokens in ${WidgetConfig.getName(response.EVM.Transfers[0]?.ChainId)}`,
title: response => `Top traded NFT tokens in ${WidgetConfig.getName(response.EVM.Transfers[0]?.ChainId) || 'network' }`,
id: 'TopTransferNFT',
columns: [
{
Expand Down Expand Up @@ -104,7 +104,7 @@
return {
topElement: response => response.EVM.Transfers,
chainId: response => response.EVM.Transfers[0]?.ChainId,
title: response => `Top transferred NFT tokens in ${WidgetConfig.getName(response.EVM.Transfers[0]?.ChainId)}`,
title: response => `Top transferred NFT tokens in ${WidgetConfig.getName(response.EVM.Transfers[0]?.ChainId) || 'network'}`,
id: 'NFTTransfersByDatePie',
columns: [
{
Expand Down Expand Up @@ -156,7 +156,7 @@
return {
topElement: response => response.EVM.DEXTrades,
chainId: response => response.EVM.DEXTrades[0]?.ChainId,
title: response => `Top traded NFT tokens in ${WidgetConfig.getName(response.EVM.DEXTrades[0]?.ChainId)}`,
title: response => `Top traded NFT tokens in ${WidgetConfig.getName(response.EVM.DEXTrades[0]?.ChainId) || 'network'}`,
id: 'TopTradedNFTTokens',
columns: [
{
Expand Down Expand Up @@ -199,7 +199,7 @@
return {
topElement: response => response.EVM.DEXTrades,
chainId: response => response.EVM.DEXTrades[0]?.ChainId,
title: response => `Top traded NFT tokens in ${WidgetConfig.getName(response.EVM.DEXTrades[0]?.ChainId)}`,
title: response => `Top traded NFT tokens in ${WidgetConfig.getName(response.EVM.DEXTrades[0]?.ChainId) || 'network'}`,
id: 'TopTradedNFTTokensPie',
columns: [
{
Expand Down

0 comments on commit 5082e72

Please sign in to comment.