Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
soumik-aj12 committed May 21, 2024
1 parent 9612b05 commit f021cc9
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 55 deletions.
Binary file added backend/public/uploads/users/no-image.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 20 additions & 21 deletions frontend/src/Screens/Authentication/Register.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ export const Register = () => {
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("");
Expand All @@ -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({
Expand Down Expand Up @@ -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
/>
<div
className={`password-requirements-popup ${
showPasswordRequirements ? "show" : ""
}`}
>
At least 8 characters, one uppercase letter, one lowercase
letter, one digit, and one special character
</div>
{passwordInputFocused && (
<div className="password-requirements">
At least 8 characters, one uppercase letter, one lowercase
letter, one digit, and one special character
</div>
)}
</div>
{/* list of locality */}
{/* {addressList &&
Expand Down
26 changes: 13 additions & 13 deletions frontend/src/Screens/OtherProfile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -111,22 +111,22 @@ export default OtherProfile;
function PostCard({ postData }) {
return (
<div className="bg-white border rounded-xl">
<div className="w-full h-[200px] bg-gray-100 mb-2">
<img
src={
postData.image !== ""
? `http://localhost:8080/post-images/${postData.image}`
: "https://source.unsplash.com/random"
}
alt="post-index"
className="object-contain h-full w-full"
/>
</div>
{postData.image !== "" ? (
<div className="w-full rounded-t-xl bg-gray-100 mb-2 overflow-hidden">
<img
src={`http://localhost:8080/post-images/${postData.image}`}
alt="post-index"
className="object-contain h-full w-full"
/>
</div>
) : (
<></>
)}

<div className="p-2">
<h2 className="font-bold text-gray-700 mb-2">{postData.title}</h2>

<p className="line-clamp-3">{postData.content}</p>
<p className="line-clamp-5">{postData.content}</p>

<div className="flex items-center gap-5 mt-2">
<button className="flex items-center mt-2 gap-2 hover:bg-gray-200 rounded-full px-2">
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/Screens/Profile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ function Profile() {
src={
profileUser.avatar
? `http://localhost:8080/users-images/${profileUser.avatar}`
: "https://source.unsplash.com/random"
: "no-image.jpg"
}
alt={profileUser.name}
className="h-full w-full object-cover"
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/CommentComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export const CommentComponent = ({ postID, userID }) => {
replies={replyComments(commentData._id)}
userID={userID}
postID={postID}
setComments={setComments}
/>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/CommentTile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/Navbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export default function Navbar() {
<NavLink to="/profile" className="navLink">
My Profile
</NavLink>

<NavLink to="/about" className="navLink">
About Us
</NavLink>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/PostComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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`}
>
<button
{/* <button
onClick={() => {
setShowPostMenu(false);
}}
Expand All @@ -152,7 +152,7 @@ export const PostComponent = ({
>
<EditIcon size="h-4 w-4" />
Edit
</button>
</button> */}
<button
type="button"
className="w-full hover:bg-gray-100 p-2 flex items-center gap-2 text-sm font-medium"
Expand Down
22 changes: 5 additions & 17 deletions frontend/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,8 @@
.circleAvatar {
@apply h-10 w-10 rounded-full overflow-hidden;
}

.password-requirements-popup {
position: absolute;
top: 348px;
left: 49%;
transform: translateX(3%);
background-color: #333;
color: #fff;
padding: 10px;
border-radius: 5px;
opacity: 0;
transition: opacity 0.3s ease-in-out;
}

.password-requirements-popup.show {
opacity: 1;
}
.password-requirements {
color: #666;
font-size: 0.8rem;
margin-top: 0.5rem;
}

0 comments on commit f021cc9

Please sign in to comment.