|
1 | 1 | 'use client'; |
| 2 | + |
| 3 | +import React, { useState } from 'react'; |
| 4 | +import { useAuthStore } from '@/lib/store'; |
| 5 | +import toast from 'react-hot-toast'; |
| 6 | + |
2 | 7 | export default function SettingsPage() { |
| 8 | + const { user } = useAuthStore(); |
| 9 | + const [resumeFile, setResumeFile] = useState<File | null>(null); |
| 10 | + const [resumeUploaded, setResumeUploaded] = useState(false); |
| 11 | + |
| 12 | + const handleResumeChange = (e: React.ChangeEvent<HTMLInputElement>) => { |
| 13 | + const file = e.target.files?.[0]; |
| 14 | + if (!file) return; |
| 15 | + if (file.type !== 'application/pdf') { |
| 16 | + toast.error('Only PDF files are supported'); |
| 17 | + return; |
| 18 | + } |
| 19 | + if (file.size > 5 * 1024 * 1024) { |
| 20 | + toast.error('File size must be under 5MB'); |
| 21 | + return; |
| 22 | + } |
| 23 | + setResumeFile(file); |
| 24 | + }; |
| 25 | + |
| 26 | + const handleResumeUpload = () => { |
| 27 | + if (!resumeFile) return; |
| 28 | + // Placeholder — wire to your backend when ready |
| 29 | + toast.success(`Resume "${resumeFile.name}" saved successfully`); |
| 30 | + setResumeUploaded(true); |
| 31 | + }; |
| 32 | + |
3 | 33 | return ( |
4 | | - <div className="max-w-7xl mx-auto px-4 py-8"> |
5 | | - <div className="mb-8"> |
6 | | - <div className="flex items-center justify-between"> |
7 | | - <div> |
8 | | - <h1 className="text-3xl font-bold text-gray-900 mb-2">Settings</h1> |
9 | | - <p className="text-gray-600"> |
10 | | - Configure your preferences and pipeline settings |
11 | | - </p> |
| 34 | + <div className="max-w-3xl mx-auto px-6 py-10"> |
| 35 | + {/* Header */} |
| 36 | + <div className="mb-10"> |
| 37 | + <h1 className="text-2xl font-bold text-gray-900">Settings</h1> |
| 38 | + <p className="text-gray-500 mt-1">Manage your account and preferences</p> |
| 39 | + </div> |
| 40 | + |
| 41 | + <div className="space-y-6"> |
| 42 | + |
| 43 | + {/* Profile Section */} |
| 44 | + <div className="bg-white rounded-xl border border-gray-200 p-6"> |
| 45 | + <h2 className="text-base font-semibold text-gray-900 mb-4">Profile</h2> |
| 46 | + <div className="space-y-4"> |
| 47 | + <div> |
| 48 | + <label className="block text-sm font-medium text-gray-600 mb-1"> |
| 49 | + Name |
| 50 | + </label> |
| 51 | + <div className="px-4 py-2.5 bg-gray-50 border border-gray-200 rounded-lg text-gray-900 text-sm"> |
| 52 | + {user?.email?.split('@')[0] || '—'} |
| 53 | + </div> |
| 54 | + </div> |
| 55 | + <div> |
| 56 | + <label className="block text-sm font-medium text-gray-600 mb-1"> |
| 57 | + Email Address |
| 58 | + </label> |
| 59 | + <div className="px-4 py-2.5 bg-gray-50 border border-gray-200 rounded-lg text-gray-900 text-sm"> |
| 60 | + {user?.email || '—'} |
| 61 | + </div> |
| 62 | + </div> |
| 63 | + </div> |
| 64 | + </div> |
| 65 | + |
| 66 | + {/* Resume Section */} |
| 67 | + <div className="bg-white rounded-xl border border-gray-200 p-6"> |
| 68 | + <h2 className="text-base font-semibold text-gray-900 mb-1">Resume</h2> |
| 69 | + <p className="text-sm text-gray-500 mb-4"> |
| 70 | + Upload your resume to attach it to job applications. PDF only, max 5MB. |
| 71 | + </p> |
| 72 | + |
| 73 | + <div className="border-2 border-dashed border-gray-200 rounded-xl p-8 text-center hover:border-gray-300 transition"> |
| 74 | + <input |
| 75 | + type="file" |
| 76 | + accept=".pdf" |
| 77 | + onChange={handleResumeChange} |
| 78 | + className="hidden" |
| 79 | + id="resume-upload" |
| 80 | + /> |
| 81 | + <label htmlFor="resume-upload" className="cursor-pointer"> |
| 82 | + <div className="text-3xl mb-2">📄</div> |
| 83 | + <p className="text-sm font-medium text-gray-700"> |
| 84 | + {resumeFile ? resumeFile.name : 'Click to upload your resume'} |
| 85 | + </p> |
| 86 | + <p className="text-xs text-gray-400 mt-1">PDF up to 5MB</p> |
| 87 | + </label> |
12 | 88 | </div> |
13 | | - {!process.env.NEXT_PUBLIC_API_URL && ( |
14 | | - <span className="px-3 py-1 bg-yellow-100 text-yellow-800 rounded-full text-sm font-medium"> |
15 | | - ⚠️ Demo Mode |
16 | | - </span> |
| 89 | + |
| 90 | + {resumeFile && !resumeUploaded && ( |
| 91 | + <button |
| 92 | + onClick={handleResumeUpload} |
| 93 | + className="mt-4 w-full px-4 py-2.5 bg-gray-900 text-white text-sm font-medium rounded-lg hover:bg-gray-700 transition" |
| 94 | + > |
| 95 | + Save Resume |
| 96 | + </button> |
| 97 | + )} |
| 98 | + |
| 99 | + {resumeUploaded && ( |
| 100 | + <div className="mt-4 px-4 py-2.5 bg-green-50 border border-green-200 rounded-lg text-sm text-green-700 text-center"> |
| 101 | + ✓ Resume uploaded successfully |
| 102 | + </div> |
17 | 103 | )} |
18 | 104 | </div> |
19 | | - </div> |
20 | | - <div className="max-w-2xl"> |
21 | | - <div className="bg-white rounded-lg border border-gray-200 p-8"> |
22 | | - <div className="text-center py-12"> |
23 | | - <p className="text-gray-600 text-lg">⚙️ Settings page coming soon!</p> |
24 | | - <p className="text-gray-500 mt-2"> |
25 | | - Here you will be able to configure: |
26 | | - </p> |
27 | | - <ul className="text-gray-600 mt-4 space-y-2"> |
28 | | - <li>✓ Pipeline scheduling</li> |
29 | | - <li>✓ Job preferences and filters</li> |
30 | | - <li>✓ Notification settings</li> |
31 | | - <li>✓ Account preferences</li> |
32 | | - </ul> |
| 105 | + |
| 106 | + {/* Preferences Section */} |
| 107 | + <div className="bg-white rounded-xl border border-gray-200 p-6"> |
| 108 | + <h2 className="text-base font-semibold text-gray-900 mb-1">Preferences</h2> |
| 109 | + <p className="text-sm text-gray-500 mb-4">More settings coming soon.</p> |
| 110 | + <div className="space-y-3 text-sm text-gray-400"> |
| 111 | + <div className="flex items-center gap-2"> |
| 112 | + <span className="w-4 h-4 rounded-full bg-gray-100 flex items-center justify-center text-xs">✓</span> |
| 113 | + Pipeline scheduling |
| 114 | + </div> |
| 115 | + <div className="flex items-center gap-2"> |
| 116 | + <span className="w-4 h-4 rounded-full bg-gray-100 flex items-center justify-center text-xs">✓</span> |
| 117 | + Notification settings |
| 118 | + </div> |
| 119 | + <div className="flex items-center gap-2"> |
| 120 | + <span className="w-4 h-4 rounded-full bg-gray-100 flex items-center justify-center text-xs">✓</span> |
| 121 | + Job preferences |
| 122 | + </div> |
33 | 123 | </div> |
34 | 124 | </div> |
| 125 | + |
35 | 126 | </div> |
36 | 127 | </div> |
37 | 128 | ); |
|
0 commit comments