idk what i changed
This commit is contained in:
+6
-4
@@ -13,8 +13,8 @@ import "./App.css";
|
|||||||
export default function Homepage() {
|
export default function Homepage() {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const dialogRef = useRef(null);
|
const dialogRef = useRef<HTMLDialogElement>(null);
|
||||||
const blockbusterButtonRef = useRef(null);
|
const blockbusterButtonRef = useRef<HTMLButtonElement>(null);
|
||||||
|
|
||||||
const isTouchDevice = () =>
|
const isTouchDevice = () =>
|
||||||
"ontouchstart" in window || navigator.maxTouchPoints > 0;
|
"ontouchstart" in window || navigator.maxTouchPoints > 0;
|
||||||
@@ -28,11 +28,12 @@ export default function Homepage() {
|
|||||||
const [showDeclineQ, setShowDeclineQ] = useState(false);
|
const [showDeclineQ, setShowDeclineQ] = useState(false);
|
||||||
|
|
||||||
const openPopup = () => {
|
const openPopup = () => {
|
||||||
dialogRef.current.showModal();
|
dialogRef.current?.showModal();
|
||||||
|
|
||||||
// Wait for layout to settle
|
// Wait for layout to settle
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
const button = blockbusterButtonRef.current;
|
const button = blockbusterButtonRef.current;
|
||||||
|
if (!button) return;
|
||||||
const rect = button.getBoundingClientRect();
|
const rect = button.getBoundingClientRect();
|
||||||
|
|
||||||
button.style.left = `${rect.left}px`;
|
button.style.left = `${rect.left}px`;
|
||||||
@@ -45,6 +46,7 @@ export default function Homepage() {
|
|||||||
* ------------------------------------------------------------------ */
|
* ------------------------------------------------------------------ */
|
||||||
const moveButton = () => {
|
const moveButton = () => {
|
||||||
const button = blockbusterButtonRef.current;
|
const button = blockbusterButtonRef.current;
|
||||||
|
if (!button) return;
|
||||||
|
|
||||||
const buttonRect = button.getBoundingClientRect();
|
const buttonRect = button.getBoundingClientRect();
|
||||||
|
|
||||||
@@ -61,7 +63,7 @@ export default function Homepage() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const handleRunawayPress = (event) => {
|
const handleRunawayPress = (event: React.MouseEvent<HTMLButtonElement> | React.TouchEvent<HTMLButtonElement>) => {
|
||||||
if (isTouchDevice()) {
|
if (isTouchDevice()) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|||||||
Reference in New Issue
Block a user