From 5f91f833b67295d0abf62e62f4223a8e9f2dec0d Mon Sep 17 00:00:00 2001 From: bacpactech Date: Tue, 9 Jul 2024 22:29:45 +0530 Subject: [PATCH 1/3] fix: added logo --- src/assets/unibuzz_logo.svg | 1 + src/components/Navbar/Navbar.tsx | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) create mode 100644 src/assets/unibuzz_logo.svg diff --git a/src/assets/unibuzz_logo.svg b/src/assets/unibuzz_logo.svg new file mode 100644 index 0000000..d0d4cec --- /dev/null +++ b/src/assets/unibuzz_logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/components/Navbar/Navbar.tsx b/src/components/Navbar/Navbar.tsx index 0230710..19b892a 100644 --- a/src/components/Navbar/Navbar.tsx +++ b/src/components/Navbar/Navbar.tsx @@ -11,7 +11,7 @@ import Image from 'next/image' import Link from 'next/link' //import demopic from '@assets/demopic.jpg' import star from '@assets/star.png' -import unibuzzLogo from '@assets/logo.svg' +import unibuzzLogo from '@assets/unibuzz_logo.svg' import { TbMailFilled } from 'react-icons/tb' import { FaBell } from 'react-icons/fa' import { usePathname } from 'next/navigation' @@ -203,10 +203,9 @@ const Navbar: React.FC = () => {
-
+
BACPAC LOGO - Unibuzz
From 464ebd92886995a2288713468baf8dbc1ec67e61 Mon Sep 17 00:00:00 2001 From: Aamil13 Date: Wed, 10 Jul 2024 11:20:57 +0530 Subject: [PATCH 2/3] added multi-image-upload in image selection and removed email from userProfile-edit and added gif in comments/post --- src/app/community/[id]/page.tsx | 2 +- src/app/community/page.tsx | 60 ++++++++++--------- src/app/register/page.tsx | 2 +- .../Timeline/Modals/EditProfileModal.tsx | 21 ------- src/components/Timeline/Post.tsx | 16 +++-- src/components/Timeline/PostInput.tsx | 56 +++++++++++++---- .../universityCommunityCart.tsx | 4 +- src/models/auth.ts | 4 +- src/services/auth.ts | 2 + src/types/constants.ts | 2 +- 10 files changed, 95 insertions(+), 74 deletions(-) diff --git a/src/app/community/[id]/page.tsx b/src/app/community/[id]/page.tsx index bc6ac0b..5cc0a22 100644 --- a/src/app/community/[id]/page.tsx +++ b/src/app/community/[id]/page.tsx @@ -111,7 +111,7 @@ const Page = () => { setIsModalOpen={setIsModalOpen} isUniversity={true} profileDp={userProfileData?.profile_dp?.imageUrl} - media={item?.imageUrl?.imageUrl} + media={item?.imageUrl} />
))} diff --git a/src/app/community/page.tsx b/src/app/community/page.tsx index 597627f..66563eb 100644 --- a/src/app/community/page.tsx +++ b/src/app/community/page.tsx @@ -4,6 +4,7 @@ import Navbar from '@/components/Timeline/Navbar' import Footer from '@/components/Footer/Footer' import UniversityCard from '@/components/universityCommunity/universityCommunityCart' import { useGetUserSubscribedCommunityGroups } from '@/services/university-community' +import Loading from '../loading' // const data = [ // { @@ -28,37 +29,40 @@ import { useGetUserSubscribedCommunityGroups } from '@/services/university-commu const Page = () => { const { data: SubscribedData, isLoading } = useGetUserSubscribedCommunityGroups() + return ( <> -
-

Joined Communities

