Better heat map calculation based on minimum tiles
This commit is contained in:
parent
00b47e2656
commit
3b86432c73
|
|
@ -62,8 +62,8 @@ export const Time = styled.div`
|
||||||
`}
|
`}
|
||||||
|
|
||||||
background-image: linear-gradient(
|
background-image: linear-gradient(
|
||||||
${props => `${props.theme.primary}${Math.round(((props.peopleCount-props.minPeople)/(props.maxPeople-props.minPeople))*255).toString(16)}`},
|
${props => `${props.theme.primary}${Math.round(((props.peopleCount)/(props.maxPeople))*255).toString(16)}`},
|
||||||
${props => `${props.theme.primary}${Math.round(((props.peopleCount-props.minPeople)/(props.maxPeople-props.minPeople))*255).toString(16)}`}
|
${props => `${props.theme.primary}${Math.round(((props.peopleCount)/(props.maxPeople))*255).toString(16)}`}
|
||||||
);
|
);
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,11 +21,11 @@ const Legend = ({
|
||||||
<Label>{min}/{total} available</Label>
|
<Label>{min}/{total} available</Label>
|
||||||
|
|
||||||
<Bar onMouseOut={() => onSegmentFocus(null)}>
|
<Bar onMouseOut={() => onSegmentFocus(null)}>
|
||||||
{[...Array(max-min+1).keys()].map(i =>
|
{[...Array(max+1-min).keys()].map(i => i+min).map(i =>
|
||||||
<Grade
|
<Grade
|
||||||
key={i}
|
key={i}
|
||||||
color={`${theme.primary}${Math.round((i/(max-min))*255).toString(16)}`}
|
color={`${theme.primary}${Math.round((i/(max))*255).toString(16)}`}
|
||||||
onMouseOver={() => onSegmentFocus(i+min)}
|
onMouseOver={() => onSegmentFocus(i)}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</Bar>
|
</Bar>
|
||||||
|
|
|
||||||
|
|
@ -286,7 +286,7 @@ const Event = (props) => {
|
||||||
{(!!event || isLoading) ? (
|
{(!!event || isLoading) ? (
|
||||||
<>
|
<>
|
||||||
<EventName isLoading={isLoading}>{event?.name}</EventName>
|
<EventName isLoading={isLoading}>{event?.name}</EventName>
|
||||||
<EventDate isLoading={isLoading} title={event?.created && dayjs.unix(event?.created).format('h:mma D MMMM, YYYY')}>{event?.created && `Created ${dayjs.unix(event?.created).fromNow()}`}</EventDate>
|
<EventDate isLoading={isLoading} title={event?.created && dayjs.unix(event?.created).format('D MMMM, YYYY')}>{event?.created && `Created ${dayjs.unix(event?.created).fromNow()}`}</EventDate>
|
||||||
<ShareInfo
|
<ShareInfo
|
||||||
onClick={() => navigator.clipboard?.writeText(`https://crab.fit/${id}`)
|
onClick={() => navigator.clipboard?.writeText(`https://crab.fit/${id}`)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue