remove logs
This commit is contained in:
@@ -146,7 +146,11 @@ const Filters: FC<FiltersProps> = ({
|
|||||||
{/* فیلترها برای دسکتاپ (همیشه نمایش داده میشوند) */}
|
{/* فیلترها برای دسکتاپ (همیشه نمایش داده میشوند) */}
|
||||||
<div className="hidden md:flex md:flex-row justify-between items-center gap-4 w-full">
|
<div className="hidden md:flex md:flex-row justify-between items-center gap-4 w-full">
|
||||||
<div className={fieldClassName}>
|
<div className={fieldClassName}>
|
||||||
{otherFields.map(renderField)}
|
{otherFields.map(field => (
|
||||||
|
<div key={field.name}>
|
||||||
|
{renderField(field)}
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
</div>
|
</div>
|
||||||
{searchFieldObj && (
|
{searchFieldObj && (
|
||||||
<div className="w-full md:w-auto">
|
<div className="w-full md:w-auto">
|
||||||
|
|||||||
@@ -57,7 +57,6 @@ const UploadBoxDraggble: FC<Props> = (props: Props) => {
|
|||||||
|
|
||||||
if (props.preview && props.preview.length > 0 && !isFill) {
|
if (props.preview && props.preview.length > 0 && !isFill) {
|
||||||
setPerviews(props.preview)
|
setPerviews(props.preview)
|
||||||
console.log('preview', props.preview);
|
|
||||||
|
|
||||||
setIsFill(true)
|
setIsFill(true)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ const EmailBuilder: FC = () => {
|
|||||||
isPreviewMode,
|
isPreviewMode,
|
||||||
togglePreview,
|
togglePreview,
|
||||||
updateTemplateName,
|
updateTemplateName,
|
||||||
exportTemplate,
|
|
||||||
resetTemplate
|
resetTemplate
|
||||||
} = useEmailBuilderStore()
|
} = useEmailBuilderStore()
|
||||||
|
|
||||||
@@ -27,8 +26,7 @@ const EmailBuilder: FC = () => {
|
|||||||
|
|
||||||
const handleSave = () => {
|
const handleSave = () => {
|
||||||
// TODO: Integrate with existing template save API
|
// TODO: Integrate with existing template save API
|
||||||
const exportedTemplate = exportTemplate()
|
// const exportedTemplate = exportTemplate()
|
||||||
console.log('Template to save:', exportedTemplate)
|
|
||||||
// Here you would call your existing template save API
|
// Here you would call your existing template save API
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ const Home: FC = () => {
|
|||||||
{
|
{
|
||||||
getWorkspaces.data?.data?.workspaces?.map((item: workspaceItem) => {
|
getWorkspaces.data?.data?.workspaces?.map((item: workspaceItem) => {
|
||||||
return (
|
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)}
|
onClick={() => handleChangeWorkspace(item.id)}
|
||||||
>
|
>
|
||||||
<div className='mt-5'>
|
<div className='mt-5'>
|
||||||
|
|||||||
@@ -182,6 +182,7 @@ const AddressForm: FC<AddressFormProps> = ({ selectedAddress, isEditMode, onCanc
|
|||||||
items={
|
items={
|
||||||
templates?.data?.templates
|
templates?.data?.templates
|
||||||
? templates.data.templates.map((template) => ({
|
? templates.data.templates.map((template) => ({
|
||||||
|
key: template.id,
|
||||||
value: template.id,
|
value: template.id,
|
||||||
label: template.name
|
label: template.name
|
||||||
}))
|
}))
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ const MailServer: FC = () => {
|
|||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const { data, isLoading, error } = useMailServerData();
|
const { data, isLoading, error } = useMailServerData();
|
||||||
|
|
||||||
console.log('Mail Server Data:', data); // برای debug
|
|
||||||
|
|
||||||
if (isLoading) {
|
if (isLoading) {
|
||||||
return (
|
return (
|
||||||
<div className='bg-white rounded-4xl p-8 mt-9'>
|
<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
|
// Auto-switch to relevant tab when element is selected
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (selectedElement) {
|
if (selectedElement) {
|
||||||
console.log('Element selected, switching tab:', selectedElement);
|
|
||||||
switch (selectedElement.type) {
|
switch (selectedElement.type) {
|
||||||
case ElementType.TEXT:
|
case ElementType.TEXT:
|
||||||
console.log('Switching to TEXT tab');
|
|
||||||
setActive(SideBarTab.TEXT)
|
setActive(SideBarTab.TEXT)
|
||||||
break
|
break
|
||||||
case ElementType.BUTTON:
|
case ElementType.BUTTON:
|
||||||
console.log('Switching to BUTTON tab');
|
|
||||||
setActive(SideBarTab.BUTTON)
|
setActive(SideBarTab.BUTTON)
|
||||||
break
|
break
|
||||||
case ElementType.IMAGE:
|
case ElementType.IMAGE:
|
||||||
console.log('Switching to IMAGE tab');
|
|
||||||
setActive(SideBarTab.IMAGE)
|
setActive(SideBarTab.IMAGE)
|
||||||
break
|
break
|
||||||
case ElementType.SOCIAL:
|
case ElementType.SOCIAL:
|
||||||
console.log('Switching to SOCIAL tab');
|
|
||||||
setActive(SideBarTab.SOCIAL)
|
setActive(SideBarTab.SOCIAL)
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
console.log('Unknown element type');
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
console.log('No element selected');
|
|
||||||
}
|
}
|
||||||
}, [selectedElement])
|
}, [selectedElement])
|
||||||
|
|
||||||
|
|||||||
@@ -14,14 +14,6 @@ const ButtonRenderer: FC<ButtonRendererProps> = ({ buttons, itemId, sectionKey }
|
|||||||
if (!buttons || buttons.length === 0) return null
|
if (!buttons || buttons.length === 0) return null
|
||||||
|
|
||||||
const handleButtonClick = (e: React.MouseEvent, buttonId: string) => {
|
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.stopPropagation() // Prevent bubbling to item/section handlers
|
||||||
e.preventDefault() // جلوگیری از اجرای لینک
|
e.preventDefault() // جلوگیری از اجرای لینک
|
||||||
|
|||||||
@@ -37,11 +37,8 @@ const ButtonSidebar: FC = () => {
|
|||||||
// Load selected button data when element is selected
|
// Load selected button data when element is selected
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isEditMode && selectedElement) {
|
if (isEditMode && selectedElement) {
|
||||||
console.log('Loading button data for editing:', selectedElement);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const sectionData = data[selectedElement.sectionKey];
|
const sectionData = data[selectedElement.sectionKey];
|
||||||
console.log('Section data:', sectionData);
|
|
||||||
|
|
||||||
if (!sectionData || !sectionData.items) {
|
if (!sectionData || !sectionData.items) {
|
||||||
console.error('Section data or items not found');
|
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);
|
const item = sectionData.items.find(item => item.id === selectedElement.itemId);
|
||||||
console.log('Found item:', item);
|
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
console.error('Item not found');
|
console.error('Item not found');
|
||||||
@@ -57,7 +53,6 @@ const ButtonSidebar: FC = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const button = item.buttons?.find(b => b.id === selectedElement.elementId);
|
const button = item.buttons?.find(b => b.id === selectedElement.elementId);
|
||||||
console.log('Found button:', button);
|
|
||||||
|
|
||||||
if (button) {
|
if (button) {
|
||||||
setButtonText(button.text);
|
setButtonText(button.text);
|
||||||
@@ -70,7 +65,6 @@ const ButtonSidebar: FC = () => {
|
|||||||
setBorderColor(button.borderColor);
|
setBorderColor(button.borderColor);
|
||||||
setHorizontalAlignment(button.alignment || HorizontalAlignment.CENTER);
|
setHorizontalAlignment(button.alignment || HorizontalAlignment.CENTER);
|
||||||
setVerticalAlignment(button.verticalAlignment || VerticalAlignment.MIDDLE);
|
setVerticalAlignment(button.verticalAlignment || VerticalAlignment.MIDDLE);
|
||||||
console.log('Button data loaded successfully');
|
|
||||||
} else {
|
} else {
|
||||||
console.error('Button element not found');
|
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) => {
|
const handleSectionClick = (section: SectionName, e: React.MouseEvent) => {
|
||||||
console.log('🔴 FooterSection - handleSectionClick called:', {
|
|
||||||
section,
|
|
||||||
event: e,
|
|
||||||
target: e.target,
|
|
||||||
currentTarget: e.currentTarget
|
|
||||||
});
|
|
||||||
|
|
||||||
// اگر کلیک روی فضای خالی باشد (نه روی content elements)
|
// اگر کلیک روی فضای خالی باشد (نه روی content elements)
|
||||||
const target = e.target as HTMLElement;
|
const target = e.target as HTMLElement;
|
||||||
const isClickOnContent = target.closest('[data-element-type]') !== null;
|
const isClickOnContent = target.closest('[data-element-type]') !== null;
|
||||||
|
|
||||||
console.log('🔴 FooterSection - Section click analysis:', {
|
|
||||||
isClickOnContent,
|
|
||||||
targetTagName: target.tagName,
|
|
||||||
targetClasses: target.className
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!isClickOnContent) {
|
if (!isClickOnContent) {
|
||||||
console.log('🔴 FooterSection - Setting active section:', section);
|
|
||||||
setActiveSection(section)
|
setActiveSection(section)
|
||||||
} else {
|
|
||||||
console.log('🔴 FooterSection - Click on content element, not setting section');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleItemClick = (index: number, e: React.MouseEvent) => {
|
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)
|
// Check if click is on a content element (text, button, image, social)
|
||||||
const target = e.target as HTMLElement;
|
const target = e.target as HTMLElement;
|
||||||
const isClickOnContent = target.closest('[data-element-type]') !== null;
|
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
|
// Only select column if not clicking on content elements
|
||||||
if (!isClickOnContent) {
|
if (!isClickOnContent) {
|
||||||
console.log('🔴 FooterSection - Selecting column:', {
|
|
||||||
index,
|
|
||||||
section: SectionName.FOOTER,
|
|
||||||
currentActiveSection: activeSection,
|
|
||||||
currentActiveItemIndex: activeItemIndex
|
|
||||||
});
|
|
||||||
|
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
|
|
||||||
// Only set active section if we're not already in footer section
|
// Only set active section if we're not already in footer section
|
||||||
if (activeSection !== SectionName.FOOTER) {
|
if (activeSection !== SectionName.FOOTER) {
|
||||||
console.log('🔴 FooterSection - Switching to footer section');
|
|
||||||
setActiveSection(SectionName.FOOTER)
|
setActiveSection(SectionName.FOOTER)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Always set the active item index
|
// Always set the active item index
|
||||||
console.log('🔴 FooterSection - Setting active item index to:', index);
|
|
||||||
setActiveItemIndex(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
|
// جلوگیری از propagation به parent handlers
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
console.log('Image clicked:', imageId)
|
|
||||||
setSelectedElement({
|
setSelectedElement({
|
||||||
type: ElementType.IMAGE,
|
type: ElementType.IMAGE,
|
||||||
elementId: imageId,
|
elementId: imageId,
|
||||||
|
|||||||
@@ -33,11 +33,8 @@ const ImageSideBar: FC = () => {
|
|||||||
// Load selected image data when element is selected
|
// Load selected image data when element is selected
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isEditMode && selectedElement) {
|
if (isEditMode && selectedElement) {
|
||||||
console.log('Loading image data for editing:', selectedElement);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const sectionData = data[selectedElement.sectionKey];
|
const sectionData = data[selectedElement.sectionKey];
|
||||||
console.log('Section data:', sectionData);
|
|
||||||
|
|
||||||
if (!sectionData || !sectionData.items) {
|
if (!sectionData || !sectionData.items) {
|
||||||
console.error('Section data or items not found');
|
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);
|
const item = sectionData.items.find(item => item.id === selectedElement.itemId);
|
||||||
console.log('Found item:', item);
|
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
console.error('Item not found');
|
console.error('Item not found');
|
||||||
@@ -53,14 +49,12 @@ const ImageSideBar: FC = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const image = item.images?.find(img => img.id === selectedElement.elementId);
|
const image = item.images?.find(img => img.id === selectedElement.elementId);
|
||||||
console.log('Found image:', image);
|
|
||||||
|
|
||||||
if (image) {
|
if (image) {
|
||||||
setImageSrc(image.src);
|
setImageSrc(image.src);
|
||||||
setImageSize(image.size);
|
setImageSize(image.size);
|
||||||
setHorizontalAlignment(image.alignment || HorizontalAlignment.CENTER);
|
setHorizontalAlignment(image.alignment || HorizontalAlignment.CENTER);
|
||||||
setVerticalAlignment(image.verticalAlignment || VerticalAlignment.MIDDLE);
|
setVerticalAlignment(image.verticalAlignment || VerticalAlignment.MIDDLE);
|
||||||
console.log('Image data loaded successfully');
|
|
||||||
} else {
|
} else {
|
||||||
console.error('Image element not found');
|
console.error('Image element not found');
|
||||||
}
|
}
|
||||||
@@ -103,12 +97,6 @@ const ImageSideBar: FC = () => {
|
|||||||
const handleAddImage = () => {
|
const handleAddImage = () => {
|
||||||
if (!imageSrc) return
|
if (!imageSrc) return
|
||||||
|
|
||||||
console.log('Store state before adding image:', {
|
|
||||||
activeSection,
|
|
||||||
activeItemIndex,
|
|
||||||
hasActiveItem: activeSection && data[activeSection as keyof typeof data]?.items[activeItemIndex],
|
|
||||||
})
|
|
||||||
|
|
||||||
// Validation
|
// Validation
|
||||||
if (!activeSection) {
|
if (!activeSection) {
|
||||||
console.error('No active section selected')
|
console.error('No active section selected')
|
||||||
@@ -124,14 +112,6 @@ const ImageSideBar: FC = () => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('Adding image with data:', {
|
|
||||||
src: imageSrc,
|
|
||||||
alt: 'عکس آپلود شده',
|
|
||||||
size: imageSize,
|
|
||||||
alignment: horizontalAlignment,
|
|
||||||
verticalAlignment,
|
|
||||||
})
|
|
||||||
|
|
||||||
setIsLoading(true)
|
setIsLoading(true)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -143,8 +123,6 @@ const ImageSideBar: FC = () => {
|
|||||||
verticalAlignment,
|
verticalAlignment,
|
||||||
})
|
})
|
||||||
|
|
||||||
console.log('Image added successfully')
|
|
||||||
|
|
||||||
// Reset form after adding
|
// Reset form after adding
|
||||||
setImageSrc('')
|
setImageSrc('')
|
||||||
setImageSize(ImageSize.COVER)
|
setImageSize(ImageSize.COVER)
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ const SettingSideBar: FC = () => {
|
|||||||
const handleUploadBackground = (file: File[]) => {
|
const handleUploadBackground = (file: File[]) => {
|
||||||
if (activeSection && file.length > 0) {
|
if (activeSection && file.length > 0) {
|
||||||
const imageUrl = URL.createObjectURL(file[0])
|
const imageUrl = URL.createObjectURL(file[0])
|
||||||
console.log('Setting background image:', imageUrl)
|
|
||||||
|
|
||||||
const currentItem = data[activeSection as keyof typeof data]?.items[activeItemIndex]
|
const currentItem = data[activeSection as keyof typeof data]?.items[activeItemIndex]
|
||||||
updateActiveItem({
|
updateActiveItem({
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ const SocialRenderer: FC<SocialRendererProps> = ({ socials, itemId, sectionKey }
|
|||||||
// جلوگیری از propagation به parent handlers
|
// جلوگیری از propagation به parent handlers
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
console.log('Social clicked:', socialId)
|
|
||||||
setSelectedElement({
|
setSelectedElement({
|
||||||
type: ElementType.SOCIAL,
|
type: ElementType.SOCIAL,
|
||||||
elementId: socialId,
|
elementId: socialId,
|
||||||
|
|||||||
@@ -34,11 +34,8 @@ const SocialSidebar: FC = () => {
|
|||||||
// Load selected social data when element is selected
|
// Load selected social data when element is selected
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isEditMode && selectedElement) {
|
if (isEditMode && selectedElement) {
|
||||||
console.log('Loading social data for editing:', selectedElement);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const sectionData = data[selectedElement.sectionKey];
|
const sectionData = data[selectedElement.sectionKey];
|
||||||
console.log('Section data:', sectionData);
|
|
||||||
|
|
||||||
if (!sectionData || !sectionData.items) {
|
if (!sectionData || !sectionData.items) {
|
||||||
console.error('Section data or items not found');
|
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);
|
const item = sectionData.items.find(item => item.id === selectedElement.itemId);
|
||||||
console.log('Found item:', item);
|
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
console.error('Item not found');
|
console.error('Item not found');
|
||||||
@@ -54,7 +50,6 @@ const SocialSidebar: FC = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const social = item.socials?.find(s => s.id === selectedElement.elementId);
|
const social = item.socials?.find(s => s.id === selectedElement.elementId);
|
||||||
console.log('Found social:', social);
|
|
||||||
|
|
||||||
if (social) {
|
if (social) {
|
||||||
setNetworkType(social.networkType);
|
setNetworkType(social.networkType);
|
||||||
@@ -65,7 +60,6 @@ const SocialSidebar: FC = () => {
|
|||||||
setBackgroundColor(social.backgroundColor || '#ffffff');
|
setBackgroundColor(social.backgroundColor || '#ffffff');
|
||||||
setHorizontalAlignment(social.alignment || HorizontalAlignment.CENTER);
|
setHorizontalAlignment(social.alignment || HorizontalAlignment.CENTER);
|
||||||
setVerticalAlignment(social.verticalAlignment || VerticalAlignment.MIDDLE);
|
setVerticalAlignment(social.verticalAlignment || VerticalAlignment.MIDDLE);
|
||||||
console.log('Social data loaded successfully');
|
|
||||||
} else {
|
} else {
|
||||||
console.error('Social element not found');
|
console.error('Social element not found');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,15 +12,6 @@ const TextRenderer: FC<TextRendererProps> = ({ texts, itemId, sectionKey }) => {
|
|||||||
const { selectedElement, setSelectedElement } = usePersonalityStore()
|
const { selectedElement, setSelectedElement } = usePersonalityStore()
|
||||||
|
|
||||||
const handleTextClick = (e: React.MouseEvent, textId: string) => {
|
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
|
// جلوگیری از propagation به parent handlers
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|||||||
@@ -29,11 +29,8 @@ const TextSidebar: FC = () => {
|
|||||||
// Load selected text data when element is selected
|
// Load selected text data when element is selected
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isEditMode && selectedElement) {
|
if (isEditMode && selectedElement) {
|
||||||
console.log('Loading text data for editing:', selectedElement);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const sectionData = data[selectedElement.sectionKey];
|
const sectionData = data[selectedElement.sectionKey];
|
||||||
console.log('Section data:', sectionData);
|
|
||||||
|
|
||||||
if (!sectionData || !sectionData.items) {
|
if (!sectionData || !sectionData.items) {
|
||||||
console.error('Section data or items not found');
|
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);
|
const item = sectionData.items.find(item => item.id === selectedElement.itemId);
|
||||||
console.log('Found item:', item);
|
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
console.error('Item not found');
|
console.error('Item not found');
|
||||||
@@ -49,14 +45,12 @@ const TextSidebar: FC = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const text = item.texts?.find(t => t.id === selectedElement.elementId);
|
const text = item.texts?.find(t => t.id === selectedElement.elementId);
|
||||||
console.log('Found text:', text);
|
|
||||||
|
|
||||||
if (text) {
|
if (text) {
|
||||||
setValue(text.text);
|
setValue(text.text);
|
||||||
setColor(text.color || '#000');
|
setColor(text.color || '#000');
|
||||||
setHorizontalPosition(text.alignment || HorizontalAlignment.CENTER);
|
setHorizontalPosition(text.alignment || HorizontalAlignment.CENTER);
|
||||||
setVerticalPosition(text.verticalAlignment || VerticalAlignment.MIDDLE);
|
setVerticalPosition(text.verticalAlignment || VerticalAlignment.MIDDLE);
|
||||||
console.log('Text data loaded successfully');
|
|
||||||
} else {
|
} else {
|
||||||
console.error('Text element not found');
|
console.error('Text element not found');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,14 +32,7 @@ export const usePersonalityStore = create<PersonalityStore>((set) => ({
|
|||||||
})),
|
})),
|
||||||
|
|
||||||
setActiveSection: (section: SectionName) =>
|
setActiveSection: (section: SectionName) =>
|
||||||
set((state) => {
|
set(() => {
|
||||||
console.log("🏪 Store - setActiveSection called:", {
|
|
||||||
newSection: section,
|
|
||||||
oldSection: state.activeSection,
|
|
||||||
oldItemIndex: state.activeItemIndex,
|
|
||||||
newItemIndex: 0,
|
|
||||||
});
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
activeSection: section,
|
activeSection: section,
|
||||||
activeItemIndex: 0,
|
activeItemIndex: 0,
|
||||||
@@ -49,13 +42,7 @@ export const usePersonalityStore = create<PersonalityStore>((set) => ({
|
|||||||
}),
|
}),
|
||||||
|
|
||||||
setActiveItemIndex: (index: number) =>
|
setActiveItemIndex: (index: number) =>
|
||||||
set((state) => {
|
set(() => {
|
||||||
console.log("🏪 Store - setActiveItemIndex called:", {
|
|
||||||
newIndex: index,
|
|
||||||
oldIndex: state.activeItemIndex,
|
|
||||||
currentSection: state.activeSection,
|
|
||||||
});
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
activeItemIndex: index,
|
activeItemIndex: index,
|
||||||
selectedElement: null,
|
selectedElement: null,
|
||||||
@@ -136,12 +123,6 @@ export const usePersonalityStore = create<PersonalityStore>((set) => ({
|
|||||||
|
|
||||||
if (activeIndex >= items.length) return state;
|
if (activeIndex >= items.length) return state;
|
||||||
|
|
||||||
console.log("Updating active item:", {
|
|
||||||
sectionKey,
|
|
||||||
activeIndex,
|
|
||||||
updates,
|
|
||||||
});
|
|
||||||
|
|
||||||
const updatedItems = items.map((item, index) =>
|
const updatedItems = items.map((item, index) =>
|
||||||
index === activeIndex ? { ...item, ...updates } : item
|
index === activeIndex ? { ...item, ...updates } : item
|
||||||
);
|
);
|
||||||
|
|||||||
+2
-10
@@ -1,8 +1,8 @@
|
|||||||
import { FC, useEffect, useState } from 'react'
|
import { FC } from 'react'
|
||||||
import Input from '../components/Input'
|
import Input from '../components/Input'
|
||||||
import { Element3, HambergerMenu, Wallet } from 'iconsax-react'
|
import { Element3, HambergerMenu, Wallet } from 'iconsax-react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { Link, useLocation } from 'react-router-dom'
|
import { Link } from 'react-router-dom'
|
||||||
import { Paths } from '@/utils/Paths'
|
import { Paths } from '@/utils/Paths'
|
||||||
// import Notifications from '../pages/notification/Notification'
|
// import Notifications from '../pages/notification/Notification'
|
||||||
import { useSharedStore } from './store/sharedStore'
|
import { useSharedStore } from './store/sharedStore'
|
||||||
@@ -13,19 +13,11 @@ import { useSharedStore } from './store/sharedStore'
|
|||||||
|
|
||||||
const Header: FC = () => {
|
const Header: FC = () => {
|
||||||
|
|
||||||
const location = useLocation();
|
|
||||||
const [popoverKey, setPopoverKey] = useState(0);
|
|
||||||
const { t } = useTranslation('global')
|
const { t } = useTranslation('global')
|
||||||
const { setOpenSidebar, openSidebar } = useSharedStore()
|
const { setOpenSidebar, openSidebar } = useSharedStore()
|
||||||
// const { data } = useGetProfile()
|
// const { data } = useGetProfile()
|
||||||
// const getWalletBalance = useGetWalletBalance()
|
// const getWalletBalance = useGetWalletBalance()
|
||||||
|
|
||||||
console.log(popoverKey);
|
|
||||||
useEffect(() => {
|
|
||||||
|
|
||||||
setPopoverKey((prevKey) => prevKey + 1);
|
|
||||||
}, [location.pathname]);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='fixed z-10 right-2 left-2 md:right-4 md:left-4 xl:right-[285px] top-2 md:top-4 xl:h-16 h-12 flex items-center px-3 md:px-6 bg-white justify-between rounded-[20px] md:rounded-[32px] xl:w-[calc(100%-305px)]'>
|
<div className='fixed z-10 right-2 left-2 md:right-4 md:left-4 xl:right-[285px] top-2 md:top-4 xl:h-16 h-12 flex items-center px-3 md:px-6 bg-white justify-between rounded-[20px] md:rounded-[32px] xl:w-[calc(100%-305px)]'>
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ const BuySpace: FC = () => {
|
|||||||
</div>
|
</div>
|
||||||
<div className='mt-4 flex gap-4 flex-wrap'>
|
<div className='mt-4 flex gap-4 flex-wrap'>
|
||||||
{gigs.map((gig) => (
|
{gigs.map((gig) => (
|
||||||
<div onClick={() => setSpaceSelected(gig)} className={clx(
|
<div key={gig} onClick={() => setSpaceSelected(gig)} className={clx(
|
||||||
'bg-[#EBEDF5] border border-[#EBEDF5] cursor-pointer flex items-center text-xs h-10 px-6 rounded-lg',
|
'bg-[#EBEDF5] border border-[#EBEDF5] cursor-pointer flex items-center text-xs h-10 px-6 rounded-lg',
|
||||||
spaceSelected === gig && 'border-black'
|
spaceSelected === gig && 'border-black'
|
||||||
)}>
|
)}>
|
||||||
|
|||||||
Reference in New Issue
Block a user