- Add detailed report viewing with full-screen ReportDetail component for both company and employee reports - Fix company wiki to display onboarding Q&A in card format matching Figma designs - Exclude company owners from employee submission counts (owners contribute to wiki, not employee data) - Fix employee report generation to include company context (wiki + company report + employee answers) - Fix company report generation to use filtered employee submissions only - Add proper error handling for submission data format variations - Update Firebase functions to use gpt-4o model instead of deprecated gpt-4.1 - Fix UI syntax errors and improve report display functionality - Add comprehensive logging for debugging report generation flow 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
57 lines
2.0 KiB
TypeScript
57 lines
2.0 KiB
TypeScript
import { initializeApp, getApps } from 'firebase/app';
|
|
import { getAuth, GoogleAuthProvider, setPersistence, browserLocalPersistence } from 'firebase/auth';
|
|
import { getFirestore, connectFirestoreEmulator } from 'firebase/firestore';
|
|
|
|
const firebaseConfig = {
|
|
apiKey: import.meta.env.VITE_FIREBASE_API_KEY,
|
|
authDomain: import.meta.env.VITE_FIREBASE_AUTH_DOMAIN,
|
|
projectId: import.meta.env.VITE_FIREBASE_PROJECT_ID,
|
|
storageBucket: import.meta.env.VITE_FIREBASE_STORAGE_BUCKET,
|
|
messagingSenderId: import.meta.env.VITE_FIREBASE_MESSAGING_SENDER_ID,
|
|
appId: import.meta.env.VITE_FIREBASE_APP_ID,
|
|
};
|
|
|
|
export const isFirebaseConfigured = Boolean(
|
|
firebaseConfig.apiKey &&
|
|
firebaseConfig.authDomain &&
|
|
firebaseConfig.projectId &&
|
|
firebaseConfig.apiKey !== 'undefined' &&
|
|
firebaseConfig.authDomain !== 'undefined' &&
|
|
firebaseConfig.projectId !== 'undefined'
|
|
);
|
|
|
|
let app;
|
|
let auth;
|
|
let db;
|
|
let googleProvider;
|
|
|
|
if (isFirebaseConfigured) {
|
|
app = getApps().length === 0 ? initializeApp(firebaseConfig) : getApps()[0];
|
|
auth = getAuth(app);
|
|
setPersistence(auth, browserLocalPersistence);
|
|
db = getFirestore(app);
|
|
googleProvider = new GoogleAuthProvider();
|
|
|
|
// Connect to emulator in development
|
|
const isLocalhost = typeof window !== 'undefined' &&
|
|
(window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1');
|
|
|
|
if (isLocalhost && !db._settings?.host?.includes('localhost')) {
|
|
try {
|
|
connectFirestoreEmulator(db, 'localhost', 5003);
|
|
console.log('🔥 Connected to Firestore emulator on localhost:5003');
|
|
} catch (error) {
|
|
console.log('⚠️ Firestore emulator already connected or connection failed');
|
|
}
|
|
}
|
|
|
|
console.log('🔥 Firebase initialized successfully');
|
|
} else {
|
|
auth = null;
|
|
db = null;
|
|
googleProvider = null;
|
|
console.log('⚠️ Firebase not configured - missing environment variables');
|
|
}
|
|
|
|
export { auth, db, googleProvider };
|