Skip to content

Fix(Webapp): Apply All4Trees Feedback#151

Open
arnaudfnr wants to merge 8 commits intomainfrom
arnaudfnr/fix-a4t-feedback
Open

Fix(Webapp): Apply All4Trees Feedback#151
arnaudfnr wants to merge 8 commits intomainfrom
arnaudfnr/fix-a4t-feedback

Conversation

@arnaudfnr
Copy link
Copy Markdown
Collaborator

@arnaudfnr arnaudfnr commented May 3, 2026

Objective

Apply All4Trees Feedback on the webapp

Context

Catahlijne from All4Trees reviewed the website and gave some feedback that is available here:
https://outline.services.dataforgood.fr/doc/remarques-sur-la-ui-QBK9SKykJA

The webapp is online at this link: https://test-data4trees.services.d4g.fr/

@arnaudfnr arnaudfnr linked an issue May 3, 2026 that may be closed by this pull request
Comment thread backend/requirements.txt
@@ -1,5 +1,5 @@
asgiref==3.8.1
coordo @ git+https://github.com/dataforgoodfr/Coordonnees.git@0.3.0#subdirectory=coordo-py
coordo @ git+https://github.com/dataforgoodfr/Coordonnees.git@arnaudfnr/fix-null-values-in-formulas#subdirectory=coordo-py
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need an approval to merge this branch ?

Comment on lines +38 to +39
{chartConfig[payload[0].name]?.label || payload[0].name}:{" "}
{payload[0].value} {unit}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit prone to bad formating and space issue. I suggest

const name = chartConfig[payload[0].name]?.label || payload[0].name;
const tooltip = `${name}: ${payload[0].value}${unit}`;

Comment on lines +104 to +106
<polyline
fill="none"
points={`${lineStartX},${lineStartY} ${lineMidX},${lineMidY} ${labelX},${labelY}`}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it this arrow that routes to the label ? x)

Image

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes ^^


return (
<div className="flex flex-row items-center justify-between gap-sm flex-1">
<div className="flex flex-row items-center justify-between gap-sm flex-1 mt-5 text-sm">
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to enforce standard spacing

Suggested change
<div className="flex flex-row items-center justify-between gap-sm flex-1 mt-5 text-sm">
<div className="flex flex-row items-center justify-between gap-sm flex-1 mt-sm text-sm">

iconStart?: ReactNode;
}>;

const isChartElement = (node: ReactNode): boolean => {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to have an explanation of all this stuff with isChartElement , flattenChildren, const [valueChildren, chartChildren]...

It's hard to understand and read, and thus, hard to maintain. What's the goal behind ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The goal behind this is to clearly separate charts from other indicators, to make those other indicators more visible in the popup. Therefore I decided to put all the other indicators of a section inside a card component , to highlight them a bit more.
In order to achieve this, I needed to find a way to recognize the chart components. I created the "ChartComponent" which is and should be used by any component in the App, such as Shadcn's chart container. It encapsulates any chart into a Card component. However I did not find a suitable / elegant way to recignize the presence of this component in the chart's children, so I checked the presence of the string "Chart" in the components display names... This is not a very robust solution.

import {
ICON_SIZE,
ICON_SIZE_HEADER,
} from "../../indicators/components/constants";
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
} from "../../indicators/components/constants";
} from "@features/indicators/components/constants";

Comment on lines 42 to 57
<AlertDescription className={cn("text-muted-foreground text-sm")}>
<div>
{subtitle && (
<>
<span>{subtitle}</span>
<br />
</>
)}
{date && (
<div className="flex flex-row items-center gap-xs text-muted-foreground">
<Calendar size={ICON_SIZE} />
<p className="pt-0.5">{date}</p>
</div>
)}
</div>
</AlertDescription>
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be simplified just by adding a gap when both elements are defined

Suggested change
<AlertDescription className={cn("text-muted-foreground text-sm")}>
<div>
{subtitle && (
<>
<span>{subtitle}</span>
<br />
</>
)}
{date && (
<div className="flex flex-row items-center gap-xs text-muted-foreground">
<Calendar size={ICON_SIZE} />
<p className="pt-0.5">{date}</p>
</div>
)}
</div>
</AlertDescription>
<AlertDescription className={cn("text-muted-foreground text-sm", { "flex flex-col gap-sm": subtitle && data })}>
{subtitle && (
<span>{subtitle}</span>
)}
{date && (
<div className="flex flex-row items-center gap-xs text-muted-foreground">
<Calendar size={ICON_SIZE} />
<p className="pt-0.5">{date}</p>
</div>
)}
</AlertDescription>

root.render(
<Element
className="w-120 max-h-120"
className="w-130 max-w-130 max-h-150"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's starting to not fit the screen for small computers :/ (mine for instance, I need to zoom at 80% my browser to see the full popup)

Ideally, we should compute the height based on the size of the div that contains the map.

For instance, we can provide the containerHeight, compute the maxSize we want (I would remove 12 pixels for visual "padding" in the div), provide a custom tailwind class

getRenderPopupLayer(Element: ..., containerHeight: number) {
  const maxSizePixel = min(600, containerHeight-12);
  ...
  <Element style={{ "--popup-max-height": min(600, containerHeight) }} className="max-h-[--popup-max-height]"
 ...
}

Comment thread webapp/package-lock.json
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"coordo": "github:dataforgoodfr/Coordonnees#0.3.0",
"coordo": "github:dataforgoodfr/Coordonnees#arnaudfnr/fix-null-values-in-formulas",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To update when merged


export const markChartComponent = <P extends object>(
component: ComponentType<P>,
): ComponentType<P> & { isChartComponent: boolean } =>
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seemed to be not used

Copy link
Copy Markdown
Collaborator

@david-bretaud-dev david-bretaud-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Globally okay with changes, some improvements suggestion for popup display or code cleaning

Blocking part on my side is this react children manipulation 🤔 need alignment

@arnaudfnr
Copy link
Copy Markdown
Collaborator Author

arnaudfnr commented May 7, 2026

Todo :

  • Clean code in indicator-section => TBR
  • make popup size responsive
  • update to coordo 0.3.1 (when PR on coordo side is merged)
  • fix popup border style
  • (BONUS): improve coloring of plotly's taxon chart

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix(Webapp): Apply All4Trees feedback to the Webapp

2 participants