Skip to content

Commit

Permalink
Merge pull request #535 from AI4Bharat/tab-index-fix
Browse files Browse the repository at this point in the history
Tab index fix
  • Loading branch information
harsh12-99 authored Jan 10, 2024
2 parents d94068c + e6c6f96 commit 683d77c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 24 deletions.
13 changes: 8 additions & 5 deletions src/containers/Organization/Project/Project.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
FetchVideoListAPI,
UploadCSVAPI,
setSnackBar,
updateProjectTabIndex,
} from "redux/actions";
import C from "redux/constants";

Expand Down Expand Up @@ -102,6 +101,7 @@ const Project = () => {
const [alertMessage, setAlertMessage] = useState("");
const [alertColumn, setAlertColumn] = useState("");
const [orgOwnerId, setOrgOwnerId] = useState("");
const [tabIndex, setTabIndex] = useState(0);

const projectInfo = useSelector((state) => state.getProjectDetails.data);
const projectvideoList = useSelector(
Expand All @@ -110,7 +110,6 @@ const Project = () => {
const userData = useSelector((state) => state.getLoggedInUserDetails.data);
const userList = useSelector((state) => state.getOrganizatioUsers.data);
const apiStatus = useSelector((state) => state.apiStatus);
const tabIndex = useSelector((state) => state.taskFilters.tabIndex);

useEffect(() => {
if (userData && userData.id) {
Expand Down Expand Up @@ -179,6 +178,9 @@ const Project = () => {
};

useEffect(() => {
const temp = +localStorage.getItem("projectTabIndex");
temp && setTabIndex(temp);

getProjectMembers();
GetManagerName();
getProjectnDetails();
Expand Down Expand Up @@ -352,9 +354,10 @@ const Project = () => {
<Box>
<Tabs
value={tabIndex}
onChange={(_event, newValue) =>
dispatch(updateProjectTabIndex(newValue))
}
onChange={(_event, newValue) => {
setTabIndex(newValue);
localStorage.setItem("projectTabIndex", newValue);
}}
aria-label="basic tabs example"
>
<Tab label={"Videos"} sx={{ fontSize: 16, fontWeight: "700" }} />
Expand Down
2 changes: 0 additions & 2 deletions src/redux/actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ import {
updateColumnDisplay,
updateSelectedFilter,
updateSortOptions,
updateProjectTabIndex,
updateProjectSearchValues,
} from "./taskFilters";

Expand Down Expand Up @@ -260,7 +259,6 @@ export {
updateColumnDisplay,
updateSelectedFilter,
updateSortOptions,
updateProjectTabIndex,
updateProjectSearchValues,
updateOrgColumnDisplay,
updateOrgSelectedFilter,
Expand Down
7 changes: 0 additions & 7 deletions src/redux/actions/taskFilters.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@ export const updateSortOptions = (payload) => {
};
};

export const updateProjectTabIndex = (payload) => {
return {
type: C.PROJECT_TAB_INDEX,
payload,
};
};

export const updateProjectSearchValues = (payload) => {
return {
type: C.PROJECT_SEARCH_VALUES,
Expand Down
3 changes: 0 additions & 3 deletions src/redux/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,6 @@ const constants = {
ORG_COLUMN_DISPLAY: "ORG_COLUMN_DISPLAY",
ORG_SEARCH_VALUES: "ORG_SEARCH_VALUES",
CURRENT_ORG_SEARCHED_COLUMN: "CURRENT_ORG_SEARCHED_COLUMN",

//Project Tabs
PROJECT_TAB_INDEX: "PROJECT_TAB_INDEX",
};

export default constants;
7 changes: 0 additions & 7 deletions src/redux/reducers/Project/TaskFilters.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ const initialState = {
created_at: false,
updated_at: false,
},
tabIndex: 0,
searchValue: {
id: "",
video_name: "",
Expand Down Expand Up @@ -49,12 +48,6 @@ const reducer = (state = initialState, action) => {
columnDisplay: action.payload,
};

case constants.PROJECT_TAB_INDEX:
return {
...state,
tabIndex: action.payload,
};

case constants.PROJECT_SEARCH_VALUES:
return {
...state,
Expand Down

0 comments on commit 683d77c

Please sign in to comment.