Skip to content
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
18 changes: 16 additions & 2 deletions src/components/community-stats/CommunityStatsContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import BannerSection from "./BannerSection";
export default function CommunityStatsContent() {
const [data, setData] = useState([]);
const [dependenciesData, setDependenciesData] = useState([]);
const [statsDate, setStatsDate] = useState(null);
const fileUrl =
"https://raw.githubusercontent.com/sdv-dev/sdv-dev.github.io/gatsby-home/assets/Downloads_Summary.xlsx";

Expand All @@ -33,11 +34,21 @@ export default function CommunityStatsContent() {

const firstSheet = workbook.SheetNames[0];
const thirdSheet = workbook.SheetNames[2];
const fifthSheet = workbook.SheetNames[4];
const worksheet = workbook.Sheets[firstSheet];
const dependenciesWorksheet = workbook.Sheets[thirdSheet];
const metaInfoWorksheet = workbook.Sheets[fifthSheet];

const rawData = XLSX.utils.sheet_to_json(worksheet);
const rawDependencies = XLSX.utils.sheet_to_json(dependenciesWorksheet);
const metaInfo = XLSX.utils.sheet_to_json(metaInfoWorksheet);

const metaMap = {};
metaInfo.forEach((row) => {
metaMap[row.index] = row.value;
});
const dateValue = metaMap.date;
setStatsDate(dateValue);

const filtered = rawData.filter(
(item) =>
Expand Down Expand Up @@ -87,11 +98,14 @@ export default function CommunityStatsContent() {
<div className="pt-16 relative bg-white flex flex-col justify-center overflow-hidden">
<SdvCommunityHero />
<SynthesizeCardsSection />
<SdvInNumbersSection data={data} />
<SdvInNumbersSection data={data} lastUpdatedDate={statsDate} />
<CommunityUsersSection />
{/* <LatestsNewsSubSection /> */}
{/* <SdvOpenCoreSection /> */}
<SdvCoreSection dependenciesData={dependenciesData} />
<SdvCoreSection
dependenciesData={dependenciesData}
lastUpdatedDate={statsDate}
/>
<NewsSliderSection />
<BannerSection />
</div>
Expand Down
6 changes: 5 additions & 1 deletion src/components/community-stats/SdvCoreSection.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import TableRow from "../common/table/TableRow";
import TableRowCell from "../common/table/TableRowCell";
import useWindowWidth from "../../hooks/useviewport";

export default function SdvCoreSection({ dependenciesData }) {
export default function SdvCoreSection({ dependenciesData, lastUpdatedDate }) {
const currentYear = new Date().getFullYear().toString();
const metricKeys = ["toDate", "yearToDate"];
const metricLabels = ["To date", currentYear];
Expand Down Expand Up @@ -52,6 +52,10 @@ export default function SdvCoreSection({ dependenciesData }) {
<h1 className="heading-600-lg pb-6 text-center md:leading-lg md:pb-12">
SDV Community <span className="text-blue-600">downloads</span>
</h1>
<p className="text-midnight-600 text-center text-base font-normal leading-[18px] mb-6 md:mb-8 md:text-lg md:leading-5">
Last Updated:{" "}
<span className="text-midnight-800">{lastUpdatedDate}</span>
</p>
<div className="flex justify-center">
<Table tableColDimensions={tableColDimensions}>
<TableHeader>
Expand Down
10 changes: 7 additions & 3 deletions src/components/community-stats/SdvInNumbersSection.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Tab from "../common/Tab";
import useWindowWidth from "../../hooks/useviewport";
import CustomPieChart from "./CustomPieChart";

export default function SdvInNumbersSection({ data }) {
export default function SdvInNumbersSection({ data, lastUpdatedDate }) {
const currentYear = new Date().getFullYear().toString();
const metricKeys = ["toDate", "yearToDate"];
const metricLabels = ["To date", currentYear];
Expand Down Expand Up @@ -72,7 +72,7 @@ export default function SdvInNumbersSection({ data }) {
<br className="hidden md:inline-block lg:hidden" />
<span className="text-blue-600">in numbers</span>
</h1>
<div className="text-center pt-1.5 pb-12">
<div className="text-center pt-1.5">
<a
href="https://datacebo.com/announcements/sdv-reaches-10-million-downloads/"
target="_blank"
Expand All @@ -81,10 +81,14 @@ export default function SdvInNumbersSection({ data }) {
>
Learn more
</a>
<p className="text-midnight-600 text-base font-normal leading-[18px] mb-4 mt-[38px] md:mt-12 md:mb-6 md:text-lg md:leading-5">
Last Updated:{" "}
<span className="text-midnight-800">{lastUpdatedDate}</span>
</p>
</div>
<div
id="numbers"
className="flex justify-center items-center gap-2.5 mb-6"
className="flex justify-center items-center gap-2.5 my-3.5"
>
{tabs.map((t) => (
<Tab
Expand Down