Merge pull request #242 from Prydeton/feat/tooltip-legend-display-filtered-count

Display filtered people count on legend and tooltip
This commit is contained in:
Benjamin Grant 2023-03-17 17:06:53 +11:00 committed by GitHub
commit 01bb14031d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -126,7 +126,7 @@ const AvailabilityViewer = ({
setTooltip({ setTooltip({
x: Math.round(cellBox.x-wrapperBox.x + cellBox.width/2), x: Math.round(cellBox.x-wrapperBox.x + cellBox.width/2),
y: Math.round(cellBox.y-wrapperBox.y + cellBox.height)+6, y: Math.round(cellBox.y-wrapperBox.y + cellBox.height)+6,
available: `${peopleHere.length} / ${people.length} ${t('event:available')}`, available: `${peopleHere.length} / ${filteredPeople.length} ${t('event:available')}`,
date: parsedDate.hour(time.slice(0, 2)).minute(time.slice(2, 4)).format(isSpecificDates ? `${timeText} ddd, D MMM YYYY` : `${timeText} ddd`), date: parsedDate.hour(time.slice(0, 2)).minute(time.slice(2, 4)).format(isSpecificDates ? `${timeText} ddd, D MMM YYYY` : `${timeText} ddd`),
people: peopleHere, people: peopleHere,
}) })
@ -168,7 +168,7 @@ const AvailabilityViewer = ({
<Legend <Legend
min={Math.min(min, filteredPeople.length)} min={Math.min(min, filteredPeople.length)}
max={Math.min(max, filteredPeople.length)} max={Math.min(max, filteredPeople.length)}
total={people.filter(p => p.availability.length > 0).length} total={filteredPeople.length}
onSegmentFocus={count => setFocusCount(count)} onSegmentFocus={count => setFocusCount(count)}
/> />
<Info>{t('event:group.info1')}</Info> <Info>{t('event:group.info1')}</Info>