Merge pull request #151 from apuc/registration

Registration
This commit is contained in:
NikoM1k 2023-11-19 20:02:23 +03:00 committed by GitHub
commit 67f3f3b437
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 237 additions and 129 deletions

View File

@ -13,7 +13,11 @@ export const ModalLayout = ({
return ( return (
<div <div
className={active ? `modal-layout active` : "modal-layout"} className={active ? `modal-layout active` : "modal-layout"}
onClick={() => setActive(false)} onClick={(event) => {
if (event.target.className === "modal-layout active") {
setActive(false);
}
}}
{...props} {...props}
> >
<div <div
@ -22,7 +26,6 @@ export const ModalLayout = ({
? `modal-layout__content ${styles}` ? `modal-layout__content ${styles}`
: `modal-layout__content ${type}` : `modal-layout__content ${type}`
} }
onClick={(e) => e.stopPropagation()}
> >
{children} {children}
</div> </div>

View File

@ -45,6 +45,16 @@
font-weight: 300; font-weight: 300;
} }
.addPersonBlock {
display: flex;
flex-direction: column;
justify-content: space-between;
button {
margin: 0 auto;
}
}
.invitePersonBlock { .invitePersonBlock {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@ -64,7 +74,7 @@
} }
&__btn { &__btn {
margin: 0 auto 0 0; margin: 0 auto;
max-width: 242px; max-width: 242px;
width: 100%; width: 100%;
} }

View File

@ -20,6 +20,12 @@ export const ModalRegistration = ({ active, setActive }) => {
password: "", password: "",
}); });
const [inputsError, setInputsError] = useState({
name: false,
email: false,
password: false,
});
const validateEmail = (email) => { const validateEmail = (email) => {
// регулярное выражение для проверки email // регулярное выражение для проверки email
const re = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; const re = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
@ -37,20 +43,29 @@ export const ModalRegistration = ({ active, setActive }) => {
}; };
const { showNotification } = useNotification(); const { showNotification } = useNotification();
const submitHandler = () => {
if (!inputsValue.password || !inputsValue.userName || !inputsValue.email) { const validateForm = () => {
return showNotification({ if (inputsValue.password.length < 6) {
show: true, setInputsError((prevValue) => ({ ...prevValue, password: true }));
text: "Введите коректные данные", }
type: "error", if (inputsValue.userName.length < 6) {
}); setInputsError((prevValue) => ({ ...prevValue, name: true }));
} }
if (!validateEmail(inputsValue.email)) { if (!validateEmail(inputsValue.email)) {
return showNotification({ setInputsError((prevValue) => ({ ...prevValue, email: true }));
show: true, }
text: "Введите коректный email", if (
type: "error", inputsValue.password.length < 6 ||
}); inputsValue.userName.length < 6 ||
!validateEmail(inputsValue.email)
) {
return true;
}
};
const submitHandler = () => {
if (validateForm()) {
return;
} }
apiRequest("/register/sign-up", { apiRequest("/register/sign-up", {
method: "POST", method: "POST",
@ -90,43 +105,70 @@ export const ModalRegistration = ({ active, setActive }) => {
<div className="input-body"> <div className="input-body">
<div className="input-body__box"> <div className="input-body__box">
<h5>Ваше имя</h5> <div className="inputContainer">
<input <h5>Ваше имя</h5>
onChange={(e) => <input
setInputsValue((prevValue) => ({ className={inputsError.name ? "error" : ""}
...prevValue, onChange={(e) => {
userName: e.target.value, setInputsError({
})) name: false,
} email: false,
placeholder="Name" password: false,
/> });
<h5>E-mail</h5> setInputsValue((prevValue) => ({
<input ...prevValue,
type="email" userName: e.target.value,
onChange={(e) => }));
setInputsValue((prevValue) => ({ }}
...prevValue, placeholder="Name"
email: e.target.value, />
})) {inputsError.name && <span>Минимум 6 символов</span>}
} </div>
placeholder="Email" <div className="inputContainer">
/> <h5>E-mail</h5>
<input
type="email"
className={inputsError.email ? "error" : ""}
onChange={(e) => {
setInputsError({
name: false,
email: false,
password: false,
});
setInputsValue((prevValue) => ({
...prevValue,
email: e.target.value,
}));
}}
placeholder="Email"
/>
{inputsError.email && <span>Введите коректный email</span>}
</div>
</div> </div>
<div className="input-body__box"> <div className="input-body__box">
{/*<h5>Название компании</h5>*/} {/*<h5>Название компании</h5>*/}
{/*<input></input>*/} {/*<input></input>*/}
<h5>Пароль</h5> <div className="inputContainer">
<input <h5>Пароль</h5>
type="password" <input
onChange={(e) => className={inputsError.password ? "error" : ""}
setInputsValue((prevValue) => ({ type="password"
...prevValue, onChange={(e) => {
password: e.target.value, setInputsError({
})) name: false,
} email: false,
placeholder="Password" password: false,
/> });
setInputsValue((prevValue) => ({
...prevValue,
password: e.target.value,
}));
}}
placeholder="Password"
/>
{inputsError.password && <span>Минимум 6 символов</span>}
</div>
</div> </div>
</div> </div>
<div className="button-box"> <div className="button-box">

View File

@ -59,9 +59,24 @@
background: #eff2f7; background: #eff2f7;
border-radius: 8px; border-radius: 8px;
border: none; border: none;
margin-bottom: 35px; margin-bottom: 5px;
padding-left: 20px; padding-left: 20px;
} }
.inputContainer {
height: 81px;
margin-bottom: 10px;
max-width: 294px;
}
span {
color: red;
font-size: 12px;
}
.error {
border: 1px solid red;
}
} }
} }

View File

@ -5,7 +5,7 @@
background: #e1fccf; background: #e1fccf;
border-radius: 12px; border-radius: 12px;
transform: scale(0); transform: scale(0);
bottom: -90px; bottom: -40px;
right: -120px; right: -120px;
@media (max-width: 1050px) { @media (max-width: 1050px) {

View File

@ -80,7 +80,7 @@ export const ModalTiсket = ({
const [users, setUsers] = useState([]); const [users, setUsers] = useState([]);
const [timerStart, setTimerStart] = useState(false); const [timerStart, setTimerStart] = useState(false);
const [timerInfo, setTimerInfo] = useState({}); const [timerInfo, setTimerInfo] = useState({});
const [uploadedFile, setUploadedFile] = useState(null); // const [uploadedFile, setUploadedFile] = useState(null);
const [currentTimerCount, setCurrentTimerCount] = useState({ const [currentTimerCount, setCurrentTimerCount] = useState({
hours: 0, hours: 0,
minute: 0, minute: 0,
@ -379,25 +379,26 @@ export const ModalTiсket = ({
const data = await res.json(); const data = await res.json();
setUploadedFile(data); // setUploadedFile(data);
attachFile(data[0].id);
} }
function deleteLoadedFile() { // function deleteLoadedFile() {
setUploadedFile(null); // setUploadedFile(null);
} // }
function attachFile() { function attachFile(id) {
apiRequest("/file/attach", { apiRequest("/file/attach", {
method: "POST", method: "POST",
data: { data: {
file_id: uploadedFile[0].id, file_id: id,
entity_type: 2, entity_type: 2,
entity_id: task.id, entity_id: task.id,
status: 1, status: 1,
}, },
}).then((res) => { }).then((res) => {
setTaskFiles((prevValue) => [...prevValue, res]); setTaskFiles((prevValue) => [...prevValue, res]);
setUploadedFile(null); // setUploadedFile(null);
}); });
} }
@ -636,24 +637,24 @@ export const ModalTiсket = ({
})} })}
</div> </div>
)} )}
{uploadedFile && ( {/*{uploadedFile && (*/}
<div className="fileLoaded"> {/* <div className="fileLoaded">*/}
{uploadedFile.map((file) => { {/* {uploadedFile.map((file) => {*/}
return ( {/* return (*/}
<div className="loadedFile" key={file.id}> {/* <div className="loadedFile" key={file.id}>*/}
<img src={backendImg(file.url)} alt="img" key={file.id} /> {/* <img src={backendImg(file.url)} alt="img" key={file.id} />*/}
<div {/* <div*/}
className="deleteFile" {/* className="deleteFile"*/}
onClick={() => deleteLoadedFile(file)} {/* onClick={() => deleteLoadedFile(file)}*/}
> {/* >*/}
<img src={close} alt="delete" /> {/* <img src={close} alt="delete" />*/}
</div> {/* </div>*/}
</div> {/* </div>*/}
); {/* );*/}
})} {/* })}*/}
<button onClick={attachFile}>Загрузить</button> {/* <button onClick={attachFile}>Загрузить</button>*/}
</div> {/* </div>*/}
)} {/*)}*/}
<div className="content__communication"> <div className="content__communication">
{/*<p className="tasks">*/} {/*<p className="tasks">*/}
{/* <button*/} {/* <button*/}

View File

@ -360,24 +360,8 @@
column-gap: 25px; column-gap: 25px;
row-gap: 20px; row-gap: 20px;
margin-top: 33px; margin-top: 33px;
max-height: 170px;
overflow-y: auto; overflow-y: auto;
&::-webkit-scrollbar {
width: 5px;
border-radius: 10px;
}
&::-webkit-scrollbar-thumb {
background: #cbd9f9;
border-radius: 20px;
}
&::-webkit-scrollbar-track {
background: #c5c0c6;
border-radius: 20px;
}
.taskFile { .taskFile {
cursor: pointer; cursor: pointer;
position: relative; position: relative;

View File

@ -29,6 +29,7 @@ import { useNotification } from "@hooks/useNotification";
import { getCorrectDate } from "@components/Calendar/calendarHelper"; import { getCorrectDate } from "@components/Calendar/calendarHelper";
import { Footer } from "@components/Common/Footer/Footer"; import { Footer } from "@components/Common/Footer/Footer";
import { Loader } from "@components/Common/Loader/Loader"; import { Loader } from "@components/Common/Loader/Loader";
import FileTracker from "@components/FileTracker/FileTracker";
import AcceptModal from "@components/Modal/AcceptModal/AcceptModal"; import AcceptModal from "@components/Modal/AcceptModal/AcceptModal";
import TrackerModal from "@components/Modal/Tracker/TrackerModal/TrackerModal"; import TrackerModal from "@components/Modal/Tracker/TrackerModal/TrackerModal";
import { Navigation } from "@components/Navigation/Navigation"; import { Navigation } from "@components/Navigation/Navigation";
@ -483,20 +484,26 @@ export const TicketFullScreen = () => {
setUploadedFile(null); setUploadedFile(null);
} }
// function deleteFile(file) {
// apiRequest("/file/detach", {
// method: "DELETE",
// data: {
// file_id: file.id,
// entity_type: 2,
// entity_id: taskInfo.id,
// status: 0,
// },
// }).then(() => {
// setTaskFiles((prevValue) =>
// prevValue.filter((item) => item.id !== file.id)
// );
// });
// }
function deleteFile(file) { function deleteFile(file) {
apiRequest("/file/detach", { setTaskFiles((prevValue) =>
method: "DELETE", prevValue.filter((item) => item.id !== file.id)
data: { );
file_id: file.id,
entity_type: 2,
entity_id: taskInfo.id,
status: 0,
},
}).then(() => {
setTaskFiles((prevValue) =>
prevValue.filter((item) => item.id !== file.id)
);
});
} }
function closeAcceptModal() { function closeAcceptModal() {
@ -800,19 +807,12 @@ export const TicketFullScreen = () => {
<div className="task__files filesFullScreen"> <div className="task__files filesFullScreen">
{taskFiles.map((file) => { {taskFiles.map((file) => {
return ( return (
<div className="taskFile" key={file.id}> <FileTracker
<img key={file.id}
className="imgFile" file={file}
src={backendImg(file.file?.url)} setDeletedTask={deleteFile}
alt="img" taskId={taskInfo.id}
/> />
<div
className="deleteFile"
onClick={() => deleteFile(file)}
>
<img src={fileDelete} alt="delete" />
</div>
</div>
); );
})} })}
</div> </div>

View File

@ -322,6 +322,7 @@ export const TrackerModal = ({
} else { } else {
setCorrectProjectUsers(projectUsers); setCorrectProjectUsers(projectUsers);
} }
initListeners();
}, [active]); }, [active]);
useEffect(() => { useEffect(() => {
@ -336,6 +337,38 @@ export const TrackerModal = ({
} }
}, [taskTags, projectMarks]); }, [taskTags, projectMarks]);
const initListeners = () => {
document.addEventListener("click", closeByClickingOut);
};
const closeByClickingOut = (event) => {
const path = event.path || (event.composedPath && event.composedPath());
if (
event &&
!path.find(
(div) =>
div.classList &&
(div.classList.contains("tags__selected__name") ||
div.classList.contains("tags__dropDown"))
)
) {
setSelectTagsOpen(false);
}
if (
event &&
!path.find(
(div) =>
div.classList &&
(div.classList.contains("select__executor") ||
div.classList.contains("select__executor__dropDown"))
)
) {
setSelectExecutorTaskOpen(false);
}
};
return ( return (
<ModalLayout <ModalLayout
active={active} active={active}

View File

@ -43,7 +43,10 @@ export const ProjectTiket = ({ project, index }) => {
if ( if (
event && event &&
!path.find((item) => item.classList && item.classList.contains("project")) !path.find(
(div) =>
div.classList && div.classList.contains(`project-${project.id}`)
)
) { ) {
setModalSelect(false); setModalSelect(false);
} }
@ -73,7 +76,7 @@ export const ProjectTiket = ({ project, index }) => {
function linkProject() {} function linkProject() {}
return ( return (
<div className="project" key={index}> <div className={`project project-${project.id}`} key={index}>
<Link <Link
to={`/tracker/project/${project.id}`} to={`/tracker/project/${project.id}`}
className="project__open-traker" className="project__open-traker"
@ -93,7 +96,12 @@ export const ProjectTiket = ({ project, index }) => {
</div> </div>
</Link> </Link>
<span className="menu-settings" onClick={() => setModalSelect(true)}> <span
className="menu-settings"
onClick={() => {
setModalSelect(!modalSelect);
}}
>
... ...
</span> </span>

View File

@ -87,7 +87,7 @@
font-size: 21px; font-size: 21px;
color: #6f6f6f; color: #6f6f6f;
right: 26px; right: 26px;
top: 59px; top: 10px;
} }
&__avatar { &__avatar {
@ -104,10 +104,10 @@
position: absolute; position: absolute;
bottom: 18px; bottom: 18px;
left: 26px; left: 26px;
color: #678eda; color: #0042b4;
text-decoration: underline; text-decoration: underline;
font-size: 12px; font-size: 14px;
font-weight: 300; font-weight: 400;
line-height: 17px; line-height: 17px;
} }
} }

View File

@ -151,6 +151,9 @@ export const Summary = () => {
</a> </a>
); );
})} })}
{!Boolean(gitInfo.length) && (
<p className="noGitItems">Нет актуальных проектов</p>
)}
</div> </div>
</div> </div>
)} )}

View File

@ -298,6 +298,16 @@
column-gap: 25px; column-gap: 25px;
justify-content: space-between; justify-content: space-between;
.noGitItems {
width: 100%;
font-size: 20px;
background: #FFFFFF;
border-radius: 12px;
padding: 35px 30px 30px 45px;
color: #000000;
font-weight: 600;
}
.gitItem { .gitItem {
width: 48%; width: 48%;
display: flex; display: flex;

View File

@ -391,9 +391,9 @@
flex-direction: column; flex-direction: column;
background: linear-gradient(180deg, #ffffff 0%, #ebebeb 100%); background: linear-gradient(180deg, #ffffff 0%, #ebebeb 100%);
border-radius: 40px; border-radius: 40px;
padding: 31px 128px 41px 49px; padding: 15px 30px;
cursor: default; cursor: default;
width: 650px; width: 800px;
&__close { &__close {
cursor: pointer; cursor: pointer;
@ -410,7 +410,6 @@
align-items: end; align-items: end;
color: #1458dd; color: #1458dd;
font-size: 22px; font-size: 22px;
margin-top: 10px;
span { span {
font-size: 44px; font-size: 44px;
font-weight: 700; font-weight: 700;
@ -462,7 +461,7 @@
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
max-width: 190px; max-width: 300px;
width: 100%; width: 100%;
.avatar { .avatar {
@ -479,7 +478,7 @@
color: #807777; color: #807777;
width: auto; width: auto;
height: auto; height: auto;
max-width: 130px; max-width: 215px;
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;