{"version":3,"file":"InteractiveStars-CKgAOqNX.js","sources":["../../../app/javascript/components/BookReview/InteractiveStars.tsx"],"sourcesContent":["import { useRef, useState } from \"react\";\nimport { StarIcon } from \"@heroicons/react/solid\";\nimport classNames from \"lib/classNames\";\n// import useIsLoggedIn from \"hooks/user/useIsLoggedIn\";\n\nexport interface UserBookRatingProps {\n rating?: number;\n onRatingChanged?: any;\n onRatingHoverChange?: any;\n size?: number;\n}\n\nexport default function InteractiveStars(props: UserBookRatingProps) {\n const {\n rating = null,\n onRatingChanged,\n onRatingHoverChange,\n size = 6,\n } = props;\n const [hoverRating, setHoverRating] = useState(0);\n // const isLoggedIn = useIsLoggedIn();\n const halfSize = size / 2;\n\n // let party;\n // if (\n // isLoggedIn &&\n // onRatingChanged &&\n // typeof window !== \"undefined\" &&\n // typeof document !== \"undefined\"\n // ) {\n // // eslint-disable-next-line global-require\n // party = require(\"party-js\");\n // }\n const starsRef = useRef();\n\n const starClicked = (newRating) => {\n // if (party && newRating === 5) {\n // party.default.sparkles(starsRef.current, {\n // count: party.default.variation.range(20, 30),\n // speed: party.default.variation.range(50, 150),\n // size: party.default.variation.range(0.5, 1.5),\n // });\n // }\n if (onRatingChanged) {\n onRatingChanged(newRating);\n }\n if (onRatingHoverChange) {\n onRatingHoverChange(newRating);\n }\n };\n\n const onHover = (stars) => {\n if (onRatingChanged) {\n setHoverRating(stars);\n }\n if (onRatingHoverChange) {\n onRatingHoverChange(stars);\n }\n };\n\n return (\n