Skip to content

Commit

Permalink
добавляет исправленные типы
Browse files Browse the repository at this point in the history
  • Loading branch information
semant1cs committed Nov 19, 2023
1 parent c8180bd commit 1616500
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 149 deletions.
54 changes: 2 additions & 52 deletions frontend/src/components/mapMenu/MapMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ import Coins from "./UIMapMenu/Coins.tsx";
import './../../styles/mapMenu.scss'
import ChooseModuleWindow from "./UIMapMenu/ChooseModuleWindow.tsx";
import UserProfile from "./UIMapMenu/UserProfile.tsx";
import StarUnit from "./UIMapMenu/Level/StarUnit.tsx";
import Module from "./UIMapMenu/Level/Module.tsx";
import mapMenuStore from "../../store/mapMenuStore.ts";
import {ILevelType} from "../../types/LevelType.ts";

const MapMenu: React.FC = () => {
const navigate = useNavigate()
Expand All @@ -24,54 +23,6 @@ const MapMenu: React.FC = () => {
})
}, [navigate])

// const onHandleSignOut = () => {
// authStore.logOutUser().then()
// navigate('/')
// }

const geolocations: ILevelType[] = [
{
id: "1",
levels: {
levelName: "Уровень 1",
title: "Собери помидорки",
menu: [{
taskName: "test",
body: "Какая-то информация которая очень хорошо тебе поведает тайну о помидорках и ещё какая-то информация которая очень хорошо тебе поведает тайну о помидорках ",
}]
}
},
{
id: "2",
level: {
levelName: "Уровень 2",
title: "Собери не помидорки",
menu: [{
taskName: "theory",
body: "Я уже не помидорка"
}]
}
},
{
id: "3",
level: {
levelName: "Уровень 3",
title: "Начни текст",
menu: [
{
taskName: "video",
body: "Я помидорка"
},
{
taskName: "test",
body: "БУБУБУБУ"
}
]
}
},

]

return (
<div>
<Coins coins={100} additionalClassname="coins"/>
Expand All @@ -81,10 +32,9 @@ const MapMenu: React.FC = () => {
<div className="geolocations">
<div className="geolocations__wrapper">
{geolocations.map((geolocation) =>
<StarUnit id={geolocation.id} level={geolocation.level} key={geolocation.id}/>)}
<Module id={geolocation.id} level={geolocation.level} key={geolocation.id}/>)}
</div>
</div>
{/*<CustomButton text="Выйти" handleOnClick={onHandleSignOut}/>*/}
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React, {useState} from 'react';
import ModalWindow from "../../../../UIComponents/modalWindow/ModalWindow.tsx";
import ModalLevelBody from "./ModalLevelBody.tsx";
import {LevelType} from "../../../../types/LevelType.ts";
import {ILevelType} from "../../../../types/LevelType.ts";

interface IGeolocationProps {
id: number,
level: LevelType
level: ILevelType
}

const StarUnit: React.FC<IGeolocationProps> = ({id, level}) => {
const Module: React.FC<IGeolocationProps> = ({id, level}) => {
const [isOpenModalWindow, setOpenModalWindow] = useState(false)
const classNameGeolocation = "geolocation-" + id
return (
Expand All @@ -17,8 +17,8 @@ const StarUnit: React.FC<IGeolocationProps> = ({id, level}) => {
{isOpenModalWindow
? <ModalWindow
onClose={() => setOpenModalWindow(!isOpenModalWindow)}
body={<ModalLevelBody levelName={level.levelName} title={level.title}
menu={level.menu}/>}
body={<ModalLevelBody levelName={level} title={level}
menu={level}/>}
/>
: ""}

Expand All @@ -45,4 +45,4 @@ const StarUnit: React.FC<IGeolocationProps> = ({id, level}) => {
};


export default StarUnit;
export default Module;
68 changes: 0 additions & 68 deletions frontend/src/components/mapMenu/UIMapMenu/Level/modalLevelBody.css

This file was deleted.

This file was deleted.

14 changes: 9 additions & 5 deletions frontend/src/store/mapMenuStore.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import {makeAutoObservable} from "mobx";
import axios from "axios";
import {IMapType} from "../types/MapType.ts";
import {IModuleType} from "../types/ModuleType.ts";

class MapMenuStore {
mapMenu: IModuleType[] = []
availableMaps: { id: string }[] = []
mapMenu: IMapType | null = null
availableMaps: IMapType[] = []

modulesMap: IModuleType | null = null
availableModules: IModuleType[] = []

constructor() {
makeAutoObservable(this)
Expand All @@ -18,9 +22,9 @@ class MapMenuStore {
await axios.get("http://localhost:8000/maps/" + id).then((response) => this.mapMenu = response.data)
}

// setModulesMap(newModulesMap: IModuleType[]) {
// this.modulesMap = newModulesMap
// }
setModulesMap(newModulesMap: IModuleType) {
this.modulesMap = newModulesMap
}

// updateMapById(id: string) {
// axios.patch(id, {
Expand Down
10 changes: 3 additions & 7 deletions frontend/src/types/LevelType.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import {ITaskType} from "./TaskType.ts";

export interface ILevelType {
id: string,
levels: {
levelName: string,
title: string
menu: ITaskType[]
}[]
name: string,
body: string,
tasks: string[]
}
4 changes: 1 addition & 3 deletions frontend/src/types/MapType.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import {IModuleType} from "./ModuleType.ts";

export interface IMapType {
id: string,
title: string,
modules_ids: IModuleType[]
modules_ids: string[]
}
10 changes: 5 additions & 5 deletions frontend/src/types/ModuleType.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {ILevelType} from "./LevelType.ts";

export interface IModuleType {
mapId: string,
map_id: string,
title: string,
moduleId: string,
modules_ids: ILevelType[]
previous_module_id: string,
next_module_id: string,
id: string,
levels_ids: string[]
}
1 change: 0 additions & 1 deletion frontend/src/types/RouteType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ export interface IRouteType {
path: string,
element: ReactNode
}

3 changes: 2 additions & 1 deletion frontend/src/types/TaskType.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export interface ITaskType {
taskName: string,
id: string,
name: string,
body: string
}

0 comments on commit 1616500

Please sign in to comment.