cfahlgren1 HF Staff commited on
Commit
a61e08f
·
1 Parent(s): a6d1411

refresh summary cards

Browse files
src/components/ProviderSummary.tsx CHANGED
@@ -14,7 +14,8 @@ const ProviderSummary: React.FC<ProviderSummaryProps> = ({
14
  }) => {
15
  const providerName = provider.fullName || provider.authors[0];
16
  const calendarKey = provider.authors[0];
17
- const totalCount = calendarData[calendarKey]?.reduce((sum, day) => sum + day.count, 0) || 0;
 
18
 
19
  const handleClick = () => {
20
  const element = document.getElementById(`provider-${calendarKey}`);
@@ -23,13 +24,31 @@ const ProviderSummary: React.FC<ProviderSummaryProps> = ({
23
  }
24
  };
25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  return (
27
  <div
28
- className="flex flex-col items-center min-w-0 flex-shrink-0 cursor-pointer"
29
  onClick={handleClick}
30
  >
31
- {/* Logo Circle with Release Count Badge */}
32
  <div className="relative">
 
 
 
 
 
33
  {provider.avatarUrl ? (
34
  <img
35
  src={provider.avatarUrl}
@@ -41,11 +60,21 @@ const ProviderSummary: React.FC<ProviderSummaryProps> = ({
41
  {providerName.charAt(0).toUpperCase()}
42
  </div>
43
  )}
 
 
 
 
 
 
 
 
44
 
45
- {/* Release Count Badge */}
46
- <div className="absolute -top-2 -right-2 bg-gradient-to-br from-gray-600 to-gray-700 text-white text-xs font-bold rounded-full min-w-[24px] h-6 flex items-center justify-center px-1.5 shadow-lg border-2 border-background">
47
- {totalCount > 999 ? `${Math.floor(totalCount / 1000)}k` : totalCount}
48
  </div>
 
 
49
  </div>
50
  </div>
51
  );
 
14
  }) => {
15
  const providerName = provider.fullName || provider.authors[0];
16
  const calendarKey = provider.authors[0];
17
+ const providerData = calendarData[calendarKey] || [];
18
+ const totalCount = providerData.reduce((sum, day) => sum + day.count, 0);
19
 
20
  const handleClick = () => {
21
  const element = document.getElementById(`provider-${calendarKey}`);
 
24
  }
25
  };
26
 
27
+ const getRankBadgeClasses = () => {
28
+ if (rank === 1) {
29
+ return "bg-gradient-to-br from-yellow-400 to-yellow-600 text-yellow-900";
30
+ }
31
+ if (rank === 2) {
32
+ return "bg-gradient-to-br from-gray-300 to-gray-500 text-gray-900";
33
+ }
34
+ if (rank === 3) {
35
+ return "bg-gradient-to-br from-amber-600 to-amber-800 text-amber-100";
36
+ }
37
+ return "bg-gradient-to-br from-blue-500 to-blue-700 text-white";
38
+ };
39
+
40
  return (
41
  <div
42
+ className="flex flex-col items-center min-w-0 flex-shrink-0 cursor-pointer group px-1"
43
  onClick={handleClick}
44
  >
45
+ {/* Logo Circle */}
46
  <div className="relative">
47
+ {/* Rank Badge */}
48
+ <div className={`absolute -top-2 -left-2 ${getRankBadgeClasses()} text-xs font-bold rounded-full min-w-[24px] h-6 flex items-center justify-center px-1.5 shadow-lg border-2 border-background z-10`}>
49
+ #{rank}
50
+ </div>
51
+
52
  {provider.avatarUrl ? (
53
  <img
54
  src={provider.avatarUrl}
 
60
  {providerName.charAt(0).toUpperCase()}
61
  </div>
62
  )}
63
+ </div>
64
+
65
+ {/* Activity Info */}
66
+ <div className="mt-1.5 text-center space-y-0.5">
67
+ {/* Provider Name */}
68
+ <div className="text-xs font-medium text-foreground truncate max-w-20 text-center">
69
+ {providerName}
70
+ </div>
71
 
72
+ {/* Release Count */}
73
+ <div className="text-[10px] text-muted-foreground">
74
+ {totalCount} releases
75
  </div>
76
+
77
+
78
  </div>
79
  </div>
80
  );
src/pages/index.tsx CHANGED
@@ -123,7 +123,7 @@ const OpenSourceHeatmap: React.FC<OpenSourceHeatmapProps> = ({
123
  );
124
 
125
  return (
126
- <div className="w-full max-w-screen-xl mx-auto p-4 py-16 relative">
127
  <h1 className="text-3xl lg:text-5xl mt-16 font-bold text-center mb-2 text-foreground">
128
  Hugging Face Heatmap 🤗
129
  </h1>
@@ -134,9 +134,9 @@ const OpenSourceHeatmap: React.FC<OpenSourceHeatmapProps> = ({
134
  </div>
135
 
136
  {/* Provider Summary List */}
137
- <div className="w-full mb-16">
138
  <div className="overflow-x-auto scrollbar-hide">
139
- <div className="flex gap-6 px-4 py-2 min-w-max">
140
  {sortedProviders.map((provider, index) => (
141
  <ProviderSummary
142
  key={provider.fullName || provider.authors[0]}
 
123
  );
124
 
125
  return (
126
+ <div className="w-full p-4 py-16 relative">
127
  <h1 className="text-3xl lg:text-5xl mt-16 font-bold text-center mb-2 text-foreground">
128
  Hugging Face Heatmap 🤗
129
  </h1>
 
134
  </div>
135
 
136
  {/* Provider Summary List */}
137
+ <div className="mb-16 mx-auto">
138
  <div className="overflow-x-auto scrollbar-hide">
139
+ <div className="flex gap-6 px-4 py-2 min-w-max justify-center">
140
  {sortedProviders.map((provider, index) => (
141
  <ProviderSummary
142
  key={provider.fullName || provider.authors[0]}