From 5ddf842def59e3718efa287fe54a1bc3ac2ec8f3 Mon Sep 17 00:00:00 2001 From: Aditya-Sakpal Date: Sat, 20 Jan 2024 20:05:44 +0530 Subject: [PATCH 1/5] Confirmation --- functions/package.json | 2 +- src/store/actions/authActions.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/package.json b/functions/package.json index f20d6f03..837d0b0f 100644 --- a/functions/package.json +++ b/functions/package.json @@ -15,7 +15,7 @@ "dependencies": { "dotenv": "^16.0.1", "firebase-admin": "^9.0.0", - "firebase-functions": "^3.9.0", + "firebase-functions": "^3.24.1", "lodash": "^4.17.19" }, "devDependencies": { diff --git a/src/store/actions/authActions.js b/src/store/actions/authActions.js index 5b748dee..9520eb78 100644 --- a/src/store/actions/authActions.js +++ b/src/store/actions/authActions.js @@ -290,4 +290,4 @@ export const setUpInitialData = console.log(e); dispatch({ type: actions.INITIAL_SETUP_FAIL, payload: e }); } - }; + }; \ No newline at end of file From 7df06d1aea68519430e4d9d2b01ddec172f6a42f Mon Sep 17 00:00:00 2001 From: Aditya-Sakpal Date: Sun, 21 Jan 2024 14:35:24 +0530 Subject: [PATCH 2/5] Confirmation --- src/components/Card/CardWithPicture.jsx | 108 +++++++++++++----- src/components/Card/CardWithoutPicture.jsx | 92 ++++++++++++--- src/components/HomePage/userList.jsx | 2 + .../Organization/ViewOrganization/Feeds.jsx | 9 +- .../User/UserProfile/UserProfile.jsx | 4 +- src/store/actions/orgActions.js | 2 +- 6 files changed, 160 insertions(+), 57 deletions(-) diff --git a/src/components/Card/CardWithPicture.jsx b/src/components/Card/CardWithPicture.jsx index e8cd65c2..e96144e6 100644 --- a/src/components/Card/CardWithPicture.jsx +++ b/src/components/Card/CardWithPicture.jsx @@ -23,6 +23,7 @@ import { useDispatch, useSelector } from "react-redux"; import { useFirebase, useFirestore } from "react-redux-firebase"; import { getUserProfileData } from "../../store/actions"; + const useStyles = makeStyles(theme => ({ root: { margin: "0.5rem", @@ -75,6 +76,8 @@ export default function CardWithPicture({ tutorial }) { const classes = useStyles(); const [alignment, setAlignment] = React.useState("left"); const [count, setCount] = useState(1); + const [tags, setTags] = useState([]) + const dispatch = useDispatch(); const firebase = useFirebase(); const firestore = useFirestore(); @@ -106,24 +109,44 @@ export default function CardWithPicture({ tutorial }) { return timestamp.toDate().toDateString(); }; + useEffect(() => { + if (tutorial.tags) { + const tagsArray = tutorial.tags.split(' '); + setTags(tagsArray) + } + console.log(tutorial) + },[]) + + + return ( - - - + {tutorial.featured_image ? + + + + : ""} - {user?.photoURL && user?.photoURL.length > 0 ? ( - - ) : ( - user?.displayName[0] - )} + {tutorial.profilePic ? + + + : + user?.photoURL && user?.photoURL.length > 0 ? ( + + ) : ( + user?.displayName[0] + ) + } + + + } title={ @@ -135,7 +158,7 @@ export default function CardWithPicture({ tutorial }) { color="textPrimary" data-testId="UserName" > - {user?.displayName} + {tutorial.name ? tutorial.name : user?.displayName} {tutorial?.owner && ( <> @@ -153,9 +176,25 @@ export default function CardWithPicture({ tutorial }) { )} } - subheader={tutorial?.createdAt ? getTime(tutorial?.createdAt) : ""} + subheader={tutorial?.createdAt ? getTime(tutorial?.createdAt) : tutorial.date} /> - + {tutorial.tutorial_id ? + + + + {tutorial?.title} + + + {tutorial?.summary} + + + : {tutorial?.title} @@ -167,26 +206,41 @@ export default function CardWithPicture({ tutorial }) { paragraph data-testId="Description" > - {tutorial?.summary} + {tutorial?.description} - + } + - + {tutorial.tags ? + tags.map((tag) => ( + + )) + : + + } + - {"10 min"} + {tutorial.time ? tutorial.time : "10 min"}
data ); + useEffect(() => { + console.log(tutorial, user) + }, []) + const getTime = timestamp => { return timestamp.toDate().toDateString(); }; + useEffect(() => { + if (tutorial.tags) { + const tagsArray = tutorial.tags.split(' '); + setTags(tagsArray) + } + console.log(tutorial) + }, []) + + return ( - {user?.photoURL && user?.photoURL.length > 0 ? ( - - ) : ( - user?.displayName[0] - )} + {tutorial?.profilePic ? + + + : + user?.photoURL && user?.photoURL.length > 0 ? ( + + ) : ( + user?.displayName[0] + ) + } + } title={ @@ -121,7 +141,7 @@ export default function CardWithoutPicture({ tutorial }) { color="textPrimary" data-testId="UserName" > - {user?.displayName} + {tutorial?.name ? tutorial.name : user?.displayName} {tutorial?.owner && ( <> @@ -139,9 +159,29 @@ export default function CardWithoutPicture({ tutorial }) { )} } - subheader={tutorial?.createdAt ? getTime(tutorial?.createdAt) : ""} + subheader={tutorial?.createdAt ? getTime(tutorial?.createdAt) : tutorial.date} /> - + {tutorial?.tutorial_id ? + + + + {tutorial?.title} + + + {tutorial?.summary} + + + + : - {tutorial?.summary} + {tutorial?.description} - + } + - + {tutorial.tags ? + tags.map((tag) => ( + + )) + : + + } - {"10 min"} + {tutorial.time ? tutorial.time : "10 min"}
))} diff --git a/src/components/User/UserProfile/UserProfile.jsx b/src/components/User/UserProfile/UserProfile.jsx index c0e31882..a2fabb1e 100644 --- a/src/components/User/UserProfile/UserProfile.jsx +++ b/src/components/User/UserProfile/UserProfile.jsx @@ -106,9 +106,9 @@ function UserProfile(props) { {userList.persons.map(person => { return person.Heading == "CardWithoutPicture" ? ( - + ) : ( - + ); })} diff --git a/src/store/actions/orgActions.js b/src/store/actions/orgActions.js index c73b05d4..27fd8dca 100644 --- a/src/store/actions/orgActions.js +++ b/src/store/actions/orgActions.js @@ -229,7 +229,7 @@ export const getOrgData = try { dispatch({ type: actions.GET_ORG_DATA_START }); - const isOrgExists = await checkOrgHandleExists(org_handle)(firestore); + const isOrgExists = await checkOrgHandleExists(org_handle)(firebase); if (isOrgExists) { const doc = await firestore From e67e498e82641a394481bc2b19075e11ca01875e Mon Sep 17 00:00:00 2001 From: Aditya Sakpal <112710558+Aditya-Sakpal@users.noreply.github.com> Date: Sun, 21 Jan 2024 15:23:09 +0530 Subject: [PATCH 3/5] Update package.json --- functions/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/package.json b/functions/package.json index 837d0b0f..f20d6f03 100644 --- a/functions/package.json +++ b/functions/package.json @@ -15,7 +15,7 @@ "dependencies": { "dotenv": "^16.0.1", "firebase-admin": "^9.0.0", - "firebase-functions": "^3.24.1", + "firebase-functions": "^3.9.0", "lodash": "^4.17.19" }, "devDependencies": { From ef0c622d4a427e317bd18ea5c856b7c222144cc2 Mon Sep 17 00:00:00 2001 From: Aditya Sakpal <112710558+Aditya-Sakpal@users.noreply.github.com> Date: Sun, 21 Jan 2024 15:23:54 +0530 Subject: [PATCH 4/5] Update authActions.js --- src/store/actions/authActions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/store/actions/authActions.js b/src/store/actions/authActions.js index 9520eb78..5b748dee 100644 --- a/src/store/actions/authActions.js +++ b/src/store/actions/authActions.js @@ -290,4 +290,4 @@ export const setUpInitialData = console.log(e); dispatch({ type: actions.INITIAL_SETUP_FAIL, payload: e }); } - }; \ No newline at end of file + }; From 52e2cd3072192ed4a4b5b159c2fc314aa263c649 Mon Sep 17 00:00:00 2001 From: Aditya Sakpal <112710558+Aditya-Sakpal@users.noreply.github.com> Date: Sun, 21 Jan 2024 15:25:27 +0530 Subject: [PATCH 5/5] Update authActions.js