Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
001elijah committed Jun 26, 2023
1 parent c9bdefa commit aef85f0
Show file tree
Hide file tree
Showing 14 changed files with 78 additions and 85 deletions.
40 changes: 18 additions & 22 deletions src/components/BoardItem/BoardItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,29 @@ export const BoardItem = ({
id,
}) => {
return (
<li
onClick={onClick}

>
<li onClick={onClick}>
<NavLink
to={`/home/${id}`}
className={clsx(s.item, s[theme], isCurrent && s.current)}
>
<div className={s.projectNameWrapper}>
<svg className={clsx(s.iconProject, s[theme])}>
<use href={icon}></use>
</svg>
<span className={clsx(s.text, s[theme])}>{boardName}</span>
</div>
<ul className={clsx(s.iconList, s[theme])}>
<li>
<svg className={clsx(s.actionIcon, s[theme])}>
<use href={`${sprite}#icon-pencil`}></use>
</svg>
</li>
<li>
<svg className={clsx(s.actionIcon, s[theme])}>
<use href={`${sprite}#icon-trash`}></use>
<div className={s.projectNameWrapper}>
<svg className={clsx(s.iconProject, s[theme])}>
<use href={icon}></use>
</svg>
</li>
</ul>

<span className={clsx(s.text, s[theme])}>{boardName}</span>
</div>
<ul className={clsx(s.iconList, s[theme])}>
<li>
<svg className={clsx(s.actionIcon, s[theme])}>
<use href={`${sprite}#icon-pencil`}></use>
</svg>
</li>
<li>
<svg className={clsx(s.actionIcon, s[theme])}>
<use href={`${sprite}#icon-trash`}></use>
</svg>
</li>
</ul>
</NavLink>
</li>
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/BoardList/BoardList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const BoardList = ({ theme, boards }) => {

return (
<ul className={s.list}>
{boards.map(({ title, icon, _id}) => (
{boards.map(({ title, icon, _id }) => (
<BoardItem
key={title}
id={_id}
Expand Down
10 changes: 6 additions & 4 deletions src/components/ButtonAddColumn/ButtonAddColumn.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ import { useSelector } from 'react-redux';
import PropTypes from 'prop-types';
import clsx from 'clsx';

export const AddButton = ({ title, typeOfButton, onClick}) => {
export const AddButton = ({ title, typeOfButton, onClick }) => {
const theme = useSelector(selectorTheme);

return (
<>

<div className={clsx(s.Button, s[typeOfButton], s[theme])} onClick={onClick}>
<div
className={clsx(s.Button, s[typeOfButton], s[theme])}
onClick={onClick}
>
<div className={clsx(s.BoxPlus, s[typeOfButton], s[theme])}>
<svg width="16" height="16" className={s.Svg}>
<use href={`${svg}#icon-${'plus'}`} />
Expand All @@ -26,5 +28,5 @@ export const AddButton = ({ title, typeOfButton, onClick}) => {
AddButton.propTypes = {
title: PropTypes.string,
typeOfButton: PropTypes.string,
onClick:PropTypes.func
onClick: PropTypes.func,
};
16 changes: 8 additions & 8 deletions src/components/ColumnModalWindow/ColumnModalWindow.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,29 @@ import { selectorTheme } from 'redux/Auth/authSelectors';
import { Modal } from 'components/Modal/Modal';
import sprite from '../../assets/icons/sprite.svg';
import s from './ColumnModalWindow.module.scss';
import {addColumn} from '../../redux/Columns/ColumnOperation'
import { addColumn } from '../../redux/Columns/ColumnOperation';

export const ColumnModalWindow = ({
inputTitle,
titleModalButton,
modalTitle,
onClick,
boardId
boardId,
}) => {
const dispatch = useDispatch()
const dispatch = useDispatch();
const [value, setValue] = useState('');
const theme = useSelector(selectorTheme);

const handleSubmit = (e) => {
e.preventDefault()
const handleSubmit = e => {
e.preventDefault();
const newColumn = {
title:value,
boardId
title: value,
boardId,
};
console.log(value);
dispatch(addColumn(newColumn));
setValue('');
onClick()
onClick();
};

return (
Expand Down
8 changes: 4 additions & 4 deletions src/components/HeaderDashBoard/HeaderDashBoard.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
display: flex;
justify-content: space-between;
align-items: flex-end;
padding:10px 24px 10px 0;
padding: 10px 24px 10px 0;

// &.dark {
// background-color: $black-color;
Expand Down Expand Up @@ -33,7 +33,7 @@
border: none;
margin-left: auto;
outline: none;
fill:none;
fill: none;

&.dark {
color: $middle-color;
Expand Down Expand Up @@ -61,6 +61,6 @@

color: inherit;
}
.Svg{
.Svg {
margin-right: 8px;
}
}
11 changes: 5 additions & 6 deletions src/components/MainBoard/MainBoard.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@
height: 100%;
padding-left: 24px;
&.dark {
background-color: #1F1F1F;
;
background-color: #1f1f1f;
}
&.light{
background-color: #F6F6F7;
&.light {
background-color: #f6f6f7;
}
&.colorful {
background: #ECEDFD;
background: #ecedfd;
}
}
}
7 changes: 3 additions & 4 deletions src/components/MainBoard/MainBoard.styled.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import styled from 'styled-components';

export const Wrapper = styled.div`
background-repeat: no-repeat;
background-size: cover;
background-position: bottom;
background-color: ${props=>props.colorbg};
background-color: ${props => props.colorbg};
height: 100%;
@media screen and (min-width: 375px) {
padding-left:0px;
padding-left: 0px;
background-image: url(${props =>
props.BASE_URL + 'mobile/x1/' + props.imgid});
}
Expand All @@ -27,4 +26,4 @@ export const Wrapper = styled.div`
(min-resolution: 2dppx) {
@content;
}
`
`;
2 changes: 1 addition & 1 deletion src/components/ModalFilter/LabelBlock.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const LabelBlock = ({ newField }) => {
const handleOnClickAll = () => {
setField('');
};
console.log(newField, field)
console.log(newField, field);

return (
<>
Expand Down
6 changes: 3 additions & 3 deletions src/components/ModalFilter/ModalFilter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ import svg from '../../assets/icons/sprite.svg';
import PropTypes from 'prop-types';
import { LabelBlock } from './LabelBlock';
// import { BackgroundBlock } from './BackgroundBlock';
import { useState } from 'react';
import { useState } from 'react';
import { selectorTheme } from 'redux/Auth/authSelectors';
import { useSelector } from 'react-redux';
import {BoxRadioBackgroundGroup} from '../BoxRadioBackgroundGroup/BoxRadioBackgroundGroup'
import { BoxRadioBackgroundGroup } from '../BoxRadioBackgroundGroup/BoxRadioBackgroundGroup';
import clsx from 'clsx';

export const ModalFilter = ({ closeModal, color }) => {
const [colorFilter, setColorFilter] = useState('');
const theme = useSelector(selectorTheme);
const [icon, setIcon] = useState('');
console.log(color, colorFilter, icon)
console.log(color, colorFilter, icon);
return (
<>
<div className={clsx(s.Wrapper, s[theme])}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,32 @@ import { selectorTheme } from 'redux/Auth/authSelectors';
import { Modal } from 'components/Modal/Modal';
import sprite from '../../assets/icons/sprite.svg';
import s from './ReusableColumnModalWindow.module.scss';
import {addNewBoard} from '../../redux/Boards/boardsOperations'
import { addNewBoard } from '../../redux/Boards/boardsOperations';

export const ReusableColumnModalWindow = ({
inputTitle,
titleModalButton,
modalTitle,
onClick,
icon='',
background='',
icon = '',
background = '',
children,

}) => {
const dispatch = useDispatch()
const dispatch = useDispatch();
const [value, setValue] = useState('');
const theme = useSelector(selectorTheme);

const handleSubmit = (e) => {
e.preventDefault()
const handleSubmit = e => {
e.preventDefault();
const newCard = {
title:value,
title: value,
icon,
background,
};
// console.log(newCard);
dispatch(addNewBoard(newCard));
setValue('');
onClick()
onClick();
};

return (
Expand Down
21 changes: 10 additions & 11 deletions src/redux/Boards/boardsOperations.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
import { createAsyncThunk } from '@reduxjs/toolkit';

import { getListOfBoardsApi,addBoardApi } from '../../services/backendAPI';

import { getListOfBoardsApi, addBoardApi } from '../../services/backendAPI';

export const addNewBoard = createAsyncThunk(
'boards/addboard',
async (dataBoard, { getState, rejectWithValue }) => {
async (dataBoard, { getState, rejectWithValue }) => {
const { token } = getState().auth;
try {
const newBoard = await addBoardApi(dataBoard, token);
return newBoard;
} catch (error) {
console.log('error', error)
console.log('error', error);
rejectWithValue(error.message);
}
}
},
);

// export const getBoardById = createAsyncThunk(
Expand All @@ -29,11 +28,11 @@ export const addNewBoard = createAsyncThunk(
// rejectWithValue(error.message);
// }
// },
// {
// condition(_, { getState }) {
// return Boolean(getState().boards.length <= 0);
// },
// },
// {
// condition(_, { getState }) {
// return Boolean(getState().boards.length <= 0);
// },
// },
// );

export const getListOfBoards = createAsyncThunk(
Expand All @@ -52,4 +51,4 @@ export const getListOfBoards = createAsyncThunk(
return Boolean(getState().boards.length <= 0);
},
},
);
);
10 changes: 5 additions & 5 deletions src/redux/Boards/boardsSlice.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ const boardsSlice = createSlice({
state.push(...payload);
})
.addCase(addNewBoard.fulfilled, (state, { payload }) => {
state.push(payload)
})
// .addCase(getBoardById.fulfilled, (state, { payload }) => {
// console.log('slice', payload);
state.push(payload);
});
// .addCase(getBoardById.fulfilled, (state, { payload }) => {
// console.log('slice', payload);

// });
// });
},
});

Expand Down
8 changes: 4 additions & 4 deletions src/redux/Columns/ColumnOperation.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { createAsyncThunk } from '@reduxjs/toolkit';
import {addColumnApi} from '../../services/backendAPI'
import { addColumnApi } from '../../services/backendAPI';

export const addColumn = createAsyncThunk(
'board/addColumn',
async (dataColumn, { getState, rejectWithValue }) => {
async (dataColumn, { getState, rejectWithValue }) => {
const { token } = getState().auth;
try {
const newColumn = await addColumnApi(dataColumn, token);
return newColumn;
} catch (error) {
rejectWithValue(error.message);
}
}
);
},
);
5 changes: 2 additions & 3 deletions src/services/backendAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ export const addBoardApi = async (dataBoard, userToken) => {
return data;
};
export const getBoardByIdApi = async (boardName, userToken) => {
token.set(userToken);
const { data } = await axios.get(`/board/${boardName}`, );
token.set(userToken);
const { data } = await axios.get(`/board/${boardName}`);
return data;
};

Expand Down Expand Up @@ -84,7 +84,6 @@ export const sendEmailApi = async userEmail => {
// return data;
// };


// export const editColumn = async board => {
// const { data } = await axios.post('/board');
// return data;
Expand Down

0 comments on commit aef85f0

Please sign in to comment.