cfahlgren1 HF staff commited on
Commit
b17ac62
1 Parent(s): e4c1ec6

add type, center content

Browse files
Files changed (1) hide show
  1. 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
- const PROVIDERS_MAP = {
 
 
 
 
 
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 mx-10">
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-2">{providerName}</h2>
137
- <div className="w-full overflow-x-auto">
138
- <div className="inline-block mx-auto">
139
- <ActivityCalendar
140
- data={calendarData[providerName]}
141
- theme={{
142
- dark: ['#161b22', color],
143
- light: ['#e0e0e0', color],
144
- }}
145
- hideTotalCount
146
- renderBlock={(block, activity) => (
147
- <Tooltip
148
- title={`${activity.count} models created on ${activity.date}`}
149
- arrow
150
- >
151
- {block}
152
- </Tooltip>
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
  ))