import React from "react";
import { useDispatch, useSelector } from "../../store/redux-separate-context";
import { selectDefaultAfter } from "../../domains/global/selectors";
import { resetGlobalPanAndZoomAction, setDefaultAfterAction } from "../../domains/global/actions";
import { TimeBtn } from "./timebtn";
import { ButtonGroup } from "./styled";
import { timeSlices } from "./constants";
export const TimeGroup = () => {
    const dispatch = useDispatch();
    const selectedGap = useSelector(selectDefaultAfter);
    const setSelected = (gap, timeOffset) => {
        dispatch(resetGlobalPanAndZoomAction());
        dispatch(setDefaultAfterAction({
            after: timeOffset,
        }));
    };
    return (React.createElement(React.Fragment, null,
        React.createElement(ButtonGroup, null,
            "Last\u00A0",
            timeSlices.map(({ text, timeGap }) => (React.createElement(TimeBtn, { key: text, gap: timeGap, isSelected: selectedGap === timeGap, setTimeOffset: setSelected }, text))))));
};
//# sourceMappingURL=time-group.js.map