remove logs
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ const Home: FC = () => {
|
||||
{
|
||||
getWorkspaces.data?.data?.workspaces?.map((item: workspaceItem) => {
|
||||
return (
|
||||
<div className={`p-6 min-w-[40%] xl:min-w-[15%] flex flex-col items-center xl:items-start flex-1 bg-white rounded-3xl cursor-pointer transition-all duration-300 hover:shadow-lg ${selectedWorkspace === item.id ? 'border border-black' : ''}`}
|
||||
<div key={item.id} className={`p-6 min-w-[40%] xl:min-w-[15%] flex flex-col items-center xl:items-start flex-1 bg-white rounded-3xl cursor-pointer transition-all duration-300 hover:shadow-lg ${selectedWorkspace === item.id ? 'border border-black' : ''}`}
|
||||
onClick={() => handleChangeWorkspace(item.id)}
|
||||
>
|
||||
<div className='mt-5'>
|
||||
|
||||
@@ -182,6 +182,7 @@ const AddressForm: FC<AddressFormProps> = ({ selectedAddress, isEditMode, onCanc
|
||||
items={
|
||||
templates?.data?.templates
|
||||
? templates.data.templates.map((template) => ({
|
||||
key: template.id,
|
||||
value: template.id,
|
||||
label: template.name
|
||||
}))
|
||||
|
||||
@@ -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 (
|
||||
<div className='bg-white rounded-4xl p-8 mt-9'>
|
||||
|
||||
@@ -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])
|
||||
|
||||
|
||||
@@ -14,14 +14,6 @@ const ButtonRenderer: FC<ButtonRendererProps> = ({ 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() // جلوگیری از اجرای لینک
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ const ImageRenderer: FC<ImageRendererProps> = ({ images, itemId, sectionKey }) =
|
||||
// جلوگیری از propagation به parent handlers
|
||||
e.stopPropagation()
|
||||
e.preventDefault()
|
||||
console.log('Image clicked:', imageId)
|
||||
setSelectedElement({
|
||||
type: ElementType.IMAGE,
|
||||
elementId: imageId,
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -17,7 +17,6 @@ const SocialRenderer: FC<SocialRendererProps> = ({ socials, itemId, sectionKey }
|
||||
// جلوگیری از propagation به parent handlers
|
||||
e.stopPropagation()
|
||||
e.preventDefault()
|
||||
console.log('Social clicked:', socialId)
|
||||
setSelectedElement({
|
||||
type: ElementType.SOCIAL,
|
||||
elementId: socialId,
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
@@ -12,15 +12,6 @@ const TextRenderer: FC<TextRendererProps> = ({ 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()
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
@@ -32,14 +32,7 @@ export const usePersonalityStore = create<PersonalityStore>((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<PersonalityStore>((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<PersonalityStore>((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
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user