Skip to content

Commit

Permalink
Enhancement: Files & Links tab on patient view
Browse files Browse the repository at this point in the history
  • Loading branch information
Nelliney committed Sep 11, 2024
1 parent 9e0c76a commit 614fee5
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 15 deletions.
24 changes: 16 additions & 8 deletions src/shared/components/resources/ResourceTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,22 @@ export default class ResourceTab extends React.Component<

return (
<div>
<FeatureTitle
title={
this.currentResourceDatum.resourceDefinition.displayName
}
isLoading={false}
className="pull-left"
style={{ marginBottom: 10 }}
/>
<div style={{ display: 'flex', alignItems: 'flex-end' }}>
<FeatureTitle
title={
this.currentResourceDatum.resourceDefinition
.displayName
}
isLoading={false}
className="pull-left"
style={{ marginBottom: 10 }}
/>
<p style={{ marginLeft: 10 }}>
{this.currentResourceDatum.sampleId
? this.currentResourceDatum.sampleId
: this.currentResourceDatum.patientId}
</p>
</div>
<div
style={{
width: '100%',
Expand Down
5 changes: 4 additions & 1 deletion src/shared/components/resources/ResourceTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export interface IResourceTableProps {
resources: ResourceData[];
isTabOpen: (resourceId: string) => boolean;
openResource: (resource: ResourceData) => void;
sampleId?: React.ReactNode;
}

function icon(resource: ResourceData) {
Expand Down Expand Up @@ -45,7 +46,7 @@ function icon(resource: ResourceData) {
}

const ResourceTable = observer(
({ resources, isTabOpen, openResource }: IResourceTableProps) => {
({ resources, isTabOpen, openResource, sampleId }: IResourceTableProps) => {
const resourceTable = useLocalObservable(() => ({
get data() {
return _.sortBy(resources, r => r.resourceDefinition.priority);
Expand All @@ -56,6 +57,7 @@ const ResourceTable = observer(
<table className="simple-table table table-striped table-border-top">
<thead>
<tr>
{sampleId && <th>Sample ID</th>}
<th>Resource</th>
<th></th>
<th>Description</th>
Expand All @@ -64,6 +66,7 @@ const ResourceTable = observer(
<tbody>
{resourceTable.data.map(resource => (
<tr>
{sampleId && <td>{sampleId}</td>}
<td>
<a onClick={() => openResource(resource)}>
{icon(resource)}
Expand Down
15 changes: 9 additions & 6 deletions src/shared/components/resources/SampleResourcesTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,21 @@ export default class SampleResourcesTable extends React.Component<
return (
<>
{this.data.map((datum, index) => {
const sampleId = (
<p className="blackHeader" style={{ margin: 0 }}>
{datum.sample.sampleId}{' '}
{this.props.sampleManager.getComponentForSample(
datum.sample.sampleId
)}
</p>
);
return (
<>
<h5 className="blackHeader">
Sample {datum.sample.sampleId}{' '}
{this.props.sampleManager.getComponentForSample(
datum.sample.sampleId
)}
</h5>
<ResourceTable
resources={datum.resources}
isTabOpen={this.props.isTabOpen}
openResource={this.props.openResource}
sampleId={sampleId}
/>
{index < this.data.length - 1 && (
<hr style={{ marginTop: 20 }}></hr>
Expand Down

0 comments on commit 614fee5

Please sign in to comment.