/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ // eslint-disable-next-line no-unused-vars import React from "react"; import { actionCreators as ac, actionTypes as at } from "common/Actions.mjs"; const USER_ACTION_TYPES = { CHANGE_LIVE_MATCH: "change_live_match", }; // Arrow icons are mirrored under RTL via :dir(rtl) CSS. function LivePagination({ dispatch, liveIndex, liveCount, size, widgetSize, handleInteraction, }) { const buttonSize = size === "medium" ? "small" : undefined; const goTo = nextIndex => { if (nextIndex === liveIndex) { return; } dispatch( ac.OnlyToMain({ type: at.WIDGETS_USER_EVENT, data: { widget_name: "sports", widget_source: "widget", user_action: USER_ACTION_TYPES.CHANGE_LIVE_MATCH, action_value: String(nextIndex + 1), widget_size: widgetSize, }, }) ); dispatch( ac.AlsoToMain({ type: at.WIDGETS_SPORTS_CHANGE_LIVE_INDEX, data: nextIndex, }) ); handleInteraction(); }; const goPrev = () => goTo((liveIndex - 1 + liveCount) % liveCount); const goNext = () => goTo((liveIndex + 1) % liveCount); return (