Skip to content

Learning profile recharts poc - #2831

Open
adamska27 wants to merge 10 commits into
masterfrom
learning-profile-recharts-poc
Open

Learning profile recharts poc#2831
adamska27 wants to merge 10 commits into
masterfrom
learning-profile-recharts-poc

Conversation

@adamska27

@adamska27 adamska27 commented Mar 13, 2024

Copy link
Copy Markdown
Contributor

Detailed purpose of the PR

Result and observation

hexagon with customize colors:
image
pentagon with one skill on focus:
image
quadrilateral:
image
triangle:
image
wip > multiple dataset:
image

  • Breaking changes ?
    If checked, what have you broken ?

  • Extra lib ?

    • Recharts

Testing Strategy

  • Already covered by tests
  • Manual testing
  • Unit testing

@AdrieanKhisbe AdrieanKhisbe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Set of feedbacks

);

const buildSvgGradient = styles =>
map.convert({cap: false})(({gradient}, index) => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[style] tu peux eventuelement le destructurer dans la signature

({gradient: {fill, stroke}}, index)=> (<svg>)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

et utiliser la currification pour faire sauter le styles => KEEP(THIS, styles)

const right = {
offset: {x: 30, y: -10},
alignment: 'start',
marginRigth: 'auto'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this ain't right 🙈

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

😅

}, styles);

// TICK_POSITIONS
const top = {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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 = {/*...*/};

Comment on lines +189 to +190
const {color, background} = percentage;
const {color: colorLabel} = label;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

style: maybe signature destructuring


LearningProfileRadarChart.propTypes = {
data: PropTypes.objectOf(PropTypes.arrayOf(PropTypes.number)).isRequired,
totalDataset: PropTypes.number.isRequired,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

totalDataset, ça correspond à quoi?

LearningProfileRadarChart.propTypes = {
data: PropTypes.objectOf(PropTypes.arrayOf(PropTypes.number)).isRequired,
totalDataset: PropTypes.number.isRequired,
onClick: PropTypes.func,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ç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());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

quality, test it!
(mobileUserAgentRegex to CONSTANT_CASE

Suggested change
export const isMobile = () => mobileUserAgentRegex.test(navigator.userAgent.toLowerCase());
export const isMobile = (userAgent = navigator.userAgent) => mobileUserAgentRegex.test(userAgent.toLowerCase());

Comment on lines +5 to +7
'Adaptability and resilience': [15.6],
'Digital culture': [43.8],
'Problem solving': [56.4],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Idéalement pas de tableau à une valeur en entrée

@codecov

codecov Bot commented Mar 28, 2024

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 50.00000% with 44 lines in your changes are missing coverage. Please review.

Project coverage is 93.88%. Comparing base (bb34234) to head (a9d5965).
Report is 10 commits behind head on master.

❗ Current head a9d5965 differs from pull request most recent head aa29ae7. Consider uploading reports for the commit aa29ae7 to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            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     
Files Coverage Δ
...src/molecule/learning-profile-radar-chart/types.ts 100.00% <100.00%> (ø)
...oorpacademy-components/src/util/check-is-mobile.js 66.66% <66.66%> (ø)
...rc/molecule/learning-profile-radar-chart/index.tsx 46.91% <46.91%> (ø)

... and 15 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f38adf1...aa29ae7. Read the comment docs.


const uncappedMap = map.convert({cap: false});

// TICK_POSITIONS

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
// TICK_POSITIONS
/* TICK_POSITIONS */

Utilise plutot le block comment pour délimiter tes sections
(et NE CRIE PAS STEUPLE 😅 )

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

😂

// 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'};

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
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'],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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 = {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

style: on peut ptetre omettre le CUSTOM du nom des constantes

Comment on lines +137 to +145
if (active && size(payload))
return (
<div className={style.tooltip}>
<p>{label}</p>
<p>{payload[0].value}%</p>
</div>
);

return null;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

style

Suggested change
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;

Comment on lines +114 to +117
const {value: activeDotValue, label: activeDotLabel} = activeDot;
const label = get('payload.subject', payload);
const value = get(`payload[${dataKey}]`, payload);
const isCurrentDotActive = value === activeDotValue && label === activeDotLabel;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

maybe inline (au formatage pret)

Suggested change
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;

Comment on lines +161 to +163
// only on mobile
// to handle dot style on hover (convert to click)
// use with the tooltip component

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

style with block comment, après le activeDot={{ }}

Comment on lines +269 to +282
const isMobile_ = useMemo(() => getIsMobile(useragent), [useragent]);

const setIsMobile_ = useCallback(() => {
setIsMobile(isMobile_);
}, [isMobile_]);

useEffect(() => {
setIsMobile_();
window.addEventListener('resize', setIsMobile_);

return () => {
window.removeEventListener('resize', setIsMobile_);
};
}, [setIsMobile_]);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

question: c'est un pattern courant? (il est déjà en place dans d'autre composants?)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

non d'ailleurs c'est pas vraiment nécessaire,
je modifie ça

{
gradient: {
fill: ['#0062ffff', '#8000ff85'],
stroke: ['#0062ffff', '#8000FF ']

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

attention à la deuxième valeur

@adamska27
adamska27 force-pushed the learning-profile-recharts-poc branch from a9d5965 to aa29ae7 Compare April 3, 2024 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants