+
Загальна інформація
+
{user && profile && mainProfile ? (
) : (
@@ -590,6 +594,4 @@ GeneralInfo.propTypes = {
path: PropTypes.string,
}),
}).isRequired,
- currentFormNameHandler: PropTypes.func,
- curForm: PropTypes.string,
};
diff --git a/FrontEnd/src/pages/ProfilePage/FormComponents/ProductServiceInfo.jsx b/FrontEnd/src/pages/ProfilePage/FormComponents/ProductServiceInfo.jsx
index 54aade2c0..80fcafa29 100644
--- a/FrontEnd/src/pages/ProfilePage/FormComponents/ProductServiceInfo.jsx
+++ b/FrontEnd/src/pages/ProfilePage/FormComponents/ProductServiceInfo.jsx
@@ -8,6 +8,7 @@ import defineChanges from '../../../utils/defineChanges';
import { useAuth, useProfile } from '../../../hooks';
import TextField from './FormFields/TextField';
import Loader from '../../../components/Loader/Loader';
+import ProfileFormButton from '../UI/ProfileFormButton/ProfileFormButton';
import css from './FormComponents.module.css';
const LABELS = {
@@ -33,10 +34,6 @@ const ProductServiceInfo = (props) => {
setFormIsDirty(isDirty);
}, [mainProfile, profile]);
- useEffect(() => {
- props.currentFormNameHandler(props.curForm);
- }, []);
-
const onUpdateTextAreaField = (e) => {
if (e.target.value.length <= TEXT_AREA_MAX_LENGTH)
setProfile((prevState) => {
@@ -69,6 +66,8 @@ const ProductServiceInfo = (props) => {
return (
+
Інформація про товари/послуги
+
{user && profile && mainProfile ? (
+
+
) : (
diff --git a/FrontEnd/src/pages/ProfilePage/FormComponents/StartupInfo.jsx b/FrontEnd/src/pages/ProfilePage/FormComponents/StartupInfo.jsx
index 376338db9..5b22b8d6a 100644
--- a/FrontEnd/src/pages/ProfilePage/FormComponents/StartupInfo.jsx
+++ b/FrontEnd/src/pages/ProfilePage/FormComponents/StartupInfo.jsx
@@ -8,6 +8,7 @@ import defineChanges from '../../../utils/defineChanges';
import { useAuth, useProfile } from '../../../hooks';
import TextField from './FormFields/TextField';
import Loader from '../../../components/Loader/Loader';
+import ProfileFormButton from '../UI/ProfileFormButton/ProfileFormButton';
import css from './FormComponents.module.css';
const LABELS = {
@@ -31,10 +32,6 @@ const StartupInfo = (props) => {
setFormIsDirty(isDirty);
}, [mainProfile, profile]);
- useEffect(() => {
- props.currentFormNameHandler(props.curForm);
- }, []);
-
const onUpdateTextAreaField = (e) => {
if (e.target.value.length <= TEXT_AREA_MAX_LENGTH)
setProfile((prevState) => {
@@ -67,6 +64,8 @@ const StartupInfo = (props) => {
return (
+
Стартап
+
{user && profile && mainProfile ? (
+
+
) : (
diff --git a/FrontEnd/src/pages/ProfilePage/FormComponents/UserInfo.jsx b/FrontEnd/src/pages/ProfilePage/FormComponents/UserInfo.jsx
index 329f01315..43679bfdf 100644
--- a/FrontEnd/src/pages/ProfilePage/FormComponents/UserInfo.jsx
+++ b/FrontEnd/src/pages/ProfilePage/FormComponents/UserInfo.jsx
@@ -8,6 +8,7 @@ import checkFormIsDirty from '../../../utils/checkFormIsDirty';
import defineChanges from '../../../utils/defineChanges';
import HalfFormField from './FormFields/HalfFormField';
import Loader from '../../../components/Loader/Loader';
+import ProfileFormButton from '../UI/ProfileFormButton/ProfileFormButton';
import css from './FormComponents.module.css';
const LABELS = {
@@ -51,9 +52,6 @@ const UserInfo = (props) => {
setFormIsDirty(isDirty);
}, [user, profile, updateUser, updateProfile]);
- useEffect(() => {
- props.currentFormNameHandler(props.curForm);
- }, []);
const errorMessageTemplates = {
requiredField: 'Обов’язкове поле',
@@ -192,6 +190,8 @@ const UserInfo = (props) => {
return (
+
Інформація про користувача
+
{updateUser && user && profile && updateProfile ? (
) : (
diff --git a/FrontEnd/src/pages/ProfilePage/FormComponents/WarnUnsavedDataModal.jsx b/FrontEnd/src/pages/ProfilePage/FormComponents/WarnUnsavedDataModal.jsx
index 93249ba0d..4cf591df0 100644
--- a/FrontEnd/src/pages/ProfilePage/FormComponents/WarnUnsavedDataModal.jsx
+++ b/FrontEnd/src/pages/ProfilePage/FormComponents/WarnUnsavedDataModal.jsx
@@ -19,12 +19,12 @@ const WarnUnsavedDataModal = ({ onCancel, onConfirm }) => {
-
+
diff --git a/FrontEnd/src/pages/ProfilePage/FormComponents/WarnUnsavedDataModal.module.css b/FrontEnd/src/pages/ProfilePage/FormComponents/WarnUnsavedDataModal.module.css
index a3585857b..b00c52de1 100644
--- a/FrontEnd/src/pages/ProfilePage/FormComponents/WarnUnsavedDataModal.module.css
+++ b/FrontEnd/src/pages/ProfilePage/FormComponents/WarnUnsavedDataModal.module.css
@@ -1,9 +1,9 @@
.modal {
display: flex;
- width: 572px;
+ width: 345px;
flex-direction: column;
align-items: flex-start;
- border-radius: 2px;
+ border-radius: 6px;
background: var(--Conditional-pop-over, #FFF);
box-shadow: 0px 9px 28px 8px rgba(0, 0, 0, 0.05), 0px 6px 16px 0px rgba(0, 0, 0, 0.08), 0px 3px 6px -4px rgba(0, 0, 0, 0.12);
}
@@ -14,7 +14,6 @@
justify-content: space-between;
align-items: center;
align-self: stretch;
- background: var(--main-white, #FFF);
box-shadow: 0px -1px 0px 0px #F0F0F0 inset;
}
@@ -50,7 +49,6 @@
}
.modal-content--text {
- width: 524px;
align-self: stretch;
color: var(--Main-Black-90, #292E32);
font-feature-settings: 'calt' off;
@@ -64,12 +62,11 @@
.modal-footer {
display: flex;
- padding: 10px 16px;
- justify-content: flex-end;
+ padding: 10px 16px 10px 24px;
+ justify-content: flex-start;
align-items: center;
gap: 8px;
align-self: stretch;
- background: var(--main-white, #FFF);
box-shadow: 0px 1px 0px 0px #F0F0F0 inset;
}
@@ -106,7 +103,17 @@
}
.modal-footer--button-continue {
- border: 1px solid var(--Primary-Green-80, #1F9A7C);
- background: var(--Primary-Green-80, #1F9A7C);
+ border: 1px solid var(--main-button-color, #000000);
+ background: var(--main-button-color, #000000);
color: var(--main-white, #FFF);
+}
+
+@media only screen and (min-width: 768px) {
+ .modal {
+ width: 572px;
+ }
+
+ .modal-content {
+ height: 53px;
+ }
}
\ No newline at end of file
diff --git a/FrontEnd/src/pages/ProfilePage/Mobile/Accordion.jsx b/FrontEnd/src/pages/ProfilePage/Mobile/Accordion.jsx
new file mode 100644
index 000000000..24d88e974
--- /dev/null
+++ b/FrontEnd/src/pages/ProfilePage/Mobile/Accordion.jsx
@@ -0,0 +1,41 @@
+import { useState, useContext } from 'react';
+import AccordionItem from './AccordionItem';
+import MyModal from '../UI/MyModal/MyModal';
+import WarnUnsavedDataModal from '../FormComponents/WarnUnsavedDataModal';
+import { DirtyFormContext } from '../../../context/DirtyFormContext';
+
+const Accordion = ({ sections }) => {
+ const [showWarningModal, setShowWarningModal] = useState(false);
+ const { setFormIsDirty } = useContext(DirtyFormContext);
+
+ const onConfirmModal = () => {
+ setShowWarningModal(false);
+ setFormIsDirty(false);
+ };
+
+ const onCancelModal = () => {
+ setShowWarningModal(false);
+ };
+
+ return (
+ <>
+
+ {sections.map((section) => (
+
setShowWarningModal(true)} />
+ ))}
+
+
+
+
+ >
+ );
+};
+
+export default Accordion;
\ No newline at end of file
diff --git a/FrontEnd/src/pages/ProfilePage/Mobile/Accordion.module.css b/FrontEnd/src/pages/ProfilePage/Mobile/Accordion.module.css
new file mode 100644
index 000000000..e69de29bb
diff --git a/FrontEnd/src/pages/ProfilePage/Mobile/AccordionItem.jsx b/FrontEnd/src/pages/ProfilePage/Mobile/AccordionItem.jsx
new file mode 100644
index 000000000..624678ec1
--- /dev/null
+++ b/FrontEnd/src/pages/ProfilePage/Mobile/AccordionItem.jsx
@@ -0,0 +1,32 @@
+import { useState, useContext } from 'react';
+import css from './AccordionItem.module.css';
+import { DirtyFormContext } from '../../../context/DirtyFormContext';
+
+const AccordionItem = (props) => {
+ const [isOpen, setIsOpen] = useState(false);
+ const { formIsDirty } = useContext(DirtyFormContext);
+
+ const toggle = () => {
+ if (!props.disabled) {
+ formIsDirty ? props.warningHandler() : setIsOpen(!isOpen);
+ }
+ };
+
+ return (
+
+
+
+
+ {props.content}
+
+
+ );
+};
+
+export default AccordionItem;
\ No newline at end of file
diff --git a/FrontEnd/src/pages/ProfilePage/Mobile/AccordionItem.module.css b/FrontEnd/src/pages/ProfilePage/Mobile/AccordionItem.module.css
new file mode 100644
index 000000000..5ca64ecdd
--- /dev/null
+++ b/FrontEnd/src/pages/ProfilePage/Mobile/AccordionItem.module.css
@@ -0,0 +1,54 @@
+.accordion-content {
+ max-height: 2500px;
+ transition: max-height 0.5s ease-in-out;
+ overflow: hidden;
+ border-radius: 6px;
+}
+
+.accordion-content.close {
+ max-height: 0;
+}
+
+.accordion-button {
+ display: flex;
+ background-color: var(--main-white);
+ font-family: var(--font-main);
+ font-size: 16px;
+ width: 335px;
+ margin-left: 3px;
+ text-align: left;
+ padding: 4px 6px;
+ position: relative;
+ border-radius: 10px;
+ padding-top: 13px;
+ height: 49px;
+ cursor: pointer;
+ color: var(--link-text-color);
+}
+
+.accordion-button img {
+ top: 20px;
+ position: absolute;
+ right: 5px;
+}
+
+.accordion-item {
+ border-radius: 6px;
+ width: 342px;
+ background-color: var(--main-white);
+ margin: 6px;
+}
+
+.divider {
+ width: 100%;
+ height: 1px;
+ background-color: var(--light-seashell-background);
+}
+
+.danger {
+ color: var(--delete-text-color);
+}
+
+.disabled {
+ color: var(--disabled-link);
+}
\ No newline at end of file
diff --git a/FrontEnd/src/pages/ProfilePage/Mobile/EditProfileMobile.jsx b/FrontEnd/src/pages/ProfilePage/Mobile/EditProfileMobile.jsx
new file mode 100644
index 000000000..befa4f204
--- /dev/null
+++ b/FrontEnd/src/pages/ProfilePage/Mobile/EditProfileMobile.jsx
@@ -0,0 +1,70 @@
+import Accordion from './Accordion';
+import AdditionalInfo from '../FormComponents/AdditionalInfo';
+import ContactsInfo from '../FormComponents/ContactsInfo';
+import DeleteProfilePage from '../FormComponents/DeleteProfileComponent/DeleteProfilePage';
+import GeneralInfo from '../FormComponents/GeneralInfo';
+import ProductServiceInfo from '../FormComponents/ProductServiceInfo';
+import StartupInfo from '../FormComponents/StartupInfo';
+import UserInfo from '../FormComponents/UserInfo';
+import ChangePassword from '../FormComponents/ChangePassword';
+import Loader from '../../../components/Loader/Loader';
+import { useAuth, useProfile } from '../../../hooks';
+import css from './EditProfileMobile.module.css';
+
+
+
+
+const EditProfileMobile = () => {
+ const { user } = useAuth();
+ const { profile } = useProfile();
+ if (user && profile) {
+ const sections = [
+ {
+ title: 'Інформація про користувача',
+ content:
+ },
+ {
+ title: 'Загальна інформація',
+ content:
+ },
+ {
+ title: 'Контакти',
+ content:
+ },
+ {
+ title: 'Інформація про товари/послуги',
+ content:
,
+ disabled: !profile.is_registered
+ },
+ {
+ title: 'Додаткова інформація',
+ content:
,
+ disabled: !profile.is_registered
+ },
+ {
+ title: 'Стартап',
+ content:
,
+ disabled: !profile.is_startup
+ },
+ {
+ title: 'Змінити пароль',
+ content:
+ },
+ {
+ title: 'Видалити профіль',
+ content:
+ },
+ ];
+ return (
+
+
Профіль користувача
+
+
+ );
+ } else {
+ return
;
+ }
+};
+
+export default EditProfileMobile;
\ No newline at end of file
diff --git a/FrontEnd/src/pages/ProfilePage/Mobile/EditProfileMobile.module.css b/FrontEnd/src/pages/ProfilePage/Mobile/EditProfileMobile.module.css
new file mode 100644
index 000000000..ddce67b96
--- /dev/null
+++ b/FrontEnd/src/pages/ProfilePage/Mobile/EditProfileMobile.module.css
@@ -0,0 +1,13 @@
+.container {
+ width: 343px;
+ padding: 20px 16px;
+ background-color: #F9F5EC;
+ margin: auto;
+}
+
+.head {
+ font-family: var(--font-main);
+ font-size: 20px;
+ font-weight: 700;
+ padding: 14px 8px;
+}
\ No newline at end of file
diff --git a/FrontEnd/src/pages/ProfilePage/ProfilePage.jsx b/FrontEnd/src/pages/ProfilePage/ProfilePage.jsx
index 7de127d7b..e36aff560 100644
--- a/FrontEnd/src/pages/ProfilePage/ProfilePage.jsx
+++ b/FrontEnd/src/pages/ProfilePage/ProfilePage.jsx
@@ -1,41 +1,60 @@
import css from './ProfilePage.module.css';
import Description from './ProfilePageComponents/Description';
import ProfileContent from './ProfilePageComponents/ProfileContent';
-import { useState } from 'react';
-import BreadCrumbs from '../../components/BreadCrumbs/BreadCrumbs';
+import { useState, useEffect } from 'react';
+import { DirtyFormContext } from '../../context/DirtyFormContext';
import Loader from '../../components/Loader/Loader';
import { useAuth, useProfile } from '../../hooks';
+import useWindowWidth from '../../hooks/useWindowWidth';
+import EditProfileMobile from './Mobile/EditProfileMobile';
const ProfilePage = () => {
+ const [formIsDirty, setFormIsDirty] = useState(false);
const { user } = useAuth();
const { profile } = useProfile();
- const [formName, setFormName] = useState('');
+ const windowWidth = useWindowWidth();
- const currentFormNameHandler = (currentName) => {
- setFormName(currentName);
- };
+ useEffect(() => {
+ const onBeforeUnload = (e) => {
+ if (formIsDirty) {
+ e.preventDefault();
+ e.returnValue = '';
+ }
+ };
+ window.addEventListener('beforeunload', onBeforeUnload);
+ return () => {
+ window.removeEventListener('beforeunload', onBeforeUnload);
+ };
+ }, [formIsDirty]);
+
+
+ if (windowWidth < 768) {
+ return (
+
+
+
+ );
+ }
return (
-
- {!profile ? (
-
- ) : (
- <>
-
-
- >
- )}
-
+
+ {!profile ? (
+
+ ) : (
+ <>
+
+
+ >
+ )}
+
+
);
};
diff --git a/FrontEnd/src/pages/ProfilePage/ProfilePage.module.css b/FrontEnd/src/pages/ProfilePage/ProfilePage.module.css
index 5fc31f3e5..cb8a02b61 100644
--- a/FrontEnd/src/pages/ProfilePage/ProfilePage.module.css
+++ b/FrontEnd/src/pages/ProfilePage/ProfilePage.module.css
@@ -2,5 +2,11 @@
display: flex;
flex-direction: column;
padding-top: 32px;
- left: 192px;
+ background-color: var(--light-seashell-background);
+}
+
+@media only screen and (min-width: 1200px) {
+ .container {
+ padding-left: 70px;
+ }
}
diff --git a/FrontEnd/src/pages/ProfilePage/ProfilePageComponents/Description.jsx b/FrontEnd/src/pages/ProfilePage/ProfilePageComponents/Description.jsx
index c1e2a89a9..ee9a03bde 100644
--- a/FrontEnd/src/pages/ProfilePage/ProfilePageComponents/Description.jsx
+++ b/FrontEnd/src/pages/ProfilePage/ProfilePageComponents/Description.jsx
@@ -1,44 +1,12 @@
-import { PropTypes } from 'prop-types';
import css from './Description.module.css';
-const DESCRIPTIONS = {
- UserInfo: 'Інформація про користувача платформи',
- GeneralInfo: 'Інформація про компанію',
- ContactsInfo: 'Інформація про компанію',
- ProductServiceInfo: 'Інформація про компанію',
- AdditionalInfo: 'Інформація про компанію',
- StartupInfo: 'Інформація про стартап',
- Delete: 'Видалення профілю',
- ChangePassword: 'Зміна паролю користувача',
-};
-
-const Description = (props) => {
+const Description = () => {
return (
@@ -109,59 +96,41 @@ const ProfileContent = (props) => {
Видалити профіль
-