import { Copy, Trash, AddSquare, DocumentText } from 'iconsax-react'
import { useEditorStore } from '../store/editorStore'
import { clx } from '@/helpers/utils'
import CatalogPreview from '@/pages/catalogue/components/CatalogPreview'
type PagesPanelProps = {
catalogSize?: string
}
const PagesPanel = ({ catalogSize }: PagesPanelProps) => {
const {
pages,
currentPageId,
setCurrentPage,
addPage,
duplicatePage,
deletePage,
} = useEditorStore()
const handleAddPage = () => {
addPage()
}
const handleDuplicatePage = (pageId: string) => {
duplicatePage(pageId)
}
const handleDeletePage = (pageId: string) => {
if (pages.length > 1) {
deletePage(pageId)
}
}
return (
<>
{pages.length === 0 ? (
صفحهای وجود ندارد
) : (
pages.map((page) => {
const isSelected = currentPageId === page.id
const isEmpty = page.objects.length === 0
return (
setCurrentPage(page.id)}
className={clx(
'flex flex-col gap-2 cursor-pointer transition-colors',
isSelected && ' rounded-lg p-0.5'
)}
>
{isEmpty ? (
) : (
)}
{page.name}
)
})
)}
{currentPageId && (
<>
>
)}
>
)
}
export default PagesPanel