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 d53bf2a..77bcd72 100644 --- a/src/app/community/page.tsx +++ b/src/app/community/page.tsx @@ -6,27 +6,6 @@ import UniversityCard from '@/components/universityCommunity/universityCommunity import { useGetUserSubscribedCommunityGroups } from '@/services/university-community' import Loading from '../loading' -// const data = [ -// { -// UniversityName: 'University of Seoul', -// UniversityAddress: '163 Seoulsiripdae-ro, Dongdaemun-gu, Seoul', -// UniversityLink: 'asd', -// universityLogo: 'https://www.stonybrook.edu/commcms/studyabroad/_images/university-logos/UOS_emblem.png', -// }, -// { -// UniversityName: 'University of Seoul', -// UniversityAddress: '163 Seoulsiripdae-ro, Dongdaemun-gu, Seoul', -// UniversityLink: 'asd', -// universityLogo: 'https://www.stonybrook.edu/commcms/studyabroad/_images/university-logos/UOS_emblem.png', -// }, -// { -// UniversityName: 'University of Seoul', -// UniversityAddress: '163 Seoulsiripdae-ro, Dongdaemun-gu, Seoul', -// UniversityLink: 'asd', -// universityLogo: 'https://www.stonybrook.edu/commcms/studyabroad/_images/university-logos/UOS_emblem.png', -// }, -// ] - const Page = () => { const { data: SubscribedData, isLoading } = useGetUserSubscribedCommunityGroups() diff --git a/src/app/register/page.tsx b/src/app/register/page.tsx index 5e1bfda..3792274 100644 --- a/src/app/register/page.tsx +++ b/src/app/register/page.tsx @@ -27,7 +27,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 862cdbb..d8294db 100644 --- a/src/components/Timeline/Modals/EditProfileModal.tsx +++ b/src/components/Timeline/Modals/EditProfileModal.tsx @@ -37,7 +37,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] : '', @@ -133,26 +132,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/communityProfile/CommunityProfileContainer.tsx b/src/components/communityProfile/CommunityProfileContainer.tsx index c75791b..030f34b 100644 --- a/src/components/communityProfile/CommunityProfileContainer.tsx +++ b/src/components/communityProfile/CommunityProfileContainer.tsx @@ -88,7 +88,7 @@ const CommunityProfileContainer = () => { setModalContentType={setModalContentType} setIsModalOpen={setIsModalOpen} isUserProfile={true} - media="https://cdn.pixabay.com/photo/2016/04/07/18/36/architecture-1314416_1280.jpg" + media={[]} /> ) : selectedOption == valueType.Saved ? ( +
-

{UniversityName}

+

{UniversityName}

{address}