import React, { FC } from "react"; import { observer } from "mobx-react"; import { Circle, Earth, Info, Lock, Minus } from "lucide-react"; // ui import { Avatar, TOAST_TYPE, Tooltip, setToast } from "@plane/ui"; // components import { FavoriteStar } from "@/components/core"; import { PageQuickActions } from "@/components/pages/dropdowns"; // helpers import { renderFormattedDate } from "@/helpers/date-time.helper"; // hooks import { useMember, usePage } from "@/hooks/store"; type Props = { workspaceSlug: string; projectId: string; pageId: string; }; export const BlockItemAction: FC = observer((props) => { const { workspaceSlug, projectId, pageId } = props; // store hooks const { access, created_at, is_favorite, owned_by, addToFavorites, removeFromFavorites } = usePage(pageId); const { getUserDetails } = useMember(); // derived values const ownerDetails = owned_by ? getUserDetails(owned_by) : undefined; // handlers 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 details */}
{/* Labels */}
{/* 10m read */}
{access === 0 ? : }
{/* vertical divider */} {/* page info */} {/* favorite/unfavorite */} { e.preventDefault(); e.stopPropagation(); handleFavorites(); }} selected={is_favorite} /> {/* quick actions dropdown */} ); });