import { FC } from "react"; import { observer } from "mobx-react"; import Link from "next/link"; import { Circle, Info, Lock, Minus, UsersRound } from "lucide-react"; import { Avatar, TOAST_TYPE, Tooltip, setToast } from "@plane/ui"; // components import { FavoriteStar } from "@/components/core"; import { PageQuickActions } from "@/components/pages"; // helpers import { renderFormattedDate } from "@/helpers/date-time.helper"; // hooks import { useMember, usePage } from "@/hooks/store"; type TPageListBlock = { workspaceSlug: string; projectId: string; pageId: string; }; export const PageListBlock: FC = observer((props) => { const { workspaceSlug, projectId, pageId } = props; // hooks const { access, created_at, is_favorite, name, owned_by, addToFavorites, removeFromFavorites } = usePage(pageId); const { getUserDetails } = useMember(); // derived values const ownerDetails = owned_by ? getUserDetails(owned_by) : undefined; const handleFavorites = () => { if (is_favorite) removeFromFavorites().then(() => setToast({ type: TOAST_TYPE.SUCCESS, title: "Success!", message: "Page removed from favorites.", }) ); else addToFavorites().then(() => setToast({ type: TOAST_TYPE.SUCCESS, title: "Success!", message: "Page added to favorites.", }) ); }; return ( {/* page title */}
{name}
{/* page properties */}
{/* page details */}
{/* Labels */}
{/* 10m read */}
{access === 0 ? : }
{/* vertical divider */} {/* page info */} {/* favorite/unfavorite */} { e.preventDefault(); e.stopPropagation(); handleFavorites(); }} selected={is_favorite} /> {/* quick actions dropdown */}
); });