From 42378defdcbd5a76e4edce32dc1df01f8725823d Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Mon, 6 Feb 2023 15:25:28 +0100 Subject: [PATCH] fix(ui) - auto play safari issue --- .../Session_/QueueControls/QueueControls.tsx | 82 ++++++++++--------- 1 file changed, 44 insertions(+), 38 deletions(-) diff --git a/frontend/app/components/Session_/QueueControls/QueueControls.tsx b/frontend/app/components/Session_/QueueControls/QueueControls.tsx index cbb49d02d..cfb2f7a0c 100644 --- a/frontend/app/components/Session_/QueueControls/QueueControls.tsx +++ b/frontend/app/components/Session_/QueueControls/QueueControls.tsx @@ -1,8 +1,8 @@ import React, { useEffect } from 'react'; import { connect } from 'react-redux'; import { setAutoplayValues } from 'Duck/sessions'; -import { session as sessionRoute } from 'App/routes'; -import { Link, Icon, Tooltip } from 'UI';; +import { withSiteId, session as sessionRoute } from 'App/routes'; +import { Link, Icon, Tooltip } from 'UI'; import { withRouter, RouteComponentProps } from 'react-router-dom'; import cn from 'classnames'; import { fetchAutoplaySessions } from 'Duck/search'; @@ -10,18 +10,20 @@ import { fetchAutoplaySessions } from 'Duck/search'; const PER_PAGE = 10; interface Props extends RouteComponentProps { + siteId: string; previousId: string; nextId: string; defaultList: any; currentPage: number; total: number; - setAutoplayValues?: () => void; + setAutoplayValues: () => void; latestRequestTime: any; sessionIds: any; - fetchAutoplaySessions?: (page: number) => Promise; + fetchAutoplaySessions: (page: number) => Promise; } function QueueControls(props: Props) { const { + siteId, previousId, nextId, currentPage, @@ -49,43 +51,46 @@ function QueueControls(props: Props) { } }, []); + const nextHandler = () => { + props.history.push(withSiteId(sessionRoute(nextId), siteId)); + }; + + const prevHandler = () => { + props.history.push(withSiteId(sessionRoute(previousId), siteId)); + }; + return (
- Play Previous Session
} - disabled={!previousId} +
- -
- -
- - - - Play Next Session
} - disabled={!nextId} + Play Previous Session} + disabled={!previousId} + > + + + +
- -
- -
- - + Play Next Session
} + disabled={!nextId} + > + + + ); } @@ -98,6 +103,7 @@ export default connect( total: state.getIn(['sessions', 'total']) || 0, sessionIds: state.getIn(['sessions', 'sessionIds']) || [], latestRequestTime: state.getIn(['search', 'latestRequestTime']), + siteId: state.getIn(['site', 'siteId']), }), { setAutoplayValues, fetchAutoplaySessions } -)(withRouter(QueueControls)) +)(withRouter(QueueControls));