diff --git a/web/ce/store/issue/issue-details/activity.store.ts b/web/ce/store/issue/issue-details/activity.store.ts index cf180eebf7..93e1420af3 100644 --- a/web/ce/store/issue/issue-details/activity.store.ts +++ b/web/ce/store/issue/issue-details/activity.store.ts @@ -40,10 +40,12 @@ export interface IIssueActivityStore extends IIssueActivityStoreActions { loader: TActivityLoader; activities: TIssueActivityIdMap; activityMap: TIssueActivityMap; + sortOrder: TSORT_ORDER; // helper methods getActivitiesByIssueId: (issueId: string) => string[] | undefined; getActivityById: (activityId: string) => TIssueActivity | undefined; getActivityCommentByIssueId: (issueId: string, sortOrder: TSORT_ORDER) => TIssueActivityComment[] | undefined; + toggleSortOrder: () => void; } export class IssueActivityStore implements IIssueActivityStore { @@ -51,7 +53,7 @@ export class IssueActivityStore implements IIssueActivityStore { loader: TActivityLoader = "fetch"; activities: TIssueActivityIdMap = {}; activityMap: TIssueActivityMap = {}; - + sortOrder: TSORT_ORDER = TSORT_ORDER.ASC; // services serviceType; issueActivityService; @@ -73,6 +75,14 @@ export class IssueActivityStore implements IIssueActivityStore { this.issueActivityService = new IssueActivityService(this.serviceType); } + toggleSortOrder = () => { + if (this.sortOrder === TSORT_ORDER.ASC) { + this.sortOrder = TSORT_ORDER.DESC; + } else { + this.sortOrder = TSORT_ORDER.ASC; + } + }; + // helper methods getActivitiesByIssueId = (issueId: string) => { if (!issueId) return undefined; diff --git a/web/ee/components/epics/epic-detail/activity/activity-comment-root.tsx b/web/ee/components/epics/epic-detail/activity/activity-comment-root.tsx index 8288c66dc3..3c66d0ce3f 100644 --- a/web/ee/components/epics/epic-detail/activity/activity-comment-root.tsx +++ b/web/ee/components/epics/epic-detail/activity/activity-comment-root.tsx @@ -1,6 +1,8 @@ import { FC } from "react"; import { observer } from "mobx-react"; import { EIssueServiceType } from "@plane/constants"; + +import { TSORT_ORDER } from "@/constants/common"; // hooks import { useIssueDetail } from "@/hooks/store"; // plane web components @@ -33,7 +35,7 @@ export const IssueActivityCommentRoot: FC = observer( comment: {}, } = useIssueDetail(EIssueServiceType.EPICS); - const activityComments = getActivityCommentByIssueId(issueId); + const activityComments = getActivityCommentByIssueId(issueId, TSORT_ORDER.DESC); if (!activityComments || (activityComments && activityComments.length <= 0)) return <>; diff --git a/web/ee/components/epics/epic-detail/activity/root.tsx b/web/ee/components/epics/epic-detail/activity/root.tsx index 06be4f4981..fb033ac630 100644 --- a/web/ee/components/epics/epic-detail/activity/root.tsx +++ b/web/ee/components/epics/epic-detail/activity/root.tsx @@ -11,6 +11,8 @@ import { TOAST_TYPE, setToast } from "@plane/ui"; // components import { IssueCommentCreate } from "@/components/issues"; import { IssueActivityCommentRoot } from "@/components/issues/issue-detail"; +// constants +import { TSORT_ORDER } from "@/constants/common"; // hooks import { useIssueDetail, useProject, useUser, useUserPermissions } from "@/hooks/store"; // plane web components @@ -184,6 +186,7 @@ export const IssueActivity: FC = observer((props) => { activityOperations={activityOperations} showAccessSpecifier={!!project.anchor} disabled={disabled} + sortOrder={TSORT_ORDER.ASC} /> {!disabled && ( = observer(( comment: {}, } = useIssueDetail(EIssueServiceType.EPICS); - const activityComments = getActivityCommentByIssueId(issueId); + const activityComments = getActivityCommentByIssueId(issueId, TSORT_ORDER.ASC); if (!activityComments || (activityComments && activityComments.length <= 0)) return <>; diff --git a/web/ee/components/epics/sidebar/activity/comments/root.tsx b/web/ee/components/epics/sidebar/activity/comments/root.tsx index c744103e80..466951ea83 100644 --- a/web/ee/components/epics/sidebar/activity/comments/root.tsx +++ b/web/ee/components/epics/sidebar/activity/comments/root.tsx @@ -3,6 +3,7 @@ import { observer } from "mobx-react"; import { EIssueServiceType } from "@plane/constants"; // components import { TActivityOperations } from "@/components/issues"; +import { TSORT_ORDER } from "@/constants/common"; // hooks import { useIssueDetail } from "@/hooks/store"; // plane web constants @@ -26,7 +27,7 @@ export const EpicCommentActivityRoot: FC = observer((p comment: {}, } = useIssueDetail(EIssueServiceType.EPICS); - const activityComments = getActivityCommentByIssueId(issueId); + const activityComments = getActivityCommentByIssueId(issueId, TSORT_ORDER.ASC); if (!activityComments || (activityComments && activityComments.length <= 0)) return <>; diff --git a/web/ee/components/home/header.tsx b/web/ee/components/home/header.tsx new file mode 100644 index 0000000000..c95736c9eb --- /dev/null +++ b/web/ee/components/home/header.tsx @@ -0,0 +1 @@ +export const HomePageHeader = () => <>; diff --git a/web/ee/components/project-overview/sidebar/root.tsx b/web/ee/components/project-overview/sidebar/root.tsx index be4e537c0a..58c5dd53f3 100644 --- a/web/ee/components/project-overview/sidebar/root.tsx +++ b/web/ee/components/project-overview/sidebar/root.tsx @@ -6,8 +6,8 @@ import { observer } from "mobx-react"; import { useParams } from "next/navigation"; import { Activity } from "lucide-react"; import { InfoFillIcon, Tabs, UpdatesIcon } from "@plane/ui"; - import { ActivitySortRoot } from "@/components/issues"; +import { TSORT_ORDER } from "@/constants/common"; import { cn } from "@/helpers/common.helper"; // hooks import { useProject, useWorkspace } from "@/hooks/store"; @@ -33,7 +33,7 @@ export const ProjectDetailsSidebar: FC = observer((pro // router const { workspaceSlug } = useParams(); // states - const [sortOrder, setSortOrder] = React.useState<"asc" | "desc">("desc"); + const [sortOrder, setSortOrder] = React.useState(TSORT_ORDER.DESC); // store hooks const { updateProject } = useProject(); const { features } = useProjectAdvanced(); @@ -41,7 +41,7 @@ export const ProjectDetailsSidebar: FC = observer((pro const { isWorkspaceFeatureEnabled } = useWorkspaceFeatures(); // handler - const toggleSortOrder = () => setSortOrder(sortOrder === "asc" ? "desc" : "asc"); + const toggleSortOrder = () => setSortOrder(sortOrder === TSORT_ORDER.ASC ? TSORT_ORDER.DESC : TSORT_ORDER.ASC); // derived const isProjectUpdatesEnabled = features && diff --git a/web/ee/components/project-overview/sidebar/updates/root.tsx b/web/ee/components/project-overview/sidebar/updates/root.tsx index ec9942cbf1..8dbce7a8af 100644 --- a/web/ee/components/project-overview/sidebar/updates/root.tsx +++ b/web/ee/components/project-overview/sidebar/updates/root.tsx @@ -3,6 +3,7 @@ import { observer } from "mobx-react"; import { useParams } from "next/navigation"; import { Plus } from "lucide-react"; import { ActivitySortRoot } from "@/components/issues"; +import { TSORT_ORDER } from "@/constants/common"; import { useProjectUpdates } from "@/plane-web/hooks/store/projects/use-project-updates"; import { TProjectUpdate } from "@/plane-web/types"; import { UpdateBlock } from "./block"; @@ -15,14 +16,14 @@ export const ProjectUpdates = observer(() => { const { workspaceSlug, projectId } = useParams(); // state const [showInput, setShowInput] = useState(false); - const [sortOrder, setSortOrder] = useState<"asc" | "desc">("desc"); + const [sortOrder, setSortOrder] = useState(TSORT_ORDER.DESC); // hooks const { getUpdatesByProjectId, loader } = useProjectUpdates(); const { handleUpdateOperations } = useUpdates(workspaceSlug.toString(), projectId.toString()); // handler const toggleSortOrder = () => { - setSortOrder(sortOrder === "asc" ? "desc" : "asc"); + setSortOrder(sortOrder === TSORT_ORDER.ASC ? TSORT_ORDER.DESC : TSORT_ORDER.ASC); }; // derived diff --git a/web/ee/components/teams/overview/sidebar/activity.tsx b/web/ee/components/teams/overview/sidebar/activity.tsx index 915bb672bd..ca66e28a82 100644 --- a/web/ee/components/teams/overview/sidebar/activity.tsx +++ b/web/ee/components/teams/overview/sidebar/activity.tsx @@ -9,6 +9,8 @@ import { Loader } from "@plane/ui"; // components import { ActivityBlockComponent } from "@/components/common/activity/activity-block"; import { ActivitySortRoot } from "@/components/issues"; +// constants +import { TSORT_ORDER } from "@/constants/common"; // plane web constants import { TEAM_UPDATES_HELPER_MAP } from "@/plane-web/constants/teams"; // plane web helpers @@ -63,7 +65,7 @@ export const TeamsOverviewSidebarActivity: FC = observer((pr {teamActivitiesLoader === "mutation" ? : null} toggleTeamActivitySortOrder(teamId)} className="py-1" iconClassName="size-3" diff --git a/web/ee/components/teams/overview/sidebar/comments.tsx b/web/ee/components/teams/overview/sidebar/comments.tsx index ca69012b93..55787b2255 100644 --- a/web/ee/components/teams/overview/sidebar/comments.tsx +++ b/web/ee/components/teams/overview/sidebar/comments.tsx @@ -10,6 +10,8 @@ import { EFileAssetType } from "@plane/types/src/enums"; import { setToast, TOAST_TYPE } from "@plane/ui"; // components import { ActivitySortRoot } from "@/components/issues"; +// constants +import { TSORT_ORDER } from "@/constants/common"; // plane web imports import { useTeamUpdates } from "@/plane-web/hooks/store/teams/use-team-updates"; import { TTeamComment } from "@/plane-web/types"; @@ -138,7 +140,7 @@ export const TeamsOverviewSidebarComments: FC = o ) : null} toggleTeamCommentsSortOrder(teamId)} className="py-1" iconClassName="size-3" diff --git a/web/ee/constants/index.ts b/web/ee/constants/index.ts index 123db122c8..6e1947fd29 100644 --- a/web/ee/constants/index.ts +++ b/web/ee/constants/index.ts @@ -5,3 +5,4 @@ export * from "./issues"; export * from "./project"; export * from "./user-permissions"; export * from "./workspace"; +export * from "./page";