1"use strict";(self.webpackChunkstudent_management_app=self.webpackChunkstudent_management_app||[]).push([[3457],{83457:(e,s,t)=>{t.r(s),t.d(s,{default:()=>l});var a=t(9950),n=t(56600),r=t(23849);var c=t(2765),i=t(63421),d=t(75516),o=t(44414);const l=()=>{const[e,s]=(0,a.useState)(!1),[t,l]=(0,a.useState)(null),[m,u]=(0,a.useState)(null);(0,a.useEffect)(()=>{u((()=>{const e={};return["REACT_APP_FIREBASE_API_KEY","REACT_APP_FIREBASE_AUTH_DOMAIN","REACT_APP_FIREBASE_PROJECT_ID","REACT_APP_FIREBASE_STORAGE_BUCKET","REACT_APP_FIREBASE_MESSAGING_SENDER_ID","REACT_APP_FIREBASE_APP_ID"].forEach(s=>{const t={NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0,REACT_APP_FIREBASE_API_KEY:"AIzaSyCWxqxJST91KCC18B_zbsoBrP4G7VychBI",REACT_APP_FIREBASE_APP_ID:"1:510503057097:web:1ca69bea212415c8e6ff18",REACT_APP_FIREBASE_AUTH_DOMAIN:"hudumacna-2831c.firebaseapp.com",REACT_APP_FIREBASE_DATABASE_URL:"",REACT_APP_FIREBASE_MEASUREMENT_ID:"G-61E0FFVCBQ",REACT_APP_FIREBASE_MESSAGING_SENDER_ID:"510503057097",REACT_APP_FIREBASE_PROJECT_ID:"hudumacna-2831c",REACT_APP_FIREBASE_STORAGE_BUCKET:"hudumacna-2831c.firebasestorage.app",REACT_APP_STRIPE_PUBLISHABLE_KEY:"pk_live_51T2d2o4M2zSJeFA21XsMhTwj1NMSm9vDmTaESCiCAT1f9n7oKpQU5BO7fvGUsa4HQKtmpBIW45zfVKKVGCy4vvmz007R2WJy0H"}[s];e[s]={set:!!t,isPlaceholder:t&&(t.includes("Your")||t.includes("your-")),value:t?t.substring(0,10)+"...":"NOT SET"}}),e})())},[]);const x=e=>{let{status:s}=e;return!0===s?(0,o.jsx)(c.A,{className:"h-5 w-5 text-green-500"}):!1===s?(0,o.jsx)(i.A,{className:"h-5 w-5 text-red-500"}):(0,o.jsx)(d.A,{className:"h-5 w-5 text-yellow-500"})};return(0,o.jsxs)("div",{className:"max-w-4xl mx-auto p-6",children:[(0,o.jsx)("h1",{className:"text-2xl font-bold text-gray-900 mb-6",children:"Firebase Connection Test"}),(0,o.jsxs)("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-6 mb-6",children:[(0,o.jsx)("h2",{className:"text-lg font-semibold text-gray-900 mb-4",children:"Environment Configuration"}),m&&(0,o.jsx)("div",{className:"space-y-2",children:Object.entries(m).map(e=>{let[s,t]=e;return(0,o.jsxs)("div",{className:"flex items-center justify-between p-3 bg-gray-50 rounded",children:[(0,o.jsx)("span",{className:"text-sm font-mono",children:s}),(0,o.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,o.jsx)(x,{status:t.set&&!t.isPlaceholder}),(0,o.jsx)("span",{className:"text-xs text-gray-600",children:t.set?t.isPlaceholder?"Placeholder":t.value:"Not Set"})]})]},s)})}),(0,o.jsx)("div",{className:"mt-4 p-4 bg-blue-50 rounded",children:(0,o.jsxs)("p",{className:"text-sm text-blue-800",children:[(0,o.jsx)("strong",{children:"Setup Instructions:"})," Create a ",(0,o.jsx)("code",{children:".env"})," file in your project root and add your Firebase configuration values. See FIREBASE_SETUP_GUIDE.md for detailed instructions."]})})]}),(0,o.jsx)("div",{className:"text-center mb-6",children:(0,o.jsx)("button",{onClick:async()=>{s(!0);try{const e=await(async()=>{const e={configured:!1,connected:!1,canRead:!1,canWrite:!1,collections:{},errors:[]};try{const t={apiKey:"AIzaSyCWxqxJST91KCC18B_zbsoBrP4G7VychBI",authDomain:"hudumacna-2831c.firebaseapp.com",projectId:"hudumacna-2831c",storageBucket:"hudumacna-2831c.firebasestorage.app",messagingSenderId:"510503057097",appId:"1:510503057097:web:1ca69bea212415c8e6ff18"};if(Object.values(t).some(e=>!e||e.includes("YourAPIKeyHere")||e.includes("YourAppID")))return e.errors.push("Firebase configuration contains placeholder values. Please set up your .env file with real Firebase credentials."),console.error("Firebase configuration error:",t),e;e.configured=!0;const a=["students","teachers","courseSchedule","payments"];for(const c of a)try{const s=await(0,r.GG)((0,r.rJ)(n.db,c));e.collections[c]=s.size,e.canRead=!0,e.connected=!0}catch(s){e.errors.push(`Failed to read ${c}: ${s.message}`)}try{const s=await(0,r.gS)((0,r.rJ)(n.db,"connectionTest"),{timestamp:(0,r.O5)(),test:!0,message:"Testing Firebase write permissions"});e.canWrite=!0,console.log("Write test successful:",s.id)}catch(s){e.errors.push(`Failed to write test document: ${s.message}`)}}catch(s){e.errors.push(`General connection error: ${s.message}`)}return e})();l(e)}catch(e){l({configured:!1,connected:!1,canRead:!1,canWrite:!1,collections:{},errors:[e.message]})}s(!1)},disabled:e,className:"px-6 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:bg-gray-400 disabled:cursor-not-allowed transition-colors",children:e?"Testing Connection...":"Run Connection Test"})}),t&&(0,o.jsxs)("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-6",children:[(0,o.jsx)("h2",{className:"text-lg font-semibold text-gray-900 mb-4",children:"Test Results"}),(0,o.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-6",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between p-3 bg-gray-50 rounded",children:[(0,o.jsx)("span",{className:"text-sm font-medium",children:"Configuration Valid"}),(0,o.jsx)(x,{status:t.configured})]}),(0,o.jsxs)("div",{className:"flex items-center justify-between p-3 bg-gray-50 rounded",children:[(0,o.jsx)("span",{className:"text-sm font-medium",children:"Connected to Firebase"}),(0,o.jsx)(x,{status:t.connected})]}),(0,o.jsxs)("div",{className:"flex items-center justify-between p-3 bg-gray-50 rounded",children:[(0,o.jsx)("span",{className:"text-sm font-medium",children:"Can Read Data"}),(0,o.jsx)(x,{status:t.canRead})]}),(0,o.jsxs)("div",{className:"flex items-center justify-between p-3 bg-gray-50 rounded",children:[(0,o.jsx)("span",{className:"text-sm font-medium",children:"Can Write Data"}),(0,o.jsx)(x,{status:t.canWrite})]})]}),Object.keys(t.collections).length>0&&(0,o.jsxs)("div",{className:"mb-6",children:[(0,o.jsx)("h3",{className:"text-sm font-semibold text-gray-700 mb-2",children:"Collection Document Counts"}),(0,o.jsx)("div",{className:"grid grid-cols-2 gap-2",children:Object.entries(t.collections).map(e=>{let[s,t]=e;return(0,o.jsxs)("div",{className:"flex justify-between p-2 bg-gray-50 rounded text-sm",children:[(0,o.jsxs)("span",{children:[s,":"]}),(0,o.jsxs)("span",{className:"font-medium",children:[t," documents"]})]},s)})})]}),t.errors.length>0&&(0,o.jsxs)("div",{className:"p-4 bg-red-50 rounded",children:[(0,o.jsx)("h3",{className:"text-sm font-semibold text-red-800 mb
1-2",children:"Errors"}),(0,o.jsx)("ul",{className:"space-y-1",children:t.errors.map((e,s)=>(0,o.jsxs)("li",{className:"text-sm text-red-700",children:["\u2022 ",e]},s))})]}),t.configured&&t.connected&&t.canRead&&t.canWrite&&(0,o.jsx)("div",{className:"p-4 bg-green-50 rounded",children:(0,o.jsxs)("p",{className:"text-sm text-green-800",children:[(0,o.jsx)(c.A,{className:"h-4 w-4 inline mr-1"}),"Firebase is properly configured and working! The Course Tracking System should be able to fetch and save data."]})})]})]})}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.