-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
osbelyi
committed
Feb 29, 2024
1 parent
7cea411
commit 1949f98
Showing
28 changed files
with
588 additions
and
304 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
hn_talentmatch.client/src/components/ResumePage/ResumePage.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import React, { useState } from 'react'; | ||
import { Container, Title } from '../../styles/ResumePageStyles.js'; | ||
import ResumeCard from '../resumeCard/ResumeCard'; | ||
import useData from '../../hooks/useData.js'; | ||
import Modal from '../modal/Modal'; | ||
import Pagination from "../pagination/Pagination.jsx"; | ||
|
||
const ResumePage = () => { | ||
const { resumeData, loading, error } = useData(); | ||
const [currentPage, setCurrentPage] = useState(1); | ||
const [resumesPerPage] = useState(10); | ||
const [selectedResume, setSelectedResume] = useState(null); | ||
|
||
const indexOfLastResume = currentPage * resumesPerPage; | ||
const indexOfFirstResume = indexOfLastResume - resumesPerPage; | ||
const currentResumes = resumeData.slice(indexOfFirstResume, indexOfLastResume); | ||
|
||
const paginate = pageNumber => setCurrentPage(pageNumber); | ||
|
||
const handleViewResume = (resume) => { | ||
setSelectedResume(resume); | ||
}; | ||
|
||
const handleCloseDetails = () => { | ||
setSelectedResume(null); | ||
}; | ||
|
||
if (loading) { | ||
return <Container>Loading...</Container>; | ||
} | ||
|
||
if (error) { | ||
return <Container>Error: {error.message}</Container>; | ||
} | ||
|
||
return ( | ||
<Container style={{ display: 'flex', flexDirection: 'column' }}> | ||
<Title>Список резюме</Title> | ||
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: '20px' }}> | ||
{currentResumes.map(resume => ( | ||
<ResumeCard | ||
key={resume.uuid} | ||
resume={resume} | ||
handleViewResume={() => handleViewResume(resume)} | ||
/> | ||
))} | ||
</div> | ||
<Pagination | ||
resumesPerPage={resumesPerPage} | ||
totalResumes={resumeData.length} | ||
paginate={paginate} | ||
/> | ||
{selectedResume && ( | ||
<Modal onClose={handleCloseDetails}> | ||
<ResumeCard | ||
first_name={selectedResume.first_name} | ||
about={selectedResume.about} | ||
/> | ||
</Modal> | ||
)} | ||
</Container> | ||
); | ||
} | ||
|
||
export default ResumePage; |
63 changes: 63 additions & 0 deletions
63
hn_talentmatch.client/src/components/VacancyPage/VacancyPage.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import React, { useState, useEffect } from 'react'; | ||
import { Container, VacancyCardsContainer, VacancyCardView, VacancyTitle, VacancyDescription, VacancyKeywords } from '../../styles/VacancyStyles.js'; | ||
import Modal from '../modal/Modal'; | ||
import VacancyCard from "../vacancyCard/VacancyCard.jsx"; | ||
import useData from '../../hooks/useData'; // Импортируем созданный вами хук | ||
|
||
const VacancyPage = () => { | ||
const { vacancyData, loading, error, getVacancyById } = useData(); // Используем хук useData | ||
|
||
const [selectedVacancy, setSelectedVacancy] = useState(null); | ||
|
||
useEffect(() => { | ||
// Вызываем метод получения данных, если это необходимо | ||
// Пример использования: fetchVacancies(); | ||
}, []); // Указываем зависимость, если это необходимо | ||
|
||
const handleViewDetails = async (vacancyId) => { | ||
try { | ||
const vacancy = await getVacancyById(vacancyId); | ||
setSelectedVacancy(vacancy); | ||
} catch (error) { | ||
console.error("Error fetching vacancy details:", error); | ||
} | ||
}; | ||
|
||
const handleCloseDetails = () => { | ||
setSelectedVacancy(null); | ||
}; | ||
|
||
if (loading) { | ||
return <div>Loading...</div>; // Отображаем индикатор загрузки, пока данные загружаются | ||
} | ||
|
||
if (error) { | ||
return <div>Error: {error.message}</div>; // Отображаем сообщение об ошибке, если произошла ошибка при загрузке данных | ||
} | ||
|
||
return ( | ||
<Container> | ||
<div> | ||
<h2>Список вакансий</h2> | ||
<VacancyCardsContainer> | ||
{vacancyData.map(vacancy => ( | ||
<VacancyCardView key={vacancy.uuid}> | ||
<VacancyTitle>{vacancy.name}</VacancyTitle> | ||
<VacancyDescription>{vacancy.description}</VacancyDescription> | ||
<VacancyKeywords>Требуемые навыки: {vacancy.keywords}</VacancyKeywords> | ||
<button onClick={() => handleViewDetails(vacancy.id)}>Подробнее</button> | ||
</VacancyCardView> | ||
))} | ||
</VacancyCardsContainer> | ||
</div> | ||
|
||
{selectedVacancy && ( | ||
<Modal onClose={handleCloseDetails}> | ||
<VacancyCard vacancyId={selectedVacancy.id} /> | ||
</Modal> | ||
)} | ||
</Container> | ||
); | ||
} | ||
|
||
export default VacancyPage; |
Oops, something went wrong.