diff --git a/src/components/Game/lib/Scene.tsx b/src/components/Game/lib/Scene.tsx index 5b41317..cdcf5a4 100644 --- a/src/components/Game/lib/Scene.tsx +++ b/src/components/Game/lib/Scene.tsx @@ -1,6 +1,14 @@ import React from 'react'; import { Scene } from '../types/scene'; +const GoToNextScene = () => { + return ( +

+ แตะเพื่อไปต่อ +

+ ); +}; + const GameScene: Scene = { Game01: { bg: '1', @@ -18,20 +26,32 @@ const GameScene: Scene = { Game02: { bg: '2', message: ( -

เบื้องหน้าคุณคือจอโฮโลแกรมสว่างวาบ

+
+

เบื้องหน้าคุณคือจอโฮโลแกรมสว่างวาบ

+ +
), choices: [], goto: 'Game03', }, Game03: { bg: '3', - message:

กำลังเชื่อมต่อระบบ

, + message: ( +
+

กำลังเชื่อมต่อระบบ

+ +
+ ), choices: [], goto: 'Game04', }, Game04: { bg: '4', - message: <>, + message: ( +
+ +
+ ), choices: [], goto: 'Game05', }, @@ -42,6 +62,7 @@ const GameScene: Scene = { อีกไม่กี่อึดใจข้างหน้า
ยานบินลำนี้จะพาคุณท่องเอกภพอันไร้พรมแดน +

), choices: [], @@ -69,6 +90,7 @@ const GameScene: Scene = { ต้องเป็นอย่างนั้นอยู่แล้ว
คุณทุ่มแรงกับภารกิจนี้ไปไม่น้อย +

), choices: [], @@ -99,13 +121,23 @@ const GameScene: Scene = { }, Game09: { bg: '4', - message:

เอาล่ะ ใกล้ได้เวลาออกเดินทางแล้ว

, + message: ( +
+

เอาล่ะ ใกล้ได้เวลาออกเดินทางแล้ว

+ +
+ ), choices: [], goto: 'Game10', }, Game10: { bg: '4', - message:

จริงสิ คุณพกไอนั่นมาด้วย

, + message: ( +
+

จริงสิ คุณพกไอนั่นมาด้วย

+ +
+ ), choices: [], goto: 'Game11', }, @@ -127,43 +159,68 @@ const GameScene: Scene = { }, Game12: { bg: '4', - message:

ได้เวลาแล้ว

, + message: ( +
+

ได้เวลาแล้ว

+ +
+ ), choices: [], goto: 'Game13', }, Game13: { bg: '4', message: ( -

- ออกเดินทางในอีก -
- 3.. 2.. 1.. -

+
+

+ ออกเดินทางในอีก +
+ 3.. 2.. 1.. +

+ +
), choices: [], goto: 'Game14', }, Game14: { bg: '4', - message:

, + message: ( +
+ +
+ ), choices: [], goto: 'Game15', }, Game15: { bg: '15', - message:

คุณหลุดจากชั้นบรรยากาศโลกแล้ว

, + message: ( +
+

คุณหลุดจากชั้นบรรยากาศโลกแล้ว

+ +
+ ), choices: [], goto: 'Game16', }, Game16: { bg: '15', - message:

, + message: ( +
+ +
+ ), choices: [], goto: 'Game17', }, Game17: { bg: '17', - message:

, + message: ( +
+ +
+ ), choices: [], goto: 'Game18', }, @@ -186,50 +243,77 @@ const GameScene: Scene = { }, Game19: { bg: '19', - message:

โหมดการบินอัตโนมัติทำงาน

, + message: ( +
+

โหมดการบินอัตโนมัติทำงาน

+ +
+ ), choices: [], goto: 'Game20', }, Game20: { bg: '19', - message:

, + message: ( +
+ +
+ ), choices: [], goto: 'Game21', }, Game21: { bg: '21', - message:

, + message: ( +
+ +
+ ), choices: [], goto: 'Game22', }, Game22: { bg: '21', message: ( -

- บางอย่างผิดปกติ -
- คุณรีบปรี่เข้าไปหน้าแผงควบคุมทันที -

+
+

+ บางอย่างผิดปกติ +
+ คุณรีบปรี่เข้าไปหน้าแผงควบคุมทันที +

+ +
), choices: [], goto: 'Game23', }, Game23: { bg: '21', - message:

, + message: ( +
+ +
+ ), choices: [], goto: 'Game24', }, Game24: { bg: '24', - message:

, + message: ( +
+ +
+ ), choices: [], goto: 'Game25', }, Game25: { bg: '25', message: ( -

คุณรอดพ้นอุปสรรคครั้งใหญ่นั้นมาได้

+
+

คุณรอดพ้นอุปสรรคครั้งใหญ่นั้นมาได้

+ +
), choices: [], goto: 'Game26', @@ -237,13 +321,16 @@ const GameScene: Scene = { Game26: { bg: '15', message: ( -

- แต่ก็ชักจะไม่แน่ใจแล้วว่า -
- ทางข้างหน้าคือทางเดียวกับ -
- ที่คุณและทีมได้วางแผนไว้ -

+
+

+ แต่ก็ชักจะไม่แน่ใจแล้วว่า +
+ ทางข้างหน้าคือทางเดียวกับ +
+ ที่คุณและทีมได้วางแผนไว้ +

+ +
), choices: [], goto: 'Game27', @@ -268,11 +355,14 @@ const GameScene: Scene = { Game28: { bg: '15', message: ( -

- คุณวางมือที่ชื้นเหงื่อลงบนแผงควบคุม -
- รอบขมับเต้นตุบ ๆ จากความเครียด -

+
+

+ คุณวางมือที่ชื้นเหงื่อลงบนแผงควบคุม +
+ รอบขมับเต้นตุบ ๆ จากความเครียด +

+ +
), choices: [], goto: 'Game29', @@ -280,18 +370,25 @@ const GameScene: Scene = { Game29: { bg: '29', message: ( -

- ยังไม่ทันจะได้หายใจทั่วท้อง -
- แสงบางอย่างก็ปรากฎหน้ายานของคุณ -

+
+

+ ยังไม่ทันจะได้หายใจทั่วท้อง +
+ แสงบางอย่างก็ปรากฎหน้ายานของคุณ +

+ +
), choices: [], goto: 'Game30', }, Game30: { bg: '30', - message:

, + message: ( +
+ +
+ ), choices: [], goto: 'Game31', }, @@ -313,7 +410,10 @@ const GameScene: Scene = { Game32: { bg: '32', message: ( -

วินาทีนั้น แสงก็พุ่งมาอยู่ตรงหน้า

+
+

วินาทีนั้น แสงก็พุ่งมาอยู่ตรงหน้า

+ +
), choices: [], goto: 'Game33', @@ -321,18 +421,25 @@ const GameScene: Scene = { Game33: { bg: '33', message: ( -

- คุณจึงได้รู้ว่ามันคือ -
- สัญญาณขอความช่วยเหลือของยานอีกลํา -

+
+

+ คุณจึงได้รู้ว่ามันคือ +
+ สัญญาณขอความช่วยเหลือของยานอีกลํา +

+ +
), choices: [], goto: 'Game34', }, Game34: { bg: '34', - message:

, + message: ( +
+ s +
+ ), choices: [], goto: 'Game36', }, @@ -340,11 +447,14 @@ const GameScene: Scene = { Game36: { bg: '34', message: ( -

- คุณตัดสินใจอยู่ช่วยพวกเขาจนถึงที่สุด -
- กระทั่งทุกอย่างผ่านพ้นด้วยดี -

+
+

+ คุณตัดสินใจอยู่ช่วยพวกเขาจนถึงที่สุด +
+ กระทั่งทุกอย่างผ่านพ้นด้วยดี +

+ +
), choices: [], goto: 'Game37', @@ -352,24 +462,27 @@ const GameScene: Scene = { Game37: { bg: '37', message: ( -

- พวกเขาจึงเสนอมอบบัตรเชิญร่วมงาน -
- “Freshmen night” -
- แก่คุณเป็นการตอบแทน -
- เป็นงานสุดยิ่งใหญ่อลังการ -
- ที่เปิดโอกาสให้นักท่องอวกาศทุกคนในสถาบัน -
- ไม่จำกัดฝ่าย ได้ร่วมสนุกและเพลิดเพลินไปกับ -
- คํ่าคืนที่งานรับเพื่อนก้าวใหม่จะมอบให้พวกคุณ -
- ในวันที่ 6 สิงหาคม พ.ศ.2566 ที่จะถึงนี้ -
-

+
+

+ พวกเขาจึงเสนอมอบบัตรเชิญร่วมงาน +
+ “Freshmen night” +
+ แก่คุณเป็นการตอบแทน +
+ เป็นงานสุดยิ่งใหญ่อลังการ +
+ ที่เปิดโอกาสให้นักท่องอวกาศทุกคนในสถาบัน +
+ ไม่จำกัดฝ่าย ได้ร่วมสนุกและเพลิดเพลินไปกับ +
+ คํ่าคืนที่งานรับเพื่อนก้าวใหม่จะมอบให้พวกคุณ +
+ ในวันที่ 6 สิงหาคม พ.ศ.2566 ที่จะถึงนี้ +
+

+ +
), choices: [], goto: 'Game38', @@ -393,19 +506,33 @@ const GameScene: Scene = { }, Game39: { bg: '34', - message:

, + message: ( +
+ +
+ ), choices: [], goto: 'Game40', }, Game40: { bg: '19', - message:

โหมดการบินอัตโนมัติทำงาน

, + message: ( +
+

โหมดการบินอัตโนมัติทำงาน

+ +
+ ), choices: [], goto: 'Game41', }, Game41: { bg: '19', - message:

จบเรื่องวุ่น ๆ สักที

, + message: ( +
+

จบเรื่องวุ่น ๆ สักที

+ +
+ ), choices: [], goto: 'Game42', }, @@ -436,13 +563,22 @@ const GameScene: Scene = { }, Game43: { bg: '19', - message:

ได้เวลาปฏิบัติงาน

, + message: ( +
+

ได้เวลาปฏิบัติงาน

+ +
+ ), choices: [], goto: 'Game44', }, Game44: { bg: '19', - message:

, + message: ( +
+ +
+ ), choices: [], goto: 'Game45', }, @@ -474,11 +610,14 @@ const GameScene: Scene = { Game46: { bg: '19', message: ( -

- จังหวะนั้นเอง -
- คุณเพิ่งสังเกตเห็นจุดแปลกปลอมนอกหน้าต่าง -

+
+

+ จังหวะนั้นเอง +
+ คุณเพิ่งสังเกตเห็นจุดแปลกปลอมนอกหน้าต่าง +

+ +
), choices: [], goto: 'Game47', @@ -486,30 +625,46 @@ const GameScene: Scene = { Game47: { bg: '19', message: ( -

- พร้อม ๆ กับแจ้งเตือนสำคัญ -
- ที่ผุดขึ้นมาบนหน้าจอโฮโลแกรม -

+
+

+ พร้อม ๆ กับแจ้งเตือนสำคัญ +
+ ที่ผุดขึ้นมาบนหน้าจอโฮโลแกรม +

+ +
), choices: [], goto: 'Game48', }, Game48: { bg: '48', - message:

, + message: ( +
+ +
+ ), choices: [], goto: 'Game49', }, Game49: { bg: '48', - message:

ดาวของคุณถูกค้นพบแล้ว

, + message: ( +
+

ดาวของคุณถูกค้นพบแล้ว

+ +
+ ), choices: [], goto: 'Game50', }, Game50: { bg: 'null', - message:

, + message: ( +
+ +
+ ), choices: [], goto: '', }, diff --git a/src/pages/staff.tsx b/src/pages/staff.tsx index 2f4dd7b..cb98312 100644 --- a/src/pages/staff.tsx +++ b/src/pages/staff.tsx @@ -6,12 +6,38 @@ import { useRouter } from 'next/router'; import { useAuth } from '@/context/AuthContext'; import Link from 'next/link'; import NotAllowed from '@/components/NotAllowed'; +import { useToast } from '@/components/Toast'; +import { httpPost } from '@/utils/axios'; +import Button from '@/components/WalkRally/Home/components/Button'; function Scan() { const { isAuthenticated, isReady, user } = useAuth(); const [data, setData] = useState(null); const [isScanned, setIsScanned] = useState(false); const router = useRouter(); + const toast = useToast(); + + const [canAccess, setCanAccess] = useState(false); + const [password, setPassword] = useState(''); + + const handleSavePassword = () => { + if (password === 'lmao123456-thee') { + localStorage.setItem('access', 'true'); + setCanAccess(true); + toast?.setToast('success', 'Logged in successfully'); + } else { + toast?.setToast('error', 'Wrong password'); + } + }; + + useEffect(() => { + const access = localStorage.getItem('access'); + if (access === 'true') { + setCanAccess(true); + } else { + setCanAccess(false); + } + }, []); const handleScanResult = (token: any, error: any) => { if (token) { @@ -22,9 +48,23 @@ function Scan() { } }; + const checkIn = async (token: string) => { + const { status } = await httpPost( + '/staff/checkin_freshy_night/' + token, + {} + ); + if (status === 200) { + toast?.setToast('success', 'Checked in successfully'); + } else if (status === 400) { + toast?.setToast('error', 'Bad request'); + } else if (status === 401) { + toast?.setToast('error', 'Unauthorized'); + } + }; + useEffect(() => { if (data && !isScanned) { - //Call api + checkIn(data); setIsScanned(true); setData(null); } @@ -33,6 +73,30 @@ function Scan() { if (!isAuthenticated || !isReady || user?.studentID.startsWith('66')) return ; + if (!canAccess) { + return ( +
+
+

Login for Staff

+
+ setPassword(e.target.value)} + placeholder="Password" + className="w-full rounded-lg border border-black px-4 py-2 outline-none" + /> + +
+
+
+ ); + } + return (