diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx
index a2b5d29..c97b420 100644
--- a/frontend/src/App.tsx
+++ b/frontend/src/App.tsx
@@ -37,7 +37,7 @@ function Navbar() {
background: '#B1D4E0',
padding: '8px 16px',
borderRadius: '5px',
- margin: '0 5px'
+ // margin: '0 5px'
};
const session = useContext(SessionContext);
const logout = () => {
@@ -47,10 +47,14 @@ function Navbar() {
const links = session ? (
<>
-
- Home
- Search
- Logout
+
+ Home
+ Search
+ Loading...
) : files.length ? ( -Course: {file.course.name} {file.course.number}
+Professor: {file.professor.name}
+Semester: {file.semester.name}
+Upvotes: {file.upvotes.length}
+Downvotes: {file.downvotes.length}
+Course: {file.course.name} {file.course.number}
+Professor: {file.professor.name}
+Semester: {file.semester.name}
+Upvotes: {file.upvotes.length}
+Downvotes: {file.downvotes.length}
+No results found.
)} diff --git a/frontend/src/styles/App.css b/frontend/src/styles/App.css index b77c0f5..8d255d0 100644 --- a/frontend/src/styles/App.css +++ b/frontend/src/styles/App.css @@ -14,6 +14,11 @@ nav { z-index: 1000; box-sizing: border-box; } +nav div { + display: flex; + align-items: center; + gap: 1rem; +} .App { display: flex; flex-direction: column; diff --git a/frontend/src/styles/Results.module.css b/frontend/src/styles/Results.module.css index 30223ec..88bbef0 100644 --- a/frontend/src/styles/Results.module.css +++ b/frontend/src/styles/Results.module.css @@ -27,17 +27,33 @@ flex-direction: column; align-items: center; justify-content: center; - padding-top: 100px; /* Adjust based on header height to ensure content doesn't overlap */ + margin: auto; - width: 90%; - max-width: 600px; + width: 100vh; + gap: 1rem; } .resultsTable { /* to be filled out */ width: 100%; } - + .fileCard p { + background-color: #1f4f7c; + padding: 1rem; + border-radius: 5px; + } + .fileCard { + display: flex; + flex-direction: row; + align-items: center; + justify-content: center; + padding: 20px; + gap: 1rem; + background-color: #145DA0; + border-radius: 8px; + box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); + min-width: 100vh; + } .searchAgainButton { height: 50px; diff --git a/frontend/src/types/types.ts b/frontend/src/types/types.ts index ff5b577..579b27b 100644 --- a/frontend/src/types/types.ts +++ b/frontend/src/types/types.ts @@ -12,4 +12,28 @@ export interface Topic { id: number; name: string; description: string; +} + +export interface Semester { + id: number; + name: string; +} + +export interface User { + id: string; + username: string; + email: string; + ip_address: string; + points: number; +} + +export interface File { + id: string; + filename: string; + original_author: User; + professor: Professor; + course: Course; + semester: Semester; + upvotes: number[]; + downvotes: number[]; } \ No newline at end of file diff --git a/frontend/src/utils/getAuthHeaders.ts b/frontend/src/utils/getAuthHeaders.ts new file mode 100644 index 0000000..35b4cc5 --- /dev/null +++ b/frontend/src/utils/getAuthHeaders.ts @@ -0,0 +1,10 @@ +import { getSessionCookie } from "../contexts/session"; +export const getAuthHeaders = () => { + const token = getSessionCookie(); + // const token = localStorage.getItem('authToken'); + console.log("Using token for API call:", token); + return { + 'Authorization': `Token ${token}`, + 'Content-Type': 'application/json' + }; + }; \ No newline at end of file