fixes
This commit is contained in:
parent
4d8f7e6c65
commit
6419b9dd97
@ -1,13 +1,11 @@
|
|||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch } from "react-redux";
|
||||||
import { addProject } from "../../../redux/projectsTrackerSlice";
|
import { setProject } from "../../../redux/projectsTrackerSlice";
|
||||||
|
|
||||||
import "./ModalCreate.scss";
|
import "./ModalCreate.scss";
|
||||||
|
|
||||||
export const ModalCreate = ({ active, setActive, title }) => {
|
export const ModalCreate = ({ active, setActive, title }) => {
|
||||||
const [inputValue, setInputValue] = useState("");
|
const [inputValue, setInputValue] = useState("");
|
||||||
|
|
||||||
const projectInfo = useSelector(addProject);
|
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
function createName() {
|
function createName() {
|
||||||
@ -15,9 +13,9 @@ export const ModalCreate = ({ active, setActive, title }) => {
|
|||||||
name: inputValue,
|
name: inputValue,
|
||||||
count: 0,
|
count: 0,
|
||||||
};
|
};
|
||||||
dispatch(addProject(newItem));
|
dispatch(setProject(newItem));
|
||||||
// console.log(newItem);
|
|
||||||
setActive(false);
|
setActive(false);
|
||||||
|
setInputValue("")
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -17,24 +17,24 @@ import search from "../../images/search.svg";
|
|||||||
|
|
||||||
import "./tracker.scss";
|
import "./tracker.scss";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
import { addProject } from "../../redux/projectsTrackerSlice";
|
import { getProjects } from "../../redux/projectsTrackerSlice";
|
||||||
|
|
||||||
export const Tracker = () => {
|
export const Tracker = () => {
|
||||||
const [toggleTab, setToggleTab] = useState(1);
|
const [toggleTab, setToggleTab] = useState(1);
|
||||||
const [projects] = useState([
|
// const [projects] = useState([
|
||||||
{
|
// {
|
||||||
name: "Разработка трекера",
|
// name: "Разработка трекера",
|
||||||
count: 4,
|
// count: 4,
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
name: "Кинотеатр",
|
// name: "Кинотеатр",
|
||||||
count: 4,
|
// count: 4,
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
name: "Проект страхование",
|
// name: "Проект страхование",
|
||||||
count: 4,
|
// count: 4,
|
||||||
},
|
// },
|
||||||
]);
|
// ]);
|
||||||
const [tabTaskMok, setTabTaskMok] = useState([
|
const [tabTaskMok, setTabTaskMok] = useState([
|
||||||
{
|
{
|
||||||
name: "Открытые",
|
name: "Открытые",
|
||||||
@ -256,8 +256,8 @@ export const Tracker = () => {
|
|||||||
false,
|
false,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// const projectInfo = useSelector(addProject);
|
const projects = useSelector(getProjects);
|
||||||
// const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
const toggleTabs = (index) => {
|
const toggleTabs = (index) => {
|
||||||
setToggleTab(index);
|
setToggleTab(index);
|
||||||
|
@ -21,7 +21,7 @@ export const projectsTrackerSlice = createSlice({
|
|||||||
name: "projectsTracker",
|
name: "projectsTracker",
|
||||||
initialState,
|
initialState,
|
||||||
reducers: {
|
reducers: {
|
||||||
setProject(state, action) {
|
setProject: (state, action) => {
|
||||||
state.project.push(action.payload);
|
state.project.push(action.payload);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -29,6 +29,6 @@ export const projectsTrackerSlice = createSlice({
|
|||||||
|
|
||||||
export const { setProject } = projectsTrackerSlice.actions;
|
export const { setProject } = projectsTrackerSlice.actions;
|
||||||
|
|
||||||
export const addProject = (state) => state.projectsTracker.setProject;
|
export const getProjects = (state) => state.tracker.project;
|
||||||
|
|
||||||
export default projectsTrackerSlice.reducer;
|
export default projectsTrackerSlice.reducer;
|
||||||
|
Loading…
Reference in New Issue
Block a user