From f021cc9e860766012a42a5f63de3a72d031f3cea Mon Sep 17 00:00:00 2001 From: Soumik Sil Date: Tue, 21 May 2024 18:56:26 +0530 Subject: [PATCH] fix --- backend/public/uploads/users/no-image.jpg | Bin 0 -> 7426 bytes .../src/Screens/Authentication/Register.jsx | 41 +++++++++--------- frontend/src/Screens/OtherProfile.jsx | 26 +++++------ frontend/src/Screens/Profile.jsx | 2 +- frontend/src/components/CommentComponent.jsx | 1 + frontend/src/components/CommentTile.jsx | 2 +- frontend/src/components/Navbar.jsx | 1 + frontend/src/components/PostComponent.jsx | 4 +- frontend/src/index.css | 22 +++------- 9 files changed, 44 insertions(+), 55 deletions(-) create mode 100644 backend/public/uploads/users/no-image.jpg diff --git a/backend/public/uploads/users/no-image.jpg b/backend/public/uploads/users/no-image.jpg new file mode 100644 index 0000000000000000000000000000000000000000..def330ff28a855e622c45650303499abdb5a1125 GIT binary patch literal 7426 zcmeHLc~lcu7oSOhAP6R?h=>v*AR>@OP!b3Pl_ek+Wm6F)BtuBeW)cK(0o->BT5a6` z=@Ba~b!m%26-2Fy8wC*+D=1d|6qmZ=!uMuKCKDCE(|&*ToW7G}?z`K&zkBbzd6~|p z&K8Io872&aU@*L3F9_;vg>pi(WN8p26na9I5CoASTbKm-0g3~@j<7idgR2yL2k2=P zpwSVplt~b!PL?JUrOFYy8qsJ~O1ex8e$rKP38JCTM8rCkhAxxKGqgI5NGDS%y?{5= zq2b!uYCbkyr&IHoOr_RGBvGXzK4O)EnI%#)**+{L6d0VP7Kx`LI(jN1l_~j*M-@jI zbeV+DNc4+lMXN_6>9UAy4HBC@E>4_1UCfm*f`hCAvv^qwwF1$J=vfN6Qp?NYGce~o zK%;CXBgm>pphl9$n=mF!uLEX$hCZ0g%uJum;XW#jl*#6Dxl9&^$>Ded4R7r%rB0OP zt<(-iU3B>vgJ{JXnHmL1M}3M?RT(-ygQ0hbA=!#zpniuUCnO3I~Psf(S zQYuHJA~{no6C+A3;w_SD5X>kzL#LRg0Fh)U_@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tl83 z@gfqH!BNjBqU(!f5lng;JGreu=vJF@xh?iYUPIY!b*1&s!;cJjnd`P{m!In1+b>?` zUM#siBe2(@d7)EMe&)Mfesb~t!ejih)+FXow*sNpOHPE(3jUk#>kHGe^QDz9f9qJG zY zoxQ+5;v2sKozT6LFJ@!EZ#tnL*lBrrAxA6X!uxKVA4sX`pBg=+Dr8R`wQA|Hj3T!i z+i)IRP7^Jc~n;4Hnc@fDSQT-w(Q6dVW3SQOc-<<=h|6ygtpx z7P$8qV!qseVRDi6+ErIN`qmy^Q3ox2KA@!b?CC)c#Q}RtG@>2SO{{7N9$XGB+QzP( z(#Dt?)(VyJUOZAi4%s^5%K!il0W>KIiuIXWW8@?p_+zy-4V~{xgQce=bb7`6QFzO<+!hAUk4COf+*r?TM)-Rx=8{ zjTwZD5vy5*3W;tdgrcON!es<0aR~t`v@^Ojsb(%JBp4E_iN#}PG&HH^I@HjN5W`0> zVS-x|m;&&hfM96aw7_c*f}v^C{*)U^0ODFegbCs_nVP^PE{D=Yn8F?hb3+#crr|@V zrW*@|2@{G!fN6=!Ot2VXg4fwy!$3I^_f7`Z_xqTgIhpkpdTw6R! zK^{6Hq@jZB*W@JI{O080Tl~xYAC}*WCcnA^qV=YNSV&|F*^Hz=Zov?Z?E+3)*kLPQ zkXO8~y6!Qxh%9MiHyzsFMYr-$u4 zaV7p@vwiT{xS@8Zhn2i|``YHcPs_R06UuH$s+xXKT<7*^Tz%)ytJ9LU?y1b1X2VLF zEX!Q;GdWgLqu@fH5BO0>337c0u&c{RPSY!4A6SFM|-p7C~2 zqWOX>%Qmt1_teG4(^rQ=%>DUv256pC(kea zS^c!s_U_tJ_y5#g3BS>P|37E1&Z=3GdGpB8ZMS?h$~Ey9>K8YhKi9Lq_t { const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [passwordValid, setPasswordValid] = useState(false); - const [showPasswordRequirements, setShowPasswordRequirements] = - useState(false); + const [passwordInputFocused, setPasswordInputFocused] = useState(false); const [latitude, setLatitude] = useState(""); const [longitude, setLongitude] = useState(""); const [city, setCity] = useState(""); @@ -32,12 +31,12 @@ export const Register = () => { const passwordValue = e.target.value; setPassword(passwordValue); setPasswordValid(passwordRegex.test(passwordValue)); - }; - const showPasswordRequirementsPopup = () => { - setShowPasswordRequirements(true); - setTimeout(() => { - setShowPasswordRequirements(false); - }, 3000); + + if (e.type === "focus") { + setPasswordInputFocused(true); + } else if (e.type === "blur") { + setPasswordInputFocused(false); + } }; const { coords, isGeolocationAvailable, isGeolocationEnabled } = useGeolocated({ @@ -278,23 +277,23 @@ export const Register = () => { id="password" value={password} onChange={handlePasswordChange} - onFocus={showPasswordRequirementsPopup} + onFocus={(e) => handlePasswordChange(e)} + onBlur={(e) => handlePasswordChange(e)} className={`textfield ${ - passwordValid - ? "border-solid border-2 border-green-600" - : "border-solid border-2 border-red-600" - }`} + password.length !==0 && + (passwordValid + ? "border-solid border-2 border-green-600" + : "border-solid border-2 border-red-600") + }`} placeholder="Your password here ..." required /> -
- At least 8 characters, one uppercase letter, one lowercase - letter, one digit, and one special character -
+ {passwordInputFocused && ( +
+ At least 8 characters, one uppercase letter, one lowercase + letter, one digit, and one special character +
+ )} {/* list of locality */} {/* {addressList && diff --git a/frontend/src/Screens/OtherProfile.jsx b/frontend/src/Screens/OtherProfile.jsx index c1fa23d..6888613 100644 --- a/frontend/src/Screens/OtherProfile.jsx +++ b/frontend/src/Screens/OtherProfile.jsx @@ -55,7 +55,7 @@ function OtherProfile() { src={ otherProfile.avatar ? `http://localhost:8080/users-images/${otherProfile.avatar}` - : "https://source.unsplash.com/random" + : "http://localhost:8080/users-images/no-image.jpg" } alt={otherProfile.name} className="h-full w-full object-cover" @@ -111,22 +111,22 @@ export default OtherProfile; function PostCard({ postData }) { return (
-
- post-index -
+ {postData.image !== "" ? ( +
+ post-index +
+ ) : ( + <> + )}

{postData.title}

-

{postData.content}

+

{postData.content}

); diff --git a/frontend/src/components/CommentTile.jsx b/frontend/src/components/CommentTile.jsx index f30ddc1..5dc64b1 100644 --- a/frontend/src/components/CommentTile.jsx +++ b/frontend/src/components/CommentTile.jsx @@ -3,7 +3,7 @@ import { SendIcon } from "./Icons"; import axios from "axios"; import { Context } from "../context/ContextProvider"; -function CommentTile({ commentData, replies, userID, postID }) { +function CommentTile({ commentData, replies, userID, postID,setComments }) { const [newReply, setNewReply] = useState(""); const [likeComment, setLikeComment] = useState(false); const [incomingReplies, setIncomingReplies] = useState(replies); diff --git a/frontend/src/components/Navbar.jsx b/frontend/src/components/Navbar.jsx index 3ae2023..0b5cdc7 100644 --- a/frontend/src/components/Navbar.jsx +++ b/frontend/src/components/Navbar.jsx @@ -44,6 +44,7 @@ export default function Navbar() { My Profile + About Us diff --git a/frontend/src/components/PostComponent.jsx b/frontend/src/components/PostComponent.jsx index f245452..2207f61 100644 --- a/frontend/src/components/PostComponent.jsx +++ b/frontend/src/components/PostComponent.jsx @@ -143,7 +143,7 @@ export const PostComponent = ({ showPostMenu ? "opacity-100" : "opacity-0 pointer-events-none" } absolute shadow-lg py-2 bg-white rounded-lg w-[100px] transition-opacity duration-300 right-1`} > - + */}