• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

geosolutions-it / MapStore2 / 18371528919

09 Oct 2025 09:16AM UTC coverage: 76.738% (-0.05%) from 76.789%
18371528919

Pull #11572

github

web-flow
Merge 62e9c9670 into 2686c544e
Pull Request #11572: Feat: #11527 Add the tabbed view for the dashboard

31855 of 49574 branches covered (64.26%)

94 of 155 new or added lines in 10 files covered. (60.65%)

3 existing lines in 2 files now uncovered.

39633 of 51647 relevant lines covered (76.74%)

37.71 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.19
/web/client/components/dashboard/hooks/useCheckScroll.js
1
import { useEffect, useRef, useState } from "react";
2

3
export default function useCheckScroll({ data }) {
4
    const scrollRef = useRef(null);
3✔
5
    const [isLeftDisabled, setIsLeftDisabled] = useState(true);
3✔
6
    const [isRightDisabled, setIsRightDisabled] = useState(true);
3✔
7
    const [showButtons, setShowButtons] = useState(false);
3✔
8

9
    useEffect(() => {
3✔
10
        const handleScroll = () => {
3✔
11
            const el = scrollRef.current;
3✔
12
            if (!el) return;
3!
13

14
            const { scrollLeft, scrollWidth, clientWidth } = el;
3✔
15

16
            // Show buttons only if scrolling is possible
17
            const canScroll = scrollWidth > clientWidth + 1;
3✔
18
            setShowButtons(canScroll);
3✔
19

20
            // Disable states for buttons
21
            setIsLeftDisabled(scrollLeft <= 0);
3✔
22
            setIsRightDisabled(scrollLeft + clientWidth >= scrollWidth - 1);
3✔
23
        };
24

25
        const el = scrollRef.current;
3✔
26
        if (el) {
3!
27
            handleScroll(); // initial
3✔
28
            el.addEventListener("scroll", handleScroll);
3✔
29
            window.addEventListener("resize", handleScroll);
3✔
30
        }
31

32
        return () => {
3✔
33
            el?.removeEventListener("scroll", handleScroll);
3✔
34
            window.removeEventListener("resize", handleScroll);
3✔
35
        };
36
    }, [data]);
37

38
    const scroll = (direction) => {
3✔
NEW
39
        const el = scrollRef.current;
×
NEW
40
        if (!el) return;
×
NEW
41
        const scrollAmount = el.clientWidth * 0.8;
×
NEW
42
        el.scrollBy({
×
43
            left: direction === "left" ? -scrollAmount : scrollAmount,
×
44
            behavior: "smooth"
45
        });
46
    };
47

48
    return [scrollRef, showButtons, isLeftDisabled, isRightDisabled, scroll];
3✔
49
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc