diff --git a/web/ee/components/workspace-notifications/notification-card/item.tsx b/web/ee/components/workspace-notifications/notification-card/item.tsx index ef8a1f7717..d852bab087 100644 --- a/web/ee/components/workspace-notifications/notification-card/item.tsx +++ b/web/ee/components/workspace-notifications/notification-card/item.tsx @@ -1,32 +1,34 @@ -import { FC, useMemo, useState } from "react"; +import { FC, useMemo, useState, Fragment } from "react"; import orderBy from "lodash/orderBy"; import { observer } from "mobx-react"; import { usePopper } from "react-popper"; -import { Popover } from "@headlessui/react"; +import { Popover, Transition } from "@headlessui/react"; import { Row } from "@plane/ui"; import { MemberDropdown } from "@/components/dropdowns"; +//helpers +import { cn } from "@/helpers/common.helper"; import { calculateTimeAgo, convertToEpoch } from "@/helpers/date-time.helper"; //store import { useWorkspaceNotifications } from "@/hooks/store"; //components import { NotificationCardPreview } from "@/plane-web/components/workspace-notifications"; +import { uniq } from "lodash"; export interface INotificationItem { issueId: string; + workspaceSlug: string; } export const NotificationItem: FC = observer((props) => { - const [referenceElement, setReferenceElement] = useState(null); - const [popperElement, setPopperElement] = useState(null); + const { issueId, workspaceSlug } = props; - const { issueId } = props; + const [referenceElement, setReferenceElement] = useState(null); + const [popperElement, setPopperElement] = useState(null); const { groupedNotifications } = useWorkspaceNotifications(); const notificationGroup = groupedNotifications[issueId]; const issue = notificationGroup[0].data?.issue; const unreadCount = notificationGroup.filter((e) => !e.read_at).length; - const authorIds = notificationGroup - .map((e) => e.triggered_by) - .filter((id) => id != undefined && id != null) as string[]; + const projectId = notificationGroup[0].project; - if (!notificationGroup || !issue || !authorIds) return <>; + const authorIds = uniq(notificationGroup.map((e) => e.triggered_by).filter((id) => id != undefined && id != null)); const latestNotificationTime = useMemo(() => { const latestNotification = orderBy(notificationGroup, (n) => convertToEpoch(n.created_at), "desc")[0]; @@ -34,15 +36,26 @@ export const NotificationItem: FC = observer((props) => { }, [notificationGroup]); const { styles, attributes } = usePopper(referenceElement, popperElement, { - placement: "right-end", + placement: "right-start", }); + // states + const [openState, setOpenState] = useState(false); + + if (!notificationGroup || !issue || !authorIds || !projectId) return <>; + return ( - +
0 ? "bg-custom-primary-100/5" : "" + )} ref={setReferenceElement} + onClick={() => {}} + onMouseEnter={() => setOpenState(true)} + onMouseLeave={() => setOpenState(false)} > {/* Issue card header */} @@ -50,11 +63,11 @@ export const NotificationItem: FC = observer((props) => { {issue.sequence_id}-{issue.identifier}
- + {issue.name} {unreadCount > 0 && ( - + {unreadCount} )} @@ -80,11 +93,23 @@ export const NotificationItem: FC = observer((props) => {
- -
- -
-
+ 0} + onMouseEnter={() => setOpenState(true)} + onMouseLeave={() => setOpenState(false)} + > + +
+ +
+
+
); }); diff --git a/web/ee/components/workspace-notifications/notification-card/preview/acitvity-block.tsx b/web/ee/components/workspace-notifications/notification-card/preview/acitvity-block.tsx new file mode 100644 index 0000000000..f90f47a627 --- /dev/null +++ b/web/ee/components/workspace-notifications/notification-card/preview/acitvity-block.tsx @@ -0,0 +1,90 @@ +"use client"; + +import { FC, ReactElement, ReactNode } from "react"; +// hooks +import { DiceIcon, LayersIcon, Tooltip, ContrastIcon, ArchiveIcon, Intake, Avatar } from "@plane/ui"; +import { renderFormattedTime, renderFormattedDate, calculateTimeAgo } from "@/helpers/date-time.helper"; +import { usePlatformOS } from "@/hooks/use-platform-os"; +import { + ArrowRightLeft, + CalendarDays, + LayoutPanelTop, + MessageSquare, + Paperclip, + Signal, + Tag, + Triangle, + Users, +} from "lucide-react"; +import { TSvgIcons } from "@/plane-web/components/workspace-project-states"; +import { IUserLite } from "@plane/types"; +import { getFileURL } from "@/helpers/file.helper"; +// ui +// components +// helpers + +type TIssueActivityBlock = { + createdAt: string | undefined; + notificationField: string; + ends: "top" | "bottom" | undefined; + children: ReactNode; + triggeredBy: IUserLite | undefined; +}; + +export const IssueActivityBlock: FC = (props) => { + const { ends, children, createdAt, notificationField, triggeredBy } = props; + + const acitvityIconsMap: Record = { + state: