File tree Expand file tree Collapse file tree 3 files changed +29
-20
lines changed Expand file tree Collapse file tree 3 files changed +29
-20
lines changed Original file line number Diff line number Diff line change 1111 return Math .floor ((degrees / 360 ) * 100 );
1212 }
1313
14- for (let i = 0 ; i < 9 ; i ++ ) {
14+ const sliceCount = data .length < 9 ? data .length : 9 ;
15+
16+ for (let i = 0 ; i < sliceCount ; i ++ ) {
1517 if (i == 4 ) {
1618 let value = data .slice (9 ).reduce ((acc , [_ , v ]) => {
1719 if (v <= 0 ) return acc ;
Original file line number Diff line number Diff line change 3838 </a >
3939 {#key [currentPie , numberType ]}
4040 <PieChart data ={pieData [currentPie ]} {numberType }>
41- <select class ="select rounded-3xl" bind:value ={currentPie }>
42- {#each Object .keys (pieData ) as value }
43- <option {value }>{pieNames [value ]}</option >
44- {/each }
45- </select >
46- <select class ="select rounded-3xl" bind:value ={numberType }>
47- <option value =" percentage" >Percentage</option >
48- <option value =" literal" >Literal</option >
49- </select >
41+ {#if pieData [currentPie ].length > 0 }
42+ <select class ="select rounded-3xl" bind:value ={currentPie }>
43+ {#each Object .keys (pieData ) as value }
44+ <option {value }>{pieNames [value ]}</option >
45+ {/each }
46+ </select >
47+ <select class ="select rounded-3xl" bind:value ={numberType }>
48+ <option value =" percentage" >Percentage</option >
49+ <option value =" literal" >Literal</option >
50+ </select >
51+ {:else }
52+ <div >No visualizations available.</div >
53+ {/if }
5054 </PieChart >
5155 {/ key }
5256 </div >
Original file line number Diff line number Diff line change 1212 let authorData = [];
1313 let pieData = {};
1414 let type: RetrievalType = ' submission' ;
15+ let requestCompleted = false ;
1516
1617 $ : console .log (returnData );
1718 $ : console .log (authorData );
2728 input .value = null ;
2829 }
2930 }
31+
32+ requestCompleted = false ;
3033 }
3134
3235 function clearResults() {
97100
98101 populateForm ();
99102 loading = true ;
103+ requestCompleted = false ;
100104
101105 let authorName = url .searchParams .get (' author' );
102106 let type: RetrievalType = (url .searchParams .get (' type' ) as RetrievalType ) || ' submission' ;
121125 }
122126
123127 loading = false ;
128+ requestCompleted = true ;
124129 }
125130
126131 async function fetchPullPush(retrievalType : RetrievalType , value : string ) {
132137 );
133138 const json = await response .json ();
134139 _returnData = json .data ;
135- if (_returnData .length === 0 ) {
136- return {
137- toast: {
138- message:
139- ' No results found for your search. Please try again with different parameters.' ,
140- background: ' variant-filled-error' ,
141- autohide: false
142- }
143- };
144- }
145140 return _returnData ;
146141 } catch {
147142 return {
469464 </div >
470465 {/if }
471466 <IntersectionObserver element ={itemCountDiv } on:intersect ={paginate } />
467+ {:else if requestCompleted }
468+ <div class =" w-full flex justify-center" >
469+ <div
470+ class =" flex justify-center self-center alert card variant-ghost-warning max-w-5xl w-full rounded-3xl"
471+ >
472+ No results found for your search.
473+ </div >
474+ </div >
472475 {/if }
473476{/if }
You can’t perform that action at this time.
0 commit comments