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

blockcoders / kuma-wallet / ebbd3c69-fda1-4bf1-80ea-77bef87d3d87

pending completion
ebbd3c69-fda1-4bf1-80ea-77bef87d3d87

Pull #8

circleci

Ruben
fix tests
Pull Request #8: Milestone 2

876 of 1103 branches covered (79.42%)

Branch coverage included in aggregate %.

3452 of 3452 new or added lines in 44 files covered. (100.0%)

6647 of 7185 relevant lines covered (92.51%)

6.69 hits per line

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

96.49
/src/hooks/common/useCopyToClipboard.tsx
1
import { useState, useCallback } from "react";
2✔
2
import { FiCopy } from "react-icons/fi";
2✔
3
import { useTranslation } from "react-i18next";
2✔
4
import { IconBaseProps } from "react-icons";
2✔
5

2✔
6
interface IconProps {
2✔
7
  iconProps?: IconBaseProps;
2✔
8
  messagePosition?: "left" | "right";
2✔
9
  messageTopSeparation?: number;
2✔
10
}
2✔
11

2✔
12
export const useCopyToClipboard = (textToCopy: string) => {
2✔
13
  const { t } = useTranslation("common");
26✔
14
  const [isOpen, setIsOpen] = useState(false);
26✔
15

26✔
16
  const copyToClipboard = useCallback(async () => {
26✔
17
    setIsOpen(true);
2✔
18
    await navigator.clipboard.writeText(textToCopy);
2✔
19
    setTimeout(() => {
2✔
20
      setIsOpen(false);
×
21
    }, 1000);
2✔
22
  }, [textToCopy]);
26✔
23

26✔
24
  const Icon = ({
26✔
25
    iconProps,
14✔
26
    messagePosition = "left",
14✔
27
    messageTopSeparation = 16,
14✔
28
  }: IconProps) => (
14✔
29
    <div className="relative">
14✔
30
      <FiCopy {...iconProps} />
14✔
31
      {isOpen && (
14✔
32
        <div
2✔
33
          style={{
2✔
34
            position: "absolute",
2✔
35
            top: messageTopSeparation,
2✔
36
            ...(messagePosition === "left" ? { left: 0 } : { right: 0 }),
2!
37
            zIndex: 10,
2✔
38
          }}
2✔
39
          className="border border-[#343A40] rounded-xl p-2 bg-black bg-opacity-70 text-sm"
2✔
40
        >
2✔
41
          {t("copied")}
2✔
42
        </div>
2✔
43
      )}
14✔
44
    </div>
14✔
45
  );
26✔
46

26✔
47
  return {
26✔
48
    Icon,
26✔
49
    copyToClipboard,
26✔
50
  };
26✔
51
};
26✔
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

© 2025 Coveralls, Inc