Conversation
| @@ -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 | |||
There was a problem hiding this comment.
Do you need an approval to merge this branch ?
| {chartConfig[payload[0].name]?.label || payload[0].name}:{" "} | ||
| {payload[0].value} {unit} |
There was a problem hiding this comment.
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}`;| <polyline | ||
| fill="none" | ||
| points={`${lineStartX},${lineStartY} ${lineMidX},${lineMidY} ${labelX},${labelY}`} |
|
|
||
| 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"> |
There was a problem hiding this comment.
Better to enforce standard spacing
| <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 => { |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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"; |
There was a problem hiding this comment.
| } from "../../indicators/components/constants"; | |
| } from "@features/indicators/components/constants"; |
| <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> |
There was a problem hiding this comment.
It can be simplified just by adding a gap when both elements are defined
| <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" |
There was a problem hiding this comment.
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]"
...
}
| "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", |
There was a problem hiding this comment.
To update when merged
|
|
||
| export const markChartComponent = <P extends object>( | ||
| component: ComponentType<P>, | ||
| ): ComponentType<P> & { isChartComponent: boolean } => |
There was a problem hiding this comment.
Seemed to be not used
david-bretaud-dev
left a comment
There was a problem hiding this comment.
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
|
Todo :
|

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/