Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
apdavison committed Mar 1, 2024
1 parent 56e2f7d commit c8f33ba
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 27 deletions.
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;
31 changes: 25 additions & 6 deletions apps/nar-v3/src/routes/dataset.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +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(
"datasets detail",
Expand All @@ -23,14 +35,21 @@ 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) => {
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 c8f33ba

Please sign in to comment.