Spaces:
Sleeping
Sleeping
Commit ·
fdd5c82
1
Parent(s): dec5d3b
Fix admin dashboard notification loop and add resume refresh notification
Browse files
src/components/Admin/AdminSummary.jsx
CHANGED
|
@@ -132,7 +132,8 @@ export default function AdminSummary({ onNavigate, setActiveTab, selectedChatUse
|
|
| 132 |
|
| 133 |
startPolling();
|
| 134 |
return () => { if (pollInterval) clearInterval(pollInterval); };
|
| 135 |
-
|
|
|
|
| 136 |
|
| 137 |
const fetchDashboardData = async () => {
|
| 138 |
try {
|
|
|
|
| 132 |
|
| 133 |
startPolling();
|
| 134 |
return () => { if (pollInterval) clearInterval(pollInterval); };
|
| 135 |
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
| 136 |
+
}, []);
|
| 137 |
|
| 138 |
const fetchDashboardData = async () => {
|
| 139 |
try {
|
src/pages/ApplicantProfile.jsx
CHANGED
|
@@ -2,6 +2,7 @@ import React, { useState, useEffect } from 'react';
|
|
| 2 |
import { supabase } from '../supabaseClient';
|
| 3 |
import ApplicantLayout from '../components/ApplicantLayout'; // The Navigation Wrapper
|
| 4 |
import ProfilePage from '../components/ProfilePage'; // The UI Component
|
|
|
|
| 5 |
|
| 6 |
export default function ApplicantProfile({ onNavigate }) {
|
| 7 |
// --- 1. STATE VARIABLES ---
|
|
@@ -17,6 +18,7 @@ export default function ApplicantProfile({ onNavigate }) {
|
|
| 17 |
const [isSaving, setIsSaving] = useState(false);
|
| 18 |
const [saveSuccess, setSaveSuccess] = useState(false);
|
| 19 |
const [isExtracting, setIsExtracting] = useState(false);
|
|
|
|
| 20 |
|
| 21 |
// --- 2. FETCH DATA ---
|
| 22 |
useEffect(() => {
|
|
@@ -160,6 +162,18 @@ export default function ApplicantProfile({ onNavigate }) {
|
|
| 160 |
setOriginalFormData(formData);
|
| 161 |
setPhotoPreviewUrl(null);
|
| 162 |
setIsEditing(false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 163 |
} catch (error) {
|
| 164 |
alert(`Error saving profile: ${error.message}`);
|
| 165 |
} finally {
|
|
@@ -171,6 +185,66 @@ export default function ApplicantProfile({ onNavigate }) {
|
|
| 171 |
// --- 4. RENDER ---
|
| 172 |
return (
|
| 173 |
<ApplicantLayout activePage="applicant-profile" onNavigate={onNavigate}>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 174 |
<ProfilePage
|
| 175 |
profileData={formData}
|
| 176 |
loading={loading}
|
|
|
|
| 2 |
import { supabase } from '../supabaseClient';
|
| 3 |
import ApplicantLayout from '../components/ApplicantLayout'; // The Navigation Wrapper
|
| 4 |
import ProfilePage from '../components/ProfilePage'; // The UI Component
|
| 5 |
+
import { motion, AnimatePresence } from 'framer-motion';
|
| 6 |
|
| 7 |
export default function ApplicantProfile({ onNavigate }) {
|
| 8 |
// --- 1. STATE VARIABLES ---
|
|
|
|
| 18 |
const [isSaving, setIsSaving] = useState(false);
|
| 19 |
const [saveSuccess, setSaveSuccess] = useState(false);
|
| 20 |
const [isExtracting, setIsExtracting] = useState(false);
|
| 21 |
+
const [showRefreshNotification, setShowRefreshNotification] = useState(false);
|
| 22 |
|
| 23 |
// --- 2. FETCH DATA ---
|
| 24 |
useEffect(() => {
|
|
|
|
| 162 |
setOriginalFormData(formData);
|
| 163 |
setPhotoPreviewUrl(null);
|
| 164 |
setIsEditing(false);
|
| 165 |
+
|
| 166 |
+
// ✅ Show refresh notification 10 seconds after uploading a new resume
|
| 167 |
+
if (resumeFile) {
|
| 168 |
+
setTimeout(() => {
|
| 169 |
+
setShowRefreshNotification(true);
|
| 170 |
+
|
| 171 |
+
// Auto-hide after 15 seconds
|
| 172 |
+
setTimeout(() => {
|
| 173 |
+
setShowRefreshNotification(false);
|
| 174 |
+
}, 15000);
|
| 175 |
+
}, 10000); // 10 seconds delay
|
| 176 |
+
}
|
| 177 |
} catch (error) {
|
| 178 |
alert(`Error saving profile: ${error.message}`);
|
| 179 |
} finally {
|
|
|
|
| 185 |
// --- 4. RENDER ---
|
| 186 |
return (
|
| 187 |
<ApplicantLayout activePage="applicant-profile" onNavigate={onNavigate}>
|
| 188 |
+
<AnimatePresence>
|
| 189 |
+
{showRefreshNotification && (
|
| 190 |
+
<motion.div
|
| 191 |
+
initial={{ opacity: 0, y: -50, x: '-50%' }}
|
| 192 |
+
animate={{ opacity: 1, y: 0, x: '-50%' }}
|
| 193 |
+
exit={{ opacity: 0, y: -50, x: '-50%' }}
|
| 194 |
+
style={{
|
| 195 |
+
position: 'fixed',
|
| 196 |
+
top: '30px',
|
| 197 |
+
left: '50%',
|
| 198 |
+
backgroundColor: '#10b981', // Emerald green
|
| 199 |
+
color: 'white',
|
| 200 |
+
padding: '1rem 1.5rem',
|
| 201 |
+
borderRadius: '0.75rem',
|
| 202 |
+
boxShadow: '0 10px 25px rgba(0,0,0,0.2)',
|
| 203 |
+
zIndex: 9999,
|
| 204 |
+
fontWeight: '500',
|
| 205 |
+
display: 'flex',
|
| 206 |
+
alignItems: 'center',
|
| 207 |
+
gap: '1rem',
|
| 208 |
+
border: '1px solid rgba(255,255,255,0.2)'
|
| 209 |
+
}}
|
| 210 |
+
>
|
| 211 |
+
<span>✨ We've analyzed your newly uploaded resume! Please refresh the page to view your auto-filled profile fields.</span>
|
| 212 |
+
<button
|
| 213 |
+
onClick={() => window.location.reload()}
|
| 214 |
+
style={{
|
| 215 |
+
background: 'white',
|
| 216 |
+
color: '#10b981',
|
| 217 |
+
border: 'none',
|
| 218 |
+
padding: '0.5rem 1rem',
|
| 219 |
+
borderRadius: '0.5rem',
|
| 220 |
+
cursor: 'pointer',
|
| 221 |
+
fontWeight: 'bold',
|
| 222 |
+
whiteSpace: 'nowrap',
|
| 223 |
+
transition: 'all 0.2s',
|
| 224 |
+
outline: 'none'
|
| 225 |
+
}}
|
| 226 |
+
onMouseEnter={(e) => e.target.style.transform = 'scale(1.05)'}
|
| 227 |
+
onMouseLeave={(e) => e.target.style.transform = 'scale(1)'}
|
| 228 |
+
>
|
| 229 |
+
Refresh Now
|
| 230 |
+
</button>
|
| 231 |
+
<button
|
| 232 |
+
onClick={() => setShowRefreshNotification(false)}
|
| 233 |
+
style={{
|
| 234 |
+
background: 'transparent',
|
| 235 |
+
border: 'none',
|
| 236 |
+
color: 'white',
|
| 237 |
+
fontSize: '1.2rem',
|
| 238 |
+
cursor: 'pointer',
|
| 239 |
+
padding: '0',
|
| 240 |
+
marginLeft: '0.5rem'
|
| 241 |
+
}}
|
| 242 |
+
>
|
| 243 |
+
×
|
| 244 |
+
</button>
|
| 245 |
+
</motion.div>
|
| 246 |
+
)}
|
| 247 |
+
</AnimatePresence>
|
| 248 |
<ProfilePage
|
| 249 |
profileData={formData}
|
| 250 |
loading={loading}
|