From ee5121ce7a28807f52f40de6cea29485f4ce9b53 Mon Sep 17 00:00:00 2001 From: gnehs Date: Sat, 2 Mar 2024 21:14:57 +0800 Subject: [PATCH] refactor InfoWindow & Scanner --- src/app/(game)/scanner/page.tsx | 1 + src/components/InfoWindow.tsx | 39 +++++++++++++++++++++------------ 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/src/app/(game)/scanner/page.tsx b/src/app/(game)/scanner/page.tsx index 7089585..1d5e4fc 100644 --- a/src/app/(game)/scanner/page.tsx +++ b/src/app/(game)/scanner/page.tsx @@ -15,6 +15,7 @@ export default function Page() { const playerToken: string | null = useReadLocalStorage("token"); useEffect(() => { async function handleResult() { + if (showInfo) return; if (typeof result !== "string") return; let boothToken = await getBoothToken(result); setResult(null); diff --git a/src/components/InfoWindow.tsx b/src/components/InfoWindow.tsx index 66915f5..ea23dad 100644 --- a/src/components/InfoWindow.tsx +++ b/src/components/InfoWindow.tsx @@ -1,5 +1,5 @@ -import React, { useState } from "react"; - +import { motion, AnimatePresence } from "framer-motion"; +import { Info } from "lucide-react"; interface Props { title: string; msg: string; @@ -8,17 +8,28 @@ interface Props { export function InfoWindow({ title, msg, onClose }: Props) { return ( -
-
-
-
- {title} -
-

{msg}

-
-
+ + + +
{title}
+

{msg}

+ +
+
); }