-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'frontend' into cards-users
- Loading branch information
Showing
37 changed files
with
654 additions
and
394 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
from .models import Module | ||
from .models import Level |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
from game.modules import Module | ||
from game.modules import Level | ||
from repository.sqlalchemy_repository import SQLAlchemyRepository | ||
|
||
|
||
class ModuleRepository(SQLAlchemyRepository): | ||
model = Module | ||
model = Level |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from 'react'; | ||
|
||
interface IHeaderModal { | ||
body: React.ReactNode | ||
} | ||
|
||
const HeaderModal: React.FC<IHeaderModal> = ({body}) => { | ||
return ( | ||
<div className="header-modal"> | ||
{body} | ||
</div> | ||
); | ||
}; | ||
|
||
export default HeaderModal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React from 'react'; | ||
import CustomInput from "../../UIComponents/customInput/CustomInput.tsx"; | ||
import authStore from "../../store/authStore.ts"; | ||
import CustomCheckbox from "../../UIComponents/customCheckbox/CustomCheckbox.tsx"; | ||
import CustomButton from "../../UIComponents/customButton/CustomButton.tsx"; | ||
import {useNavigate} from "react-router-dom" | ||
import {observer} from "mobx-react-lite"; | ||
|
||
const AuthForm: React.FC = observer(() => { | ||
const navigateTo = useNavigate() | ||
|
||
return ( | ||
<form className="auth__form"> | ||
<h2 className="auth-form-title">ВХОД</h2> | ||
<fieldset className="auth-fields"> | ||
<CustomInput type="email" value={authStore.userLogin} autoFocus={true} placeholder="Логин" | ||
handleOnChange={(e) => { | ||
authStore.changeUserLogin(e) | ||
authStore.changeUserEmail(e) | ||
}}/> | ||
<CustomInput | ||
type={authStore.isPasswordShows ? "text" : "password"} placeholder="Пароль" | ||
value={authStore.userPassword} handleOnChange={(e) => authStore.changeUserPassword(e)}/> | ||
</fieldset> | ||
<CustomCheckbox text="Показать пароль" id="is-remember" | ||
additionalClassName="is-remember-password__checkbox" | ||
handleOnChange={authStore.changeIsPasswordShows}/> | ||
<CustomButton additionalClassName="auth__btn" text="ВОЙТИ" handleOnClick={() => { | ||
authStore.signIn().then(() => navigateTo('/map')) | ||
}}/> | ||
</form> | ||
); | ||
}); | ||
|
||
export default AuthForm; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,19 @@ | ||
import React, {useState} from 'react'; | ||
import React from 'react'; | ||
import './../../styles/authentication.scss' | ||
import CustomButton from "../../UIComponents/customButton/CustomButton.tsx"; | ||
import CustomCheckbox from "../../UIComponents/customCheckbox/CustomCheckbox.tsx"; | ||
import authStore from "../../store/authStore.ts"; | ||
import {observer} from "mobx-react-lite"; | ||
import {useNavigate} from "react-router-dom"; | ||
import CustomInput from "../../UIComponents/customInput/CustomInput.tsx"; | ||
import AuthForm from "./AuthForm.tsx"; | ||
|
||
const Authentication: React.FC = observer(() => { | ||
const Authentication: React.FC = () => { | ||
const navigateTo = useNavigate() | ||
|
||
const [isPasswordShows, setIsPasswordShow] = useState(false) | ||
|
||
const changeShowPassword = () => { | ||
setIsPasswordShow(!isPasswordShows) | ||
} | ||
|
||
|
||
return ( | ||
<div className="auth-page"> | ||
<form className="auth__form"> | ||
<h2 className="auth-form-title">ВХОД</h2> | ||
<fieldset className="auth-fields"> | ||
<CustomInput type="email" value={authStore.userLogin} handleOnChange={(e) => { | ||
authStore.changeUserLogin(e) | ||
authStore.changeUserEmail(e) | ||
}} | ||
autoFocus={true} placeholder="Логин"/> | ||
<div className="auth-data__field"> | ||
<CustomInput type={isPasswordShows ? "text" : "password"} placeholder="Пароль" | ||
value={authStore.userPassword} | ||
handleOnChange={(e) => authStore.changeUserPassword(e)}/> | ||
</div> | ||
</fieldset> | ||
<CustomCheckbox text="Показать пароль" id="is-remember" | ||
additionalClassName="is-remember-password__checkbox" | ||
handleOnChange={changeShowPassword}/> | ||
<CustomButton additionalClassName="auth__btn" text="ВОЙТИ" handleOnClick={() => { | ||
authStore.signIn().then(() => navigateTo('/map')) | ||
}}/> | ||
</form> | ||
<AuthForm/> | ||
<CustomButton additionalClassName="back-to-welcome-page__btn" text="Вернуться обратно" | ||
handleOnClick={() => navigateTo('/')}></CustomButton> | ||
</div> | ||
); | ||
}); | ||
}; | ||
|
||
export default Authentication; |
48 changes: 48 additions & 0 deletions
48
frontend/src/components/mapMenu/EmployeeMap/EmployeeMap.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import React, {useEffect} from 'react'; | ||
import Coins from "../UIMapMenu/Coins.tsx"; | ||
import ChooseModuleWindow from "../UIMapMenu/ChooseModuleWindow.tsx"; | ||
import mapMenuStore from "../../../store/mapMenuStore.ts"; | ||
import UserProfile from "../UIMapMenu/UserProfile/UserProfile.tsx"; | ||
import Level from "../UIMapMenu/Level/Level.tsx"; | ||
import {IUserType} from "../../../types/UserType.ts"; | ||
import {observer} from "mobx-react-lite"; | ||
import moduleMenuStore from "../../../store/moduleMenuStore.ts"; | ||
|
||
interface IEmployeeMap { | ||
user?: IUserType, | ||
formattedDate: string | ||
} | ||
|
||
const EmployeeMap: React.FC<IEmployeeMap> = observer(({user, formattedDate}) => { | ||
useEffect(() => { | ||
mapMenuStore.fetchAvailableMaps().then(() => { | ||
mapMenuStore.fetchMapById(mapMenuStore.availableMaps[0].id).then(() => { | ||
moduleMenuStore.fetchModules().then(() => { | ||
moduleMenuStore.fetchModuleById(moduleMenuStore.availableModules[0].id).then(() => { | ||
mapMenuStore.fetchLevels().then(() => { | ||
|
||
}).catch(() => alert("Нет доступных уровней для данного модуля")) | ||
}) | ||
}).catch(() => alert("Нет доступных модулей для данной карты")) | ||
}) | ||
}).catch(() => alert("Нет доступных карт для данного пользователя")) | ||
}, []); | ||
|
||
return ( | ||
<div className="employee-interface"> | ||
<Coins coins={100} additionalClassname="coins"/> | ||
<ChooseModuleWindow moduleName={moduleMenuStore.currentModule?.title}/> | ||
<UserProfile user={user} formattedDate={formattedDate}/> | ||
<div className="geolocations"> | ||
<div className="geolocations__wrapper"> | ||
{mapMenuStore.availableLevels.map((level, index) => { | ||
return <Level id={(index + 1).toString()} key={level.id} title={level.title} | ||
theoryUnits={level.theoryUnits} taskUnits={level.taskUnits}/> | ||
})} | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}); | ||
|
||
export default EmployeeMap; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
frontend/src/components/mapMenu/SuperUserMap/SuperUserMap.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import React, {useEffect, useState} from 'react'; | ||
import CustomButton from "../../../UIComponents/customButton/CustomButton.tsx"; | ||
import mapMenuStore from "../../../store/mapMenuStore.ts"; | ||
import CustomInput from "../../../UIComponents/customInput/CustomInput.tsx"; | ||
import {observer} from "mobx-react-lite"; | ||
import superUserStore from "../../../store/superUserStore.ts"; | ||
import moduleMenuStore from "../../../store/moduleMenuStore.ts"; | ||
import {IMapType} from "../../../types/MapType.ts"; | ||
|
||
interface ISuperUserMap { | ||
|
||
} | ||
|
||
const SuperUserMap: React.FC<ISuperUserMap> = observer(() => { | ||
const [isUsersListModalOpen, setIsUserListModalOpen] = useState<boolean>(false) | ||
|
||
useEffect(() => { | ||
mapMenuStore.fetchAvailableMaps() | ||
.then(() => mapMenuStore.fetchMapById(mapMenuStore.availableMaps[mapMenuStore.currentMapIndex].id) | ||
.then(() => moduleMenuStore.fetchModules())) | ||
}, []); | ||
|
||
function handleOnClickOptionMap(map: IMapType, indexMap: number) { | ||
mapMenuStore.selectMap(map).then(() => mapMenuStore.changeCurrentMapIndex(indexMap)) | ||
} | ||
|
||
|
||
return ( | ||
<div> | ||
<form> | ||
<select> | ||
{superUserStore.allUsers.map((user) => | ||
<option key={user.username} value={user.username}>{user.username}</option>)} | ||
</select> | ||
|
||
<div className="map-create"> | ||
<CustomInput type="text" value={mapMenuStore.newNameMap} | ||
handleOnChange={(e) => mapMenuStore.changeNewMapName(e)}/> | ||
<CustomButton text="Создать новую карту" | ||
handleOnClick={() => mapMenuStore.createMap(mapMenuStore.newNameMap)}/> | ||
</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> | ||
|
||
<select className="available-modules"> | ||
{moduleMenuStore.availableModules.map((module) => | ||
<option key={module.id} value={module.title}>{module.title}</option>)} | ||
</select> | ||
</form> | ||
</div> | ||
); | ||
}); | ||
|
||
export default SuperUserMap; |
Oops, something went wrong.