Skip to content

Commit

Permalink
fix/before deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
k0t1k777 committed Aug 19, 2024
1 parent 25027f8 commit 5bc35a3
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 43 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# Проект "Gazprom"

Задача: создание MVP Системы управления организационной структурой. Целью проведения Конкурса является:
Поддержка и развитие IT-сообщества,
Разработка сервиса Соорганизатора
- Поддержка и развитие IT-сообщества,
- Разработка сервиса Соорганизатора

[**Ссылка на сайт**](https://gazprom.hopto.org)

Expand Down
11 changes: 6 additions & 5 deletions src/components/App/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,23 @@ import { Outlet, useNavigate } from 'react-router-dom';
import { useEffect, useState } from 'react';
import { useAppDispatch, useAppSelector } from 'src/store/hooks';
import Registration from 'src/pages/Registration/Registration';
import Preloader from 'src/ui/Preloader/Preloader';
import { fetchGetTeamsId } from 'src/store/features/slice/teamsSlice';
import { id } from 'src/services/const';
import { selectMembers } from 'src/store/features/slice/membersSlice';
import { membersProps, RegisterDataProps } from 'src/services/types';
import {
allowDrop,
handleDragStart,
handleDrop,
} from 'src/services/dragAndDrop';
import { selectMembers } from 'src/store/features/slice/membersSlice';
import { membersProps, RegisterDataProps } from 'src/services/types';
import {
fetchRegisterUser,
selectUsers,
setLoading,
setLoggedIn,
} from 'src/store/features/slice/userSlice';
import Preloader from 'src/ui/Preloader/Preloader';
import { fetchGetTeamsId } from 'src/store/features/slice/teamsSlice';
import { id } from 'src/services/const';


export default function App() {
const { loggedIn, loading } = useAppSelector(selectUsers);
Expand Down
1 change: 0 additions & 1 deletion src/components/Filter/Filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ interface FilterProps {

export default function Filter({ droppedCards }: FilterProps) {
const { isFilterOpen } = useAppSelector(selectMembers);

const { members, currentPage } = useAppSelector(selectMembers);
const dispatch = useAppDispatch();

Expand Down
8 changes: 4 additions & 4 deletions src/components/SideBar/SideBar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Button } from 'antd';
import { useState } from 'react';
import styles from 'src/components/SideBar/SideBar.module.scss';
import cn from 'classnames/bind';
import { motion } from 'framer-motion';
Expand All @@ -24,13 +23,14 @@ import {
setIsFilterOpen,
setShortWindow,
} from 'src/store/features/slice/membersSlice';
import { selectUsers, setShorMore } from 'src/store/features/slice/userSlice';

const cx = cn.bind(styles);

export default function SideBar() {
const { shortWindow } = useAppSelector(selectMembers);
const { showMore } = useAppSelector(selectUsers);
const dispatch = useAppDispatch();
const [showMore, setShorMore] = useState(true);
const location = useLocation();
const navigate = useNavigate();
const newTeamRout = location.pathname === '/new-team';
Expand Down Expand Up @@ -70,7 +70,7 @@ export default function SideBar() {
</span>
),
text: 'Справочник',
onClick: () => setShorMore(!showMore),
onClick: () => dispatch(setShorMore(!showMore)),
},
].map((item, index) =>
item.link ? (
Expand Down Expand Up @@ -103,7 +103,7 @@ export default function SideBar() {
<li
key={index}
className={cx(styles.item)}
onClick={() => setShorMore(!showMore)}
onClick={() => dispatch(setShorMore(!showMore))}
>
{item.icon}
<motion.p
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Employees/Employees.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default function Employees() {
const dispatch = useAppDispatch();
const { members, membersAmount, currentPage } = useAppSelector(selectMembers);
const { isProfileOpen } = useAppSelector(selectUsers);

const startIndex = (currentPage - 1) * itemsPerPage + 1;
const endIndex = Math.min(startIndex + itemsPerPage - 1, membersAmount);
const maxPages = Math.ceil(membersAmount / itemsPerPage);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Main/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default function Main() {
}
};

// Рекурсивная функция для добавления cellId
// Рекурсивная функция для добавления ячеек cellId
const updateSubordinates = (
card: membersProps,
parentColom: number,
Expand Down
12 changes: 6 additions & 6 deletions src/pages/Registration/Registration.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { Button, Input } from 'antd';
import { useState } from 'react';
import styles from 'src/pages/Registration/Registration.module.scss';
import { selectUsers, setEmail, setPassword } from 'src/store/features/slice/userSlice';
import { useAppDispatch, useAppSelector } from 'src/store/hooks';

interface RegistrationProps {
handleRegister: (data: { email: string; password: string }) => void;
}

export default function Registration({ handleRegister }: RegistrationProps) {

const [email, setEmail] = useState<string>('');
const [password, setPassword] = useState<string>('');
const { email, password } = useAppSelector(selectUsers);
const dispatch = useAppDispatch();

const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
Expand All @@ -26,14 +26,14 @@ export default function Registration({ handleRegister }: RegistrationProps) {
<Input
className={styles.input}
value={email}
onChange={(e) => setEmail(e.target.value)}
onChange={(e) => dispatch(setEmail(e.target.value))}
placeholder='Логин'
></Input>
<Input
className={styles.input}
type='current-password'
value={password}
onChange={(e) => setPassword(e.target.value)}
onChange={(e) => dispatch(setPassword(e.target.value))}
placeholder='Введите пароль'
></Input>
<Button htmlType='submit' className={styles.button}>
Expand Down
30 changes: 28 additions & 2 deletions src/store/features/slice/userSlice.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
import { membersProps, ProfileProps, RegisterDataProps } from 'src/services/types';
import {
membersProps,
ProfileProps,
RegisterDataProps,
} from 'src/services/types';
import { getMemberId, getProfile, registration } from 'src/store/api';
import { RootStore } from 'src/store/store';

Expand All @@ -12,6 +16,9 @@ export interface StateType {
loading: boolean;
isProfileOpen: boolean;
selectedMember: membersProps | null;
showMore: boolean;
email: string;
password: string;
}

const initialState: StateType = {
Expand All @@ -23,6 +30,9 @@ const initialState: StateType = {
loading: false,
isProfileOpen: false,
selectedMember: null,
showMore: true,
email: '',
password: '',
};

export const fetchRegisterUser = createAsyncThunk(
Expand Down Expand Up @@ -59,6 +69,15 @@ const userSlice = createSlice({
setIsProfileOpen(state, action) {
state.isProfileOpen = action.payload;
},
setShorMore(state, action) {
state.showMore = action.payload;
},
setEmail(state, action) {
state.email = action.payload;
},
setPassword(state, action) {
state.password = action.payload;
},
},
extraReducers: (builder) => {
builder
Expand Down Expand Up @@ -101,6 +120,13 @@ const userSlice = createSlice({
},
});

export const { setLoggedIn, setLoading, setIsProfileOpen } = userSlice.actions;
export const {
setLoggedIn,
setLoading,
setIsProfileOpen,
setShorMore,
setEmail,
setPassword,
} = userSlice.actions;
export const userReducer = userSlice.reducer;
export const selectUsers = (state: RootStore) => state.user;
22 changes: 4 additions & 18 deletions src/ui/FilterList/FilterList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,17 @@ export default function FilterList({
city,
}: FilterListProps) {
return (
<ul
className={styles.list}
>
<ul className={styles.list}>
<li className={styles.containerItem}>
<p
className={cx(styles.item)}
>
{teams}
</p>
<p className={cx(styles.item)}>{teams}</p>
<DownOutlined className={styles.arrow} />
</li>
<li className={styles.containerItem}>
<p
className={cx(styles.item)}
>
{positions}
</p>
<p className={cx(styles.item)}>{positions}</p>
<DownOutlined className={styles.arrow} />
</li>
<li className={styles.containerItem}>
<p
className={cx(styles.item)}
>
{city}
</p>
<p className={cx(styles.item)}>{city}</p>
<DownOutlined className={styles.arrow} />
</li>
</ul>
Expand Down
5 changes: 2 additions & 3 deletions src/ui/Modal/Modal.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Button, Input } from 'antd';
import { useNavigate } from 'react-router-dom';
import { useAppDispatch, useAppSelector } from 'src/store/hooks';
import styles from 'src/ui/Modal/Modal.module.scss';
import {
selectTeams,
setAddTeam,
setNameTeam,
} from 'src/store/features/slice/teamsSlice';
import { useAppDispatch, useAppSelector } from 'src/store/hooks';
import styles from 'src/ui/Modal/Modal.module.scss';

export default function Modal() {
const dispatch = useAppDispatch();
Expand All @@ -18,7 +18,6 @@ export default function Modal() {
id: (addTeam.length + 777).toString(),
name: nameTeam,
};

dispatch(setAddTeam([...addTeam, newTeam]));
dispatch(setNameTeam(''));
navigate('/teams');
Expand Down

0 comments on commit 5bc35a3

Please sign in to comment.