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

removed marquee #66

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 4 additions & 11 deletions components/OverviewDataGrowthNew.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
import styles from "@components/OverviewDataGrowthNew.module.scss";
import { bytesToSize } from "@root/common/utilities";
import GutterContainer from "./GutterContainer";

export default function OverviewDataGrowthNew({
totalClients,
totalClientCount,
totalDataOnboarded,
}) {
const totalDataOnboarded = totalClients.reduce((acc, client) => {
const initialAllowance = BigInt(client.initialAllowance);
const allowance = BigInt(client.allowance);
return acc + (initialAllowance - allowance);
}, BigInt(0));

const totalInitialAllowance = bytesToSize(totalDataOnboarded);

return (
<div className={styles.body}>
<video className={styles.video} autoPlay muted loop>
Expand All @@ -36,7 +27,9 @@ export default function OverviewDataGrowthNew({
</p>
<div className={styles.container}>
<div>
<h4 className={styles.data}>{totalInitialAllowance}</h4>
<h4 className={styles.data}>745.4 PiB</h4>

<h4 className={styles.data}>{totalDataOnboarded}</h4>
<p className={styles.dataTitle}>Data onboarded</p>
</div>
<div>
Expand Down
14 changes: 14 additions & 0 deletions components/PartnersNew.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -304,3 +304,17 @@
}
}
}

.logoContainer {
display: flex;
flex-direction: row;
flex-wrap: wrap;
align-items: center;
justify-content: center;
gap: 0.5rem;
}

.logoContainer > .logoItem {
width: 16.6666667%;
padding: 1rem;
}
14 changes: 7 additions & 7 deletions components/PartnersNew.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,11 @@ export default function PartnersNew({ partners }) {
<h3 className={` ${styles.headingTitle}`}>Featured Clients</h3>
</div>
</GutterContainer>
<Marquee marqueeColor="transparent" direction="right">

<div className={styles.logoContainer}>
{partners.map((partner, index) => {
return (
<div key={index}>
<div key={index} className={styles.logoItem}>
<a
href={partner.link}
style={{ cursor: "pointer" }}
Expand All @@ -122,9 +123,8 @@ export default function PartnersNew({ partners }) {
</div>
);
})}
</Marquee>
<Marquee marqueeColor="transparent" direction="left">
{partnersRowTwo.map((partner, index) => {

{/* {partnersRowTwo.map((partner, index) => {
return (
<div key={index}>
<a
Expand All @@ -138,8 +138,8 @@ export default function PartnersNew({ partners }) {
</a>
</div>
);
})}
</Marquee>
})} */}
</div>
<GutterContainer>
<div className={styles.center} style={{ paddingBottom: "6rem" }}>
<button
Expand Down
19 changes: 11 additions & 8 deletions components/SectionDataNew.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"use client";

import styles from "@components/SectionDataNew.module.scss";
import { formatDataToCamelCase } from "@root/common/utilities";
import { byteInPetabyte, formatDataToCamelCase } from "@root/common/utilities";
import { CLIENTS_WITH_DEALS_FIXTURE } from "@root/fixtures/clients-with-deals";
import { PARTNERS_FIXTURE } from "@root/fixtures/partners-fixtures";
import { fetchClientsPerPage, fetchTotalClients } from "@root/pages/api";
import { fetchStatistics } from "@root/pages/api";
import totalClientsWithDealsResolver from "@root/resolvers/total-clients";
import { useEffect, useState } from "react";
import GutterContainer from "./GutterContainer";
Expand All @@ -17,6 +17,7 @@ import SectionGraphByRegion from "./SectionGraphByRegion";
export default function SectionDataNew() {
const [error, setError] = useState(null);
const [totalClients, setTotalClients] = useState([]);
const [totalDataOnboarded, setTotalDataOnboarded] = useState(0);
const [totalClientCount, setTotalClientCount] = useState(0);
const [industryData, setIndustryData] = useState({ data: [] });
const [regionData, setRegionData] = useState({ data: [] });
Expand All @@ -30,12 +31,14 @@ export default function SectionDataNew() {
useEffect(() => {
async function fetchPaginatedAndTotalData() {
try {
const { count } = await fetchClientsPerPage(itemsPerPage, currentPage);
const clients = await fetchStatistics();

const totalClientsFetched = await fetchTotalClients();
const totalClients = clients.clientCount;

setTotalClientCount(count);
setTotalClients(totalClientsFetched.data);
const dataOnboarded = BigInt(clients.outgoingDatacap) / byteInPetabyte;

setTotalClientCount(totalClients);
setTotalDataOnboarded(dataOnboarded as any);
} catch (error) {
setError(error);
}
Expand Down Expand Up @@ -81,8 +84,8 @@ export default function SectionDataNew() {
return (
<div className={styles.body}>
<OverviewDataGrowthNew
totalClientCount={totalClientsWithDeals}
totalClients={totalClients}
totalClientCount={totalClientCount}
totalDataOnboarded={totalDataOnboarded}
/>

<div style={{ paddingBottom: "var(--p-large-xxl)" }}>
Expand Down
15 changes: 15 additions & 0 deletions fixtures/partners-fixtures.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,21 @@ export const PARTNERS_FIXTURE = [
logo: "https://user-images.githubusercontent.com/28320272/230521742-04349f72-1b6b-4111-9fe5-658a8baa2711.png",
link: "https://chainsafe.io/",
},
{
type: "image",
logo: "https://user-images.githubusercontent.com/28320272/232148507-d84eb42d-c85c-4f4b-8555-a78907f6299f.png",
link: "",
},
{
type: "image",
logo: "https://user-images.githubusercontent.com/28320272/232148668-078f083a-c43c-4617-b031-a0bd7472be94.png",
link: "https://fbsnor.no/",
},
{
type: "image",
logo: "https://user-images.githubusercontent.com/28320272/232148942-8fdd9955-d883-4714-a536-9aa4ef5e3966.png",
link: "https://motowizja.pl/",
},
];

export const PARTNERS_TWO_FIXTURE = [
Expand Down
6 changes: 6 additions & 0 deletions pages/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,13 @@ export async function fetchClientsPerPage(itemsPerPage, currentPage) {

return { count, data };
}
export async function fetchStatistics() {
const res = await fetch(`https://api.datacapstats.io/api/getSimplifiedStats`);

const clients = await res.json();
console.log("clients", clients);
return clients;
}
export async function fetchTotalClients() {
const res = await fetch(
`https://api.datacapstats.io/api/getVerifiedClients?limit=none`
Expand Down