From 098d39284b568658a1cfbbf796fe3bd5d4a44d73 Mon Sep 17 00:00:00 2001 From: hamid zarghami Date: Tue, 15 Jul 2025 16:14:34 +0330 Subject: [PATCH] remove logs --- src/components/Filters.tsx | 6 ++- src/components/UploadBoxDraggble.tsx | 1 - src/pages/email-builder/EmailBuilder.tsx | 4 +- src/pages/home/Home.tsx | 2 +- .../address/components/AddressForm.tsx | 1 + src/pages/setting/mail-server/MailServer.tsx | 2 - src/pages/setting/personality/SideBar.tsx | 8 ---- .../personality/components/ButtonRenderer.tsx | 8 ---- .../personality/components/ButtonSidebar.tsx | 6 --- .../personality/components/FooterSection.tsx | 47 ------------------- .../personality/components/ImageRenderer.tsx | 1 - .../personality/components/ImageSideBar.tsx | 22 --------- .../personality/components/SettingSideBar.tsx | 1 - .../personality/components/SocialRenderer.tsx | 1 - .../personality/components/SocialSidebar.tsx | 6 --- .../personality/components/TextRenderer.tsx | 9 ---- .../personality/components/TextSidebar.tsx | 6 --- src/pages/setting/personality/store/Store.ts | 23 +-------- src/shared/Header.tsx | 12 +---- src/shared/components/BuySpace.tsx | 2 +- 20 files changed, 13 insertions(+), 155 deletions(-) diff --git a/src/components/Filters.tsx b/src/components/Filters.tsx index 04e307f..5089f64 100644 --- a/src/components/Filters.tsx +++ b/src/components/Filters.tsx @@ -146,7 +146,11 @@ const Filters: FC = ({ {/* فیلترها برای دسکتاپ (همیشه نمایش داده می‌شوند) */}
- {otherFields.map(renderField)} + {otherFields.map(field => ( +
+ {renderField(field)} +
+ ))}
{searchFieldObj && (
diff --git a/src/components/UploadBoxDraggble.tsx b/src/components/UploadBoxDraggble.tsx index b674fa7..cccb109 100644 --- a/src/components/UploadBoxDraggble.tsx +++ b/src/components/UploadBoxDraggble.tsx @@ -57,7 +57,6 @@ const UploadBoxDraggble: FC = (props: Props) => { if (props.preview && props.preview.length > 0 && !isFill) { setPerviews(props.preview) - console.log('preview', props.preview); setIsFill(true) } diff --git a/src/pages/email-builder/EmailBuilder.tsx b/src/pages/email-builder/EmailBuilder.tsx index 38e8a65..5628fff 100644 --- a/src/pages/email-builder/EmailBuilder.tsx +++ b/src/pages/email-builder/EmailBuilder.tsx @@ -19,7 +19,6 @@ const EmailBuilder: FC = () => { isPreviewMode, togglePreview, updateTemplateName, - exportTemplate, resetTemplate } = useEmailBuilderStore() @@ -27,8 +26,7 @@ const EmailBuilder: FC = () => { const handleSave = () => { // TODO: Integrate with existing template save API - const exportedTemplate = exportTemplate() - console.log('Template to save:', exportedTemplate) + // const exportedTemplate = exportTemplate() // Here you would call your existing template save API } diff --git a/src/pages/home/Home.tsx b/src/pages/home/Home.tsx index a8e18f5..6eb3fec 100644 --- a/src/pages/home/Home.tsx +++ b/src/pages/home/Home.tsx @@ -38,7 +38,7 @@ const Home: FC = () => { { getWorkspaces.data?.data?.workspaces?.map((item: workspaceItem) => { return ( -
handleChangeWorkspace(item.id)} >
diff --git a/src/pages/setting/address/components/AddressForm.tsx b/src/pages/setting/address/components/AddressForm.tsx index 5be5dc9..d13f474 100644 --- a/src/pages/setting/address/components/AddressForm.tsx +++ b/src/pages/setting/address/components/AddressForm.tsx @@ -182,6 +182,7 @@ const AddressForm: FC = ({ selectedAddress, isEditMode, onCanc items={ templates?.data?.templates ? templates.data.templates.map((template) => ({ + key: template.id, value: template.id, label: template.name })) diff --git a/src/pages/setting/mail-server/MailServer.tsx b/src/pages/setting/mail-server/MailServer.tsx index c4e31e5..162ae8a 100644 --- a/src/pages/setting/mail-server/MailServer.tsx +++ b/src/pages/setting/mail-server/MailServer.tsx @@ -7,8 +7,6 @@ const MailServer: FC = () => { const { t } = useTranslation() const { data, isLoading, error } = useMailServerData(); - console.log('Mail Server Data:', data); // برای debug - if (isLoading) { return (
diff --git a/src/pages/setting/personality/SideBar.tsx b/src/pages/setting/personality/SideBar.tsx index e6099ff..1640fa6 100644 --- a/src/pages/setting/personality/SideBar.tsx +++ b/src/pages/setting/personality/SideBar.tsx @@ -20,30 +20,22 @@ const PersonalitySidebar: FC = () => { // Auto-switch to relevant tab when element is selected useEffect(() => { if (selectedElement) { - console.log('Element selected, switching tab:', selectedElement); switch (selectedElement.type) { case ElementType.TEXT: - console.log('Switching to TEXT tab'); setActive(SideBarTab.TEXT) break case ElementType.BUTTON: - console.log('Switching to BUTTON tab'); setActive(SideBarTab.BUTTON) break case ElementType.IMAGE: - console.log('Switching to IMAGE tab'); setActive(SideBarTab.IMAGE) break case ElementType.SOCIAL: - console.log('Switching to SOCIAL tab'); setActive(SideBarTab.SOCIAL) break default: - console.log('Unknown element type'); break } - } else { - console.log('No element selected'); } }, [selectedElement]) diff --git a/src/pages/setting/personality/components/ButtonRenderer.tsx b/src/pages/setting/personality/components/ButtonRenderer.tsx index 7e134b1..c2753a1 100644 --- a/src/pages/setting/personality/components/ButtonRenderer.tsx +++ b/src/pages/setting/personality/components/ButtonRenderer.tsx @@ -14,14 +14,6 @@ const ButtonRenderer: FC = ({ buttons, itemId, sectionKey } if (!buttons || buttons.length === 0) return null const handleButtonClick = (e: React.MouseEvent, buttonId: string) => { - console.log('🔘 ButtonRenderer - handleButtonClick called:', { - buttonId, - itemId, - sectionKey, - event: e, - target: e.target, - currentTarget: e.currentTarget - }); e.stopPropagation() // Prevent bubbling to item/section handlers e.preventDefault() // جلوگیری از اجرای لینک diff --git a/src/pages/setting/personality/components/ButtonSidebar.tsx b/src/pages/setting/personality/components/ButtonSidebar.tsx index 72d96c6..bddf9bf 100644 --- a/src/pages/setting/personality/components/ButtonSidebar.tsx +++ b/src/pages/setting/personality/components/ButtonSidebar.tsx @@ -37,11 +37,8 @@ const ButtonSidebar: FC = () => { // Load selected button data when element is selected useEffect(() => { if (isEditMode && selectedElement) { - console.log('Loading button data for editing:', selectedElement); - try { const sectionData = data[selectedElement.sectionKey]; - console.log('Section data:', sectionData); if (!sectionData || !sectionData.items) { console.error('Section data or items not found'); @@ -49,7 +46,6 @@ const ButtonSidebar: FC = () => { } const item = sectionData.items.find(item => item.id === selectedElement.itemId); - console.log('Found item:', item); if (!item) { console.error('Item not found'); @@ -57,7 +53,6 @@ const ButtonSidebar: FC = () => { } const button = item.buttons?.find(b => b.id === selectedElement.elementId); - console.log('Found button:', button); if (button) { setButtonText(button.text); @@ -70,7 +65,6 @@ const ButtonSidebar: FC = () => { setBorderColor(button.borderColor); setHorizontalAlignment(button.alignment || HorizontalAlignment.CENTER); setVerticalAlignment(button.verticalAlignment || VerticalAlignment.MIDDLE); - console.log('Button data loaded successfully'); } else { console.error('Button element not found'); } diff --git a/src/pages/setting/personality/components/FooterSection.tsx b/src/pages/setting/personality/components/FooterSection.tsx index 555fa5f..11f768a 100644 --- a/src/pages/setting/personality/components/FooterSection.tsx +++ b/src/pages/setting/personality/components/FooterSection.tsx @@ -24,80 +24,33 @@ const FooterSection: FC = () => { ) } - console.log('🔴 FooterSection - Current state:', { - activeSection, - activeItemIndex, - footerColumnsCount: data.footer.columnsCount, - footerItemsLength: data.footer.items.length - }); - const handleSectionClick = (section: SectionName, e: React.MouseEvent) => { - console.log('🔴 FooterSection - handleSectionClick called:', { - section, - event: e, - target: e.target, - currentTarget: e.currentTarget - }); // اگر کلیک روی فضای خالی باشد (نه روی content elements) const target = e.target as HTMLElement; const isClickOnContent = target.closest('[data-element-type]') !== null; - console.log('🔴 FooterSection - Section click analysis:', { - isClickOnContent, - targetTagName: target.tagName, - targetClasses: target.className - }); - if (!isClickOnContent) { - console.log('🔴 FooterSection - Setting active section:', section); setActiveSection(section) - } else { - console.log('🔴 FooterSection - Click on content element, not setting section'); } } const handleItemClick = (index: number, e: React.MouseEvent) => { - console.log('🔴 FooterSection - handleItemClick called:', { - index, - event: e, - target: e.target, - currentTarget: e.currentTarget - }); - // Check if click is on a content element (text, button, image, social) const target = e.target as HTMLElement; const isClickOnContent = target.closest('[data-element-type]') !== null; - console.log('🔴 FooterSection - Click analysis:', { - isClickOnContent, - targetTagName: target.tagName, - targetClasses: target.className, - closestDataElement: target.closest('[data-element-type]') - }); - // Only select column if not clicking on content elements if (!isClickOnContent) { - console.log('🔴 FooterSection - Selecting column:', { - index, - section: SectionName.FOOTER, - currentActiveSection: activeSection, - currentActiveItemIndex: activeItemIndex - }); - e.stopPropagation() // Only set active section if we're not already in footer section if (activeSection !== SectionName.FOOTER) { - console.log('🔴 FooterSection - Switching to footer section'); setActiveSection(SectionName.FOOTER) } // Always set the active item index - console.log('🔴 FooterSection - Setting active item index to:', index); setActiveItemIndex(index) - } else { - console.log('🔴 FooterSection - Click on content element, not selecting column'); } } diff --git a/src/pages/setting/personality/components/ImageRenderer.tsx b/src/pages/setting/personality/components/ImageRenderer.tsx index 32fa449..9308508 100644 --- a/src/pages/setting/personality/components/ImageRenderer.tsx +++ b/src/pages/setting/personality/components/ImageRenderer.tsx @@ -17,7 +17,6 @@ const ImageRenderer: FC = ({ images, itemId, sectionKey }) = // جلوگیری از propagation به parent handlers e.stopPropagation() e.preventDefault() - console.log('Image clicked:', imageId) setSelectedElement({ type: ElementType.IMAGE, elementId: imageId, diff --git a/src/pages/setting/personality/components/ImageSideBar.tsx b/src/pages/setting/personality/components/ImageSideBar.tsx index 6aff37e..4ffe223 100644 --- a/src/pages/setting/personality/components/ImageSideBar.tsx +++ b/src/pages/setting/personality/components/ImageSideBar.tsx @@ -33,11 +33,8 @@ const ImageSideBar: FC = () => { // Load selected image data when element is selected useEffect(() => { if (isEditMode && selectedElement) { - console.log('Loading image data for editing:', selectedElement); - try { const sectionData = data[selectedElement.sectionKey]; - console.log('Section data:', sectionData); if (!sectionData || !sectionData.items) { console.error('Section data or items not found'); @@ -45,7 +42,6 @@ const ImageSideBar: FC = () => { } const item = sectionData.items.find(item => item.id === selectedElement.itemId); - console.log('Found item:', item); if (!item) { console.error('Item not found'); @@ -53,14 +49,12 @@ const ImageSideBar: FC = () => { } const image = item.images?.find(img => img.id === selectedElement.elementId); - console.log('Found image:', image); if (image) { setImageSrc(image.src); setImageSize(image.size); setHorizontalAlignment(image.alignment || HorizontalAlignment.CENTER); setVerticalAlignment(image.verticalAlignment || VerticalAlignment.MIDDLE); - console.log('Image data loaded successfully'); } else { console.error('Image element not found'); } @@ -103,12 +97,6 @@ const ImageSideBar: FC = () => { const handleAddImage = () => { if (!imageSrc) return - console.log('Store state before adding image:', { - activeSection, - activeItemIndex, - hasActiveItem: activeSection && data[activeSection as keyof typeof data]?.items[activeItemIndex], - }) - // Validation if (!activeSection) { console.error('No active section selected') @@ -124,14 +112,6 @@ const ImageSideBar: FC = () => { return } - console.log('Adding image with data:', { - src: imageSrc, - alt: 'عکس آپلود شده', - size: imageSize, - alignment: horizontalAlignment, - verticalAlignment, - }) - setIsLoading(true) try { @@ -143,8 +123,6 @@ const ImageSideBar: FC = () => { verticalAlignment, }) - console.log('Image added successfully') - // Reset form after adding setImageSrc('') setImageSize(ImageSize.COVER) diff --git a/src/pages/setting/personality/components/SettingSideBar.tsx b/src/pages/setting/personality/components/SettingSideBar.tsx index a3489e7..06a1bc7 100644 --- a/src/pages/setting/personality/components/SettingSideBar.tsx +++ b/src/pages/setting/personality/components/SettingSideBar.tsx @@ -52,7 +52,6 @@ const SettingSideBar: FC = () => { const handleUploadBackground = (file: File[]) => { if (activeSection && file.length > 0) { const imageUrl = URL.createObjectURL(file[0]) - console.log('Setting background image:', imageUrl) const currentItem = data[activeSection as keyof typeof data]?.items[activeItemIndex] updateActiveItem({ diff --git a/src/pages/setting/personality/components/SocialRenderer.tsx b/src/pages/setting/personality/components/SocialRenderer.tsx index 97d6d82..bd867d3 100644 --- a/src/pages/setting/personality/components/SocialRenderer.tsx +++ b/src/pages/setting/personality/components/SocialRenderer.tsx @@ -17,7 +17,6 @@ const SocialRenderer: FC = ({ socials, itemId, sectionKey } // جلوگیری از propagation به parent handlers e.stopPropagation() e.preventDefault() - console.log('Social clicked:', socialId) setSelectedElement({ type: ElementType.SOCIAL, elementId: socialId, diff --git a/src/pages/setting/personality/components/SocialSidebar.tsx b/src/pages/setting/personality/components/SocialSidebar.tsx index 6ff4def..872eb56 100644 --- a/src/pages/setting/personality/components/SocialSidebar.tsx +++ b/src/pages/setting/personality/components/SocialSidebar.tsx @@ -34,11 +34,8 @@ const SocialSidebar: FC = () => { // Load selected social data when element is selected useEffect(() => { if (isEditMode && selectedElement) { - console.log('Loading social data for editing:', selectedElement); - try { const sectionData = data[selectedElement.sectionKey]; - console.log('Section data:', sectionData); if (!sectionData || !sectionData.items) { console.error('Section data or items not found'); @@ -46,7 +43,6 @@ const SocialSidebar: FC = () => { } const item = sectionData.items.find(item => item.id === selectedElement.itemId); - console.log('Found item:', item); if (!item) { console.error('Item not found'); @@ -54,7 +50,6 @@ const SocialSidebar: FC = () => { } const social = item.socials?.find(s => s.id === selectedElement.elementId); - console.log('Found social:', social); if (social) { setNetworkType(social.networkType); @@ -65,7 +60,6 @@ const SocialSidebar: FC = () => { setBackgroundColor(social.backgroundColor || '#ffffff'); setHorizontalAlignment(social.alignment || HorizontalAlignment.CENTER); setVerticalAlignment(social.verticalAlignment || VerticalAlignment.MIDDLE); - console.log('Social data loaded successfully'); } else { console.error('Social element not found'); } diff --git a/src/pages/setting/personality/components/TextRenderer.tsx b/src/pages/setting/personality/components/TextRenderer.tsx index d80177c..df47c9e 100644 --- a/src/pages/setting/personality/components/TextRenderer.tsx +++ b/src/pages/setting/personality/components/TextRenderer.tsx @@ -12,15 +12,6 @@ const TextRenderer: FC = ({ texts, itemId, sectionKey }) => { const { selectedElement, setSelectedElement } = usePersonalityStore() const handleTextClick = (e: React.MouseEvent, textId: string) => { - console.log('📝 TextRenderer - handleTextClick called:', { - textId, - itemId, - sectionKey, - event: e, - target: e.target, - currentTarget: e.currentTarget - }); - // جلوگیری از propagation به parent handlers e.stopPropagation() e.preventDefault() diff --git a/src/pages/setting/personality/components/TextSidebar.tsx b/src/pages/setting/personality/components/TextSidebar.tsx index ae1ab24..a1b2289 100644 --- a/src/pages/setting/personality/components/TextSidebar.tsx +++ b/src/pages/setting/personality/components/TextSidebar.tsx @@ -29,11 +29,8 @@ const TextSidebar: FC = () => { // Load selected text data when element is selected useEffect(() => { if (isEditMode && selectedElement) { - console.log('Loading text data for editing:', selectedElement); - try { const sectionData = data[selectedElement.sectionKey]; - console.log('Section data:', sectionData); if (!sectionData || !sectionData.items) { console.error('Section data or items not found'); @@ -41,7 +38,6 @@ const TextSidebar: FC = () => { } const item = sectionData.items.find(item => item.id === selectedElement.itemId); - console.log('Found item:', item); if (!item) { console.error('Item not found'); @@ -49,14 +45,12 @@ const TextSidebar: FC = () => { } const text = item.texts?.find(t => t.id === selectedElement.elementId); - console.log('Found text:', text); if (text) { setValue(text.text); setColor(text.color || '#000'); setHorizontalPosition(text.alignment || HorizontalAlignment.CENTER); setVerticalPosition(text.verticalAlignment || VerticalAlignment.MIDDLE); - console.log('Text data loaded successfully'); } else { console.error('Text element not found'); } diff --git a/src/pages/setting/personality/store/Store.ts b/src/pages/setting/personality/store/Store.ts index a7ea958..e068917 100644 --- a/src/pages/setting/personality/store/Store.ts +++ b/src/pages/setting/personality/store/Store.ts @@ -32,14 +32,7 @@ export const usePersonalityStore = create((set) => ({ })), setActiveSection: (section: SectionName) => - set((state) => { - console.log("🏪 Store - setActiveSection called:", { - newSection: section, - oldSection: state.activeSection, - oldItemIndex: state.activeItemIndex, - newItemIndex: 0, - }); - + set(() => { return { activeSection: section, activeItemIndex: 0, @@ -49,13 +42,7 @@ export const usePersonalityStore = create((set) => ({ }), setActiveItemIndex: (index: number) => - set((state) => { - console.log("🏪 Store - setActiveItemIndex called:", { - newIndex: index, - oldIndex: state.activeItemIndex, - currentSection: state.activeSection, - }); - + set(() => { return { activeItemIndex: index, selectedElement: null, @@ -136,12 +123,6 @@ export const usePersonalityStore = create((set) => ({ if (activeIndex >= items.length) return state; - console.log("Updating active item:", { - sectionKey, - activeIndex, - updates, - }); - const updatedItems = items.map((item, index) => index === activeIndex ? { ...item, ...updates } : item ); diff --git a/src/shared/Header.tsx b/src/shared/Header.tsx index a10310a..e2347e6 100644 --- a/src/shared/Header.tsx +++ b/src/shared/Header.tsx @@ -1,8 +1,8 @@ -import { FC, useEffect, useState } from 'react' +import { FC } from 'react' import Input from '../components/Input' import { Element3, HambergerMenu, Wallet } from 'iconsax-react' import { useTranslation } from 'react-i18next' -import { Link, useLocation } from 'react-router-dom' +import { Link } from 'react-router-dom' import { Paths } from '@/utils/Paths' // import Notifications from '../pages/notification/Notification' import { useSharedStore } from './store/sharedStore' @@ -13,19 +13,11 @@ import { useSharedStore } from './store/sharedStore' const Header: FC = () => { - const location = useLocation(); - const [popoverKey, setPopoverKey] = useState(0); const { t } = useTranslation('global') const { setOpenSidebar, openSidebar } = useSharedStore() // const { data } = useGetProfile() // const getWalletBalance = useGetWalletBalance() - console.log(popoverKey); - useEffect(() => { - - setPopoverKey((prevKey) => prevKey + 1); - }, [location.pathname]); - return (
diff --git a/src/shared/components/BuySpace.tsx b/src/shared/components/BuySpace.tsx index 8345006..e6c29fa 100644 --- a/src/shared/components/BuySpace.tsx +++ b/src/shared/components/BuySpace.tsx @@ -44,7 +44,7 @@ const BuySpace: FC = () => {
{gigs.map((gig) => ( -
setSpaceSelected(gig)} className={clx( +
setSpaceSelected(gig)} className={clx( 'bg-[#EBEDF5] border border-[#EBEDF5] cursor-pointer flex items-center text-xs h-10 px-6 rounded-lg', spaceSelected === gig && 'border-black' )}>