diff --git a/frontend/nyaysetu-frontend/src/pages/judge/JudgeCaseWorkspace.jsx b/frontend/nyaysetu-frontend/src/pages/judge/JudgeCaseWorkspace.jsx
index d119dd70e..e3d858f62 100644
--- a/frontend/nyaysetu-frontend/src/pages/judge/JudgeCaseWorkspace.jsx
+++ b/frontend/nyaysetu-frontend/src/pages/judge/JudgeCaseWorkspace.jsx
@@ -60,7 +60,7 @@ const CaseLifecycleStepper = ({ currentStage }) => {
return (
- {stages.map((stage, index) => (
+ {(stages ?? []).map((stage, index) => (
Duration
setHearingData({ ...hearingData, durationMinutes: parseInt(e.target.value) })}
+ onChange={e => setHearingData({ ...hearingData, durationMinutes: parseInt(e.target.value, 10) })}
style={{
width: '100%', padding: '0.875rem', borderRadius: '0.75rem',
background: 'var(--bg-glass)', border: 'var(--border-glass)',
diff --git a/frontend/nyaysetu-frontend/src/pages/lawyer/CasePreparationPage.jsx b/frontend/nyaysetu-frontend/src/pages/lawyer/CasePreparationPage.jsx
index bdc4b111b..50ce49530 100644
--- a/frontend/nyaysetu-frontend/src/pages/lawyer/CasePreparationPage.jsx
+++ b/frontend/nyaysetu-frontend/src/pages/lawyer/CasePreparationPage.jsx
@@ -172,7 +172,7 @@ export default function CasePreparationPage() {
/>
- {templates.map(t => (
+ {(templates ?? []).map(t => (
setSelectedTemplate(t)}
@@ -302,77 +302,4 @@ export default function CasePreparationPage() {
if (confirm("Send this draft to the client for approval?")) {
try {
await import('../../services/api').then(({ default: api }) =>
- api.post(`/api/v1/cases/${selectedCaseId}/submit-draft`, { draftContent })
- );
- alert("Draft sent to client!");
- fetchCaseDetails(selectedCaseId);
- } catch (e) { console.error(e); alert("Failed to send"); }
- }
- }}
- className="btn"
- style={{
- display: 'flex', alignItems: 'center', gap: '0.5rem',
- background: 'rgba(63, 93, 204, 0.08)',
- color: 'var(--color-secondary)', border: '1px solid rgba(63, 93, 204, 0.2)',
- padding: '0.6rem 1.25rem', borderRadius: '0.75rem', fontWeight: '700',
- fontSize: '0.85rem', cursor: 'pointer'
- }}>
-
Send for Review
-
-
-
- Export
-
-
-
-
-
- {!selectedTemplate && (
-
-
-
No Template Selected
-
- Please select a document type from the sidebar to begin your professional draft.
-
-
- )}
-
-
-
-
-
- );
-}
+ .catch(err => console.error(err))
\ No newline at end of file
diff --git a/frontend/nyaysetu-frontend/src/pages/lawyer/CaseWorkspace.jsx b/frontend/nyaysetu-frontend/src/pages/lawyer/CaseWorkspace.jsx
index ca0d4c278..ef4c3a89b 100644
--- a/frontend/nyaysetu-frontend/src/pages/lawyer/CaseWorkspace.jsx
+++ b/frontend/nyaysetu-frontend/src/pages/lawyer/CaseWorkspace.jsx
@@ -421,9 +421,9 @@ function TabEvidence({ caseId }) {
) : (
- {documents.map(doc => {
+ {(documents ?? []).map(doc => {
const dateStr = doc.uploadDate || doc.createdAt || new Date().toISOString();
- const isValidDate = !isNaN(new Date(dateStr).getTime());
+ const isValidDate = !Number.isNaN(new Date(dateStr).getTime());
return (
({
+ setRecentCases((sortedCases ?? []).map(c => ({
id: c.id?.substring(0, 8) || 'CS-' + Math.random().toString(36).substr(2, 6),
fullId: c.id,
title: c.title || 'Untitled Case',
@@ -242,340 +242,4 @@ export default function LitigantDashboard() {
onClick={() => {
if (confirm('Are you sure you want to approve this draft? This will notify your lawyer.')) {
import('../../services/api').then(({ default: api }) => {
- api.put(`/api/v1/cases/${draft.id}/approve-draft`, { approved: true })
- .then(() => {
- alert('Draft Approved! Your status is now updated.');
- window.location.reload();
- });
- });
- }
- }}
- style={{
- padding: '0.6rem 1.5rem', background: 'linear-gradient(135deg, #f59e0b 0%, #d97706 100%)',
- border: 'none', color: 'white', borderRadius: '0.75rem', fontWeight: '700', cursor: 'pointer',
- boxShadow: '0 4px 10px rgba(245, 158, 11, 0.3)'
- }}>
- {t('litigant.approveSign')}
-
-
-
- ))}
-
-
- )}
-
- {/* Stats Grid */}
-
- {loading ? (
- <>
-
-
-
-
- >
- )
- : stats.map((stat, index) => {
- const Icon = stat.icon;
- return (
-
stat.link && navigate(stat.link)}
- style={{
- background: 'var(--bg-glass-strong)',
- border: 'var(--border-glass-strong)',
- borderRadius: '1.5rem',
- padding: '1.5rem',
- transition: 'all 0.3s',
- cursor: 'pointer'
- }}
- onMouseOver={(e) => {
- e.currentTarget.style.transform = 'translateY(-4px)';
- e.currentTarget.style.borderColor = 'var(--color-primary)';
- }}
- onMouseOut={(e) => {
- e.currentTarget.style.transform = 'translateY(0)';
- e.currentTarget.style.borderColor = '';
- }}
- >
-
-
-
- {t(stat.labelKey)}
-
-
- {stat.value}
-
-
-
-
-
-
-
- {stat.changeKey ? t(stat.changeKey) : stat.change}
-
-
- );
- })}
-
-
- {/* Recent Cases & Hearings Grid */}
-
- {/* Recent Cases */}
-
-
-
- {t('litigant.recentCases')}
-
- navigate('/litigant/case-diary')}
- style={{
- padding: '0.5rem 1rem',
- background: 'var(--bg-glass)',
- border: 'var(--border-glass)',
- borderRadius: '0.5rem',
- color: 'var(--color-primary)',
- fontSize: '0.875rem',
- fontWeight: '600',
- cursor: 'pointer'
- }}
- >
- {t('litigant.viewAll')}
-
-
-
- {loading ? (
-
- ) : recentCases.length === 0 ? (
- navigate('/litigant/file')}
- style={{
- padding: '0.5rem 1rem',
- background: 'var(--color-primary)',
- border: 'none',
- borderRadius: '0.5rem',
- color: 'white',
- fontWeight: '600',
- cursor: 'pointer'
- }}
- >
- {t('litigant.fileFirstCase')}
-
- }
- />
- ) : (
- recentCases.map((caseItem, index) => (
- navigate(`/litigant/case-diary/${caseItem.fullId}`)}
- >
-
-
- ))
- )}
-
-
-
- {/* Upcoming Hearings */}
-
-
-
- {t('litigant.upcomingHearings')}
-
- navigate('/litigant/hearings')}
- style={{
- padding: '0.5rem 1rem',
- background: 'var(--bg-glass)',
- border: 'var(--border-glass)',
- borderRadius: '0.5rem',
- color: 'var(--color-primary)',
- fontSize: '0.875rem',
- fontWeight: '600',
- cursor: 'pointer'
- }}
- >
- {t('litigant.viewAll')}
-
-
-
- {loading ? (
-
- ) : upcomingHearings.length === 0 ? (
-
- ) : (
- upcomingHearings.map((hearing, index) => (
-
-
-
-
-
-
-
- {hearing.title}
-
-
- {hearing.caseId}
-
-
-
-
-
-
-
- {hearing.date} at {hearing.time}
-
-
- {hearing.type}
-
-
-
-
{
- e.stopPropagation();
- alert("Running VOIS 5G Network Check... \n\n✅ Bandwidth: 100 Mbps\n✅ Latency: 12ms\n✅ Jitter: 2ms\n\nConnection is stable for HD Court VC.");
- }}
- style={{
- padding: '0.5rem',
- background: 'rgba(139, 92, 246, 0.1)',
- border: '1px solid rgba(139, 92, 246, 0.3)',
- borderRadius: '0.5rem',
- color: 'var(--color-primary)',
- cursor: 'pointer',
- display: 'flex', alignItems: 'center', justifyContent: 'center'
- }} title="Test 5G Connection">
-
-
- {(() => {
- // Calculate time difference
- // Assuming hearing.date is YYYY-MM-DD
- const hearingDate = new Date(`${hearing.date}T${hearing.time}`);
- const now = new Date();
- const diffMins = (hearingDate - now) / 60000;
- // Enable logic: 15 mins before OR anytime if demo mode (forced true for now as per user request to "Fix Broken Fetches")
- // Actually, let's make it look dynamic: if date is today and time is close
- const isJoinable = true; // diffMins <= 15 && diffMins > -120;
-
- if (isJoinable) {
- return (
-
{
- e.stopPropagation();
- // Jitsi Meet Integration logic
- const domain = 'meet.jit.si';
- const roomName = `NyaySetuVirtualCourt_${hearing.caseId}_${hearing.date.replace(/-/g, '')}`;
- const meetLink = `https://${domain}/${roomName}`;
- window.open(meetLink, '_blank');
- }}
- style={{
- padding: '0.5rem 1rem',
- background: 'var(--color-primary)',
- border: 'none',
- borderRadius: '0.5rem',
- color: 'white',
- fontSize: '0.875rem',
- fontWeight: '600',
- cursor: 'pointer',
- animation: 'pulse 2s infinite',
- display: 'flex', alignItems: 'center', gap: '0.5rem'
- }}>
-
- {t('litigant.joinVirtualCourt')}
-
- );
- } else {
- return (
-
- Starts in {Math.round(diffMins)} mins
-
- );
- }
- })()}
-
-
-
- ))
- )}
-
-
-
-
-
-
- );
-}
+ .catch(err => console.error(err))
\ No newline at end of file
diff --git a/frontend/nyaysetu-frontend/src/pages/litigant/VakilFriendPage.jsx b/frontend/nyaysetu-frontend/src/pages/litigant/VakilFriendPage.jsx
index 32a4d02b6..38380db7e 100644
--- a/frontend/nyaysetu-frontend/src/pages/litigant/VakilFriendPage.jsx
+++ b/frontend/nyaysetu-frontend/src/pages/litigant/VakilFriendPage.jsx
@@ -335,7 +335,7 @@ const {
} catch (err) {
console.error('Failed to send message:', err);
if (err.response?.status === 429) {
- const retryAfter = parseInt(err.response.headers['retry-after'] || '60');
+ const retryAfter = parseInt(err.response.headers['retry-after'] || '60', 10);
startCooldown(retryAfter);
setMessages(prev => [...prev, {
role: 'assistant',
@@ -803,7 +803,7 @@ const startDeepResearch = async (query) => {
const analysis = response.data;
// Update file status with analysis results
- setAttachedFiles(prev => prev.map(f =>
+ setAttachedFiles(prev => (prev ?? []).map(f =>
f.name === file.name && f.status === 'pending'
? {
...f,