Learning profile recharts poc - #2831
Conversation
diferant behavior on mobile
| ); | ||
|
|
||
| const buildSvgGradient = styles => | ||
| map.convert({cap: false})(({gradient}, index) => { |
There was a problem hiding this comment.
extrait un mapUncapped au top level
const mapUncapped = map.convert({cap: false});
|
|
||
| const buildSvgGradient = styles => | ||
| map.convert({cap: false})(({gradient}, index) => { | ||
| const {fill, stroke} = gradient; |
There was a problem hiding this comment.
[style] tu peux eventuelement le destructurer dans la signature
({gradient: {fill, stroke}}, index)=> (<svg>)
There was a problem hiding this comment.
et utiliser la currification pour faire sauter le styles => KEEP(THIS, styles)
| const right = { | ||
| offset: {x: 30, y: -10}, | ||
| alignment: 'start', | ||
| marginRigth: 'auto' |
| }, styles); | ||
|
|
||
| // TICK_POSITIONS | ||
| const top = { |
There was a problem hiding this comment.
style: si ça rentre je rendrai ce block plus compact:
/* Ticks ** */
const top = {offset: {x: -100, y: -65}, alignment: 'center', margin: 'auto'};
const bottom = {/*...*/};
const right = {/*...*/};
const left = {/*...*/};| const {color, background} = percentage; | ||
| const {color: colorLabel} = label; |
There was a problem hiding this comment.
style: maybe signature destructuring
|
|
||
| LearningProfileRadarChart.propTypes = { | ||
| data: PropTypes.objectOf(PropTypes.arrayOf(PropTypes.number)).isRequired, | ||
| totalDataset: PropTypes.number.isRequired, |
There was a problem hiding this comment.
totalDataset, ça correspond à quoi?
| LearningProfileRadarChart.propTypes = { | ||
| data: PropTypes.objectOf(PropTypes.arrayOf(PropTypes.number)).isRequired, | ||
| totalDataset: PropTypes.number.isRequired, | ||
| onClick: PropTypes.func, |
There was a problem hiding this comment.
ptetre à renommer (précise que on click on parle)
| data: PropTypes.objectOf(PropTypes.arrayOf(PropTypes.number)).isRequired, | ||
| totalDataset: PropTypes.number.isRequired, | ||
| onClick: PropTypes.func, | ||
| styles: PropTypes.arrayOf( |
There was a problem hiding this comment.
ça serait cool s'il supporte une simple valeur, sans avoir à la wrapper dans une array
| @@ -0,0 +1,3 @@ | |||
| const mobileUserAgentRegex = /iphone|ipad|ipod|android|blackberry|windows phone/g; | |||
|
|
|||
| export const isMobile = () => mobileUserAgentRegex.test(navigator.userAgent.toLowerCase()); | |||
There was a problem hiding this comment.
quality, test it!
(mobileUserAgentRegex to CONSTANT_CASE
| export const isMobile = () => mobileUserAgentRegex.test(navigator.userAgent.toLowerCase()); | |
| export const isMobile = (userAgent = navigator.userAgent) => mobileUserAgentRegex.test(userAgent.toLowerCase()); |
| 'Adaptability and resilience': [15.6], | ||
| 'Digital culture': [43.8], | ||
| 'Problem solving': [56.4], |
There was a problem hiding this comment.
Idéalement pas de tableau à une valeur en entrée
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2831 +/- ##
==========================================
- Coverage 94.88% 93.88% -1.00%
==========================================
Files 396 387 -9
Lines 6133 5857 -276
Branches 401 413 +12
==========================================
- Hits 5819 5499 -320
- Misses 249 292 +43
- Partials 65 66 +1
... and 15 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
|
|
||
| const uncappedMap = map.convert({cap: false}); | ||
|
|
||
| // TICK_POSITIONS |
There was a problem hiding this comment.
| // TICK_POSITIONS | |
| /* TICK_POSITIONS */ |
Utilise plutot le block comment pour délimiter tes sections
(et NE CRIE PAS STEUPLE 😅 )
| // TICK_POSITIONS | ||
| const top = {offset: {x: -100, y: -65}, alignment: 'center', margin: 'auto'}; | ||
| const bottom = {offset: {x: -100, y: 10}, alignment: 'center', margin: 'auto'}; | ||
| const right = {offset: {x: 30, y: -10}, alignment: 'start', marginRigth: 'auto'}; |
There was a problem hiding this comment.
| const right = {offset: {x: 30, y: -10}, alignment: 'start', marginRigth: 'auto'}; | |
| const right = {offset: {x: 30, y: -10}, alignment: 'start', marginRight: 'auto'}; |
| // CONSTANTS | ||
| const DEFAULT_COLORS = { | ||
| gradient: { | ||
| fill: ['#0062ffff', '#0062ffff'], |
There was a problem hiding this comment.
maybe const black, white, et main color?
|
|
||
| const CHART_CONFIGS_BY_SIDE_COUNT = pipe(keyBy('sideCount'), mapValues('name'))(CHART_CONFIGS); | ||
|
|
||
| const CUSTOM_DOT_DEFAULT_PROPS = { |
There was a problem hiding this comment.
style: on peut ptetre omettre le CUSTOM du nom des constantes
| if (active && size(payload)) | ||
| return ( | ||
| <div className={style.tooltip}> | ||
| <p>{label}</p> | ||
| <p>{payload[0].value}%</p> | ||
| </div> | ||
| ); | ||
|
|
||
| return null; |
There was a problem hiding this comment.
style
| if (active && size(payload)) | |
| return ( | |
| <div className={style.tooltip}> | |
| <p>{label}</p> | |
| <p>{payload[0].value}%</p> | |
| </div> | |
| ); | |
| return null; | |
| return active && size(payload) ? ( | |
| <div className={style.tooltip}> | |
| <p>{label}</p> | |
| <p>{payload[0].value}%</p> | |
| </div> | |
| ) : null; |
| const {value: activeDotValue, label: activeDotLabel} = activeDot; | ||
| const label = get('payload.subject', payload); | ||
| const value = get(`payload[${dataKey}]`, payload); | ||
| const isCurrentDotActive = value === activeDotValue && label === activeDotLabel; |
There was a problem hiding this comment.
maybe inline (au formatage pret)
| const {value: activeDotValue, label: activeDotLabel} = activeDot; | |
| const label = get('payload.subject', payload); | |
| const value = get(`payload[${dataKey}]`, payload); | |
| const isCurrentDotActive = value === activeDotValue && label === activeDotLabel; | |
| const isCurrentDotActive = get(`payload[${dataKey}]`, payload) === activeDot.value && get('payload.subject', payload) === activeDot.label; |
| // only on mobile | ||
| // to handle dot style on hover (convert to click) | ||
| // use with the tooltip component |
There was a problem hiding this comment.
style with block comment, après le activeDot={{ }}
| const isMobile_ = useMemo(() => getIsMobile(useragent), [useragent]); | ||
|
|
||
| const setIsMobile_ = useCallback(() => { | ||
| setIsMobile(isMobile_); | ||
| }, [isMobile_]); | ||
|
|
||
| useEffect(() => { | ||
| setIsMobile_(); | ||
| window.addEventListener('resize', setIsMobile_); | ||
|
|
||
| return () => { | ||
| window.removeEventListener('resize', setIsMobile_); | ||
| }; | ||
| }, [setIsMobile_]); |
There was a problem hiding this comment.
question: c'est un pattern courant? (il est déjà en place dans d'autre composants?)
There was a problem hiding this comment.
non d'ailleurs c'est pas vraiment nécessaire,
je modifie ça
| { | ||
| gradient: { | ||
| fill: ['#0062ffff', '#8000ff85'], | ||
| stroke: ['#0062ffff', '#8000FF '] |
There was a problem hiding this comment.
attention à la deuxième valeur
a9d5965 to
aa29ae7
Compare
Detailed purpose of the PR
Result and observation
hexagon with customize colors:





pentagon with one skill on focus:
quadrilateral:
triangle:
wip > multiple dataset:
Breaking changes ?
If checked, what have you broken ?
Extra lib ?
Testing Strategy