MCPcopy
hub / github.com/refinedev/refine / RaffleHandler

Function RaffleHandler

packages/devtools-ui/src/components/raffle-handler.tsx:9–110  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7const CALENDLY_URL = "#";
8
9export const RaffleHandler = () => {
10 const [ran, setRan] = React.useState(false);
11 const [calendlyURL, setCalendlyURL] = React.useState("");
12 const [raffleModal, setRaffleModal] = React.useState(false);
13
14 const submitRaffle = React.useCallback(async () => {
15 const response = await raffle();
16
17 if (response.raffle) {
18 setCalendlyURL(response.calendlyURL);
19 setRaffleModal(true);
20 } else {
21 setRaffleModal(false);
22 }
23 }, []);
24
25 const onCloseModal = React.useCallback(() => {
26 acknowledgeRaffle();
27 setRaffleModal(false);
28 }, []);
29
30 React.useEffect(() => {
31 const time = 60 * 1000 * (ran ? 5 : 0.5);
32
33 const interval = setInterval(() => {
34 submitRaffle();
35 if (!ran) {
36 setRan(true);
37 }
38 }, time);
39
40 return () => {
41 clearInterval(interval);
42 };
43 }, [ran]);
44
45 return (
46 <Modal
47 overlay
48 visible={raffleModal}
49 onClose={onCloseModal}
50 header={
51 <div className={clsx("re-flex")}>
52 <h1
53 className={clsx(
54 "re-text-gray-300",
55 "re-font-semibold",
56 "re-text-lg",
57 )}
58 >
59 {"Let's chat!"}
60 </h1>
61 </div>
62 }
63 >
64 <div className={clsx("re-p-5", "re-flex", "re-flex-col", "re-gap-5")}>
65 <img
66 src="https://refine.ams3.cdn.digitaloceanspaces.com/devtools/refine-swag.webp"

Callers

nothing calls this directly

Calls 3

raffleFunction · 0.90
acknowledgeRaffleFunction · 0.90
clsxFunction · 0.50

Tested by

no test coverage detected