ui: fix q controls
This commit is contained in:
parent
18ee36832b
commit
fa723ebc87
3 changed files with 28 additions and 17 deletions
|
|
@ -27,23 +27,22 @@ function QueueControls(props: Props) {
|
||||||
const {
|
const {
|
||||||
match: {
|
match: {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
params: { sessionId }
|
params: { sessionId },
|
||||||
}
|
},
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const currentPage = searchStore.currentPage;
|
const currentPage = searchStore.currentPage;
|
||||||
const latestRequestTime = searchStore.latestRequestTime;
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (latestRequestTime) {
|
setAutoplayValues();
|
||||||
setAutoplayValues();
|
const totalPages = Math.ceil(total / PER_PAGE);
|
||||||
const totalPages = Math.ceil(total / PER_PAGE);
|
const index = sessionIds.indexOf(sessionId);
|
||||||
const index = sessionIds.indexOf(sessionId);
|
|
||||||
|
|
||||||
// check for the last page and load the next
|
// check for the last page and load the next
|
||||||
if (currentPage !== totalPages && index === sessionIds.length - 1) {
|
if (currentPage !== totalPages && index === sessionIds.length - 1) {
|
||||||
searchStore.fetchAutoplaySessions(currentPage + 1).then(setAutoplayValues);
|
searchStore
|
||||||
}
|
.fetchAutoplaySessions(currentPage + 1)
|
||||||
|
.then(setAutoplayValues);
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|
@ -63,15 +62,22 @@ function QueueControls(props: Props) {
|
||||||
onClick={prevHandler}
|
onClick={prevHandler}
|
||||||
className={cn('p-1 group rounded-full', {
|
className={cn('p-1 group rounded-full', {
|
||||||
'pointer-events-none opacity-50': !previousId,
|
'pointer-events-none opacity-50': !previousId,
|
||||||
'cursor-pointer': !!previousId
|
'cursor-pointer': !!previousId,
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
<Popover
|
<Popover
|
||||||
placement="bottom"
|
placement="bottom"
|
||||||
content={<div className="whitespace-nowrap">Play Previous Session</div>}
|
content={
|
||||||
|
<div className="whitespace-nowrap">Play Previous Session</div>
|
||||||
|
}
|
||||||
open={previousId ? undefined : false}
|
open={previousId ? undefined : false}
|
||||||
>
|
>
|
||||||
<Button size={'small'} shape={'circle'} disabled={!previousId} className={'flex items-center justify-center'}>
|
<Button
|
||||||
|
size={'small'}
|
||||||
|
shape={'circle'}
|
||||||
|
disabled={!previousId}
|
||||||
|
className={'flex items-center justify-center'}
|
||||||
|
>
|
||||||
<LeftOutlined />
|
<LeftOutlined />
|
||||||
</Button>
|
</Button>
|
||||||
</Popover>
|
</Popover>
|
||||||
|
|
@ -81,7 +87,7 @@ function QueueControls(props: Props) {
|
||||||
onClick={nextHandler}
|
onClick={nextHandler}
|
||||||
className={cn('p-1 group ml-1 rounded-full', {
|
className={cn('p-1 group ml-1 rounded-full', {
|
||||||
'pointer-events-none opacity-50': !nextId,
|
'pointer-events-none opacity-50': !nextId,
|
||||||
'cursor-pointer': !!nextId
|
'cursor-pointer': !!nextId,
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
<Popover
|
<Popover
|
||||||
|
|
@ -89,7 +95,12 @@ function QueueControls(props: Props) {
|
||||||
content={<div className="whitespace-nowrap">Play Next Session</div>}
|
content={<div className="whitespace-nowrap">Play Next Session</div>}
|
||||||
open={nextId ? undefined : false}
|
open={nextId ? undefined : false}
|
||||||
>
|
>
|
||||||
<Button size={'small'} shape={'circle'} disabled={!nextId} className={'flex items-center justify-center'}>
|
<Button
|
||||||
|
size={'small'}
|
||||||
|
shape={'circle'}
|
||||||
|
disabled={!nextId}
|
||||||
|
className={'flex items-center justify-center'}
|
||||||
|
>
|
||||||
<RightOutlined />
|
<RightOutlined />
|
||||||
</Button>
|
</Button>
|
||||||
</Popover>
|
</Popover>
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -1 +1 @@
|
||||||
nodeLinker: pnpm
|
nodeLinker: node-modules
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue