Skip to content

Commit

Permalink
убрал лишнее со страницы карт, добавил обработку плюсика
Browse files Browse the repository at this point in the history
  • Loading branch information
semant1cs committed Dec 14, 2023
1 parent 3260f0e commit 68961f2
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 19 deletions.
16 changes: 11 additions & 5 deletions frontend/src/UIComponents/customAddButton/CustomAddButton.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import React from 'react';

const CustomAddButton: React.FC = () => {
interface ICustomAddButton {
handleOnClick: () => void;
}

const CustomAddButton: React.FC<ICustomAddButton> = ({handleOnClick}) => {
return (
<svg width="70" height="70" viewBox="0 0 70 70" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="35" cy="35" r="35" fill="#00D29D"/>
<path d="M35 10V60M10 34.5H35H60" stroke="white" strokeWidth="4"/>
</svg>
<div onClick={handleOnClick}>
<svg width="70" height="70" viewBox="0 0 70 70" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="35" cy="35" r="35" fill="#00D29D"/>
<path d="M35 10V60M10 34.5H35H60" stroke="white" strokeWidth="4"/>
</svg>
</div>
);
};

Expand Down
35 changes: 21 additions & 14 deletions frontend/src/components/mapMenu/SuperUserMap/SuperUserMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ const SuperUserMap: React.FC<ISuperUserMap> = observer(() => {
.then(() => moduleMenuStore.fetchModules()))
}, []);

function handleOnClickOptionMap(map: IMapType, indexMap: number) {
const handleOnClickOptionMap = useCallback((map: IMapType, indexMap: number) => {
mapMenuStore.selectMap(map).then(() => mapMenuStore.changeCurrentMapIndex(indexMap))
}
}, [])

const handleOnClickChangeIsModalOpen = useCallback(() => {
setIsUserListModalOpen(!isUsersListModalOpen)
Expand All @@ -39,7 +39,7 @@ const SuperUserMap: React.FC<ISuperUserMap> = observer(() => {
body={<UsersListModalBody users={superUserStore.allUsers}/>}
windowContentStyles=""
/>
: ""
: null
}
<CustomButton handleOnClick={handleOnClickChangeIsModalOpen} text="Открыть список сотрудников"/>

Expand All @@ -55,18 +55,25 @@ const SuperUserMap: React.FC<ISuperUserMap> = observer(() => {
handleOnChange={(e) => mapMenuStore.changeNewMapName(e)}/>
</div>

<select className="available-maps">
{mapMenuStore.availableMaps?.map((map, index) =>
<option key={map.id} value={map.title}
onClick={() => handleOnClickOptionMap(map, index)}>{map.title}</option>)}
<CustomButton text="Удалить выбранную карту" additionalClassName="delete-map__btn"
handleOnClick={() => mapMenuStore.deleteMap(mapMenuStore.mapMenu?.id)}/>
</select>
<div className="module-create">
<CustomButton text="Создать новый модуль"
handleOnClick={() => mapMenuStore.createMap(mapMenuStore.newNameMap)}/>
<CustomInput type="text" value={mapMenuStore.newNameMap}
handleOnChange={(e) => mapMenuStore.changeNewMapName(e)}/>
</div>

<select className="available-modules">
{moduleMenuStore.availableModules.map((module) =>
<option key={module.id} value={module.title}>{module.title}</option>)}
</select>
{/*<select className="available-maps">*/}
{/* {mapMenuStore.availableMaps?.map((map, index) =>*/}
{/* <option key={map.id} value={map.title}*/}
{/* onClick={() => handleOnClickOptionMap(map, index)}>{map.title}</option>)}*/}
{/* <CustomButton text="Удалить выбранную карту" additionalClassName="delete-map__btn"*/}
{/* handleOnClick={() => mapMenuStore.deleteMap(mapMenuStore.mapMenu?.id)}/>*/}
{/*</select>*/}

{/*<select className="available-modules">*/}
{/* {moduleMenuStore.availableModules.map((module) =>*/}
{/* <option key={module.id} value={module.title}>{module.title}</option>)}*/}
{/*</select>*/}
</div>
);
});
Expand Down

0 comments on commit 68961f2

Please sign in to comment.