Skip to content

Commit

Permalink
add attributes trunk circumference, tree height, crown diameter
Browse files Browse the repository at this point in the history
  • Loading branch information
joergreichert committed Jun 30, 2024
1 parent 8520b27 commit 8f679fc
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/components/Sidebar/SidebarTree/TreeInfos.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ const TreeInfos: FC<{
artdtsch,
gattung,
gattungdeutsch,
baumhoehe,
kronedurch,
stammumfg,
gattungwikipedia,
gattungwikidata,
gattungwikicommons,
Expand Down Expand Up @@ -192,6 +195,14 @@ const TreeInfos: FC<{
}
};

const formatNumber = (str: string) => {
try {
return parseFloat(str).toLocaleString("de");
} catch(e) {
return str;
}
};

return (
<Wrapper>
<Dialog onClose={() => setOpen(false)} aria-labelledby="share-tree-dialog-title" open={open}>
Expand Down Expand Up @@ -333,6 +344,24 @@ const TreeInfos: FC<{
<InfoValue>{gattung}</InfoValue>
</InfoContainer>
)}
{baumhoehe && (
<InfoContainer>
<span>Höhe</span>
<InfoValue>{formatNumber(baumhoehe)} m</InfoValue>
</InfoContainer>
)}
{stammumfg && (
<InfoContainer>
<span>Stammumfang</span>
<InfoValue>{formatNumber(stammumfg)} cm</InfoValue>
</InfoContainer>
)}
{kronedurch && (
<InfoContainer>
<span>Kronendurchmesser</span>
<InfoValue>{formatNumber(kronedurch)} m</InfoValue>
</InfoContainer>
)}
{standortnr && (
<InfoContainer>
<span>Standortnummer</span>
Expand Down

0 comments on commit 8f679fc

Please sign in to comment.