Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita0711fb

Browse files
committed
forgotten comp
1 parentfd72d8b commita0711fb

File tree

1 file changed

+252
-0
lines changed

1 file changed

+252
-0
lines changed
Lines changed: 252 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,252 @@
1+
import{useEffect,useState}from'react';
2+
import{baseUrl}from'../lib/utils';
3+
4+
typeContributor={
5+
login:string;
6+
avatar_url:string;
7+
html_url:string;
8+
contributions:number;
9+
name?:string;
10+
};
11+
12+
typeMaintainer={
13+
login:string;
14+
avatar_url:string;
15+
html_url:string;
16+
name?:string;
17+
bio?:string;
18+
contributions?:number;
19+
};
20+
21+
interfaceGitHubContributorsProps{
22+
initialContributors:Contributor[];
23+
initialMaintainer:Maintainer|null;
24+
}
25+
26+
exportdefaultfunctionGitHubContributors({
27+
initialContributors,
28+
initialMaintainer,
29+
}:GitHubContributorsProps){
30+
const[contributors,setContributors]=useState<Contributor[]>([]);
31+
const[maintainer,setMaintainer]=useState<Maintainer|null>(null);
32+
const[isLoading,setIsLoading]=useState(true);
33+
const[contributorsError,setContributorsError]=useState(false);
34+
const[maintainerError,setMaintainerError]=useState(false);
35+
// Data source is always 'static' since we don't fetch from client-side
36+
const[dataSource]=useState<'static'|'live'>('static');
37+
38+
useEffect(()=>{
39+
// Step 1: Initialize from static JSON file
40+
constinitializeFromJSON=async()=>{
41+
try{
42+
console.log('[Build Data] 🔄 Initializing contributors/maintainer from static JSON file...');
43+
constresponse=awaitfetch(baseUrl('build-data-contributors.json'));
44+
if(response.ok){
45+
constdata=awaitresponse.json();
46+
letloaded=false;
47+
if(data.contributors&&Array.isArray(data.contributors)&&data.contributors.length>0){
48+
setContributors(data.contributors);
49+
setContributorsError(false);
50+
loaded=true;
51+
}
52+
if(data.maintainer){
53+
setMaintainer(data.maintainer);
54+
setMaintainerError(false);
55+
loaded=true;
56+
}
57+
if(loaded){
58+
setDataSource('static');
59+
setIsLoading(false);
60+
console.log(
61+
`[Build Data] ✓ Initialized from static JSON:${data.contributors?.length||0} contributors, maintainer:${data.maintainer ?'Yes' :'No'}`
62+
);
63+
returntrue;
64+
}
65+
}
66+
}catch(error){
67+
console.error('[Build Data] ✗ Failed to initialize from static JSON:',error);
68+
}
69+
setIsLoading(false);
70+
returnfalse;
71+
};
72+
73+
// No client-side fetching - GitHub API has CORS restrictions
74+
// Data is only loaded from static JSON files generated at build time
75+
initializeFromJSON();
76+
},[]);
77+
78+
return(
79+
<>
80+
{/* Current Maintainer */}
81+
<div>
82+
<h2className="text-3xl font-bold mb-6 text-gray-900 dark:text-white">
83+
Current Maintainer
84+
{isLoading&&(
85+
<spanclassName="ml-2 text-sm font-normal opacity-75">(loading...)</span>
86+
)}
87+
</h2>
88+
{maintainerError&&!maintainer ?(
89+
<divclassName="bg-yellow-50 dark:bg-yellow-900/20 border-2 border-yellow-400 rounded-lg p-6">
90+
<pclassName="text-gray-700 dark:text-gray-300">
91+
Unable to load maintainer information at this time. This may be due to GitHub API
92+
rate limits. Please visit{' '}
93+
<a
94+
href="https://github.com/Carreau"
95+
target="_blank"
96+
rel="noopener noreferrer"
97+
className="text-theme-secondary hover:text-theme-secondary/80 transition-colors underline"
98+
>
99+
@Carreau's GitHub profile
100+
</a>{' '}
101+
directly.
102+
</p>
103+
</div>
104+
) :maintainer ?(
105+
<divclassName="gradient-stats-cyan-blue border-2 border-theme-secondary rounded-lg p-8">
106+
<divclassName="flex flex-col sm:flex-row items-center sm:items-start gap-6">
107+
<a
108+
href={maintainer.html_url}
109+
target="_blank"
110+
rel="noopener noreferrer"
111+
className="flex-shrink-0 group"
112+
>
113+
<img
114+
src={maintainer.avatar_url}
115+
alt={`${maintainer.name}'s avatar`}
116+
className="w-24 h-24 rounded-full border-4 border-theme-secondary group-hover:scale-110 transition-transform"
117+
/>
118+
</a>
119+
<divclassName="flex-1 text-center sm:text-left">
120+
<a
121+
href={maintainer.html_url}
122+
target="_blank"
123+
rel="noopener noreferrer"
124+
className="block"
125+
>
126+
<h3className="text-2xl font-bold text-gray-900 dark:text-white mb-1 hover:text-theme-secondary transition-colors">
127+
{maintainer.name}
128+
</h3>
129+
<pclassName="text-theme-secondary mb-3">@{maintainer.login}</p>
130+
</a>
131+
{maintainer.contributions!==undefined&&(
132+
<pclassName="text-gray-600 dark:text-gray-400 mb-2">
133+
{maintainer.contributions}{' '}
134+
{maintainer.contributions===1 ?'contribution' :'contributions'}
135+
</p>
136+
)}
137+
{maintainer.bio&&(
138+
<pclassName="text-gray-600 dark:text-gray-400">{maintainer.bio}</p>
139+
)}
140+
</div>
141+
</div>
142+
</div>
143+
) :!maintainer ?(
144+
<divclassName="bg-yellow-50 dark:bg-yellow-900/20 border-2 border-yellow-400 rounded-lg p-6">
145+
<pclassName="text-gray-700 dark:text-gray-300">
146+
Unable to load maintainer information at this time. Please visit{' '}
147+
<a
148+
href="https://github.com/Carreau"
149+
target="_blank"
150+
rel="noopener noreferrer"
151+
className="text-theme-secondary hover:text-theme-secondary/80 transition-colors underline"
152+
>
153+
@Carreau's GitHub profile
154+
</a>{' '}
155+
directly.
156+
</p>
157+
</div>
158+
) :null}
159+
</div>
160+
161+
{/* Developers */}
162+
<div>
163+
<h2className="text-3xl font-bold mb-4 text-gray-900 dark:text-white">
164+
Developers&Contributors
165+
</h2>
166+
<pclassName="text-gray-600 dark:text-gray-400 mb-6">
167+
IPython is built and maintained by a vibrant community of developers and contributors
168+
from around the world. Here are some of the key contributors to the project:
169+
</p>
170+
{contributorsError&&contributors.length===0 ?(
171+
<divclassName="bg-yellow-50 dark:bg-yellow-900/20 border-2 border-yellow-400 rounded-lg p-6">
172+
<pclassName="text-gray-700 dark:text-gray-300 mb-2">
173+
Unable to load contributors at this time. This may be due to GitHub API rate limits.
174+
</p>
175+
<pclassName="text-gray-700 dark:text-gray-300">
176+
Please visit our{' '}
177+
<a
178+
href="https://github.com/ipython/ipython/graphs/contributors"
179+
target="_blank"
180+
rel="noopener noreferrer"
181+
className="text-theme-secondary hover:text-theme-secondary/80 transition-colors underline"
182+
>
183+
GitHub contributors page
184+
</a>{' '}
185+
to see all contributors.
186+
</p>
187+
</div>
188+
) :contributors.length>0 ?(
189+
<divclassName="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-4">
190+
{contributors
191+
.filter((c)=>c.login!=='Carreau')
192+
.map((contributor)=>(
193+
<a
194+
key={contributor.login}
195+
href={contributor.html_url}
196+
target="_blank"
197+
rel="noopener noreferrer"
198+
className="flex flex-col items-center p-4 rounded-lg border border-gray-200 dark:border-ipython-slate hover:border-theme-secondary hover:shadow-lg dark:hover:shadow-xl dark:hover:shadow-theme-secondary/20 transition-all group"
199+
>
200+
<img
201+
src={contributor.avatar_url}
202+
alt={`${contributor.name||contributor.login}'s avatar`}
203+
className="w-16 h-16 rounded-full mb-2 group-hover:scale-110 transition-transform"
204+
loading="lazy"
205+
/>
206+
<spanclassName="text-sm font-medium text-gray-900 dark:text-white text-center truncate w-full">
207+
{contributor.name||contributor.login}
208+
</span>
209+
<spanclassName="text-xs text-gray-500 dark:text-gray-400 text-center truncate w-full">
210+
@{contributor.login}
211+
</span>
212+
<spanclassName="text-xs text-gray-500 dark:text-gray-400">
213+
{contributor.contributions}{' '}
214+
{contributor.contributions===1 ?'contribution' :'contributions'}
215+
</span>
216+
</a>
217+
))}
218+
</div>
219+
) :contributors.length===0 ?(
220+
<divclassName="bg-yellow-50 dark:bg-yellow-900/20 border-2 border-yellow-400 rounded-lg p-6">
221+
<pclassName="text-gray-700 dark:text-gray-300 mb-2">
222+
Unable to load contributors at this time.
223+
</p>
224+
<pclassName="text-gray-700 dark:text-gray-300">
225+
Please visit our{' '}
226+
<a
227+
href="https://github.com/ipython/ipython/graphs/contributors"
228+
target="_blank"
229+
rel="noopener noreferrer"
230+
className="text-theme-secondary hover:text-theme-secondary/80 transition-colors underline"
231+
>
232+
GitHub contributors page
233+
</a>{' '}
234+
to see all contributors.
235+
</p>
236+
</div>
237+
) :null}
238+
<pclassName="text-gray-600 dark:text-gray-400 mt-6">
239+
Want to contribute? Check out our{' '}
240+
<a
241+
href="https://github.com/ipython/ipython"
242+
className="text-theme-secondary hover:text-theme-secondary/80 transition-colors"
243+
>
244+
GitHub repository
245+
</a>{' '}
246+
to get started!
247+
</p>
248+
</div>
249+
250+
</>
251+
);
252+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp