Skip to content

Commit

Permalink
build error fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Aamil13 committed Jul 13, 2024
2 parents 650a1fe + a203933 commit 96791c0
Show file tree
Hide file tree
Showing 15 changed files with 73 additions and 72 deletions.
2 changes: 1 addition & 1 deletion src/app/community/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ const Page = () => {
setIsModalOpen={setIsModalOpen}
isUniversity={true}
profileDp={userProfileData?.profile_dp?.imageUrl}
media={item?.imageUrl?.imageUrl}
media={item?.imageUrl}
/>
</div>
))}
Expand Down
21 changes: 0 additions & 21 deletions src/app/community/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion src/app/register/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const SignUp = () => {

const onSignupSubmit: SubmitHandler<RegisterForm> = (data) => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { confirmPassword, tnc, country, city, ...signupData } = data
const { confirmPassword, tnc, ...signupData } = data
mutateRegister(signupData)
}

Expand Down
1 change: 1 addition & 0 deletions src/app/timeline/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ const Timeline = () => {
<Dropdown options={options} defaultOption="Recent" />
<Post
user="Joshua Welman"
adminId="123"
university="Nagoya University"
year="2nd Yr. Graduate"
text="Can someone help me with this chemistry equation? Here’s the link to the google drive:"
Expand Down
1 change: 1 addition & 0 deletions src/assets/unibuzz_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 2 additions & 3 deletions src/components/Navbar/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -276,10 +276,9 @@ const Navbar: React.FC = () => {
<div className="navbar justify-around w-full center-v h-16 sticky top-0 px-6 xl:px-28 bg-white">
<div className="flex w-full center-v justify-between">
<div className="w-1/6">
<div className="flex">
<div className="flex max-w-[150px] min-w-[100px]">
<Link className="flex gap-4 center-v" href="/">
<Image src={unibuzzLogo} alt="BACPAC LOGO" className="h-full w-full cursor-pointer" />
<span>Unibuzz</span>
</Link>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Notifiaction/AssignNotification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ type Props = {

const AssignNotification = ({ id, senderName, communityGroupId, message, createdAt }: Props) => {
const { mutate: updateIsSeen } = useUpdateIsSeenCommunityGroupNotification()
console.log('postId', communityGroupId)

const handleIsSeenGroup = (id: string) => {
const dataToPush = {
Expand All @@ -23,6 +22,7 @@ const AssignNotification = ({ id, senderName, communityGroupId, message, created
}
// console.log('nData', dataToPush)
updateIsSeen(dataToPush)
console.log('postId', communityGroupId)
}

return (
Expand Down
2 changes: 1 addition & 1 deletion src/components/Notifiaction/CommentNotification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ type Props = {

const CommentNotification = ({ id, senderName, communityPostId, message, createdAt }: Props) => {
const { mutate: updateIsSeen } = useUpdateIsSeenCommunityGroupNotification()
console.log('postId', communityPostId)

const handleIsSeenGroup = (id: string) => {
const dataToPush = {
Expand All @@ -24,6 +23,7 @@ const CommentNotification = ({ id, senderName, communityPostId, message, created
}
// console.log('nData', dataToPush)
updateIsSeen(dataToPush)
console.log('postId', communityPostId)
}
return (
<div key={id} className="bg-slate-50 p-2 border-b border-slate-300">
Expand Down
21 changes: 0 additions & 21 deletions src/components/Timeline/Modals/EditProfileModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ const EditProfileModal = () => {
} = useForm<editProfileInputs>({
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] : '',
Expand Down Expand Up @@ -133,26 +132,6 @@ const EditProfileModal = () => {
</label>
<input {...register('city')} placeholder="City" className=" border pl-3 py-2 text-md rounded-lg border-gray-light font-normal" />
{errors.city && <span className="text-red-500 font-normal">Please enter your City!</span>}
<label htmlFor="email" className="py-1 mt-5">
Email
</label>
<input
{...register('email', {
required: true,
pattern: {
value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i,
message: 'Please enter a valid email address',
},
})}
placeholder="Email Address"
className=" border pl-3 py-2 text-md rounded-lg border-gray-light font-normal"
/>
{errors.email && (
<span className="text-red-500 font-normal">
{' '}
{typeof errors.email.message === 'string' ? errors.email.message : 'Please enter your email!'}
</span>
)}
<label htmlFor="phone_number" className="py-1 mt-5">
Phone Number
</label>
Expand Down
16 changes: 10 additions & 6 deletions src/components/Timeline/Post.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -52,7 +52,7 @@ interface PostProps {
setModalContentType: React.Dispatch<React.SetStateAction<ModalContentType>>
setIsModalOpen: React.Dispatch<React.SetStateAction<boolean>>
isUserProfile?: boolean
media?: string
media?: []
saved?: boolean
isUniversity?: boolean
postID?: string
Expand Down Expand Up @@ -224,8 +224,10 @@ const Post: React.FC<PostProps> = ({
</div>
{/* media div */}
{media && (
<div className="flex justify-center w-full px-10 mt-2">
<img className="rounded-lg h-96 object-cover w-full " src={media} alt="media" />
<div className="flex justify-center flex-wrap w-full px-10 mt-2">
{media?.map((item: { imageUrl: string }) => (
<img key={item.imageUrl} className="rounded-lg h-96 object-cover w-full " src={item.imageUrl} alt="media" />
))}
</div>
)}
{/* Post Content */}
Expand Down Expand Up @@ -285,16 +287,17 @@ const Post: React.FC<PostProps> = ({
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"
/>
<MdGifBox size={24} color="#737373" />
{/* <MdGifBox size={24} color="#737373" /> */}
<div>
<input
style={{ display: 'none' }}
type="file"
id={`CommentsImage${postID}`}
onChange={(e: any) => setImageValue(e.target.files[0])}
accept="image/gif,image/webp"
/>
<label htmlFor={`CommentsImage${postID}`}>
<MdOutlineImage size={24} color="#737373" />
<MdGifBox size={24} color="#737373" />
</label>
</div>

Expand Down Expand Up @@ -340,6 +343,7 @@ const Post: React.FC<PostProps> = ({
</div>
<SlOptions color="gray" />
</div>
{comment?.imageUrl?.imageUrl && <img className="w-full h-80 object-contain" src={comment?.imageUrl?.imageUrl} alt="" />}
<p className="text-xs sm:text-sm pt-1 break-words lg:min-w-[450px] max-lg:min-w-[200px]">{comment?.content}</p>
</div>
</div>
Expand Down
56 changes: 44 additions & 12 deletions src/components/Timeline/PostInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,35 @@ interface PostInputProps {

const PostInput: React.FC<PostInputProps> = ({ setIsModalOpen, setModalContentType, idToPost, profileDp }) => {
const [inputValue, setInputValue] = useState('')
const [ImageValue, setImageValue] = useState<File | null>(null)
const [ImageValue, setImageValue] = useState<File[] | []>([])
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 = {
Expand Down Expand Up @@ -69,21 +77,45 @@ const PostInput: React.FC<PostInputProps> = ({ setIsModalOpen, setModalContentTy
</button>
</div>
{ImageValue && (
<div className="relative w-11/12">
<img className="" src={URL.createObjectURL(ImageValue)} alt="" />
<p onClick={() => setImageValue(null)} className="absolute right-0 top-0 w-5 h-5 bg-white rounded-full text-center">
X
</p>
<div className=" w-11/12">
{ImageValue?.map((item, idx) => (
<div key={idx} className="relative w-11/12">
<img className="" src={URL.createObjectURL(item)} alt="" />
<p
onClick={() => setImageValue(ImageValue.filter((img) => img != item))}
className="absolute right-0 top-0 w-5 h-5 bg-white rounded-full text-center"
>
X
</p>
</div>
))}
</div>
)}
<div className="flex items-center gap-2">
<div>
<input style={{ display: 'none' }} type="file" multiple id="postImage" onChange={(e: any) => setImageValue(e.target.files[0])} />
<input
style={{ display: 'none' }}
type="file"
accept="image/png, image/jpeg"
id="postImage"
onChange={(e: any) => setImageValue([...ImageValue, e.target.files[0]])}
/>
<label htmlFor="postImage">
<MdOutlineImage size={24} color="#737373" />
</label>
</div>
<MdGifBox size={24} color="#737373" />
<div>
<input
style={{ display: 'none' }}
type="file"
accept="image/gif,image/webp"
id="postGif"
onChange={(e: any) => setImageValue([...ImageValue, e.target.files[0]])}
/>
<label htmlFor="postGif">
<MdGifBox size={24} color="#737373" />
</label>
</div>
{/* EMOJI Icon */}
<Popover>
<PopoverTrigger>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ const CommunityProfileContainer = () => {
{selectedOption == valueType.Posts ? (
<Post
user="Kathryn Murphy"
adminId="123"
university="Nagoya University"
year="2nd Yr. Graduate"
text="Law Debate Club will have its first debate starting next week Feb 19, 2024! Any participants interested send me a DM."
Expand All @@ -75,6 +76,7 @@ const CommunityProfileContainer = () => {
) : selectedOption == valueType.Media ? (
<Post
user="Kathryn Murphy"
adminId="123"
university="Nagoya University"
year="2nd Yr. Graduate"
text="Beautiful building landscapes in the japanese skyline."
Expand All @@ -88,11 +90,12 @@ 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 ? (
<Post
user="Kathryn Murphy"
adminId="123"
university="Nagoya University"
year="2nd Yr. Graduate"
text="Law Debate Club will have its first debate starting next week Feb 19, 2024! Any participants interested send me a DM."
Expand All @@ -113,6 +116,7 @@ const CommunityProfileContainer = () => {
) : (
<Post
user="Kathryn Murphy"
adminId="123"
university="Nagoya University"
year="2nd Yr. Graduate"
text="Beautiful building landscapes in the japanese skyline."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ const UniversityCommunityCart = ({ UniversityName, UniversityAddress, University
}
}
return (
<div className="flex flex-col gap-4 items-center ">
<div className="flex flex-col gap-4 items-center w-1/4 max-sm:w-80 h-80 justify-between">
<img className="w-40 h-40 bg-white shadow-lg rounded-full p-4" src={universityLogo} alt="" />
<h3 className="text-sm font-semibold">{UniversityName}</h3>
<h3 className="text-sm font-semibold text-center">{UniversityName}</h3>
<p className="text-xs text-neutral-500 max-w-[90%] text-center">{address}</p>
<button onClick={() => handleClick()} className="text-primary bg-primary-50 px-4 py-2 rounded-lg">
University Page
Expand Down
4 changes: 2 additions & 2 deletions src/models/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ export interface RegisterForm {
email: string
gender: string
dob: any
country?: string
city?: string
country: string
city: string
password: string
confirmPassword: string // only for client side validation
tnc: boolean // only for client side validation
Expand Down
2 changes: 2 additions & 0 deletions src/services/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const useHandleLogin = () => {

export const useHandleRegister = () => {
const setUserData = useUniStore((state) => state.setUserData)
const setUserProfileData = useUniStore((state) => state.setUserProfileData)
// const setToken = useUniStore((state) => state.setToken)
const [_, setCookieValue] = useCookie('uni_user_token')
const [__, setRefreshCookieValue] = useCookie('uni_user_refresh_token')
Expand All @@ -48,6 +49,7 @@ export const useHandleRegister = () => {
console.log(_, __)

setUserData(response.user)
setUserProfileData(response.userProfile)
// setToken(response.tokens)
setCookieValue(response.tokens.access.token, response.tokens.access.expires)
setRefreshCookieValue(response.tokens.refresh.token, response.tokens.refresh.expires)
Expand Down

0 comments on commit 96791c0

Please sign in to comment.