Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into dev
  • Loading branch information
manishiwa committed Jan 16, 2025
2 parents fc4e231 + e4ee729 commit cfe0ca9
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 40 deletions.
8 changes: 4 additions & 4 deletions app/(layout)/da-overview/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ export default function DAOverviewPage() {
};
} else {
return {
"180d": {
shortLabel: "6m",
label: "6 months",
"90d": {
shortLabel: "3m",
label: "3 months",
value: 90,
xMin: xMax - 180 * 24 * 60 * 60 * 1000,
xMin: xMax - 90 * 24 * 60 * 60 * 1000,
xMax: xMax,
},
"365d": {
Expand Down
22 changes: 11 additions & 11 deletions components/layout/DA-Overview/DAHeadCharts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ export default function DAHeadCharts({selectedTimespan, isMonthly, data}: {selec

let xMax = 0;
Object.keys(data.metrics["fees_paid"]).forEach((key) => {
if(data.metrics["fees_paid"][key].daily.data[data.metrics["fees_paid"][key].daily.data.length - 1][0] > xMax){
xMax = data.metrics["fees_paid"][key].daily.data[data.metrics["fees_paid"][key].daily.data.length - 1][0];
if(data.metrics["fees_paid"][key].daily.data[data.metrics["fees_paid"][key][isMonthly ? "monthly" : "daily"].data.length - 1][0] > xMax){
xMax = data.metrics["fees_paid"][key].daily.data[data.metrics["fees_paid"][key][isMonthly ? "monthly" : "daily"].data.length - 1][0];
}
})

Expand Down Expand Up @@ -119,11 +119,11 @@ export default function DAHeadCharts({selectedTimespan, isMonthly, data}: {selec
};
} else {
return {
"180d": {
shortLabel: "6m",
label: "6 months",
"90d": {
shortLabel: "3m",
label: "3 months",
value: 90,
xMin: xMax - 180 * 24 * 60 * 60 * 1000,
xMin: xMax - 90 * 24 * 60 * 60 * 1000,
xMax: xMax,
},
"365d": {
Expand Down Expand Up @@ -256,12 +256,12 @@ export default function DAHeadCharts({selectedTimespan, isMonthly, data}: {selec
let sum = 0;
Object.keys(isolated_data).map((key) => {
let typeIndex = 1;
if(isolated_data[key].daily.types.includes("usd")){
typeIndex = isolated_data[key].daily.types.indexOf(showUsd ? "usd" : "eth")
if(isolated_data[key][isMonthly ? "monthly" : "daily"].types.includes("usd")){
typeIndex = isolated_data[key][isMonthly ? "monthly" : "daily"].types.indexOf(showUsd ? "usd" : "eth")
}

sum +=
isolated_data[key].daily.data[isolated_data[key].daily.data.length - 1][
isolated_data[key][isMonthly ? "monthly" : "daily"].data[isolated_data[key][isMonthly ? "monthly" : "daily"].data.length - 1][
typeIndex
];
});
Expand Down Expand Up @@ -644,7 +644,7 @@ export default function DAHeadCharts({selectedTimespan, isMonthly, data}: {selec
>
{Object.keys(data.metrics[metricKey])
.map((key, i) => {
let types = data.metrics[metricKey][key].daily.types;
let types = data.metrics[metricKey][key][isMonthly ? "monthly" : "daily"].types;
let typeIndex = 1;


Expand All @@ -659,7 +659,7 @@ export default function DAHeadCharts({selectedTimespan, isMonthly, data}: {selec
return(
<AreaSeries
key={key}
data={data.metrics[metricKey][key].daily.data.map((d) => [d[0], d[typeIndex]])}
data={data.metrics[metricKey][key][isMonthly ? "monthly" : "daily"].data.map((d) => [d[0], d[typeIndex]])}
color={area_colors[key]}
name={data.metrics[metricKey][key].metric_name}
/>
Expand Down
8 changes: 4 additions & 4 deletions components/layout/DA-Overview/DATable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,11 @@ export default function DATable({breakdown_data, selectedTimespan, isMonthly}: {
};
} else {
return {
"180d": {
shortLabel: "6m",
label: "6 months",
"90d": {
shortLabel: "3m",
label: "3 months",
value: 90,
xMin: xMax - 180 * 24 * 60 * 60 * 1000,
xMin: xMax - 90 * 24 * 60 * 60 * 1000,
xMax: xMax,
},
"365d": {
Expand Down
48 changes: 27 additions & 21 deletions components/layout/DA-Overview/DATableCharts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,15 @@ export default function DATableCharts({selectedTimespan, data, isMonthly, da_nam
let xMax = 0;
Object.keys(data.da_consumers).forEach((key) => {

const values = data.da_consumers[key].daily.values;
const values = data.da_consumers[key][isMonthly ? "monthly" : "daily"].values;
const length = values.length;
const types = data.da_consumers[key].daily.types;
const types = data.da_consumers[key][isMonthly ? "monthly" : "daily"].types;

if(values[values.length - 1][types.indexOf("unix")] > xMax){
xMax = values[values.length - 1][types.indexOf("unix")];
}
if(values.length > 0){
if(values[values.length - 1][types.indexOf("unix")] > xMax){
xMax = values[values.length - 1][types.indexOf("unix")];
}
}
})


Expand Down Expand Up @@ -114,12 +116,12 @@ export default function DATableCharts({selectedTimespan, data, isMonthly, da_nam
};
} else {
return {
"180d": {
shortLabel: "6m",
label: "6 months",
value: 90,
xMin: xMax - 180 * 24 * 60 * 60 * 1000,
xMax: xMax,
"90d": {
shortLabel: "3m",
label: "3 months",
value: 90,
xMin: xMax - 90 * 24 * 60 * 60 * 1000,
xMax: xMax,
},
"365d": {
shortLabel: "1y",
Expand All @@ -146,8 +148,8 @@ export default function DATableCharts({selectedTimespan, data, isMonthly, da_nam
let totalArray = [[Number, Number]]
Object.keys(data.da_consumers).forEach((key) => {

const values = data.da_consumers[key].daily.values;
const types = data.da_consumers[key].daily.types;
const values = data.da_consumers[key][isMonthly ? "monthly" : "daily"].values;
const types = data.da_consumers[key][isMonthly ? "monthly" : "daily"].types;
const total = values.map((d) => [
d[types.indexOf("unix")],
d[types.indexOf("data_posted")]
Expand Down Expand Up @@ -606,17 +608,17 @@ export default function DATableCharts({selectedTimespan, data, isMonthly, da_nam
min={0}

>
{Object.keys(filteredChains).map((key, index) => {
const types = data.da_consumers[key].daily.types;
const name = data.da_consumers[key].daily.values[0][1];
{Object.keys(filteredChains).filter((key) => {return data.da_consumers[key][isMonthly ? "monthly" : "daily"].values[0]}).map((key, index) => {
const types = data.da_consumers[key][isMonthly ? "monthly" : "daily"].types;
const name = data.da_consumers[key][isMonthly ? "monthly" : "daily"].values[0][1];

return(
<AreaSeries
key={key + "-DATableCharts" + da_name}
name={name}
visible={data.da_consumers[key].daily.values.length > 0}
visible={data.da_consumers[key][isMonthly ? "monthly" : "daily"].values.length > 0}

data={data.da_consumers[key].daily.values.map((d) => [
data={data.da_consumers[key][isMonthly ? "monthly" : "daily"].values.map((d) => [
d[types.indexOf("unix")],
d[types.indexOf("data_posted")]
])}
Expand All @@ -643,6 +645,10 @@ export default function DATableCharts({selectedTimespan, data, isMonthly, da_nam
return 0;
}).map((key, index) => {
const custom_logo_keys = Object.keys(master.custom_logos);

if(!data.da_consumers[key][isMonthly ? "monthly" : "daily"].values[0]){
return <div></div>
}

return(
<div key={key + "da_consumers_info"} className={`flex relative gap-x-[5px] px-[5px] text-xxs rounded-full py-[0.5px] items-center transition-all cursor-pointer bg-[#344240] ${
Expand All @@ -662,8 +668,8 @@ export default function DATableCharts({selectedTimespan, data, isMonthly, da_nam

>

<div>{AllChainsByKeys[data.da_consumers[key].daily.values[0][2]] ?
(<Icon icon={`gtp:${AllChainsByKeys[data.da_consumers[key].daily.values[0][2]].urlKey}-logo-monochrome`} className="w-[12px] h-[12px]" style={{ color: AllChainsByKeys[key].colors["dark"][0] }} />)
<div>{AllChainsByKeys[data.da_consumers[key][isMonthly ? "monthly" : "daily"].values[0][2]] ?
(<Icon icon={`gtp:${AllChainsByKeys[data.da_consumers[key][isMonthly ? "monthly" : "daily"].values[0][2]].urlKey}-logo-monochrome`} className="w-[12px] h-[12px]" style={{ color: AllChainsByKeys[key].colors["dark"][0] }} />)
: custom_logo_keys.includes(key)
? (
<DynamicIcon
Expand All @@ -675,7 +681,7 @@ export default function DATableCharts({selectedTimespan, data, isMonthly, da_nam
/>
)
: (<div></div>)}</div>
<div className="text-xxs">{data.da_consumers[key].daily.values[0][1]}</div>
<div className="text-xxs">{data.da_consumers[key][isMonthly ? "monthly" : "daily"].values[0][1]}</div>
<div className={`absolute right-[2px] top-[2.5px] w-[12px] h-[12px] text-[#FE5468] ${selectedChain === "all" ? "invisible" : "visible"}`}><Icon icon={selectedChain === key ? "gtp:x-circle" : "gtp:plus-circle"} className="w-[12px] h-[12px] "></Icon></div>
</div>
)
Expand Down

0 comments on commit cfe0ca9

Please sign in to comment.