// next import Image from "next/image"; // ui import { Spinner } from "ui"; // icons import { CalendarDaysIcon, ChartBarIcon, ChatBubbleBottomCenterTextIcon, Squares2X2Icon, UserIcon, } from "@heroicons/react/24/outline"; // types import { IssueResponse, IState } from "types"; // constants import { addSpaceIfCamelCase, timeAgo } from "constants/common"; type Props = { issueActivities: any[] | undefined; states: IState[] | undefined; issues: IssueResponse | undefined; }; const activityIcons: { [key: string]: JSX.Element; } = { state: , priority: , name: , description: , target_date: , parent: , }; const IssueActivitySection: React.FC = ({ issueActivities, states, issues }) => { return ( <> {issueActivities ? ( {issueActivities.map((activity, index) => { if (activity.field !== "updated_by") return ( {issueActivities.length > 1 && index !== issueActivities.length - 1 ? ( ) : null} {activity.field ? ( {activityIcons[activity.field as keyof typeof activityIcons]} ) : ( {activity.actor_detail.avatar && activity.actor_detail.avatar !== "" ? ( ) : ( {activity.actor_detail.first_name.charAt(0)} )} )} {activity.actor_detail.first_name} {activity.actor_detail.last_name} {activity.verb} {activity.verb !== "created" ? ( {activity.field ?? "commented"} ) : ( " this issue" )} {timeAgo(activity.created_at)} {activity.verb !== "created" && ( From: {activity.field === "state" ? activity.old_value ? addSpaceIfCamelCase( states?.find((s) => s.id === activity.old_value)?.name ?? "" ) : "None" : activity.field === "parent" ? activity.old_value ? issues?.results.find((i) => i.id === activity.old_value)?.name : "None" : activity.old_value ?? "None"} To: {activity.field === "state" ? activity.new_value ? addSpaceIfCamelCase( states?.find((s) => s.id === activity.new_value)?.name ?? "" ) : "None" : activity.field === "parent" ? activity.new_value ? issues?.results.find((i) => i.id === activity.new_value)?.name : "None" : activity.new_value ?? "None"} )} ); })} ) : ( )} > ); }; export default IssueActivitySection;
{activity.actor_detail.first_name} {activity.actor_detail.last_name} {activity.verb} {activity.verb !== "created" ? ( {activity.field ?? "commented"} ) : ( " this issue" )} {timeAgo(activity.created_at)}