Skip to content

Commit

Permalink
Fix advance buttons showing up for the spotlight speaker
Browse files Browse the repository at this point in the history
  • Loading branch information
robintown committed Jun 7, 2024
1 parent c2f33a2 commit 78a9e85
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/tile/SpotlightTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,9 @@ export const SpotlightTile = forwardRef<HTMLDivElement, Props>(
const [visibleId, setVisibleId] = useState(vms[0].id);
const latestVms = useLatest(vms);
const latestVisibleId = useLatest(visibleId);
const canGoBack = visibleId !== vms[0].id;
const canGoToNext = visibleId !== vms[vms.length - 1].id;
const visibleIndex = vms.findIndex((vm) => vm.id === visibleId);
const canGoBack = visibleIndex > 0;
const canGoToNext = visibleIndex !== -1 && visibleIndex < vms.length - 1;

// To keep track of which item is visible, we need an intersection observer
// hooked up to the root element and the items. Because the items will run
Expand Down

0 comments on commit 78a9e85

Please sign in to comment.