+
+ {selectedFile?.name}
+
+
+
@@ -85,17 +103,14 @@ const ImageContentData = ({ onCropClick, onUpload }: ImageContentDataProps) => {
)}
+ {/* Upload Button */}
>
)}
diff --git a/src/components/ui/molecules/nav-bar/Navbar.tsx b/src/components/ui/molecules/nav-bar/Navbar.tsx
index 71b32762..a8cbf26b 100644
--- a/src/components/ui/molecules/nav-bar/Navbar.tsx
+++ b/src/components/ui/molecules/nav-bar/Navbar.tsx
@@ -3,6 +3,8 @@ import { Link, useLocation } from "react-router-dom";
import { ModeToggle } from "../mode-toggle/modetoggle";
// import { IoAnalytics } from "react-icons/io5";
import { MdDashboard } from "react-icons/md";
+import { IoPricetags } from "react-icons/io5";
+import { ROUTES } from "@/routes/paths";
import { LanguageToggle } from "../language-toggle/languageToggle";
import AuthLogout from "../auth-logout/AuthLogout";
import {
@@ -17,9 +19,15 @@ const navItems = [
{
icon:
,
label: "studio.nav.dashboard",
- path: "/dashboard",
+ path: ROUTES.dashboard,
tooltip: "Go to dashboard",
},
+ {
+ icon:
,
+ label: "Tags",
+ path: ROUTES.tags,
+ tooltip: "Manage tags",
+ },
// {
// icon:
,
// label: "studio.nav.analytics",
@@ -29,7 +37,11 @@ const navItems = [
const tooltipItems = [
{
id: "avatar",
- component:
,
+ component: (
+
+ ),
label: "View Profile",
},
{
@@ -72,7 +84,7 @@ const Navbar = () => {
{item.icon}
diff --git a/src/components/ui/molecules/profile-edit-form/ProfileEditForm.tsx b/src/components/ui/molecules/profile-edit-form/ProfileEditForm.tsx
index 1578ebaf..2ef038a0 100644
--- a/src/components/ui/molecules/profile-edit-form/ProfileEditForm.tsx
+++ b/src/components/ui/molecules/profile-edit-form/ProfileEditForm.tsx
@@ -29,7 +29,6 @@ interface SocialProfile {
interface ProfileEditFormProps {
userInfo: any;
- author_id: string;
onSuccess: () => void;
}
@@ -49,12 +48,10 @@ const updateUserProfile = async (
return data;
};
-const ProfileEditForm = ({
- userInfo,
- author_id,
- onSuccess,
-}: ProfileEditFormProps) => {
+const ProfileEditForm = ({ userInfo, onSuccess }: ProfileEditFormProps) => {
const queryClient = useQueryClient();
+
+ const [isSocialDirty, setIsSocialDirty] = useState(false);
const [socialProfiles, setSocialProfiles] = useState(() => {
const existingProfiles = userInfo?.social_profiles || [];
const hasEmail = existingProfiles.some(
@@ -69,10 +66,13 @@ const ProfileEditForm = ({
...existingProfiles,
];
});
+
const [imagePreview, setImagePreview] = useState(
userInfo?.image?.medium || null,
);
+
const [isImageDialogOpen, setIsImageDialogOpen] = useState(false);
+ const [isImageUploading, setIsImageUploading] = useState(false);
const form = useForm({
resolver: zodResolver(profileSchema),
@@ -80,7 +80,7 @@ const ProfileEditForm = ({
firstname: userInfo.firstname || "",
lastname: userInfo.lastname || "",
bio: userInfo.bio || "",
- image_url: userInfo.image_url || "",
+ image_url: decodeURIComponent(userInfo?.image?.original) || "",
},
});
@@ -89,7 +89,7 @@ const ProfileEditForm = ({
profileData: ProfileFormData & { social_profiles?: SocialProfile[] },
) => updateUserProfile(profileData),
onSuccess: () => {
- queryClient.invalidateQueries({ queryKey: ["userInfo", author_id] });
+ queryClient.invalidateQueries({ queryKey: ["userInfo"] });
onSuccess();
toast.success("Profile updated successfully!");
},
@@ -99,27 +99,35 @@ const ProfileEditForm = ({
});
const handleImageUpload = async (file: File) => {
+ setIsImageUploading(true);
try {
- const { image, key } = await uploadImageToS3(file, "");
- const imageUrl = image.original;
- const imageKey = key;
+ const data = await uploadImageToS3(file, "");
+ const imageUrl = data.image.original;
+ const imageKey = data.key;
setImagePreview(imageUrl);
- form.setValue("image_url", imageKey);
+ form.setValue("image_url", imageKey, {
+ shouldDirty: true,
+ shouldTouch: true,
+ });
setIsImageDialogOpen(false);
toast.success("Image uploaded successfully!");
} catch (error) {
toast.error("Failed to upload image");
+ } finally {
+ setIsImageUploading(false);
}
};
const handleAddSocialProfile = () => {
if (socialProfiles.length < 7) {
setSocialProfiles([{ account: "", url: "" }, ...socialProfiles]);
+ setIsSocialDirty(false);
}
};
const handleRemoveSocialProfile = (index: number) => {
setSocialProfiles(socialProfiles.filter((_, i) => i !== index));
+ setIsSocialDirty(true);
};
const handleSocialProfileChange = (
@@ -155,6 +163,7 @@ const ProfileEditForm = ({
}
}
};
+
return (