From 34a643a731da3825f4bb8d119a0ce12dd952f558 Mon Sep 17 00:00:00 2001 From: Jen Jones Arnesen Date: Fri, 8 Nov 2024 14:09:28 +0100 Subject: [PATCH] chore: renaming vars --- src/modules/useFullscreen.js | 18 +++++++++--------- src/pages/view/ItemGrid.js | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/modules/useFullscreen.js b/src/modules/useFullscreen.js index bc42139a1..dbb13676a 100644 --- a/src/modules/useFullscreen.js +++ b/src/modules/useFullscreen.js @@ -7,22 +7,22 @@ import { SPACER, MESSAGES } from './itemTypes.js' const useFullscreen = (displayItems) => { const dispatch = useDispatch() - const sItems = useRef([]) + const sortedItems = useRef([]) const fsItemStartingIndex = useSelector(sGetPresentDashboard) const [fsItemIndex, setFsItemIndex] = useState(null) - const fsElement = useRef(null) + const fsElementRef = useRef(null) useEffect(() => { - const sortedItems = sortBy(displayItems, ['y', 'x']).filter( + const sItems = sortBy(displayItems, ['y', 'x']).filter( (i) => [SPACER, MESSAGES].indexOf(i.type) === -1 ) - sItems.current = sortedItems + sortedItems.current = sItems }, [displayItems]) // Handle Present button or Item Fullscreen button clicked useEffect(() => { if (Number.isInteger(fsItemStartingIndex)) { - const el = fsElement?.current + const el = fsElementRef?.current el?.requestFullscreen() setFsItemIndex(fsItemStartingIndex) } else if (document.fullscreenElement) { @@ -43,7 +43,7 @@ const useFullscreen = (displayItems) => { } const nextItem = useCallback(() => { - if (fsItemIndex === sItems.current.length - 1) { + if (fsItemIndex === sortedItems.current.length - 1) { setFsItemIndex(0) } else { setFsItemIndex(fsItemIndex + 1) @@ -52,7 +52,7 @@ const useFullscreen = (displayItems) => { const prevItem = useCallback(() => { if (fsItemIndex === 0) { - setFsItemIndex(sItems.current.length - 1) + setFsItemIndex(sortedItems.current.length - 1) } else { setFsItemIndex(fsItemIndex - 1) } @@ -93,11 +93,11 @@ const useFullscreen = (displayItems) => { return { fsItemIndex, - fsElement, + fsElementRef, exitFullscreen, nextItem, prevItem, - sortedItems: sItems.current, + sortedItems: sortedItems.current, } } diff --git a/src/pages/view/ItemGrid.js b/src/pages/view/ItemGrid.js index 17d9cb00b..cb6a2dbef 100644 --- a/src/pages/view/ItemGrid.js +++ b/src/pages/view/ItemGrid.js @@ -54,7 +54,7 @@ const ResponsiveItemGrid = () => { const { fsItemIndex, - fsElement, + fsElementRef, exitFullscreen, nextItem, prevItem, @@ -164,7 +164,7 @@ const ResponsiveItemGrid = () => { className={cx(classes.fullscreenWrapper, { [classes.isFullscreenMode]: Number.isInteger(fsItemIndex), })} - ref={fsElement} + ref={fsElementRef} >