Skip to content

Commit d5ae198

Browse files
committed
Removed currentClub display, enhanced book selection UI, and improved button functionality for searching books.
1 parent eb2bfcf commit d5ae198

File tree

1 file changed

+37
-36
lines changed

1 file changed

+37
-36
lines changed

src/pages/Profile.tsx

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ export default function Profile() {
2424
const { getBooks } = useBookCache();
2525
const { openBookSearch } = useBookSearchModal();
2626

27-
const currentClub = clubs.find(
28-
(club) => club.isActive && club.members.length > 0
29-
);
30-
3127
const [books, setBooks] = useState<BookData[]>([]);
3228
const [currentBook, setCurrentBook] = useState<{
3329
id: string;
@@ -267,14 +263,43 @@ export default function Profile() {
267263
)}
268264
</div>
269265
) : (
270-
<div className="text-center mb-4">
271-
<h5 className="mb-1">No current book yet</h5>
272-
<p className="text-muted">
273-
Add a book to your shelf to track progress.
266+
<div className="text-center">
267+
<h5 className="mb-2">No current book yet</h5>
268+
<p className="text-muted mb-4">
269+
Select a book from your shelf to track your reading progress.
274270
</p>
275-
<button className="btn btn-outline-success btn-sm me-2" onClick={() => openBookSearch()}>
276-
Search for Books
277-
</button>
271+
272+
{books && books.length > 0 ? (
273+
<div className="d-flex flex-column align-items-center gap-3">
274+
<select
275+
className="form-select"
276+
style={{ maxWidth: "400px", width: "100%" }}
277+
value=""
278+
onChange={(e: React.ChangeEvent<HTMLSelectElement>) => changeCurrentBook(e.target.value)}
279+
>
280+
<option value="" disabled>Select current book</option>
281+
{books.map((b: BookData) => (
282+
<option key={b.id} value={b.id}>
283+
{b.title}
284+
</option>
285+
))}
286+
</select>
287+
<div className="text-muted small mb-2">or</div>
288+
<button
289+
className="btn btn-success"
290+
onClick={() => openBookSearch()}
291+
>
292+
Search for New Books
293+
</button>
294+
</div>
295+
) : (
296+
<button
297+
className="btn btn-success"
298+
onClick={() => openBookSearch()}
299+
>
300+
Search for Books
301+
</button>
302+
)}
278303
</div>
279304
)}
280305

@@ -297,30 +322,6 @@ export default function Profile() {
297322
</div>
298323
)}
299324

300-
{currentClub && (
301-
<div className="mb-3 p-3 bg-light rounded">
302-
<div className="d-flex align-items-center">
303-
<div className="me-3">
304-
<div
305-
className="bg-primary rounded-circle d-flex align-items-center justify-content-center"
306-
style={{ width: "40px", height: "40px" }}
307-
>
308-
<span className="text-white fw-bold">
309-
{currentClub.name.charAt(0)}
310-
</span>
311-
</div>
312-
</div>
313-
<div className="flex-grow-1">
314-
<h6 className="mb-1">{currentClub.name}</h6>
315-
<small className="text-muted">
316-
{currentClub.meetingFrequency}{" "}
317-
{currentClub.members.length} members
318-
</small>
319-
</div>
320-
</div>
321-
</div>
322-
)}
323-
324325
<div className="text-center">
325326
{currentBook && (
326327
<>
@@ -411,7 +412,7 @@ export default function Profile() {
411412
</p>
412413
<div className="row g-3">
413414
{completedBooks.slice(0, 6).map((book) => (
414-
<div key={book.id} className="col-6 col-md-4 col-lg-3">
415+
<div key={book.id} className="col-md-4">
415416
<BookCard item={book} />
416417
</div>
417418
))}

0 commit comments

Comments
 (0)