@@ -14,16 +14,6 @@ interface GitHubAsset {
1414 browser_download_url : string ;
1515}
1616
17- interface FallbackAsset {
18- id : string ;
19- type : string ;
20- format : string ;
21- size : string ;
22- updated : string ;
23- link : string ;
24- description : string ;
25- }
26-
2717export const Datasets : React . FC = ( ) => {
2818 const [ assets , setAssets ] = useState < GitHubAsset [ ] > ( [ ] ) ;
2919 const [ loading , setLoading ] = useState ( true ) ;
@@ -33,7 +23,6 @@ export const Datasets: React.FC = () => {
3323 const loadDatasets = async ( ) => {
3424 try {
3525 setLoading ( true ) ;
36- // Call the fetchReleaseData method. Pass in the necessary parameters.
3726 const releaseData = await apiProxy . fetchReleaseData ( 201896251 ) ;
3827
3928 const fetchedAssets : GitHubAsset [ ] = releaseData . map ( ( asset : any ) => ( {
@@ -52,37 +41,11 @@ export const Datasets: React.FC = () => {
5241 } catch ( err : any ) {
5342 console . error ( 'Error loading datasets:' , err ) ;
5443 setError ( err . message || 'Failed to load dataset information' ) ;
55- await loadFallbackData ( ) ; // Keep fallback
5644 } finally {
5745 setLoading ( false ) ;
5846 }
5947 } ;
6048
61- const loadFallbackData = async ( ) => {
62- try {
63- const fallbackResponse = await fetch ( '/dataset_links.json' ) ;
64- if ( ! fallbackResponse . ok ) {
65- throw new Error ( `Failed to fetch fallback data: ${ fallbackResponse . status } ` ) ;
66- }
67- const fallbackData = await fallbackResponse . json ( ) ;
68- const fallbackAssets : GitHubAsset [ ] = fallbackData . links . map ( ( link : FallbackAsset ) => ( {
69- id : parseInt ( link . id , 10 ) || 0 ,
70- name : link . type ,
71- content_type : link . format === 'TAR.GZ' ? 'application/gzip' : 'application/octet-stream' ,
72- size : parseInt ( link . size . replace ( / [ ^ 0 - 9 ] / g, '' ) , 10 ) * 1024 * 1024 * 1024 ,
73- download_count : Math . floor ( Math . random ( ) * 100 ) ,
74- created_at : link . updated ,
75- updated_at : link . updated ,
76- browser_download_url : link . link ,
77- } ) ) ;
78- setAssets ( fallbackAssets ) ;
79- setError ( null ) ;
80- } catch ( fallbackErr : any ) {
81- console . error ( 'Error loading fallback data:' , fallbackErr ) ;
82- setError ( fallbackErr . message || "Failed to load fallback data." ) ;
83- }
84- } ;
85-
8649 loadDatasets ( ) ;
8750 } , [ ] ) ;
8851
@@ -145,7 +108,7 @@ export const Datasets: React.FC = () => {
145108 ) ;
146109 }
147110
148- if ( error && assets . length === 0 ) {
111+ if ( error ) {
149112 return (
150113 < div className = "flex items-center justify-center min-h-[60vh]" >
151114 < div className = "text-red-500 bg-red-500/10 px-6 py-4 rounded-lg border border-red-500/20 max-w-md text-center" >
@@ -174,17 +137,7 @@ export const Datasets: React.FC = () => {
174137 </ div >
175138 </ div >
176139
177- { error && (
178- < div className = "mb-6 bg-yellow-900/20 border border-yellow-800/30 rounded-lg p-4 flex items-start gap-3" >
179- < AlertCircle className = "w-5 h-5 text-yellow-500 flex-shrink-0 mt-0.5" />
180- < div >
181- < p className = "text-yellow-500 font-medium" > Note</ p >
182- < p className = "text-gray-400 text-sm" >
183- We're having trouble connecting to our dataset repository. Some information may not be up to date.
184- </ p >
185- </ div >
186- </ div >
187- ) }
140+ { /* Alert section removed as fallback is removed */ }
188141
189142 < div className = "grid gap-6 md:grid-cols-2" >
190143 { assets . map ( ( asset ) => (
@@ -252,4 +205,4 @@ export const Datasets: React.FC = () => {
252205 </ div >
253206 </ div >
254207 ) ;
255- } ;
208+ } ;
0 commit comments