Skip to content

Commit

Permalink
Remove "In Arcs" header when there are no arcs to display. (datacommo…
Browse files Browse the repository at this point in the history
…nsorg#4745)

One side effect of this change is that the footer does not stick to the
bottom of the page for short pages. This is non blocking for now might
may be addressed in follow up changes.

Before:

![image](https://github.com/user-attachments/assets/8bae02ac-c9a2-410b-b684-fee336a7fbb0)

After:

![image](https://github.com/user-attachments/assets/3a8e224f-aa4b-49ed-bbce-73c2d5e46bd5)
  • Loading branch information
clincoln8 authored and gmechali committed Dec 5, 2024
1 parent 56fa57c commit c0da00a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 29 deletions.
13 changes: 5 additions & 8 deletions static/js/browser/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,11 @@ export class BrowserPage extends React.Component<
</div>
)}
{showInArcSection && (
<div className="table-page-section">
<h3>In Arcs</h3>
<InArcSection
nodeName={this.props.nodeName}
dcid={this.props.dcid}
provDomain={this.state.provDomain}
/>
</div>
<InArcSection
nodeName={this.props.nodeName}
dcid={this.props.dcid}
provDomain={this.state.provDomain}
/>
)}
{this.props.pageDisplayType === PageDisplayType.PLACE_STAT_VAR && (
<div className="table-page-section">
Expand Down
49 changes: 28 additions & 21 deletions static/js/browser/in_arc_section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,29 +59,36 @@ export class InArcSection extends React.Component<
}

render(): JSX.Element {
if (!_.isEmpty(this.state.errorMessage)) {
return <div className="error-message">{this.state.errorMessage}</div>;
if (_.isEmpty(this.state.parentTypes)) {
return null;
}
return (
<div id={LOADING_CONTAINER_ID} className="loading-spinner-container">
{this.state.parentTypes.map((parentType) => {
const arcsByPredicate = this.state.data[parentType];
return Object.keys(arcsByPredicate).map((predicate) => {
return (
<InArcSubsection
nodeName={this.props.nodeName}
parentType={parentType}
property={predicate}
arcValues={arcsByPredicate[predicate]}
provDomain={this.props.provDomain}
key={parentType + predicate}
/>
);
});
})}
<div id="browser-screen" className="screen">
<div id="spinner"></div>
</div>
<div className="table-page-section">
<h3>In Arcs</h3>
{!_.isEmpty(this.state.errorMessage) ? (
<div className="error-message">{this.state.errorMessage}</div>
) : (
<div id={LOADING_CONTAINER_ID} className="loading-spinner-container">
{this.state.parentTypes.map((parentType) => {
const arcsByPredicate = this.state.data[parentType];
return Object.keys(arcsByPredicate).map((predicate) => {
return (
<InArcSubsection
nodeName={this.props.nodeName}
parentType={parentType}
property={predicate}
arcValues={arcsByPredicate[predicate]}
provDomain={this.props.provDomain}
key={parentType + predicate}
/>
);
});
})}
<div id="browser-screen" className="screen">
<div id="spinner"></div>
</div>
</div>
)}
</div>
);
}
Expand Down

0 comments on commit c0da00a

Please sign in to comment.