diff --git a/backend/src/controller/auth.js b/backend/src/controller/auth.js index 6c5be6c..790e6be 100644 --- a/backend/src/controller/auth.js +++ b/backend/src/controller/auth.js @@ -216,7 +216,7 @@ const varifyOtp = async (req, res) => { return res .cookie(updateUser.userID, token, { path: "/", - expires: new Date(Date.now() + 1000 * 1 * 24 * 60 * 60), + expires: new Date(Date.now() + 1000 * 7 * 24 * 60 * 60), httpOnly: true, sameSite: "lax", }) @@ -334,7 +334,7 @@ const signin = async (req, res) => { res .cookie(user.userID, token, { path: "/", - expires: new Date(Date.now() + 1000 * 1 * 24 * 60 * 60), + expires: new Date(Date.now() + 1000 * 7 * 24 * 60 * 60), httpOnly: true, sameSite: "lax", }) diff --git a/frontend/src/assets/cficon.ico b/frontend/src/assets/cficon.ico new file mode 100644 index 0000000..0eaac6b Binary files /dev/null and b/frontend/src/assets/cficon.ico differ diff --git a/frontend/src/components/ProfileLayout.jsx b/frontend/src/components/ProfileLayout.jsx index 7653a0e..05b8e32 100644 --- a/frontend/src/components/ProfileLayout.jsx +++ b/frontend/src/components/ProfileLayout.jsx @@ -15,6 +15,7 @@ import LeetCode from './LeetCode'; import LeetCodeLogo from '../assets/LeetCodeLogo' import Codeforces from './Codeforces'; import { setBgImg, setDp } from '../redux/profile'; +import cficon from '../assets/cficon.ico' axios.defaults.withCredentials = true @@ -37,7 +38,7 @@ const ProfileLayout = ({ isLoading, user }) => { const currentPath = location.pathname.split('/').pop(); - + const handleClickOutside = (event) => { @@ -96,7 +97,7 @@ const ProfileLayout = ({ isLoading, user }) => {
- +
@@ -112,32 +113,42 @@ const ProfileLayout = ({ isLoading, user }) => {
- Profile + Profile
{userInfo?.username === user.username && }
-
-
{user.username}
+
+
{user.username}
u/{user.username}
{userInfo?.bio}
- {user?.showCf&&
} +
-
+
+ {user.showLC && + + } + { } +
+ {user?.showCf &&
+ +
} - {user.showLC &&
+ {/* {user.showLC &&
-
} +
} */} {showLCard &&
@@ -172,9 +183,9 @@ const ProfileLayout = ({ isLoading, user }) => { export default ProfileLayout; -export const handleDpChange = async ({dpLoc, setBtnLoading, dispatch,setIsOpen}) => { +export const handleDpChange = async ({ dpLoc, setBtnLoading, dispatch, setIsOpen }) => { - if(!dpLoc){ + if (!dpLoc) { return; } const formData = new FormData(); @@ -190,7 +201,7 @@ export const handleDpChange = async ({dpLoc, setBtnLoading, dispatch,setIsOpen}) if (res.status == 202) { console.log(res); - + dispatch(setUserInfo(res.data)); dispatch(setDp(res.data.dp)) toast.success("Profile Picture Updated !") diff --git a/frontend/src/pages/CreatePost.jsx b/frontend/src/pages/CreatePost.jsx index 58c9309..3ac4e98 100644 --- a/frontend/src/pages/CreatePost.jsx +++ b/frontend/src/pages/CreatePost.jsx @@ -17,6 +17,8 @@ const CreatePost = ({ setShowCP, onNewPost, roomTitle, setPost }) => { const [description, setDescription] = useState(''); const [image, setImage] = useState(null); const [Btnloading, setLoading] = useState(false); + const [mediaLoading, setmediaLoading] = useState(false) + const [disable, setdisable] = useState(false) const location = useLocation(); const selectFile = useRef(null); @@ -37,14 +39,19 @@ const [error, seterror] = useState("") const handleChange = async (e) => { const file = e.target.files[0]; - - // Check if file exists + if (!file) return; + setmediaLoading(true) + setdisable(true) // Check file size - if (file.size <= 3 * 1024 * 1024) { + console.log(file); + + if (file.size <= 3 * 1024 * 1024) {3,145,728 // File size is less than or equal to 3MB, no need to compress setImage(file); + setdisable(false) + setmediaLoading(false) return; } @@ -61,8 +68,13 @@ const [error, seterror] = useState("") } catch (error) { console.error('Error compressing image:', error); } + setmediaLoading(false) + setdisable(false) }; + + + const handleSelectChange = (event) => { setSelectedOption(event.target.value); }; @@ -210,19 +222,20 @@ const [error, seterror] = useState("") Image
{image?.name}
-
- + {mediaLoading && }
handleChange(e)} accept='image/*' ref={selectFile} type="file" name="media" id="media" hidden />
{/* Submit Button */} -
diff --git a/frontend/src/pages/Overview.jsx b/frontend/src/pages/Overview.jsx index ab126b4..e416641 100644 --- a/frontend/src/pages/Overview.jsx +++ b/frontend/src/pages/Overview.jsx @@ -102,7 +102,7 @@ const Overview = () => { const fetchMoreData = () => { if (isLoading || !hasMore) return; - setPage(prevPage => prevPage + 1); + setPage(prevPage => prevPage + 1); }; return (