-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/test rechart #723
base: development/1.0
Are you sure you want to change the base?
Feature/test rechart #723
Conversation
…ry slider, and utils with calc functions
Hello jeanmarcmilletscality,My role is to assist you with the merge of this Available options
Available commands
Status report is not available. |
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
Peer approvals must include at least 1 approval from the following list: |
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
Peer approvals must include at least 1 approval from the following list: |
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
Peer approvals must include at least 1 approval from the following list: |
// console.log('tooltip', tooltipRef.current); | ||
// console.log('tooltipCoord', tooltipRef.current.getBoundingClientRect()); | ||
// left and top < 0 = tooltip is out of the screen | ||
// right or bottom > window.innerWidth or window.innerheight = tooltip is out of the screen |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// console.log('tooltip', tooltipRef.current); | |
// console.log('tooltipCoord', tooltipRef.current.getBoundingClientRect()); | |
// left and top < 0 = tooltip is out of the screen | |
// right or bottom > window.innerWidth or window.innerheight = tooltip is out of the screen | |
// left and top < 0 = tooltip is out of the screen | |
// right or bottom > window.innerWidth or window.innerheight = tooltip is out of the screen |
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
Peer approvals must include at least 1 approval from the following list: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should unit test this component and ensure that the screen readers description of it is intelligible
type HistoryAlertContextType = { | ||
selectedDate: number; | ||
setSelectedDate: (date: number) => void; | ||
}; | ||
export const HistoryAlertContext = createContext< | ||
HistoryAlertContextType | undefined | ||
>(undefined); | ||
|
||
export const HistoryAlertProvider = ({ children }) => { | ||
const [selectedDate, setSelectedDate] = useState<number>(Date.now()); | ||
return ( | ||
<HistoryAlertContext.Provider value={{ selectedDate, setSelectedDate }}> | ||
{children} | ||
</HistoryAlertContext.Provider> | ||
); | ||
}; | ||
|
||
export const useHistoryAlert = () => { | ||
const context = useContext(HistoryAlertContext); | ||
if (!context) { | ||
return { selectedDate: null }; | ||
} | ||
return context; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This component is not specific to alerts, it is more a "Point in time" selector/provider that can be used more widely.
|
||
const StyledRange = styled.input` | ||
width: 600px; | ||
padding: 0; /* nécessaire pour IE */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please review those french comments
endDate: number; | ||
}; | ||
|
||
export const HistoryAlertSlider = ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly I think this could be used in other context than Alerting. It is a "Point in time Slider/Selector", not sure how to name it yet
start, | ||
end, | ||
startDate, | ||
endDate, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure to understand why we have both Start and StartDate props, same for end and endDate
const width = ((selectedDate - startDate) / (endDate - startDate)) * 600; | ||
const leftPosition = width - 132 / 2; | ||
return `auto auto -4px ${leftPosition}px`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From a reader perspective it looks like math black magic here, maybe we can introduce variables to explain what is
- 600
- 132
- -4px ?
start: number, | ||
end: number, | ||
startDate: number, | ||
endDate: number, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What the meaning of those props ? IMO the signature of the function is not very clear to understand what it does
DATE_FORMATER.format(history.selectedDate) + | ||
'T' + | ||
TIME_SECOND_FORMATER.format(history.selectedDate) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
history.selectedDate.toISOString ?
offset={20} | ||
isAnimationActive={false} | ||
cursor={false} | ||
content={<CustomTooltip tooltipData={tooltipData}></CustomTooltip>} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: could be self-closed
allowDataOverflow={true} | ||
dataKey="start" | ||
type="number" | ||
domain={[new Date(start).getTime(), new Date(end).getTime()]} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
domain={[new Date(start).getTime(), new Date(end).getTime()]} | |
domain={[startDate, endDate]} |
tickSize={8} | ||
minTickGap={0} | ||
interval={0} | ||
ticks={getDataListOptions(startDate, endDate)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ticks={getDataListOptions(startDate, endDate)} | |
ticks={getTicks(startDate, endDate)} |
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
Peer approvals must include at least 1 approval from the following list: The following reviewers are expecting changes from the author, or must review again: |
Component:
Description:
Design:
Breaking Changes:
Closes: #ISSUE_NUMBER