Skip to content

Commit

Permalink
fix: qr scanner not update event
Browse files Browse the repository at this point in the history
  • Loading branch information
TeeGoood committed Jul 29, 2024
1 parent 2cac5c6 commit 430d7fe
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/app/(main)/staff/register/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export default function Register() {
const isRpkm =
new Date(process.env.NEXT_PUBLIC_RPKM_DAY_1 as string) < new Date();

let newPath = isRpkm ? '/rpkm/staff/home' : '/firstdate/staff/home';
const newPath = isRpkm ? '/rpkm/staff/home' : '/firstdate/staff/home';

await resetContext();
router.push(newPath);
Expand Down
2 changes: 1 addition & 1 deletion src/app/rpkm/freshy-night/confirm-register/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import { useState, ChangeEvent, useCallback } from 'react';
import { useState, ChangeEvent } from 'react';
import { useRouter } from 'next/navigation';
import { useAuth } from '@/context/AuthContext';
import { getAccessToken } from '@/utils/auth';
Expand Down
6 changes: 4 additions & 2 deletions src/app/rpkm/staff/home/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import { getCurrentTime } from '@/utils/time';
import React, { useEffect, useState } from 'react';

function Page() {
const [eventText, setEventText] = useState<string>('Onsite 3 สิงหาคม 2567');
const [event, setEvent] = useState<string>('rpkm-day-1');
const [eventText, setEventText] = useState<string>('');
const [event, setEvent] = useState<string>('');

useEffect(() => {
const checkEvent = async () => {
const currentTime = (await getCurrentTime()).currentTime;
Expand Down Expand Up @@ -41,6 +42,7 @@ function Page() {

checkEvent();
}, []);

return (
<div className="bg-[#EAE3C3]">
<div className="bg-[url('/rpkm/staff/background.svg')] w-full bg-cover bg-no-repeat">
Expand Down
3 changes: 2 additions & 1 deletion src/app/rpkm/staff/profile/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ function Page() {
>
สตาฟ
</div>
<div className="relative w-32 h-44 rounded-t-full overflow-hidden">
<div className="relative w-32 h-44 rounded-t-full overflow-hidden p-1">
<Image
src={user?.photoUrl || placeholder.src}
alt="profile picture"
fill
className="object-cover object-center"
/>
</div>
<div className="flex flex-col gap-y-2 justify-items-center items-center">
Expand Down
13 changes: 8 additions & 5 deletions src/components/rpkm/staff/home/qrscanner/QRScanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,14 @@ const Scan: React.FC<ScanProp> = ({ event }) => {
return (
<div className="flex flex-col items-center justify-center w-full">
<div className="relative w-full h-full">
<QrReader
className="bg-black"
onResult={handleScanResult}
constraints={{ facingMode: 'environment' }}
/>
{event != '' && (
<QrReader
className="bg-black"
onResult={handleScanResult}
constraints={{ facingMode: 'environment' }}
/>
)}

<motion.div
className="absolute left-1/2 top-1/2 h-48 w-48 max-w-md -translate-x-1/2 -translate-y-1/2 transform rounded-3xl border-4 border-white"
animate={{ opacity: [0.25, 0.5, 1, 0.5, 0.25] }}
Expand Down

0 comments on commit 430d7fe

Please sign in to comment.