[WEB-643] chore: update issue activity tabs. (#4232)

* remove `updates` tab.
* make `comments` as primary tab.
This commit is contained in:
Prateek Shourya 2024-04-23 12:52:31 +05:30 committed by GitHub
parent c50a0602f7
commit f77d2d8c0a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 50 deletions

View File

@ -1,33 +0,0 @@
import { FC } from "react";
import { observer } from "mobx-react-lite";
// hooks
import { useIssueDetail } from "@/hooks/store";
// components
import { IssueActivityList } from "./activity-list";
type TIssueActivityRoot = {
issueId: string;
};
export const IssueActivityRoot: FC<TIssueActivityRoot> = observer((props) => {
const { issueId } = props;
// hooks
const {
activity: { getActivitiesByIssueId },
} = useIssueDetail();
const activityIds = getActivitiesByIssueId(issueId);
if (!activityIds) return <></>;
return (
<div>
{activityIds.map((activityId, index) => (
<IssueActivityList
key={activityId}
activityId={activityId}
ends={index === 0 ? "top" : index === activityIds.length - 1 ? "bottom" : undefined}
/>
))}
</div>
);
});

View File

@ -3,7 +3,6 @@ export * from "./root";
export * from "./activity-comment-root"; export * from "./activity-comment-root";
// activity // activity
export * from "./activity/root";
export * from "./activity/activity-list"; export * from "./activity/activity-list";
// issue comment // issue comment

View File

@ -1,12 +1,12 @@
import { FC, useMemo, useState } from "react"; import { FC, useMemo, useState } from "react";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { History, LucideIcon, MessageCircle, ListRestart } from "lucide-react"; import { History, LucideIcon, MessageCircle } from "lucide-react";
// types // types
import { TIssueComment } from "@plane/types"; import { TIssueComment } from "@plane/types";
// ui // ui
import { TOAST_TYPE, setToast } from "@plane/ui"; import { TOAST_TYPE, setToast } from "@plane/ui";
// components // components
import { IssueActivityCommentRoot, IssueActivityRoot, IssueCommentRoot, IssueCommentCreate } from "@/components/issues"; import { IssueActivityCommentRoot, IssueCommentRoot, IssueCommentCreate } from "@/components/issues";
// hooks // hooks
import { useIssueDetail, useProject } from "@/hooks/store"; import { useIssueDetail, useProject } from "@/hooks/store";
@ -17,24 +17,19 @@ type TIssueActivity = {
disabled?: boolean; disabled?: boolean;
}; };
type TActivityTabs = "all" | "activity" | "comments"; type TActivityTabs = "all" | "comments";
const activityTabs: { key: TActivityTabs; title: string; icon: LucideIcon }[] = [ const activityTabs: { key: TActivityTabs; title: string; icon: LucideIcon }[] = [
{
key: "all",
title: "All activity",
icon: History,
},
{
key: "activity",
title: "Updates",
icon: ListRestart,
},
{ {
key: "comments", key: "comments",
title: "Comments", title: "Comments",
icon: MessageCircle, icon: MessageCircle,
}, },
{
key: "all",
title: "All activity",
icon: History,
},
]; ];
export type TActivityOperations = { export type TActivityOperations = {
@ -49,7 +44,7 @@ export const IssueActivity: FC<TIssueActivity> = observer((props) => {
const { createComment, updateComment, removeComment } = useIssueDetail(); const { createComment, updateComment, removeComment } = useIssueDetail();
const { getProjectById } = useProject(); const { getProjectById } = useProject();
// state // state
const [activityTab, setActivityTab] = useState<TActivityTabs>("all"); const [activityTab, setActivityTab] = useState<TActivityTabs>("comments");
const activityOperations: TActivityOperations = useMemo( const activityOperations: TActivityOperations = useMemo(
() => ({ () => ({
@ -158,8 +153,6 @@ export const IssueActivity: FC<TIssueActivity> = observer((props) => {
/> />
)} )}
</div> </div>
) : activityTab === "activity" ? (
<IssueActivityRoot issueId={issueId} />
) : ( ) : (
<div className="space-y-3"> <div className="space-y-3">
<IssueCommentRoot <IssueCommentRoot