fix preview pages:
This commit is contained in:
@@ -1,8 +1,18 @@
|
|||||||
import { Copy, Trash, AddSquare, DocumentText } from 'iconsax-react'
|
import { Copy, Trash, AddSquare, DocumentText } from 'iconsax-react'
|
||||||
import { useEditorStore } from '../store/editorStore'
|
import { useEditorStore } from '../store/editorStore'
|
||||||
|
import type { Page } from '../store/editorStore.types'
|
||||||
import { clx } from '@/helpers/utils'
|
import { clx } from '@/helpers/utils'
|
||||||
import CatalogPreview from '@/pages/catalogue/components/CatalogPreview'
|
import CatalogPreview from '@/pages/catalogue/components/CatalogPreview'
|
||||||
|
|
||||||
|
function isPageEmptyForPreview(page: Page): boolean {
|
||||||
|
if (page.objects.length > 0) return false
|
||||||
|
if (page.backgroundType === 'image' && page.backgroundImageUrl.trim() !== '') {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if (page.backgroundType === 'gradient') return false
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
type PagesPanelProps = {
|
type PagesPanelProps = {
|
||||||
catalogSize?: string
|
catalogSize?: string
|
||||||
}
|
}
|
||||||
@@ -42,7 +52,7 @@ const PagesPanel = ({ catalogSize }: PagesPanelProps) => {
|
|||||||
) : (
|
) : (
|
||||||
pages.map((page) => {
|
pages.map((page) => {
|
||||||
const isSelected = currentPageId === page.id
|
const isSelected = currentPageId === page.id
|
||||||
const isEmpty = page.objects.length === 0
|
const isEmpty = isPageEmptyForPreview(page)
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
key={page.id}
|
key={page.id}
|
||||||
|
|||||||
Reference in New Issue
Block a user