Commit a8dc7970 authored by Aron Fiechter's avatar Aron Fiechter
Browse files

Change QueryResult info to only display count

It cannot display "No results" because that will be handled differently.
parent 649baf31
import React from 'react'; import React, { useState } from 'react';
import { selectResult } from '../navbar/querySlice'; import { selectQuery, selectResult } from '../navbar/querySlice';
import Container from 'react-bootstrap/Container'; import Container from 'react-bootstrap/Container';
import { useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
export default function QueryResult(props) { export default function QueryResult(props) {
const { nResults } = useSelector(selectResult); const { nResults } = useSelector(selectResult);
const query = useSelector(selectQuery);
const allDataText = query?.fields?.find((f) => f.key === 'allData')?.value;
const queryText = allDataText || query?.fields?.find((f) => f.value)?.value;
const text = const displayText = <h5 className="card-title text-sm-right">{nResults} results</h5>;
nResults > 0 ? (
<h5 className='card-title text-sm-right'>{nResults} results</h5>
) : (
<h5 className='card-title text-sm-right text-danger'>No results!</h5>
);
return ( return (
<div className='mt-sm-2 mb-sm-1'> <div className="mt-sm-2 mb-sm-1">
<Container>{text}</Container> <Container>{displayText}</Container>
</div> </div>
); );
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment