Skip to content

Commit c2aa918

Browse files
committed
Refactor DocumentProcessingStatus and PredictionPanel components to remove unused variables and clean up imports for improved readability
1 parent 56c17c9 commit c2aa918

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

frontend/src/components/DocumentProcessingStatus.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { useState, useEffect } from 'react';
22
import { useAuth } from '../contexts/AuthContext';
3-
import { getFirestore, collection, query, where, onSnapshot, doc } from 'firebase/firestore';
3+
import { getFirestore, collection, query, onSnapshot, doc } from 'firebase/firestore';
44
import { getFunctions, httpsCallable } from 'firebase/functions';
55

66
interface Document {
@@ -71,7 +71,8 @@ const DocumentProcessingStatus: React.FC<DocumentProcessingStatusProps> = ({ onP
7171

7272
// Check if we have the minimum required documents
7373
const hasSyllabus = documentTypeCount.syllabus > 0;
74-
const hasGradesOrTranscript = documentTypeCount.transcript > 0 || documentTypeCount.grades > 0;
74+
// We'll keep this comment to document what we're checking, but remove the unused variable
75+
// const hasGradesOrTranscript = documentTypeCount.transcript > 0 || documentTypeCount.grades > 0;
7576
const hasMinimumDocuments = hasSyllabus;
7677

7778
// Handle manual formatting
@@ -144,7 +145,8 @@ const DocumentProcessingStatus: React.FC<DocumentProcessingStatusProps> = ({ onP
144145

145146
const progress = calculateProgress();
146147
const canFormat = documentCounts.extracted > 0 && !isFormatting;
147-
const hasErrors = documentCounts.error > 0;
148+
// We'll keep this comment to document what we're checking, but remove the unused variable
149+
// const hasErrors = documentCounts.error > 0;
148150

149151
return (
150152
<div style={styles.container}>

frontend/src/components/PredictionPanel.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import React, { useState, useEffect, useCallback } from 'react';
1+
import React, { useState, useEffect } from 'react';
22
import { useAuth } from '../contexts/AuthContext';
3-
import { getFunctions, httpsCallable } from 'firebase/functions';
3+
import { getFunctions } from 'firebase/functions';
44
import { getFirestore, collection, query, orderBy, limit, onSnapshot, doc, getDoc } from 'firebase/firestore';
55
import { calculateCurrentGrade, predictFinalGrade } from '../services/gradeService';
66
import DocumentProcessingStatus from './DocumentProcessingStatus';
@@ -36,12 +36,11 @@ const PredictionPanel: React.FC = () => {
3636
const { currentUser } = useAuth();
3737
const [isPredicting, setIsPredicting] = useState<boolean>(false);
3838
const [predictionResult, setPredictionResult] = useState<Prediction | null>(null);
39-
const [documents, setDocuments] = useState<Document[]>([]);
39+
const [documents] = useState<Document[]>([]);
4040
const [error, setError] = useState<string | null>(null);
4141
const [status, setStatus] = useState<string>('');
4242
const [processingComplete, setProcessingComplete] = useState<boolean>(false);
4343

44-
const functions = getFunctions();
4544
const db = getFirestore();
4645

4746
// Listen for documents and predictions
@@ -130,11 +129,12 @@ const PredictionPanel: React.FC = () => {
130129
// Determine if we can make a prediction based on document status or processing completion
131130
const canPredict = documents.some(doc => doc.status === 'processed') || processingComplete;
132131

132+
// We'll keep this comment to document what we're calculating, but remove the unused variable
133133
// Get count of documents by type
134-
const docCounts = documents.reduce((acc: Record<string, number>, doc) => {
135-
acc[doc.documentType] = (acc[doc.documentType] || 0) + 1;
136-
return acc;
137-
}, {});
134+
// const docCounts = documents.reduce((acc: Record<string, number>, doc) => {
135+
// acc[doc.documentType] = (acc[doc.documentType] || 0) + 1;
136+
// return acc;
137+
// }, {});
138138

139139
return (
140140
<div style={styles.container}>

0 commit comments

Comments
 (0)