fix style names

This commit is contained in:
Victor Batischev
2024-01-31 16:57:22 +03:00
parent 78249348eb
commit 66e6b4c7d7
10 changed files with 28 additions and 44 deletions

View File

@ -0,0 +1,180 @@
import React, { useEffect, useState } from "react";
import { useDispatch } from "react-redux";
import { Link } from "react-router-dom";
import { deleteProject, modalToggle } from "@redux/projectsTrackerSlice";
import { copyProjectLink } from "@utils/helper";
import { apiRequest } from "@api/request";
import { useNotification } from "@hooks/useNotification";
import AcceptModal from "@components/Modal/AcceptModal/AcceptModal";
import { ModalSelect } from "@components/Modal/ModalSelect/ModalSelect";
import TrackerModal from "@components/Modal/Tracker/TrackerModal/TrackerModal";
import archiveSet from "assets/icons/archive.svg";
import del from "assets/icons/delete.svg";
import edit from "assets/icons/edit.svg";
import link from "assets/icons/link.svg";
import avatarProject from "assets/images/avatarMok.png";
import "./projectTicket.scss";
export const ProjectTicket = ({ project, index }) => {
const [modalSelect, setModalSelect] = useState(false);
const [modalAdd, setModalAdd] = useState(false);
const [modalDelete, setModalDelete] = useState(false);
const [acceptModalOpen, setAcceptModalOpen] = useState(false);
const [path, setPath] = useState("");
const dispatch = useDispatch();
const { showNotification } = useNotification();
useEffect(() => {
initListeners();
}, []);
function initListeners() {
document.addEventListener("click", closeByClickingOut);
}
function closeByClickingOut(event) {
const path = event.path || (event.composedPath && event.composedPath());
if (
event &&
!path.find(
(div) =>
div.classList && div.classList.contains(`project-${project.id}`)
)
) {
setModalSelect(false);
}
}
function removeProject() {
apiRequest("/project/update", {
method: "PUT",
data: {
project_id: project.id,
status: 10
}
}).then(() => {
dispatch(deleteProject(project));
showNotification({
show: true,
text: "Проект успешно был перемещен в архив",
type: "archive"
});
});
}
function closeAcceptModal() {
setAcceptModalOpen(false);
setModalDelete(false);
}
function linkProject() {}
return (
<div className={`project project-${project.id}`} key={index}>
<Link
to={`/tracker/project/${project.id}`}
className="project__open-tracker"
>
<div className="project__link">{project.name}</div>
<div className="project__info">
<p>Открытые задачи</p>
<span className="count">
{project.columns.reduce(
(accumulator, currentValue) =>
accumulator + currentValue.tasks.length,
0
)}
</span>
<img src={avatarProject} alt="#" className="project__avatar" />
</div>
</Link>
<span
className="menu-settings"
onClick={() => {
setModalSelect(!modalSelect);
}}
>
...
</span>
<Link
to={`/profile/statistics/${project.id}`}
className="project__statistics"
>
Просмотреть статистику
</Link>
<TrackerModal
active={modalAdd}
setActive={setModalAdd}
defautlInput={project.name}
projectId={project.id}
></TrackerModal>
<ModalSelect active={modalSelect} onClick={(e) => e.stopPropagation()}>
<div className="project__settings-menu">
<div
onClick={() => {
dispatch(modalToggle("edit-project"));
setModalAdd(true);
setModalSelect(false);
}}
>
<img src={edit}></img>
<p>редактировать</p>
</div>
<div>
<img src={link}></img>
<p onClick={copyProjectLink(project.id)}>ссылка на проект</p>
</div>
<div
onClick={() => {
setModalSelect(false);
setAcceptModalOpen(true);
}}
>
<img src={archiveSet}></img>
<p>в архив</p>
</div>
<div
onClick={() => {
setModalDelete(true);
setModalSelect(false);
}}
>
<img src={del}></img>
<p>удалить</p>
</div>
</div>
</ModalSelect>
{acceptModalOpen && (
<AcceptModal
title={"Вы точно хотите переместить проект в архив?"}
closeModal={closeAcceptModal}
agreeHandler={removeProject}
/>
)}
{modalDelete && (
<AcceptModal
title={"Вы точно хотите удалить?"}
closeModal={closeAcceptModal}
agreeHandler={removeProject}
/>
)}
</div>
);
};
export default ProjectTicket;

View File

@ -0,0 +1,113 @@
.project {
display: flex;
flex-direction: column;
position: relative;
width: 322px;
background: #f1f1f1;
border-radius: 12px;
cursor: pointer;
max-width: 440px;
transition: 0.4s;
&:hover {
transition: 0.4s;
box-shadow: 4px 4px 8px 0px rgba(34, 60, 80, 0.11);
}
@media (max-width: 1068px) {
width: 47%;
}
@media (max-width: 785px) {
width: 100%;
}
&__link {
font-weight: 700;
width: 194px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font-size: 18px;
line-height: 32px;
color: #111112;
margin-bottom: 22px;
max-width: 380px;
&:hover {
color: black;
}
}
&__info {
display: flex;
align-items: center;
position: relative;
margin-bottom: 45px;
p {
color: #6f6f6f;
margin-bottom: 0;
font-size: 12px;
font-weight: 500;
line-height: 17px;
width: 60px;
}
.count {
margin-left: 8px;
width: 26px;
height: 26px;
display: flex;
align-items: center;
justify-content: center;
background: #dddddd;
border-radius: 4px;
font-weight: 500;
font-size: 14px;
line-height: 24px;
color: #6f6f6f;
}
.add {
color: #6f6f6f;
font-size: 17px;
margin: 0 25px 0 auto;
@media (max-width: 430px) {
display: none;
}
}
}
.menu-settings {
position: absolute;
font-size: 21px;
color: #6f6f6f;
right: 26px;
top: 10px;
}
&__avatar {
width: 25px;
height: 25px;
margin-left: 56px;
}
&__open-tracker {
padding: 17px 26px 16px;
}
&__statistics {
position: absolute;
bottom: 18px;
left: 26px;
color: #0042b4;
text-decoration: underline;
font-size: 14px;
font-weight: 400;
line-height: 17px;
}
}