import { Text, Group, UnstyledButton, Badge, Table, ActionIcon, Button, } from "@mantine/core"; import { Link } from "react-router-dom"; import PageListSkeleton from "@/components/ui/page-list-skeleton.tsx"; import { buildPageUrl } from "@/features/page/page.utils.ts"; import { formattedDate } from "@/lib/time.ts"; import { useRecentChangesQuery } from "@/features/page/queries/page-query.ts"; import { IconFileDescription, IconFiles } from "@tabler/icons-react"; import { EmptyState } from "@/components/ui/empty-state.tsx"; import { getSpaceUrl } from "@/lib/config.ts"; import { useTranslation } from "react-i18next"; import { getInitialsColor } from "@/lib/get-initials-color.ts"; interface Props { spaceId?: string; } export default function RecentChanges({ spaceId }: Props) { const { t } = useTranslation(); const { data, isLoading, isError, hasNextPage, fetchNextPage, isFetchingNextPage } = useRecentChangesQuery(spaceId); const pages = data?.pages.flatMap((p) => p.items) ?? []; if (isLoading) { return ; } if (isError) { return {t("Failed to fetch recent pages")}; } return pages.length > 0 ? ( <> {pages.map((page) => ( {page.icon || ( )} {page.title || t("Untitled")} {!spaceId && ( {page?.space.name} )} {formattedDate(page.updatedAt)} ))}
{hasNextPage && ( )} ) : ( ); }