chore: migrate page method to hooks

This commit is contained in:
QiShaoXuan
2022-12-20 17:40:05 +08:00
parent 9fdb3c4311
commit 393da326e6
12 changed files with 159 additions and 54 deletions
@@ -28,15 +28,11 @@ import { useRouter } from 'next/router';
import { useConfirm } from '@/providers/confirm-provider';
import { SyncIcon } from './sync-icon';
import { toast } from '@/components/toast';
import useCurrentPageMeta from '@/hooks/use-current-page-meta';
import { usePageHelper } from '@/hooks/use-page-helper';
const PopoverContent = () => {
const {
getPageMeta,
editor,
currentPage,
toggleFavoritePage,
toggleDeletePage,
} = useAppState();
const { getPageMeta, editor, currentPage } = useAppState();
const { toggleFavoritePage, toggleDeletePage } = usePageHelper();
const { mode, setMode } = useEditor();
const { confirm } = useConfirm();
@@ -192,7 +188,8 @@ const HeaderRight = () => {
export const Header = ({ children }: PropsWithChildren<{}>) => {
const [showWarning, setShowWarning] = useState(shouldShowWarning());
const currentPageMeta = useCurrentPageMeta();
console.log('currentPageMeta', currentPageMeta);
return (
<StyledHeaderContainer hasWarning={showWarning}>
<BrowserWarning