-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
120 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import Head from "next/head"; | ||
|
||
import "../globals.css"; | ||
|
||
export default function RootLayout({ | ||
children, | ||
}: Readonly<{ | ||
children: React.ReactNode; | ||
}>) { | ||
return ( | ||
<html lang="zh-TW"> | ||
<Head> | ||
<link rel="preconnect" href="https://fonts.googleapis.com" /> | ||
<link | ||
rel="preconnect" | ||
href="https://fonts.gstatic.com" | ||
crossOrigin="" | ||
/> | ||
<link | ||
href="https://fonts.googleapis.com/css2?family=Lato:wght@400;700&family=Noto+Sans+TC:wght@400;700&family=Roboto+Mono:ital,wght@0,100..700;1,100..700&display=swap" | ||
rel="stylesheet" | ||
/> | ||
</Head> | ||
<body className="flex min-h-screen w-screen flex-col bg-sitcon-color8 font-sans"> | ||
{children} | ||
</body> | ||
</html> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
"use client"; | ||
import { useState, useEffect } from "react"; | ||
import { motion, AnimatePresence } from "framer-motion"; | ||
export default function Page() { | ||
const [token, setToken] = useState(""); | ||
const [copied, setCopied] = useState(false); | ||
useEffect(() => { | ||
if (typeof window !== "undefined") { | ||
setToken(new URLSearchParams(window.location.search).get("token")!); | ||
} | ||
}, []); | ||
function copy() { | ||
if (typeof window !== "undefined") { | ||
navigator.clipboard.writeText(token); | ||
} else { | ||
console.error("window is undefined"); | ||
prompt("請複製以下代碼", token); | ||
} | ||
setCopied(true); | ||
setTimeout(() => { | ||
setCopied(false); | ||
}, 500); | ||
} | ||
return ( | ||
<div className="mx-auto w-full max-w-[512px] px-2 py-10"> | ||
<h1 className="text-center text-4xl font-bold"> | ||
你找到了拼圖 | ||
<span className="absolute">!</span> | ||
</h1> | ||
<div className="my-4 flex flex-wrap items-center justify-between gap-6 rounded-2xl bg-gray-50 p-4 pl-6 text-center text-6xl shadow"> | ||
<div | ||
className="grow overflow-hidden text-ellipsis p-2 text-left" | ||
style={{ | ||
fontFamily: `"Roboto Mono", monospace`, | ||
}} | ||
> | ||
{token} | ||
</div> | ||
<motion.button | ||
onClick={copy} | ||
className="mx-auto overflow-hidden rounded-2xl bg-purple-500 px-6 py-2 text-2xl font-bold text-white shadow-md" | ||
whileHover={{ scale: 1.1 }} | ||
whileTap={{ scale: 0.9 }} | ||
key={copied ? "copied" : "copy"} | ||
> | ||
{copied ? "已複製" : "複製"} | ||
</motion.button> | ||
</div> | ||
<div className="text-center text-2xl text-gray-600"> | ||
在 OPass > 大地遊戲 > 掃描器中輸入以下代碼來取得拼圖 | ||
</div> | ||
</div> | ||
); | ||
} |