From 548b3045c80da5f835aea1e077187df010b8992f Mon Sep 17 00:00:00 2001 From: Vineet Bogam <114532660+V15247@users.noreply.github.com> Date: Mon, 21 Oct 2024 17:54:56 -0400 Subject: [PATCH] Added seperate string variable to handle points input --- app/dashboard/views/organizerView.tsx | 31 +++++++++++++++++---------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/app/dashboard/views/organizerView.tsx b/app/dashboard/views/organizerView.tsx index 4db72d0..632ef6b 100644 --- a/app/dashboard/views/organizerView.tsx +++ b/app/dashboard/views/organizerView.tsx @@ -114,6 +114,7 @@ function OrganizerView() { const [manualEmail, setManualEmail] = useState(''); const [manualPoints, setManualPoints] = useState(0); + const [manualPointsInput, setManualPointsInput] = useState(''); const [pointOperation, setPointOperation] = useState<'add' | 'subtract'>( 'add', ); @@ -289,13 +290,12 @@ function OrganizerView() { try { const data = await getSelf(); - const domain = data.response.email.slice(-11) - setIsSponsor(domain == "sponsor.com") - if (domain == "sponsor.com"){ - setScannerTab("SPONSOR") + const domain = data.response.email.slice(-11); + setIsSponsor(domain == 'sponsor.com'); + if (domain == 'sponsor.com') { + setScannerTab('SPONSOR'); resetScanLog(); } - } catch (error) { console.log(error); } @@ -317,7 +317,7 @@ function OrganizerView() { disabled={isSponsor} className={`rounded bg-blue-500 px-4 py-2 font-bold text-white hover:bg-blue-700 ${ scannerTab === 'CHECK IN' ? 'bg-blue-700' : '' - } ${isSponsor ? "bg-blue-500 hover:bg-blue-500": ""}`} + } ${isSponsor ? 'bg-blue-500 hover:bg-blue-500' : ''}`} onClick={() => { setScannerTab('CHECK IN'); resetScanLog(); @@ -329,7 +329,7 @@ function OrganizerView() { disabled={isSponsor} className={`rounded bg-blue-500 px-4 py-2 font-bold text-white hover:bg-blue-700 ${ scannerTab === 'EVENT' ? 'bg-blue-700' : '' - }${isSponsor ? "bg-blue-500 hover:bg-blue-500": ""}`} + }${isSponsor ? 'bg-blue-500 hover:bg-blue-500' : ''}`} onClick={() => { setScannerTab('EVENT'); resetScanLog(); @@ -341,7 +341,7 @@ function OrganizerView() { disabled={isSponsor} className={`rounded bg-blue-500 px-4 py-2 font-bold text-white hover:bg-blue-700 ${ scannerTab === 'MANUAL' ? 'bg-blue-700' : '' - }${isSponsor ? "bg-blue-500 hover:bg-blue-500": ""}`} + }${isSponsor ? 'bg-blue-500 hover:bg-blue-500' : ''}`} onClick={() => { setScannerTab('MANUAL'); resetScanLog(); @@ -444,9 +444,18 @@ function OrganizerView() {
Manual Points: setManualPoints(Number(e.target.value))} + type="text" + value={manualPointsInput} + onChange={(e) => { + const value = e.target.value; + setManualPointsInput(value); + const numValue = parseFloat(value); + if (!isNaN(numValue)) { + setManualPoints(numValue); + } else { + setManualPoints(0); + } + }} placeholder="Enter points" className="mr-2 rounded border p-2 text-black" />