diff --git a/src/components/sd-gym/PrivacyTradeoffs.js b/src/components/sd-gym/PrivacyTradeoffs.js new file mode 100644 index 0000000..67d5ed5 --- /dev/null +++ b/src/components/sd-gym/PrivacyTradeoffs.js @@ -0,0 +1,15 @@ +import React from "react"; + +const PrivacyTradeoffs = () => { + return ( +
+
+

+ The Privacy-Quality Tradeoffs +

+
+
+ ); +}; + +export default PrivacyTradeoffs; diff --git a/src/components/sd-gym/SdGymContent.js b/src/components/sd-gym/SdGymContent.js index 5ba15a7..4240388 100644 --- a/src/components/sd-gym/SdGymContent.js +++ b/src/components/sd-gym/SdGymContent.js @@ -5,11 +5,14 @@ import NewsSliderSection from "../community-stats/NewsSliderSection"; import BannerSection from "../community-stats/BannerSection"; import SdGymLeaderboard from "./SdGymLeaderboard"; import AboutSdGym from "./AboutSdGym"; +// import PrivacyTradeoffs from "./PrivacyTradeoffs"; +import SpeedTradeoffs from "./SpeedTradeoffs"; export default function SdGymContent() { + const [rawData, setRawData] = useState([]); const [data, setData] = useState([]); const [dateTags, setDateTags] = useState([]); - // const activeDateTag = dateTags.find((dt) => dt.active); + const activeDateTag = dateTags.find((dt) => dt.active); const fileUrl = "https://raw.githubusercontent.com/sdv-dev/sdv-dev.github.io/gatsby-home/assets/sdgym-leaderboard-files/SDGym%20Monthly%20Run.xlsx"; @@ -24,6 +27,7 @@ export default function SdGymContent() { const firstSheet = workbook.SheetNames[0]; const worksheet = workbook.Sheets[firstSheet]; const rawData = XLSX.utils.sheet_to_json(worksheet); + setRawData(rawData); // Date tags for the tables const rawDateTags = extractSortedDates(rawData); @@ -41,6 +45,13 @@ export default function SdGymContent() { fetchExcel(); }, []); + useEffect(() => { + if (activeDateTag && rawData.length) { + const tableData = buildTableData(rawData, activeDateTag.date); + setData(tableData); + } + }, [activeDateTag, rawData]); + const extractSortedDates = (data) => { const datesSet = new Set(); @@ -84,6 +95,8 @@ export default function SdGymContent() { + {/* */} + diff --git a/src/components/sd-gym/SdGymLeaderboard.js b/src/components/sd-gym/SdGymLeaderboard.js index 2e656fc..325e36c 100644 --- a/src/components/sd-gym/SdGymLeaderboard.js +++ b/src/components/sd-gym/SdGymLeaderboard.js @@ -12,7 +12,7 @@ import TableRowCell from "../common/table/TableRowCell"; const SdGymLeaderboard = ({ data, tags, setTags }) => { const metricLabels = ["Models", "Number of wins"]; - const tableColDimensions = "minmax(172px, 379px) minmax(172px, 379px)"; + const tableColDimensions = "minmax(160px, 379px) minmax(140px, 379px)"; const lastRunLabel = tags[0]?.label; return ( diff --git a/src/components/sd-gym/SpeedTradeoffChart.js b/src/components/sd-gym/SpeedTradeoffChart.js new file mode 100644 index 0000000..28535c2 --- /dev/null +++ b/src/components/sd-gym/SpeedTradeoffChart.js @@ -0,0 +1,77 @@ +import React from "react"; +import { + ScatterChart, + Scatter, + XAxis, + YAxis, + CartesianGrid, + Tooltip, + Legend, +} from "recharts"; + +const trendLineData = [ + { x: 0.5, y: 0.5 }, + { x: 1, y: 1 }, + { x: 1.5, y: 1.5 }, + { x: 2, y: 2.2 }, + { x: 2.5, y: 3 }, + { x: 3, y: 4 }, + { x: 3.5, y: 5.3 }, + { x: 4, y: 7 }, +]; + +export default function SpeedTradeoffChart() { + return ( + + + + + [ + `${value}`, + name === "x" ? "Time" : "Quality", + ]} + content={({ payload }) => + payload && payload.length ? ( +
+ {payload[0].payload.model} +
+ Time: {payload[0].payload.x} +
+ Quality: {payload[0].payload.y} +
+ ) : null + } + /> + + null} + legendType="none" + /> +
+ ); +} diff --git a/src/components/sd-gym/SpeedTradeoffs.js b/src/components/sd-gym/SpeedTradeoffs.js new file mode 100644 index 0000000..dcac08e --- /dev/null +++ b/src/components/sd-gym/SpeedTradeoffs.js @@ -0,0 +1,17 @@ +import React from "react"; +import SpeedTradeoffChart from "./SpeedTradeoffChart"; + +const SpeedTradeoffs = () => { + return ( +
+
+

+ The Quality-Speed Tradeoffs +

+ +
+
+ ); +}; + +export default SpeedTradeoffs; diff --git a/src/pages/sd-gym.js b/src/pages/sd-gym.js index 91bb48e..cce3bbc 100644 --- a/src/pages/sd-gym.js +++ b/src/pages/sd-gym.js @@ -1,26 +1,23 @@ import React from "react"; -// import { Article } from "../components/common"; -// import config from "../utils/siteConfig"; -// import Seo from "../components/Seo"; -// import SdGymContent from "../components/sd-gym/SdGymContent"; -import NotFoundPage from "./404"; +import { Article } from "../components/common"; +import config from "../utils/siteConfig"; +import Seo from "../components/Seo"; +import SdGymContent from "../components/sd-gym/SdGymContent"; export default function SdGymPage() { - return ; + return ( +
+ - // return ( - //
- // - - //
- // - //
- //
- // ); +
+ +
+
+ ); }