Commit
·
6c9b36e
1
Parent(s):
6253c9b
add type, center content
Browse files- src/pages/index.tsx +26 -23
src/pages/index.tsx
CHANGED
|
@@ -2,7 +2,12 @@ import React, { useState, useEffect } from 'react';
|
|
| 2 |
import ActivityCalendar from "react-activity-calendar";
|
| 3 |
import { Tooltip } from '@mui/material';
|
| 4 |
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
"Mistral AI": { color: "#ff7000", authors: ["mistralai"] },
|
| 7 |
"Meta": { color: "#1877F2", authors: ["facebook", "meta-llama"] },
|
| 8 |
"OpenAI": { color: "#10A37F", authors: ["openai"] },
|
|
@@ -125,34 +130,32 @@ export default function OpenSourceHeatmap() {
|
|
| 125 |
{isLoading ? (
|
| 126 |
<p className="text-center">Loading...</p>
|
| 127 |
) : (
|
| 128 |
-
<div className="space-y-8
|
| 129 |
{Object.entries(PROVIDERS_MAP)
|
| 130 |
.sort(([keyA], [keyB]) =>
|
| 131 |
calendarData[keyB].reduce((sum, day) => sum + day.count, 0) -
|
| 132 |
calendarData[keyA].reduce((sum, day) => sum + day.count, 0)
|
| 133 |
)
|
| 134 |
.map(([providerName, { color }]) => (
|
| 135 |
-
<div key={providerName} className="flex flex-col">
|
| 136 |
-
<h2 className="text-xl font-bold mb-
|
| 137 |
-
<div className="w-full overflow-x-auto">
|
| 138 |
-
<
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
/>
|
| 155 |
-
</div>
|
| 156 |
</div>
|
| 157 |
</div>
|
| 158 |
))
|
|
|
|
| 2 |
import ActivityCalendar from "react-activity-calendar";
|
| 3 |
import { Tooltip } from '@mui/material';
|
| 4 |
|
| 5 |
+
interface ProviderInfo {
|
| 6 |
+
color: string;
|
| 7 |
+
authors: string[];
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
const PROVIDERS_MAP: Record<string, ProviderInfo> = {
|
| 11 |
"Mistral AI": { color: "#ff7000", authors: ["mistralai"] },
|
| 12 |
"Meta": { color: "#1877F2", authors: ["facebook", "meta-llama"] },
|
| 13 |
"OpenAI": { color: "#10A37F", authors: ["openai"] },
|
|
|
|
| 130 |
{isLoading ? (
|
| 131 |
<p className="text-center">Loading...</p>
|
| 132 |
) : (
|
| 133 |
+
<div className="space-y-8">
|
| 134 |
{Object.entries(PROVIDERS_MAP)
|
| 135 |
.sort(([keyA], [keyB]) =>
|
| 136 |
calendarData[keyB].reduce((sum, day) => sum + day.count, 0) -
|
| 137 |
calendarData[keyA].reduce((sum, day) => sum + day.count, 0)
|
| 138 |
)
|
| 139 |
.map(([providerName, { color }]) => (
|
| 140 |
+
<div key={providerName} className="flex flex-col items-center">
|
| 141 |
+
<h2 className="text-xl font-bold mb-4">{providerName}</h2>
|
| 142 |
+
<div className="w-full overflow-x-auto flex justify-center">
|
| 143 |
+
<ActivityCalendar
|
| 144 |
+
data={calendarData[providerName]}
|
| 145 |
+
theme={{
|
| 146 |
+
dark: ['#161b22', color],
|
| 147 |
+
light: ['#e0e0e0', color],
|
| 148 |
+
}}
|
| 149 |
+
hideTotalCount
|
| 150 |
+
renderBlock={(block, activity) => (
|
| 151 |
+
<Tooltip
|
| 152 |
+
title={`${activity.count} models created on ${activity.date}`}
|
| 153 |
+
arrow
|
| 154 |
+
>
|
| 155 |
+
{block}
|
| 156 |
+
</Tooltip>
|
| 157 |
+
)}
|
| 158 |
+
/>
|
|
|
|
|
|
|
| 159 |
</div>
|
| 160 |
</div>
|
| 161 |
))
|