Skip to content

Commit

Permalink
Add dataset counts to home page
Browse files Browse the repository at this point in the history
  • Loading branch information
apdavison committed Mar 7, 2024
1 parent 256ee1f commit 933e528
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions apps/nar-v3/src/routes/home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@ import Chip from "@mui/material/Chip";

import { datastore } from "../datastore";
import { query as patchClampRecordingsQuery } from "./patchClampRecordings";
import { ephysDatasetsQuery } from "./queryLibrary";
import ProgressIndicator from "../components/ProgressIndicator";

export async function loader() {
const statisticsPromise = datastore.count(patchClampRecordingsQuery);
const statisticsPromise = Promise.all([
datastore.count(patchClampRecordingsQuery),
datastore.count(ephysDatasetsQuery),
]);
console.log(statisticsPromise);
return defer({ counts: statisticsPromise });
}
Expand Down Expand Up @@ -57,15 +61,15 @@ export default function Home() {
return (
<React.Suspense fallback={<ProgressIndicator />}>
<Await resolve={data.counts} errorElement={<p>Error loading tissueSample.</p>}>
{(counts) => {
{([patchClampCounts, datasetCounts]) => {
return (
<Container maxWidth="lg" sx={{ paddingTop: 8, paddingBottom: 8 }}>
<Grid container spacing={4}>
<ModalityCard
label="Patch clamp recording"
path="/patch-clamp"
image="/images/WholeCellPatchClamp-03.jpg"
count={counts}
count={patchClampCounts}
/>
<ModalityCard
label="Intracellular sharp-electrode recording"
Expand Down Expand Up @@ -103,7 +107,7 @@ export default function Home() {
path="/datasets"
image="/images/dataset_search.png"
text=""
count={0}
count={datasetCounts}
/>
</Grid>
</Container>
Expand Down

0 comments on commit 933e528

Please sign in to comment.