From 782c8c6662bcae2bdc9de21437c2bae03f26f12a Mon Sep 17 00:00:00 2001 From: b-saikrishnakanth Date: Wed, 6 May 2026 19:35:44 +0530 Subject: [PATCH] feat: remove profile preferences activity --- .../activity/profile-activity-list.tsx | 194 ------------------ .../content/pages/activity/activity-list.tsx | 194 ------------------ .../profile/content/pages/activity/index.ts | 7 - .../profile/content/pages/activity/root.tsx | 95 --------- .../settings/profile/content/pages/index.ts | 1 - .../profile/sidebar/item-categories.tsx | 3 +- apps/web/core/services/user.service.ts | 8 - packages/constants/src/settings/profile.ts | 5 - packages/types/src/settings.ts | 2 +- 9 files changed, 2 insertions(+), 507 deletions(-) delete mode 100644 apps/web/core/components/profile/activity/profile-activity-list.tsx delete mode 100644 apps/web/core/components/settings/profile/content/pages/activity/activity-list.tsx delete mode 100644 apps/web/core/components/settings/profile/content/pages/activity/index.ts delete mode 100644 apps/web/core/components/settings/profile/content/pages/activity/root.tsx diff --git a/apps/web/core/components/profile/activity/profile-activity-list.tsx b/apps/web/core/components/profile/activity/profile-activity-list.tsx deleted file mode 100644 index 8684f54827e..00000000000 --- a/apps/web/core/components/profile/activity/profile-activity-list.tsx +++ /dev/null @@ -1,194 +0,0 @@ -/** - * Copyright (c) 2023-present Plane Software, Inc. and contributors - * SPDX-License-Identifier: AGPL-3.0-only - * See the LICENSE file for details. - */ - -import { useEffect } from "react"; -import { observer } from "mobx-react"; -import Link from "next/link"; -import useSWR from "swr"; -// icons -import { History, MessageSquare } from "lucide-react"; -import { calculateTimeAgo, getFileURL } from "@plane/utils"; -// hooks -import { ActivityIcon, ActivityMessage } from "@/components/core/activity"; -import { RichTextEditor } from "@/components/editor/rich-text"; -import { ActivitySettingsLoader } from "@/components/ui/loader/settings/activity"; -// constants -import { USER_ACTIVITY } from "@/constants/fetch-keys"; -// hooks -import { useUser } from "@/hooks/store/user"; -// services -import { UserService } from "@/services/user.service"; -const userService = new UserService(); - -type Props = { - cursor: string; - perPage: number; - updateResultsCount: (count: number) => void; - updateTotalPages: (count: number) => void; - updateEmptyState: (state: boolean) => void; -}; - -export const ProfileActivityListPage = observer(function ProfileActivityListPage(props: Props) { - const { cursor, perPage, updateResultsCount, updateTotalPages, updateEmptyState } = props; - // store hooks - const { data: currentUser } = useUser(); - - const { data: userProfileActivity } = useSWR( - USER_ACTIVITY({ - cursor, - }), - () => - userService.getUserActivity({ - cursor, - per_page: perPage, - }) - ); - - useEffect(() => { - if (!userProfileActivity) return; - - // if no results found then show empty state - if (userProfileActivity.total_results === 0) updateEmptyState(true); - - updateTotalPages(userProfileActivity.total_pages); - updateResultsCount(userProfileActivity.results.length); - }, [updateResultsCount, updateTotalPages, userProfileActivity, updateEmptyState]); - - // TODO: refactor this component - return ( - <> - {userProfileActivity ? ( - - ) : ( - - )} - - ); -}); diff --git a/apps/web/core/components/settings/profile/content/pages/activity/activity-list.tsx b/apps/web/core/components/settings/profile/content/pages/activity/activity-list.tsx deleted file mode 100644 index 9c6db81304b..00000000000 --- a/apps/web/core/components/settings/profile/content/pages/activity/activity-list.tsx +++ /dev/null @@ -1,194 +0,0 @@ -/** - * Copyright (c) 2023-present Plane Software, Inc. and contributors - * SPDX-License-Identifier: AGPL-3.0-only - * See the LICENSE file for details. - */ - -import { useEffect } from "react"; -import { observer } from "mobx-react"; -import Link from "next/link"; -import useSWR from "swr"; -// icons -import { History, MessageSquare } from "lucide-react"; -import { calculateTimeAgo, getFileURL } from "@plane/utils"; -// hooks -import { ActivityIcon, ActivityMessage } from "@/components/core/activity"; -import { RichTextEditor } from "@/components/editor/rich-text"; -import { ActivitySettingsLoader } from "@/components/ui/loader/settings/activity"; -// constants -import { USER_ACTIVITY } from "@/constants/fetch-keys"; -// hooks -import { useUserProfile } from "@/hooks/store/user/user-user-profile"; -// services -import { UserService } from "@/services/user.service"; -const userService = new UserService(); - -type Props = { - cursor: string; - perPage: number; - updateResultsCount: (count: number) => void; - updateTotalPages: (count: number) => void; - updateEmptyState: (state: boolean) => void; -}; - -export const ActivityProfileSettingsList = observer(function ProfileActivityListPage(props: Props) { - const { cursor, perPage, updateResultsCount, updateTotalPages, updateEmptyState } = props; - // store hooks - const { data: currentUser } = useUserProfile(); - - const { data: userProfileActivity } = useSWR( - USER_ACTIVITY({ - cursor, - }), - () => - userService.getUserActivity({ - cursor, - per_page: perPage, - }) - ); - - useEffect(() => { - if (!userProfileActivity) return; - - // if no results found then show empty state - if (userProfileActivity.total_results === 0) updateEmptyState(true); - - updateTotalPages(userProfileActivity.total_pages); - updateResultsCount(userProfileActivity.results.length); - }, [updateResultsCount, updateTotalPages, userProfileActivity, updateEmptyState]); - - // TODO: refactor this component - return ( - <> - {userProfileActivity ? ( - - ) : ( - - )} - - ); -}); diff --git a/apps/web/core/components/settings/profile/content/pages/activity/index.ts b/apps/web/core/components/settings/profile/content/pages/activity/index.ts deleted file mode 100644 index d980334597b..00000000000 --- a/apps/web/core/components/settings/profile/content/pages/activity/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Copyright (c) 2023-present Plane Software, Inc. and contributors - * SPDX-License-Identifier: AGPL-3.0-only - * See the LICENSE file for details. - */ - -export * from "./root"; diff --git a/apps/web/core/components/settings/profile/content/pages/activity/root.tsx b/apps/web/core/components/settings/profile/content/pages/activity/root.tsx deleted file mode 100644 index 466c523cd2e..00000000000 --- a/apps/web/core/components/settings/profile/content/pages/activity/root.tsx +++ /dev/null @@ -1,95 +0,0 @@ -/** - * Copyright (c) 2023-present Plane Software, Inc. and contributors - * SPDX-License-Identifier: AGPL-3.0-only - * See the LICENSE file for details. - */ - -import { useState } from "react"; -import { ChevronDown } from "lucide-react"; -import { observer } from "mobx-react"; -import { useTheme } from "next-themes"; -// plane imports -import { useTranslation } from "@plane/i18n"; -import { Button } from "@plane/propel/button"; -// assets -import darkActivityAsset from "@/app/assets/empty-state/profile/activity-dark.webp?url"; -import lightActivityAsset from "@/app/assets/empty-state/profile/activity-light.webp?url"; -// components -import { DetailedEmptyState } from "@/components/empty-state/detailed-empty-state-root"; -import { ProfileSettingsHeading } from "@/components/settings/profile/heading"; -// local imports -import { ActivityProfileSettingsList } from "./activity-list"; - -const PER_PAGE = 100; - -export const ActivityProfileSettings = observer(function ActivityProfileSettings() { - // states - const [pageCount, setPageCount] = useState(1); - const [totalPages, setTotalPages] = useState(0); - const [resultsCount, setResultsCount] = useState(0); - const [isEmpty, setIsEmpty] = useState(false); - // theme hook - const { resolvedTheme } = useTheme(); - // plane hooks - const { t } = useTranslation(); - // derived values - const resolvedPath = resolvedTheme === "light" ? lightActivityAsset : darkActivityAsset; - - const updateTotalPages = (count: number) => setTotalPages(count); - - const updateResultsCount = (count: number) => setResultsCount(count); - - const updateEmptyState = (isEmpty: boolean) => setIsEmpty(isEmpty); - - const handleLoadMore = () => setPageCount((prev) => prev + 1); - - const activityPages: React.ReactNode[] = []; - for (let i = 0; i < pageCount; i++) - activityPages.push( - - ); - - const isLoadMoreVisible = pageCount < totalPages && resultsCount !== 0; - - if (isEmpty) { - return ( -
- - -
- ); - } - - return ( -
- -
{activityPages}
- {isLoadMoreVisible && ( -
- -
- )} -
- ); -}); diff --git a/apps/web/core/components/settings/profile/content/pages/index.ts b/apps/web/core/components/settings/profile/content/pages/index.ts index c9e4179c125..c9dfa24d837 100644 --- a/apps/web/core/components/settings/profile/content/pages/index.ts +++ b/apps/web/core/components/settings/profile/content/pages/index.ts @@ -13,6 +13,5 @@ export const PROFILE_SETTINGS_PAGES_MAP: Record import("./preferences").then((m) => ({ default: m.PreferencesProfileSettings }))), notifications: lazy(() => import("./notifications").then((m) => ({ default: m.NotificationsProfileSettings }))), security: lazy(() => import("./security").then((m) => ({ default: m.SecurityProfileSettings }))), - activity: lazy(() => import("./activity").then((m) => ({ default: m.ActivityProfileSettings }))), "api-tokens": lazy(() => import("./api-tokens").then((m) => ({ default: m.APITokensProfileSettings }))), }; diff --git a/apps/web/core/components/settings/profile/sidebar/item-categories.tsx b/apps/web/core/components/settings/profile/sidebar/item-categories.tsx index d1ee973f3ee..eab4d7ee5b3 100644 --- a/apps/web/core/components/settings/profile/sidebar/item-categories.tsx +++ b/apps/web/core/components/settings/profile/sidebar/item-categories.tsx @@ -6,7 +6,7 @@ import type React from "react"; import type { LucideIcon } from "lucide-react"; -import { Activity, Bell, CircleUser, KeyRound, LockIcon, Settings2 } from "lucide-react"; +import { Bell, CircleUser, KeyRound, LockIcon, Settings2 } from "lucide-react"; import { observer } from "mobx-react"; import { useParams } from "react-router"; // plane imports @@ -21,7 +21,6 @@ import { ProfileSettingsSidebarWorkspaceOptions } from "./workspace-options"; const ICONS: Record> = { general: CircleUser, security: LockIcon, - activity: Activity, preferences: Settings2, notifications: Bell, "api-tokens": KeyRound, diff --git a/apps/web/core/services/user.service.ts b/apps/web/core/services/user.service.ts index 6122c432adf..185780c8d91 100644 --- a/apps/web/core/services/user.service.ts +++ b/apps/web/core/services/user.service.ts @@ -145,14 +145,6 @@ export class UserService extends APIService { }); } - async getUserActivity(params: { per_page: number; cursor?: string }): Promise { - return this.get("/api/users/me/activities/", { params }) - .then((response) => response?.data) - .catch((error) => { - throw error?.response?.data; - }); - } - async changePassword(token: string, data: { old_password?: string; new_password: string }): Promise { return this.post(`/auth/change-password/`, data, { headers: { diff --git a/packages/constants/src/settings/profile.ts b/packages/constants/src/settings/profile.ts index 38edd4ace5d..9c16d72c7f4 100644 --- a/packages/constants/src/settings/profile.ts +++ b/packages/constants/src/settings/profile.ts @@ -32,10 +32,6 @@ export const PROFILE_SETTINGS: Record< key: "security", i18n_label: "profile.actions.security", }, - activity: { - key: "activity", - i18n_label: "profile.actions.activity", - }, preferences: { key: "preferences", i18n_label: "profile.actions.preferences", @@ -61,7 +57,6 @@ export const GROUPED_PROFILE_SETTINGS: Record< PROFILE_SETTINGS["preferences"], PROFILE_SETTINGS["notifications"], PROFILE_SETTINGS["security"], - PROFILE_SETTINGS["activity"], ], [PROFILE_SETTINGS_CATEGORY.DEVELOPER]: [PROFILE_SETTINGS["api-tokens"]], }; diff --git a/packages/types/src/settings.ts b/packages/types/src/settings.ts index 7eb994dd566..c9df62f0a06 100644 --- a/packages/types/src/settings.ts +++ b/packages/types/src/settings.ts @@ -8,7 +8,7 @@ import type { EUserProjectRoles } from "."; import type { EUserWorkspaceRoles } from "./workspace"; -export type TProfileSettingsTabs = "general" | "preferences" | "activity" | "notifications" | "security" | "api-tokens"; +export type TProfileSettingsTabs = "general" | "preferences" | "notifications" | "security" | "api-tokens"; export type TWorkspaceSettingsTabs = "general" | "members" | "billing-and-plans" | "export" | "webhooks"; export type TWorkspaceSettingsItem = {