Skip to content

Commit

Permalink
fix(client): switched homePage !maxViwePostField ts->js
Browse files Browse the repository at this point in the history
fixing #109
  • Loading branch information
roman-ojha committed Jun 26, 2022
1 parent 7db1ab1 commit b27dfdf
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 18 deletions.
Expand Up @@ -3,9 +3,11 @@ import { useSelector } from "react-redux";
import admin from "../../constant/admin";
import DefaultSocialPost from "../DefaultSocialPost";
import PostBox from "../PostBox/PostBox";
import { AppState } from "../../services/redux";

const DisplayFollowedUserPost = () => {
const followedUserPostDataStore = useSelector(
(state) => state.setFollowedUserPostDataReducer
(state: AppState) => state.setFollowedUserPostDataReducer
);
return (
<>
Expand Down
Expand Up @@ -9,18 +9,19 @@ import {
setRootUserProfileDataState,
} from "../../services/redux-actions";
import constant from "../../constant/constant";
import { AppState } from "../../services/redux";

const MinViewPostField = () => {
const history = useHistory();
const dispatch = useDispatch();
const userProfileDetailStore = useSelector(
(state) => state.setUserProfileDetailReducer
(state: AppState) => state.setUserProfileDetailReducer
);
const homePageUserPostFieldData = useSelector((state) => {
const homePageUserPostFieldData = useSelector((state: AppState) => {
return state.homePageUserPostFieldDataReducer;
});
const rootUserProfileDataState = useSelector(
(state) => state.rootUserProfileDataState
(state: AppState) => state.rootUserProfileDataState
);

return (
Expand Down
Expand Up @@ -2,16 +2,17 @@ import React from "react";
import DisplayFollowedUserPost from "./DisplayFollowedUserPost";
import PostBox from "../PostBox/PostBox";
import { useSelector } from "react-redux";
import { AppState } from "../../services/redux";

const ReturnHomePageFeed = () => {
const userProfileDetailStore = useSelector(
(state) => state.setUserProfileDetailReducer
(state: AppState) => state.setUserProfileDetailReducer
);
const userPostResponseDataState = useSelector(
(state) => state.setUserPostResponseData
(state: AppState) => state.setUserPostResponseData
);
const userProfilePostStore = useSelector(
(state) => state.setUserProfilePostReducer
(state: AppState) => state.setUserProfilePostReducer
);
return (
<>
Expand Down
Expand Up @@ -2,9 +2,12 @@ import React from "react";
import { useSelector } from "react-redux";
import MinViewPostField from "./MinViewPostField";
import MaxViewPostField from "./MaxViewPostField/MaxViewPostField";
import { AppState } from "../../services/redux";

const UserPostField = () => {
const viewValue = useSelector((state) => state.homePagePostFieldViewValue);
const viewValue = useSelector(
(state: AppState) => state.homePagePostFieldViewValue
);

if (viewValue === "min") {
return (
Expand All @@ -19,7 +22,7 @@ const UserPostField = () => {
</>
);
} else {
<></>;
return <></>;
}
};

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion client/src/pages/Index.tsx
Expand Up @@ -24,7 +24,7 @@ import { actionCreators } from "../services/redux";
const Index = () => {
const dispatch = useDispatch();
const history = useHistory();
const [renderMainPage, setRenderMainPage] = useState(false);
const [renderMainPage, setRenderMainPage] = useState<boolean>(false);
const {
setUserStories,
userProfileDetailAction,
Expand Down
Expand Up @@ -4,7 +4,7 @@ import {
UserProfilePostActionTypes,
} from "./types";

const initialState: UserPostResponseDataState = [
const initialState: UserPostResponseDataState[] = [
// {
// id: "",
// useremail: "",
Expand All @@ -18,7 +18,7 @@ const initialState: UserPostResponseDataState = [
// },
];
const setUserPostResponseData = (
state: UserPostResponseDataState = initialState,
state: UserPostResponseDataState[] = initialState,
action: UserPostResponseAction
) => {
switch (action.type) {
Expand Down
@@ -1,4 +1,4 @@
export type UserPostResponseDataState = [];
export interface UserPostResponseDataState {}

export enum UserProfilePostActionTypes {
USER_POST_RESPONSE_DATA = "UserPostResponseData",
Expand Down
Expand Up @@ -5,7 +5,7 @@ import {
} from "./types";
import { Dispatch } from "react";

export const userProfilePostAction = (data: UserProfilePostState) => {
export const userProfilePostAction = (data: UserProfilePostState[]) => {
return (dispatch: Dispatch<UserProfilePostAction>) => {
dispatch({
type: UserProfilePostActionTypes.SET_USER_PROFILE_POST,
Expand Down
Expand Up @@ -4,10 +4,10 @@ import {
UserProfilePostState,
} from "./types";

const initialState: UserProfilePostState = [];
const initialState: UserProfilePostState[] = [];
// this store the user Post data
const setUserProfilePostReducer = (
state: UserProfilePostState = initialState,
state: UserProfilePostState[] = initialState,
action: UserProfilePostAction
) => {
switch (action.type) {
Expand Down
@@ -1,12 +1,14 @@
export interface UserProfilePostState {}
export interface UserProfilePostState {
date: Date;
}

export enum UserProfilePostActionTypes {
SET_USER_PROFILE_POST = "userProfilePost",
}

export interface SetUserProfilePostAction {
type: UserProfilePostActionTypes.SET_USER_PROFILE_POST;
payload: UserProfilePostState;
payload: UserProfilePostState[];
}

export type UserProfilePostAction = SetUserProfilePostAction;

0 comments on commit b27dfdf

Please sign in to comment.