Skip to content

Refactor/staging branch commits #355

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ export default function TruncatedDescription({
content: string;
maxCharacters: number;
}) {

const [showFullContent, setShowFullContent] = useState(false);
const [exceed, setExceed] = useState(false);
const [shortenedContent, setShortenedContent] = useState(" ");

/**
* If the content exceeds the maxCharacters, find the next whitespace
* and make the cutoff point there so the break does not happen mid-word
*
*
* If the new cutoff point is the end of the entire content, make it so
* the See More/Less button does not appear
*/
Expand All @@ -35,7 +35,7 @@ export default function TruncatedDescription({
newMax++;
index++;
}

if (index === content.length) {
setShortenedContent(content);
} else {
Expand All @@ -52,11 +52,11 @@ export default function TruncatedDescription({

return (
<div className="break-words">
<p className="whitespace-pre-line text-justify">
<p className="whitespace-pre-line text-left">
{showFullContent ? content : shortenedContent}
</p>
<div className="mt-1">
{exceed &&
{exceed &&
(
<button
className="text-unilectives-blue hover:underline"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,15 @@ export default function UserBookmarkedReviews({
</div>
)}
{/* Pagination */}
<Pagination
totalItems={reviews.length}
itemPerPage={itemPerPage}
onPageChange={(page: number) => setPage(page)}
/>
{reviews.length > 0 ? (
<Pagination
totalItems={reviews.length}
itemPerPage={itemPerPage}
onPageChange={(page: number) => setPage(page)}
/>
):(
<div className="text-center">No reviews bookmarked yet.</div>
)}
</div>
);
}
15 changes: 10 additions & 5 deletions frontend/src/components/UserReports/UserReports.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
} from "react";
import Dropdown from "../Dropdown/Dropdown";
import Pagination from "../Pagination/Pagination";
import ReviewCard from "../ReviewCard/ReviewCard";

type STATUS = {
UNSEEN: boolean;
Expand Down Expand Up @@ -182,11 +183,15 @@ export default function UserReports({
))}
</div>
{/* Pagination */}
<Pagination
totalItems={reports.length}
itemPerPage={itemPerPage}
onPageChange={(page: number) => setPage(page)}
/>
{reports.length > 0 ? (
<Pagination
totalItems={reports.length}
itemPerPage={itemPerPage}
onPageChange={(page: number) => setPage(page)}
/>
) : (
<div className="text-center">No reports made yet.</div>
)}
</div>
);
}
14 changes: 9 additions & 5 deletions frontend/src/components/UserReviews/UserReviews.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,15 @@ export default function UserReviews({
</div>
)}
{/* Pagination */}
<Pagination
totalItems={reviews.length}
itemPerPage={itemPerPage}
onPageChange={(page: number) => setPage(page)}
/>
{reviews.length > 0 ? (
<Pagination
totalItems={reviews.length}
itemPerPage={itemPerPage}
onPageChange={(page: number) => setPage(page)}
/>
) : (
<div className="text-center">No courses reviewed yet.</div>
)}
</div>
);
}