diff --git a/src/App.tsx b/src/App.tsx
index 669cf16..0515ab9 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -1,4 +1,5 @@
import { Route, Routes } from "react-router-dom";
+import QRCodePage from "./pages/QRCodeGenerator";
import Home from "./pages/home";
import Shooter from "./pages/shooter";
import Yatai from "./pages/yatai";
@@ -10,6 +11,7 @@ const AppRoutes = () => {
} />
} />
} />
+ } />
>
);
diff --git a/src/components/QRCodeGenerator.tsx b/src/components/QRCodeGenerator.tsx
new file mode 100644
index 0000000..bc727c6
--- /dev/null
+++ b/src/components/QRCodeGenerator.tsx
@@ -0,0 +1,22 @@
+import QRCode from "qrcode.react";
+import { useLocation } from "react-router-dom";
+import { generateUUID } from "../utils/uuid";
+
+type QRCodeGeneratorProps = {
+ size?: number;
+};
+
+const QRCodeGenerator: React.FC = ({ size = 128 }) => {
+ const location = useLocation();
+ const baseUrl = `${window.location.origin}${location.pathname}`;
+ const roomId = generateUUID();
+ const url = `${baseUrl}?room_id=${roomId}`;
+
+ return (
+
+
+
+ );
+};
+
+export default QRCodeGenerator;
diff --git a/src/pages/QRCodeGenerator/index.tsx b/src/pages/QRCodeGenerator/index.tsx
new file mode 100644
index 0000000..56c9b81
--- /dev/null
+++ b/src/pages/QRCodeGenerator/index.tsx
@@ -0,0 +1,11 @@
+import QRCodeGenerator from "../../components/QRCodeGenerator";
+
+const QRCodePage: React.FC = () => {
+ return (
+
+
+
+ );
+};
+
+export default QRCodePage;
diff --git a/src/utils/queryParams.ts b/src/utils/queryParams.ts
new file mode 100644
index 0000000..457c80c
--- /dev/null
+++ b/src/utils/queryParams.ts
@@ -0,0 +1,19 @@
+export function generateQueryParams(
+ params: Record,
+): string {
+ const searchParams = new URLSearchParams();
+ // biome-ignore lint/complexity/noForEach:
+ Object.entries(params).forEach(([key, value]) => {
+ searchParams.append(key, String(value));
+ });
+ return searchParams.toString();
+}
+
+export function appendQueryParamsToUrl(
+ baseUrl: string,
+ params: Record,
+): string {
+ const queryString = generateQueryParams(params);
+ const separator = baseUrl.includes("?") ? "&" : "?";
+ return `${baseUrl}${separator}${queryString}`;
+}