Skip to content

Commit 5d16716

Browse files
Merge pull request #121 from JumboCode/holden
borrow finishes
2 parents dfcfd21 + 7f85ae1 commit 5d16716

File tree

7 files changed

+219
-203
lines changed

7 files changed

+219
-203
lines changed

frontend/api/approval.js

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -30,29 +30,6 @@ export async function approveHandler(req, res) {
3030
res.status(200).json({ message: "User approved" });
3131
}
3232

33-
export async function checkHandler(req, res) {
34-
const { userId } = req.body;
35-
36-
if (!userId) {
37-
return res.status(400).json({ error: "Missing userId" });
38-
}
39-
40-
const response = await fetch(`https://api.clerk.dev/v1/users/${userId}`, {
41-
headers: {
42-
Authorization: `Bearer sk_test_wGcUTzeo4CJJ2iVUObnFRmkbaPT6pzAXcnonlv8q8w`, // GET RID OF HARDCODED EVENTUALLY
43-
},
44-
});
45-
46-
if (!response.ok) {
47-
return res.status(500).json({ error: "Failed to fetch user from Clerk" });
48-
}
49-
50-
const user = await response.json();
51-
52-
const approved = user.public_metadata?.approved === true;
53-
res.status(200).json({ approved });
54-
}
55-
5633
export async function unapprovedHandler(req, res) {
5734
console.log("Testing unapproved handler");
5835
try {

frontend/src/app/components/BorrowPopup.css

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,20 @@
108108

109109
.borrowed-items-container {
110110
flex: 1;
111-
overflow-y: auto;
111+
/* overflow-y: auto; */
112+
width: 100%;
113+
}
114+
115+
.pagination-container {
112116
width: 100%;
117+
display: flex;
118+
justify-content: center;
119+
margin-top: auto;
120+
}
121+
122+
.pagination {
123+
display: flex;
124+
gap: 0.5rem;
113125
}
114126

115127
.borrowed-item-box {
@@ -204,6 +216,11 @@
204216
.form-group.full-width {
205217
width: 100%;
206218
}
219+
220+
.form-group.half-height {
221+
width: 100%;
222+
height: 50%;
223+
}
207224

208225
.form-group label {
209226
margin-bottom: 0.25rem;
@@ -242,6 +259,10 @@
242259

243260
}
244261

262+
.form-group-dropdown {
263+
font: Akatab;
264+
}
265+
245266
.form-group select.form-group-dropdown {
246267
border: 0.5px solid transparent !important;
247268

@@ -255,12 +276,16 @@
255276
border: 1px solid #9b525f;
256277
font-size: 1rem;
257278
font-family: Arial, sans-serif;
258-
box-sizing: border-box;
259279
width: 100%;
260-
280+
height: 50%;
261281
border-radius: 5px;
262282
box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.25);
263283
}
284+
285+
.form-group textarea {
286+
resize: vertical;
287+
min-height: 100px;
288+
}
264289

265290
.info-form input.non-editable {
266291
background-color: #e0e0e0 !important;
@@ -324,12 +349,6 @@
324349
}
325350

326351

327-
.form-group textarea {
328-
resize: vertical;
329-
min-height: 150px;
330-
}
331-
332-
333352
.form-actions {
334353
display: flex;
335354
justify-content: flex-end;
@@ -473,20 +492,6 @@
473492
background-color: #9B525F;
474493
color: #FFFFFF;
475494
}
476-
477-
.pagination-container {
478-
width: 100%;
479-
display: flex;
480-
justify-content: center;
481-
position: absolute; /* 👈 pins it to bottom */
482-
bottom: 1rem; /* spacing from bottom */
483-
left: 0;
484-
}
485-
486-
.pagination {
487-
display: flex;
488-
gap: 0.5rem;
489-
}
490495

491496

492497
.alert-container {

frontend/src/app/components/BorrowPopup.jsx

Lines changed: 51 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -229,25 +229,58 @@ const BorrowPopup = ({ selectedItems = [], onClose, onSuccess }) => {
229229
</div>
230230

231231
{/* Left column of items to borrow */}
232-
<div className="borrowItemsContent">
233-
{borrowItems.length > 0 ? (
234-
<>
235-
<div className="borrowed-items-container">
236-
{getCurrentPageItems().map((item) => (
237-
<BorrowUnit
238-
key={item.id}
239-
item={item}
240-
onDelete={handleDelete}
241-
/>
242-
))}
243-
</div>
244-
245-
</>
246-
) : (
247-
<p>No items selected.</p>
248-
)}
232+
<div className="leftWrapper">
233+
<div className="borrowItemsContent">
234+
{borrowItems.length > 0 ? (
235+
<>
236+
<div className="borrowed-items-container">
237+
{getCurrentPageItems().map((item) => (
238+
<BorrowUnit
239+
key={item.id}
240+
item={item}
241+
onDelete={handleDelete}
242+
/>
243+
))}
244+
</div>
245+
246+
</>
247+
) : (
248+
<p>No items selected.</p>
249+
)}
250+
</div>
249251
</div>
250-
252+
253+
<div className="pagination-container">
254+
<div className="pagination">
255+
<StylishButton
256+
type="button"
257+
disabled={currentPage === 1}
258+
onClick={() => handlePageChange(currentPage - 1)}
259+
styleType='style4'
260+
>
261+
{"<"}
262+
</StylishButton>
263+
{Array.from({ length: totalPages }, (_, index) => (
264+
<StylishButton
265+
key={index + 1}
266+
type="button"
267+
className={currentPage === index + 1 ? "active" : ""}
268+
onClick={() => handlePageChange(index + 1)}
269+
styleType={currentPage === index + 1 ? 'style5' : 'style4'}
270+
>
271+
{index + 1}
272+
</StylishButton>
273+
))}
274+
<StylishButton
275+
type="button"
276+
disabled={currentPage === totalPages}
277+
onClick={() => handlePageChange(currentPage + 1)}
278+
styleType='style4'
279+
>
280+
{">"}
281+
</StylishButton>
282+
</div>
283+
</div>
251284
</div>
252285

253286
<div className="dividerNew"></div>
@@ -397,37 +430,6 @@ const BorrowPopup = ({ selectedItems = [], onClose, onSuccess }) => {
397430
</div>
398431

399432
</form>
400-
<div className="pagination-container">
401-
<div className="pagination">
402-
<StylishButton
403-
type="button"
404-
disabled={currentPage === 1}
405-
onClick={() => handlePageChange(currentPage - 1)}
406-
styleType='style4'
407-
>
408-
{"<"}
409-
</StylishButton>
410-
{Array.from({ length: totalPages }, (_, index) => (
411-
<StylishButton
412-
key={index + 1}
413-
type="button"
414-
className={currentPage === index + 1 ? "active" : ""}
415-
onClick={() => handlePageChange(index + 1)}
416-
styleType={currentPage === index + 1 ? 'style5' : 'style4'}
417-
>
418-
{index + 1}
419-
</StylishButton>
420-
))}
421-
<StylishButton
422-
type="button"
423-
disabled={currentPage === totalPages}
424-
onClick={() => handlePageChange(currentPage + 1)}
425-
styleType='style4'
426-
>
427-
{">"}
428-
</StylishButton>
429-
</div>
430-
</div>
431433
{isSuccessPopupVisible && (
432434
<div className="success-popup-overlay">
433435
<div className="success-popup">
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
3+
.searchbar-container {
4+
display: flex;
5+
flex-direction: column;
6+
align-items: center;
7+
justify-content: center;
8+
width: 100%;
9+
}
10+
11+
.searchbar-dropdown {
12+
margin-top: 2%;
13+
display: flex;
14+
align-items: left;
15+
justify-content: center;
16+
flex-direction: column;
17+
width: 100%;
18+
}
19+
20+
.borrower:hover {
21+
background-color: #bdbdbd;
22+
cursor: pointer;
23+
}

frontend/src/app/components/BorrowPopupSearchBar.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use client";
22

3-
import "./SearchBar.css";
3+
import "./BorrowPopupSearchBar.css";
44
import { useState, useEffect } from "react";
55

66
export default function BorrowPopupSearchBar({ onSelect }) {
@@ -57,7 +57,7 @@ export default function BorrowPopupSearchBar({ onSelect }) {
5757
{results.map((borrower) => {
5858
const [firstName = "", lastName = ""] = borrower.name.split(" ");
5959
return (
60-
<li key={borrower.id} onClick={() => {
60+
<div className="borrower" key={borrower.id} onClick={() => {
6161
setQuery(borrower.name);
6262
setResults([]);
6363
onSelect?.({
@@ -68,7 +68,7 @@ export default function BorrowPopupSearchBar({ onSelect }) {
6868
});
6969
}}>
7070
{borrower.name}{borrower.email}
71-
</li>
71+
</div>
7272
);
7373
})}
7474
</ul>

0 commit comments

Comments
 (0)