- {isLoading ? ( -
Loading
- ) : SubscribedData?.community?.length ? ( -
- {SubscribedData?.community?.map((item: any) => ( - - ))} -
- ) : ( -
-

- You have yet to join university communities! -

-

- Search your university and start connecting with other applicants, current students, or faculty. -

- -
- )} -
+ {isLoading || !SubscribedData ? ( + + ) : ( +
+

Joined Communities

+ {SubscribedData?.community?.length ? ( +
+ {SubscribedData?.community?.map((item: any) => ( + + ))} +
+ ) : ( +
+

+ You have yet to join university communities! +

+

+ Search your university and start connecting with other applicants, current students, or faculty. +

+ +
+ )} +
+ )}
) diff --git a/src/app/register/page.tsx b/src/app/register/page.tsx index dc40eca..e04f88e 100644 --- a/src/app/register/page.tsx +++ b/src/app/register/page.tsx @@ -26,7 +26,7 @@ const SignUp = () => { const onSignupSubmit: SubmitHandler = (data) => { // eslint-disable-next-line @typescript-eslint/no-unused-vars - const { confirmPassword, tnc, country, city, ...signupData } = data + const { confirmPassword, tnc, ...signupData } = data mutateRegister(signupData) } diff --git a/src/components/Timeline/Modals/EditProfileModal.tsx b/src/components/Timeline/Modals/EditProfileModal.tsx index c8526b0..6a3a7ff 100644 --- a/src/components/Timeline/Modals/EditProfileModal.tsx +++ b/src/components/Timeline/Modals/EditProfileModal.tsx @@ -36,7 +36,6 @@ const EditProfileModal = () => { } = useForm({ defaultValues: { fullname: userData.firstName, - email: userProfileData?.email[0]?.UniversityEmail || '', bio: userProfileData?.bio, phone_number: userProfileData?.phone_number, dob: userProfileData?.dob ? new Date(userProfileData?.dob).toISOString().split('T')[0] : '', @@ -132,26 +131,6 @@ const EditProfileModal = () => { {errors.city && Please enter your City!} - - - {errors.email && ( - - {' '} - {typeof errors.email.message === 'string' ? errors.email.message : 'Please enter your email!'} - - )} diff --git a/src/components/Timeline/Post.tsx b/src/components/Timeline/Post.tsx index 2f7adbf..176c3f9 100644 --- a/src/components/Timeline/Post.tsx +++ b/src/components/Timeline/Post.tsx @@ -6,7 +6,7 @@ import { IoPaperPlaneSharp } from 'react-icons/io5' // import Image from 'next/image' import { SlOptions } from 'react-icons/sl' import { FaBookmark } from 'react-icons/fa6' -import { MdOutlineImage } from 'react-icons/md' +// import { MdOutlineImage } from 'react-icons/md' import { MdGifBox, MdOutlineBookmarkBorder } from 'react-icons/md' import { HiReply, HiOutlineBell, HiOutlineFlag } from 'react-icons/hi' import { BiRepost } from 'react-icons/bi' @@ -52,7 +52,7 @@ interface PostProps { setModalContentType: React.Dispatch> setIsModalOpen: React.Dispatch> isUserProfile?: boolean - media?: string + media?: [] saved?: boolean isUniversity?: boolean postID?: string @@ -215,8 +215,10 @@ const Post: React.FC = ({
{/* media div */} {media && ( -
- media +
+ {media?.map((item: { imageUrl: string }) => ( + media + ))}
)} {/* Post Content */} @@ -276,16 +278,17 @@ const Post: React.FC = ({ placeholder="Add a comment..." className="flex-grow mx-1 sm:mx-4 p-1 border-none focus:outline-none w-full lg:min-w-[370px] xs:text-xs sm:text-sm" /> - + {/* */}
setImageValue(e.target.files[0])} + accept="image/gif,image/webp" />
@@ -331,6 +334,7 @@ const Post: React.FC = ({
+ {comment?.imageUrl?.imageUrl && }

{comment?.content}

diff --git a/src/components/Timeline/PostInput.tsx b/src/components/Timeline/PostInput.tsx index abc395c..cacb6b7 100644 --- a/src/components/Timeline/PostInput.tsx +++ b/src/components/Timeline/PostInput.tsx @@ -20,27 +20,35 @@ interface PostInputProps { const PostInput: React.FC = ({ setIsModalOpen, setModalContentType, idToPost, profileDp }) => { const [inputValue, setInputValue] = useState('') - const [ImageValue, setImageValue] = useState(null) + const [ImageValue, setImageValue] = useState([]) const { mutate: CreateGroupPost } = useCreateGroupPost() const handleEmojiClick = (emojiData: any) => { setInputValue((prevValue) => prevValue + emojiData.emoji) } + const processImages = async (images: File[]) => { + const promises = images.map((image) => replaceImage(image, '')) + const results = await Promise.all(promises) + return results.map((result) => ({ + imageUrl: result?.imageUrl, + publicId: result?.publicId, + })) + } + const handleGroupPost = async () => { if (inputValue.length <= 1) { return console.log('Please type something to post!') } if (ImageValue) { - // setProfileImage(files[0]); - const imagedata: any = await replaceImage(ImageValue, '') - + const imagedata = await processImages(ImageValue) const data = { communityId: idToPost, content: inputValue, - imageUrl: { imageUrl: imagedata?.imageUrl, publicId: imagedata?.publicId }, + imageUrl: imagedata, } + CreateGroupPost(data) } else { const data = { @@ -69,21 +77,45 @@ const PostInput: React.FC = ({ setIsModalOpen, setModalContentTy {ImageValue && ( -
- -

setImageValue(null)} className="absolute right-0 top-0 w-5 h-5 bg-white rounded-full text-center"> - X -

+
+ {ImageValue?.map((item, idx) => ( +
+ +

setImageValue(ImageValue.filter((img) => img != item))} + className="absolute right-0 top-0 w-5 h-5 bg-white rounded-full text-center" + > + X +

+
+ ))}
)}
- setImageValue(e.target.files[0])} /> + setImageValue([...ImageValue, e.target.files[0]])} + />
- +
+ setImageValue([...ImageValue, e.target.files[0]])} + /> + +
{/* EMOJI Icon */} diff --git a/src/components/universityCommunity/universityCommunityCart.tsx b/src/components/universityCommunity/universityCommunityCart.tsx index e1853c0..ee95ea9 100644 --- a/src/components/universityCommunity/universityCommunityCart.tsx +++ b/src/components/universityCommunity/universityCommunityCart.tsx @@ -24,9 +24,9 @@ const UniversityCommunityCart = ({ UniversityName, UniversityAddress, University } } return ( -
+
-

{UniversityName}

+

{UniversityName}

{address}