Skip to content

Commit

Permalink
minor visual change to enforce census date measurement rendering on d…
Browse files Browse the repository at this point in the history
…ifferent lines and keeping the sidebar from occupying half the screen
  • Loading branch information
siddheshraze committed Sep 13, 2024
1 parent 38bbe1e commit 97e81c5
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions frontend/components/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -366,16 +366,14 @@ export default function Sidebar(props: SidebarProps) {
const hasStartDate = startDate !== undefined && startDate !== null;
const hasEndDate = endDate !== undefined && endDate !== null;

// Determine the message based on the presence of startDate and endDate
const dateMessage =
hasStartDate || hasEndDate ? (
<>
{hasStartDate && `— First Record: ${new Date(startDate).toDateString()}`}
{hasEndDate && ` — Last Record: ${new Date(endDate).toDateString()}`}
</>
) : (
' — No Measurements'
); // Display "No Measurements" if both dates are missing
// Ensure dates are rendered in a block layout to stack them vertically
const dateMessage = (
<>
{hasStartDate && <Typography display="block">&mdash;{` First Record: ${new Date(startDate).toDateString()}`}</Typography>}
{hasEndDate && <Typography display="block">&mdash;{` Last Record: ${new Date(endDate).toDateString()}`}</Typography>}
{!hasStartDate && !hasEndDate && <Typography display="block">No Measurements</Typography>}
</>
);

return (
<Stack direction={'column'} alignItems={'start'}>
Expand Down

0 comments on commit 97e81c5

Please sign in to comment.