Skip to content

Commit

Permalink
feat: 사서 본인의 대출 시, 4권까지 가능하도록 lendingLimit 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
mixsung committed Sep 20, 2024
1 parent b612710 commit 0b344a3
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions src/component/rent/Rent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ const Rent = () => {

const { Modal, setOpen: openModal, setClose: closeModal } = useModal();
const user = useRecoilValue(userAtom);
// 사서의 대출권수 4권으로 설정. 사서 본인의 대출건만 4권으로 적용
const lendingLimit = (user.isAdmin && user.id === selectedUser?.id) ? 4 : 2;

return (
<main>
Expand All @@ -32,7 +34,6 @@ const Rent = () => {
titleKO="카뎃 정보"
titleEN="Cadet info"
/>
{/* 사서인 경우 옆에 표시해주면 좋을 것 같다! */}
<RentInquireBoxUser
selectedUser={selectedUser}
setSelectedUser={setSelectedUser}
Expand All @@ -46,18 +47,18 @@ const Rent = () => {
/>
{selectedBooks.length > 0
? selectedBooks.map((book, index) => (
<RentInquireBoxBook
key={book.bookId}
book={book}
shape={
(selectedBooks.length - index) === 1? "two" : "none"
}
selectedBooks={selectedBooks}
setSelectedBooks={setSelectedBooks}
/>
))
<RentInquireBoxBook
key={book.bookId}
book={book}
shape={
(selectedBooks.length - index) === 1 ? "two" : "none"
}
selectedBooks={selectedBooks}
setSelectedBooks={setSelectedBooks}
/>
))
: null}
{selectedBooks.length < 4 ? (
{selectedBooks.length < lendingLimit ? (
<RentInquireBoxBook
book={null}
shape={selectedBooks.length === 0 ? "two" : "four"}
Expand Down

0 comments on commit 0b344a3

Please sign in to comment.