import React from 'react'; import { Just } from 'folktale/maybe'; import { useHistory } from 'store/history'; import { usePointCursor } from 'store/pointCursor'; import Point from 'lib/types/Point'; import { Grid, Flex } from 'indigo-react'; import Passport from 'components/Passport'; import PermissionIndicator from './PermissionIndicator'; interface PointListProps { points: Point[]; className?: string; actions?: (point: Point, i: number) => React.Component; locked?: boolean; processing?: boolean; } const PointList: React.FC = function({ points, className, actions, locked = false, processing = false, ...rest }) { const { setPointCursor }: any = usePointCursor(); const { push, names }: any = useHistory(); return ( {points.map((point, i) => ( { setPointCursor(Just(point.value)); push(names.POINT); } } {...rest} /> {actions && ( {actions(point, i)} )} {!locked && ( )} ))} ); }; export default PointList;