diff --git a/src/components/dashboard/PagesManager.tsx b/src/components/dashboard/PagesManager.tsx index 4c5a67f8..8976d866 100644 --- a/src/components/dashboard/PagesManager.tsx +++ b/src/components/dashboard/PagesManager.tsx @@ -13,6 +13,7 @@ import { Fragment, useMemo, useState } from "react" import { Menu } from "@headlessui/react" import { useQueryClient } from "@tanstack/react-query" +import PostCover from "~/components/home/PostCover" import { useDate } from "~/hooks/useDate" import { Trans, useTranslation } from "~/lib/i18n/client" import { getPageVisibility } from "~/lib/page-helpers" @@ -59,6 +60,7 @@ export const PagesManager = ({ isPost }: { isPost: boolean }) => { limit: 20, visibility, handle: subdomain, + useStat: true, }) // Batch selections @@ -187,35 +189,35 @@ export const PagesManager = ({ isPost }: { isPost: boolean }) => { return ( -
-
+
+

{t(title)}

-
-
+
+ + + - - {t(`New ${isPost ? "Post" : "Page"}`)} - - - - - - -
+ + +
{description} @@ -234,7 +236,7 @@ export const PagesManager = ({ isPost }: { isPost: boolean }) => { )}
- {pages.isLoading &&

{t("Loading")}...

} + {pages.isLoading &&

{t("Loading")}...

} {!pages.isLoading && !pages.data?.pages?.[0].count && ( )} @@ -247,9 +249,75 @@ export const PagesManager = ({ isPost }: { isPost: boolean }) => { -
+ +
+
+ {page.metadata?.content?.title} +
+
+ {page.metadata?.content?.summary} + {page.metadata?.content?.summary && "..."} +
+
+ {!!page.metadata?.content?.tags?.[1] && ( + + + {page.metadata?.content?.tags?.[1]} + + )} + + + + {page.metadata?.content?.readingTime} {t("min")} + + + {!!page.stat?.viewDetailCount && ( + + + {page.stat?.viewDetailCount} + + )} +
+
+ + {t(getPageVisibility(page))} + + · + + {getPageVisibility(page) === PageVisibilityEnum.Draft + ? date.formatDate(page.updatedAt) + : date.formatDate( + page.metadata?.content?.date_published || "", + )} + + {pinnedPage.noteId === page.noteId && ( + <> + · + + {" "} + {siteT("Pinned")} + + + )} +
+
+
-
- {page.metadata?.content?.title ? ( -
- {page.metadata?.content?.title} -
- ) : ( -
- {page.metadata?.content?.summary} -
- )} -
- - {t(getPageVisibility(page))} - - · - - {getPageVisibility(page) === PageVisibilityEnum.Draft - ? date.formatDate(page.updatedAt) - : date.formatDate( - page.metadata?.content?.date_published || "", - )} - - {pinnedPage.noteId === page.noteId && ( - <> - · - - {" "} - {siteT("Pinned")} - - - )} -
-
{({ open, close }) => ( diff --git a/src/components/home/PostCover.tsx b/src/components/home/PostCover.tsx index e35be244..edd20b83 100644 --- a/src/components/home/PostCover.tsx +++ b/src/components/home/PostCover.tsx @@ -6,19 +6,27 @@ import { Autoplay, EffectFade, Navigation, Pagination } from "swiper/modules" import { Swiper, SwiperSlide } from "swiper/react" import { Image } from "~/components/ui/Image" +import { cn } from "~/lib/utils" export default function PostCover({ images, title, uniqueKey, + className, }: { images?: string[] title?: string uniqueKey?: string + className?: string }) { return ( <> -
+
{(images?.length || 0) > 1 ? ( <>