From 06a21a39aa7a0bb7703ab0ddbe3f924202ae6be0 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 11 Jun 2023 17:25:36 +0330 Subject: [PATCH] bug fix --- components/Dropdown.tsx | 2 +- components/FilterSearchDropdown.tsx | 2 +- components/Modal/User/ProfileSettings.tsx | 15 +++++++++++++-- components/ProfilePhoto.tsx | 16 ++++++++++++---- components/SortLinkDropdown.tsx | 2 +- styles/globals.css | 7 ------- 6 files changed, 28 insertions(+), 16 deletions(-) diff --git a/components/Dropdown.tsx b/components/Dropdown.tsx index 58e71b7..7da33c4 100644 --- a/components/Dropdown.tsx +++ b/components/Dropdown.tsx @@ -24,7 +24,7 @@ export default function Dropdown({ onClickOutside, className, items }: Props) { return ( {items.map((e, i) => { const inner = ( diff --git a/components/FilterSearchDropdown.tsx b/components/FilterSearchDropdown.tsx index 332c19d..b7e1758 100644 --- a/components/FilterSearchDropdown.tsx +++ b/components/FilterSearchDropdown.tsx @@ -25,7 +25,7 @@ export default function FilterSearchDropdown({ const target = e.target as HTMLInputElement; if (target.id !== "filter-dropdown") setFilterDropdown(false); }} - className="absolute top-8 right-0 shadow-md bg-gray-50 rounded-md p-2 z-20 w-40" + className="absolute top-8 right-0 border border-sky-100 shadow-md bg-gray-50 rounded-md p-2 z-20 w-40" >

Filter by

diff --git a/components/Modal/User/ProfileSettings.tsx b/components/Modal/User/ProfileSettings.tsx index 062397f..2a464bc 100644 --- a/components/Modal/User/ProfileSettings.tsx +++ b/components/Modal/User/ProfileSettings.tsx @@ -1,4 +1,4 @@ -import { Dispatch, SetStateAction, useEffect } from "react"; +import { Dispatch, SetStateAction, useEffect, useState } from "react"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faClose } from "@fortawesome/free-solid-svg-icons"; import useAccountStore from "@/store/account"; @@ -22,6 +22,12 @@ export default function ProfileSettings({ }: Props) { const { update } = useSession(); const { account, updateAccount } = useAccountStore(); + const [profileStatus, setProfileStatus] = useState(true); + + const handleProfileStatus = (e: boolean) => { + console.log(e); + setProfileStatus(!e); + }; const handleImageUpload = async (e: any) => { const file: File = e.target.files[0]; @@ -54,6 +60,10 @@ export default function ProfileSettings({ setUser({ ...user, oldPassword: undefined, newPassword: undefined }); }, []); + useEffect(() => { + console.log(user.profilePic); + }, [user.profilePic]); + const submit = async () => { const response = await updateAccount({ ...user, @@ -76,8 +86,9 @@ export default function ProfileSettings({ - {user.profilePic && ( + {profileStatus && (
setUser({ diff --git a/components/ProfilePhoto.tsx b/components/ProfilePhoto.tsx index 10c6df0..b4407a5 100644 --- a/components/ProfilePhoto.tsx +++ b/components/ProfilePhoto.tsx @@ -8,9 +8,15 @@ type Props = { src: string; className?: string; emptyImage?: boolean; + status?: Function; }; -export default function ProfilePhoto({ src, className, emptyImage }: Props) { +export default function ProfilePhoto({ + src, + className, + emptyImage, + status, +}: Props) { const [error, setError] = useState(emptyImage || true); const checkAvatarExistence = async () => { @@ -21,9 +27,11 @@ export default function ProfilePhoto({ src, className, emptyImage }: Props) { useEffect(() => { if (src) checkAvatarExistence(); - }, [src]); - return error ? ( + status && status(error || !src); + }, [src, error]); + + return error || !src ? (
@@ -31,7 +39,7 @@ export default function ProfilePhoto({ src, className, emptyImage }: Props) {
) : ( Avatar

Sort by

diff --git a/styles/globals.css b/styles/globals.css index e5d185e..ffabc19 100644 --- a/styles/globals.css +++ b/styles/globals.css @@ -1,10 +1,3 @@ -/* - Copyright (C) 2022-present Daniel31x13 - This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. - This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along with this program. If not, see . -*/ - @tailwind base; @tailwind components; @tailwind utilities;