@@ -14,7 +14,6 @@ export default function NafathPage() {
1414 const [ aiInsight , setAiInsight ] = useState < { score : number ; verdict : string ; reason : string } | null > ( null ) ;
1515 const [ error , setError ] = useState ( '' ) ;
1616
17- // 1. Initiate Login with AI Risk Assessment
1817 const handleStartAuth = async ( e : React . FormEvent ) => {
1918 e . preventDefault ( ) ;
2019 if ( nationalId . length !== 10 ) return setError ( "National ID must be 10 digits" ) ;
@@ -40,16 +39,13 @@ export default function NafathPage() {
4039 setAiInsight ( data . aiInsight ) ;
4140 setRequestId ( data . nafath . id ) ;
4241 setRandomCode ( data . nafath . randomCode ) ;
43-
44- // Delay slightly to show the "Scanning" animation for UX
4542 setTimeout ( ( ) => setStep ( 'CHALLENGE' ) , 1500 ) ;
4643 } catch ( err ) {
4744 setStep ( 'ERROR' ) ;
4845 setError ( "Failed to connect to Security Gateway." ) ;
4946 }
5047 } ;
5148
52- // 2. Polling for Status Updates
5349 useEffect ( ( ) => {
5450 let interval : NodeJS . Timeout ;
5551 if ( step === 'CHALLENGE' && requestId ) {
@@ -70,7 +66,6 @@ export default function NafathPage() {
7066 return ( ) => clearInterval ( interval ) ;
7167 } , [ step , requestId ] ) ;
7268
73- // 3. Mobile Simulator (PATCH)
7469 const simulateMobileAppApproval = async ( ) => {
7570 if ( ! requestId ) return ;
7671 try {
@@ -88,7 +83,6 @@ export default function NafathPage() {
8883 < div className = "min-h-screen bg-[#0a0c10] text-slate-200 flex flex-col items-center justify-center p-6 font-sans" >
8984 < div className = "w-full max-w-md" >
9085
91- { /* Header */ }
9286 < div className = "text-center mb-10" >
9387 < div className = "inline-flex p-3 rounded-2xl bg-emerald-500/10 mb-4 border border-emerald-500/20" >
9488 < ShieldCheck className = "text-emerald-500 w-8 h-8" />
@@ -97,7 +91,6 @@ export default function NafathPage() {
9791 < p className = "text-slate-500 text-sm mt-2" > National Single Sign-On Simulation</ p >
9892 </ div >
9993
100- { /* Step 1: Input */ }
10194 { step === 'IDLE' && (
10295 < form onSubmit = { handleStartAuth } className = "space-y-4 animate-in fade-in slide-in-from-bottom-4" >
10396 < div className = "space-y-2" >
@@ -117,7 +110,6 @@ export default function NafathPage() {
117110 </ form >
118111 ) }
119112
120- { /* Step 2: AI Scanning */ }
121113 { step === 'SCANNING' && (
122114 < div className = "bg-slate-900/50 border border-slate-800 rounded-3xl p-10 text-center space-y-6" >
123115 < div className = "relative flex justify-center" >
@@ -131,10 +123,8 @@ export default function NafathPage() {
131123 </ div >
132124 ) }
133125
134- { /* Step 3: Challenge */ }
135126 { step === 'CHALLENGE' && (
136127 < div className = "space-y-6 animate-in zoom-in-95" >
137- { /* AI Insights Card */ }
138128 < div className = "bg-blue-500/5 border border-blue-500/20 rounded-2xl p-4 flex gap-4 items-start" >
139129 < BrainCircuit className = "text-blue-400 shrink-0 mt-1" />
140130 < div >
@@ -143,7 +133,6 @@ export default function NafathPage() {
143133 </ div >
144134 </ div >
145135
146- { /* Nafath Challenge Card */ }
147136 < div className = "bg-white rounded-3xl p-8 text-center shadow-2xl overflow-hidden relative" >
148137 < div className = "absolute top-0 right-0 p-4 opacity-5" >
149138 < Smartphone size = { 120 } />
@@ -158,7 +147,6 @@ export default function NafathPage() {
158147 </ div >
159148 </ div >
160149
161- { /* Mobile Simulator Panel */ }
162150 < div className = "bg-slate-900 rounded-2xl p-4 border border-slate-800" >
163151 < button
164152 onClick = { simulateMobileAppApproval }
@@ -179,7 +167,6 @@ export default function NafathPage() {
179167 </ div >
180168 ) }
181169
182- { /* Step 4: Success */ }
183170 { step === 'SUCCESS' && (
184171 < div className = "text-center space-y-6 animate-in fade-in scale-95" >
185172 < div className = "inline-flex p-6 rounded-full bg-emerald-500/20 text-emerald-500 shadow-[0_0_40px_-10px_rgba(16,185,129,0.3)]" >
@@ -196,7 +183,6 @@ export default function NafathPage() {
196183 </ div >
197184 ) }
198185
199- { /* Errors */ }
200186 { step === 'ERROR' && (
201187 < div className = "bg-red-500/10 border border-red-500/20 rounded-2xl p-6 text-center space-y-4" >
202188 < AlertTriangle className = "mx-auto text-red-500 w-10 h-10" />
0 commit comments