File tree Expand file tree Collapse file tree 3 files changed +19
-11
lines changed
src/components/OptimadeClient Expand file tree Collapse file tree 3 files changed +19
-11
lines changed Original file line number Diff line number Diff line change @@ -12,15 +12,17 @@ export function PaginationHandler({
1212} ) {
1313 if ( ! totalPages || totalPages < 1 ) return null ;
1414
15- console . log ( "metaData" , metaData ) ;
16-
1715 const dataReturned = metaData ?. data_returned || "N/A" ;
1816
1917 const hasPrev = currentPage > 1 ;
20- const hasNext =
21- metaData . more_data_available === true ||
22- ( typeof totalAvailable === "number" &&
23- totalAvailable > currentPage * perPage ) ;
18+
19+ // check if next exists
20+ let hasNext = false ;
21+ if ( metaData ?. more_data_available === true ) {
22+ hasNext = true ;
23+ } else if ( currentPage < totalPages ) {
24+ hasNext = true ;
25+ }
2426
2527 return (
2628 < div className = "flex flex-wrap justify-center items-center gap-1" >
Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ import { containerStyleHalf } from "../../styles/containerStyles";
1111// TODO, switdch jsonview library
1212
1313export function ResultViewer ( { selectedResult } ) {
14+ console . log ( "selectedResult" , selectedResult ) ;
15+
1416 const lattice = selectedResult ?. attributes ?. lattice_vectors ?? [ ] ;
1517 const sitesRaw = selectedResult ?. attributes ?. cartesian_site_positions ?? [ ] ;
1618 const species = selectedResult ?. attributes ?. species_at_sites ?? [ ] ;
Original file line number Diff line number Diff line change @@ -6,6 +6,11 @@ export default function ResultsDropdown({
66 selectedResult,
77 setSelectedResult,
88} ) {
9+ const handleChange = ( e ) => {
10+ const chosen = results ?. data ?. find ( ( r ) => String ( r . id ) === e . target . value ) ;
11+ if ( chosen ) setSelectedResult ( chosen ) ;
12+ } ;
13+
914 return (
1015 < >
1116 < label className = "block text-sm font-medium text-gray-700 mb-1" >
@@ -14,10 +19,7 @@ export default function ResultsDropdown({
1419 < select
1520 className = { `${ slateDropdown } w-full` }
1621 value = { selectedResult ?. id || "" }
17- onChange = { ( e ) => {
18- const chosen = results ?. data ?. find ( ( r ) => r . id === e . target . value ) ;
19- if ( chosen ) setSelectedResult ( chosen ) ;
20- } }
22+ onChange = { handleChange }
2123 disabled = { resultsLoading || ! results ?. data ?. length }
2224 >
2325 { ! results ?. data ?. length ? (
@@ -26,7 +28,9 @@ export default function ResultsDropdown({
2628 results . data . map ( ( result ) => (
2729 < option key = { result . id } value = { result . id } >
2830 { `${
29- result . attributes ?. chemical_formula_descriptive || "Unknown"
31+ result . attributes ?. chemical_formula_descriptive ||
32+ result . attributes ?. chemical_formula_hill ||
33+ "Unknown"
3034 } (${ result . id } )`}
3135 </ option >
3236 ) )
You can’t perform that action at this time.
0 commit comments