From 8106d2b27922955e2fd28bea83f8b0fd8204b582 Mon Sep 17 00:00:00 2001 From: Amudieshwar A G Date: Thu, 23 Jul 2026 22:56:11 +0530 Subject: [PATCH] design: restore custom notes card UI design and add subject dropdown filter --- src/pages/Notes/Notes.tsx | 132 ++++++++++++++++++++++++++++++-------- 1 file changed, 104 insertions(+), 28 deletions(-) diff --git a/src/pages/Notes/Notes.tsx b/src/pages/Notes/Notes.tsx index cfc12f6..a5f0dec 100644 --- a/src/pages/Notes/Notes.tsx +++ b/src/pages/Notes/Notes.tsx @@ -8,7 +8,33 @@ import { TOOLKIT_ITEMS, DEPARTMENTS } from '@/constants'; const SEMESTERS = ['All', '1st Sem', '2nd Sem', '3rd Sem', '4th Sem', '5th Sem', '6th Sem', '7th Sem', '8th Sem']; -const TYPE_COLORS: Record }> = { +const SUBJECTS_BY_SEM: Record = { + 1: [ + "Communicative English", + "Matrices and Calculus", + "Physics for Information Science", + "Problem Solving and C Programming", + "Basic Electrical and Electronics Engineering", + "Heritage of Tamils", + "Physics Laboratory", + "Problem Solving and C Programming Laboratory", + "Engineering Practices Laboratory" + ], + 2: [ + "Professional English", + "Engineering Chemistry", + "Statistics and Numerical Methods", + "Python for Data Science", + "Tamils and Technology", + "Engineering Graphics", + "Data Structures Design", + "Chemistry Laboratory", + "Python for Data Science Laboratory", + "Communication Laboratory" + ] +}; + +const TYPE_COLORS: Record }> = { notes: { bg: '#EFF6FF', text: '#3B82F6', icon: BookOpen }, pyq: { bg: '#FFF7ED', text: '#F97316', icon: FileText }, syllabus: { bg: '#ECFDF5', text: '#10B981', icon: ScrollText }, @@ -1294,6 +1320,7 @@ export default function Notes() { const [selectedSem, setSelectedSem] = useState('All'); const [selectedDept, setSelectedDept] = useState('All Departments'); const [selectedType, setSelectedType] = useState('all'); + const [selectedSubject, setSelectedSubject] = useState('All Subjects'); const [searchParams, setSearchParams] = useSearchParams(); const selectedToolkit = searchParams.get('toolkit'); const [selectedCategory, setSelectedCategory] = useState(null); @@ -1365,7 +1392,8 @@ export default function Notes() { const matchSem = selectedSem === 'All' || note.semester === parseInt(selectedSem); const matchDept = selectedDept === 'All Departments' || note.department === selectedDept || note.department === 'All Departments'; const matchType = selectedType === 'all' || note.type === selectedType; - return matchSearch && matchSem && matchDept && matchType; + const matchSubject = selectedSubject === 'All Subjects' || note.subject === selectedSubject; + return matchSearch && matchSem && matchDept && matchType && matchSubject; }); return ( @@ -1920,12 +1948,12 @@ export default function Notes() { {/* Semester Filter */} -
+
{SEMESTERS.slice(0, 5).map((sem) => ( ))}
+ + {/* Subject Dropdown */} + {selectedSem !== 'All' && ( +
+ Subject: + +
+ )}
{/* Results */} - + {filtered.map((note) => { - const typeConfig = TYPE_COLORS[note.type]; + const typeConfig = TYPE_COLORS[note.type] || { bg: '#F1F5F9', text: '#475569', icon: BookOpen }; const TypeIcon = typeConfig.icon; return ( -
-
- +
+ {/* Visual PDF Preview Icon */} +
+
+ PDF +
+
+
+
+
+
+
+ + {/* Text Details */} +
+
+
+
+ +
+ + {note.type} + +
+

+ {note.title} +

+

+ {note.subject} • Sem {note.semester} +

+
- - {note.type} -
-
-

- {note.title} -

-

- {note.subject} · Sem {note.semester} -

-
-
- {note.downloads} downloads · {note.fileSize} + + {/* Metadata Line */} +
+
+ {note.downloads} downloads · {note.fileSize} + PDF +
+ {note.uploadedAt ? `Updated ${note.uploadedAt}` : 'Recently'}
+ + {/* Download Button */}