chore: height on mobile

This commit is contained in:
Aslam H
2024-09-25 18:48:23 +07:00
parent 58ce33fed5
commit 223a4524ab
6 changed files with 11 additions and 40 deletions

View File

@@ -23,33 +23,6 @@ import { usePageActions } from "../hooks/use-page-actions"
const TITLE_PLACEHOLDER = "Untitled"
const isPageEmpty = (page: PersonalPage): boolean => {
return (!page.title || page.title.trim() === "") && (!page.content || Object.keys(page.content).length === 0)
}
const useDeleteEmptyPage = (currentPageId: string | null) => {
const router = useRouter()
const { me } = useAccount({
root: {
personalPages: []
}
})
useEffect(() => {
return () => {
if (!currentPageId || !me?.root?.personalPages) return
const currentPage = me.root.personalPages.find(page => page?.id === currentPageId)
if (currentPage && isPageEmpty(currentPage)) {
const index = me.root.personalPages.findIndex(page => page?.id === currentPageId)
if (index !== -1) {
me.root.personalPages.splice(index, 1)
}
}
}
}, [currentPageId, me, router])
}
export function PageDetailRoute({ pageId }: { pageId: string }) {
const { me } = useAccount({ root: { personalLinks: [] } })
const isMobile = useMedia("(max-width: 770px)")
@@ -58,8 +31,6 @@ export function PageDetailRoute({ pageId }: { pageId: string }) {
const { deletePage } = usePageActions()
const confirm = useConfirm()
// useDeleteEmptyPage(pageId)
const handleDelete = useCallback(async () => {
const result = await confirm({
title: "Delete page",