Skip to content

Commit

Permalink
Merge pull request #982 from IET-NITK/expo24
Browse files Browse the repository at this point in the history
fixed bug in projects page
  • Loading branch information
iet-nitk-575025 authored Mar 22, 2024
2 parents ae1623f + 2737dc5 commit ad77557
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
14 changes: 6 additions & 8 deletions src/components/ProjectsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ const ProjectsPage = ({ projects, tag, img, sig }) => {
const handlePageClick = (data) => {
setCurrentPage(data.selected);
};

if (tag != "") {
projects = projects.filter(project => project.project_tags.toLowerCase().includes(tag.toLowerCase()))
} else {
projects = projects.filter(project => project.project_sig.toLowerCase() == sig.toLowerCase())
}

useEffect(() => {
Expand All @@ -36,12 +38,8 @@ const ProjectsPage = ({ projects, tag, img, sig }) => {

const indexOfLastProject = (currentPage + 1) * projectsPerPage;
const indexOfFirstProject = indexOfLastProject - projectsPerPage;
let currentProjects
if (tag == "expo24") {
currentProjects = projects.slice(indexOfFirstProject, indexOfLastProject);
} else {
currentProjects = projects.filter(project => project.project_sig.toLowerCase() == sig.toLowerCase()).filter(project => project.project_year == selectedOption).slice(indexOfFirstProject, indexOfLastProject);
}

const currentProjects = projects.slice(indexOfFirstProject, indexOfLastProject);
const pageCount = Math.ceil(projects.length / projectsPerPage);

return (
Expand All @@ -53,7 +51,7 @@ const ProjectsPage = ({ projects, tag, img, sig }) => {
</div>
</section>
}
{(currentProjects.length > 0 && tag != "expo24") &&
{false &&
<div className="flex gap-3 flex-col items-center mt-3">
<div display="flex">
<ul className="flex p-0 m-0 w-full bg-[#ebe5ec] border-[1px] border-[#71287e] rounded-lg list-none shadow-md">
Expand Down
3 changes: 2 additions & 1 deletion src/components/project/projectList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ export default function ProjectList({ img, sig, tag }) {
useEffect(() => {
const fetchData = async () => {
const projectsData = await fetchProjects();
setProjects(projectsData);
let reversed = [...projectsData].reverse()
setProjects(reversed);
};

fetchData();
Expand Down

0 comments on commit ad77557

Please sign in to comment.