Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
apdavison committed Mar 4, 2024
1 parent 56e2f7d commit f7a3df2
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 26 deletions.
3 changes: 3 additions & 0 deletions apps/nar-v3/src/components/DatasetCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,9 @@ function DatasetCard(props) {
}
};

console.log("Rendering dataset in DatasetCard.jsx");
console.log(dataset);

return (
<div>
<h1>{dataset.fullName}</h1>
Expand Down
22 changes: 14 additions & 8 deletions apps/nar-v3/src/components/DatasetList.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import { Link as RouterLink } from "react-router-dom";


import { uuidFromUri } from "../utility";

function DatasetList(props) {

return <ul>
{props.datasets.map((dataset) => (
<li key={dataset.id}>{dataset.fullName || dataset.isVersionOf.fullName}</li>
))}
</ul>;
return (
<ul>
{props.datasets.map((dataset) => (
<li key={dataset.id}>
<RouterLink to={uuidFromUri(dataset.id)}>
{dataset.fullName || dataset.isVersionOf.fullName}
</RouterLink>
</li>
))}
</ul>
);
}

export default DatasetList;
export default DatasetList;
25 changes: 14 additions & 11 deletions apps/nar-v3/src/components/PatchClampRecordingList.jsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@

import { Link as RouterLink } from "react-router-dom";


function uuidFromUri(uri) {
const parts = uri.split("/");
return parts[parts.length - 1];
const parts = uri.split("/");
return parts[parts.length - 1];
}

function PatchClampRecordingList(props) {

return <ul>
{props.tissueSamples.map((tissueSample) => (
<li key={tissueSample.id}><RouterLink to={uuidFromUri(tissueSample.id)}>{tissueSample.lookupLabel}</RouterLink></li>
))}
</ul>;
return (
<ul>
{props.tissueSamples.map((tissueSample) => (
<li key={tissueSample.id}>
<RouterLink to={uuidFromUri(tissueSample.id)}>
{tissueSample.lookupLabel}
</RouterLink>
</li>
))}
</ul>
);
}

export default PatchClampRecordingList;
export default PatchClampRecordingList;
32 changes: 27 additions & 5 deletions apps/nar-v3/src/routes/dataset.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
import React from "react";
import { Await, defer, useLoaderData } from "react-router-dom";

import { buildKGQuery, simpleProperty as S, linkProperty as L, reverseLinkProperty as R } from "../queries";
import { datastore } from "../datastore";
//import Navigation from "../components/Navigation";
import { uuidFromUri } from "../utility.js";
import Navigation from "../components/Navigation";
import DatasetCard from "../components/DatasetCard";
import ProgressIndicator from "../components/ProgressIndicator";

const query = null;
const query = buildKGQuery("core/DatasetVersion", [
S("@id"),
S("fullName"),
S("description"),
S("shortName"),
S("versionIdentifier"),
R("isVersionOf", "hasVersion", [
S("fullName"),
S("description"),
S("shortName"),
]),
]);

export async function loader({ params }) {
const datasetPromise = datastore.getKGItem(
Expand All @@ -23,14 +36,23 @@ function Dataset(props) {

return (
<div id="dataset">
{/* <Navigation location={["Datasets"]} /> */}

<React.Suspense fallback={<ProgressIndicator />}>
<Await
resolve={data.dataset}
errorElement={<p>Error loading dataset.</p>}
>
{(dataset) => <DatasetCard dataset={dataset} />}
{(dataset) => {
console.log("Resolving dataset in dataset.jsx");
console.log(dataset);
return (
<>
<Navigation
location={["Datasets", uuidFromUri(dataset.id)]}
/>
<DatasetCard dataset={dataset} />
</>
);
}}
</Await>
</React.Suspense>
</div>
Expand Down
4 changes: 2 additions & 2 deletions apps/nar-v3/src/routes/datasets.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Await, defer, useLoaderData } from "react-router-dom";

import { buildKGQuery, simpleProperty as S, linkProperty as L, reverseLinkProperty as R } from "../queries";
import { datastore } from "../datastore";
//import Navigation from "../components/Navigation";
import Navigation from "../components/Navigation";
import DatasetList from "../components/DatasetList";
import ProgressIndicator from "../components/ProgressIndicator";

Expand Down Expand Up @@ -34,7 +34,7 @@ function Datasets(props) {

return (
<div id="datasets">
{/* <Navigation location={["Datasets"]} /> */}
<Navigation location={["Datasets"]} />

<React.Suspense fallback={<ProgressIndicator />}>
<Await
Expand Down

0 comments on commit f7a3df2

Please sign in to comment.