diff --git a/web/components/headers/profile-settings.tsx b/web/components/headers/profile-settings.tsx index ce35daffb..634957d1c 100644 --- a/web/components/headers/profile-settings.tsx +++ b/web/components/headers/profile-settings.tsx @@ -19,7 +19,7 @@ export const ProfileSettingsHeader: FC = (props) => { type="text" label="My Profile" icon={} - link={`/me/profile`} + link="/profile" /> diff --git a/web/components/headers/user-profile.tsx b/web/components/headers/user-profile.tsx index abac3db8d..70cc51cf8 100644 --- a/web/components/headers/user-profile.tsx +++ b/web/components/headers/user-profile.tsx @@ -6,7 +6,7 @@ export const UserProfileHeader = () => (
- +
diff --git a/web/components/instance/sidebar-dropdown.tsx b/web/components/instance/sidebar-dropdown.tsx index c7d449a62..2da53c21b 100644 --- a/web/components/instance/sidebar-dropdown.tsx +++ b/web/components/instance/sidebar-dropdown.tsx @@ -4,7 +4,7 @@ import { useTheme } from "next-themes"; import { observer } from "mobx-react-lite"; import Link from "next/link"; import { Menu, Transition } from "@headlessui/react"; -import { Cog, LogIn, LogOut, Settings, UserCircle2 } from "lucide-react"; +import { Cog, LogIn, LogOut, Settings } from "lucide-react"; import { mutate } from "swr"; // mobx store import { useMobxStore } from "lib/mobx/store-provider"; @@ -16,16 +16,12 @@ import { AuthService } from "services/auth.service"; import { Avatar, Tooltip } from "@plane/ui"; // Static Data -const profileLinks = (workspaceSlug: string, userId: string) => [ - { - name: "View profile", - icon: UserCircle2, - link: `/${workspaceSlug}/profile/${userId}`, - }, +const PROFILE_LINKS = [ { + key: "settings", name: "Settings", icon: Settings, - link: `/me/profile`, + link: `/profile`, }, ]; @@ -123,8 +119,8 @@ export const InstanceSidebarDropdown = observer(() => { >
{currentUser?.email} - {profileLinks(workspaceSlug?.toString() ?? "", currentUser?.id ?? "").map((link, index) => ( - + {PROFILE_LINKS.map((link) => ( + diff --git a/web/components/instance/sidebar-menu.tsx b/web/components/instance/sidebar-menu.tsx index 7d8ca476e..76819403c 100644 --- a/web/components/instance/sidebar-menu.tsx +++ b/web/components/instance/sidebar-menu.tsx @@ -12,25 +12,25 @@ const INSTANCE_ADMIN_LINKS = [ Icon: Cog, name: "General", description: "General settings here", - href: `/admin`, + href: `/god-mode`, }, { Icon: Mail, name: "Email", description: "Email related settings will go here", - href: `/admin/email`, + href: `/god-mode/email`, }, { Icon: Lock, name: "Authorization", description: "Autorization", - href: `/admin/authorization`, + href: `/god-mode/authorization`, }, { Icon: BrainCog, name: "OpenAI", description: "OpenAI configurations", - href: `/admin/openai`, + href: `/god-mode/openai`, }, ]; diff --git a/web/components/profile/sidebar.tsx b/web/components/profile/sidebar.tsx index c3a63dd67..c6d183011 100644 --- a/web/components/profile/sidebar.tsx +++ b/web/components/profile/sidebar.tsx @@ -67,7 +67,7 @@ export const ProfileSidebar = () => {
{user?.id === userId && (
- + diff --git a/web/components/workspace/sidebar-dropdown.tsx b/web/components/workspace/sidebar-dropdown.tsx index 839212d75..113c16011 100644 --- a/web/components/workspace/sidebar-dropdown.tsx +++ b/web/components/workspace/sidebar-dropdown.tsx @@ -42,7 +42,7 @@ const profileLinks = (workspaceSlug: string, userId: string) => [ { name: "Settings", icon: Settings, - link: "/me/profile", + link: "/profile", }, ]; @@ -291,7 +291,7 @@ export const WorkspaceSidebarDropdown = observer(() => { ))}
-
+
{ {isUserInstanceAdmin && (
- + God Mode diff --git a/web/constants/workspace.ts b/web/constants/workspace.ts index e442bf242..1151402a1 100644 --- a/web/constants/workspace.ts +++ b/web/constants/workspace.ts @@ -92,17 +92,16 @@ export const DEFAULT_GLOBAL_VIEWS_LIST: { ]; export const RESTRICTED_URLS = [ - "api", - "installations", "404", + "accounts", + "api", "create-workspace", "error", + "god-mode", + "installations", "invitations", - "magic-sign-in", "onboarding", "profile", - "reset-password", - "sign-up", "spaces", - "workspace-member-invitation", + "workspace-invitations", ]; diff --git a/web/layouts/admin-layout/header.tsx b/web/layouts/admin-layout/header.tsx index 5f2864e32..90028f6ae 100644 --- a/web/layouts/admin-layout/header.tsx +++ b/web/layouts/admin-layout/header.tsx @@ -22,12 +22,9 @@ export const InstanceAdminHeader: FC = observer((props) => type="text" icon={} label="Settings" - link="/admin" - /> - +
diff --git a/web/layouts/settings-layout/profile/settings-sidebar.tsx b/web/layouts/settings-layout/profile/settings-sidebar.tsx index f5160cd5b..534a69b4f 100644 --- a/web/layouts/settings-layout/profile/settings-sidebar.tsx +++ b/web/layouts/settings-layout/profile/settings-sidebar.tsx @@ -13,22 +13,22 @@ const PROFILE_LINKS: Array<{ { key: "profile", label: "Profile", - href: `/me/profile`, + href: `/profile`, }, { key: "change-password", label: "Change password", - href: `/me/profile/change-password`, + href: `/profile/change-password`, }, { key: "activity", label: "Activity", - href: `/me/profile/activity`, + href: `/profile/activity`, }, { key: "preferences", label: "Preferences", - href: `/me/profile/preferences`, + href: `/profile/preferences`, }, ]; diff --git a/web/pages/admin/authorization.tsx b/web/pages/god-mode/authorization.tsx similarity index 100% rename from web/pages/admin/authorization.tsx rename to web/pages/god-mode/authorization.tsx diff --git a/web/pages/admin/email.tsx b/web/pages/god-mode/email.tsx similarity index 81% rename from web/pages/admin/email.tsx rename to web/pages/god-mode/email.tsx index bdb3a16d1..03eab3318 100644 --- a/web/pages/admin/email.tsx +++ b/web/pages/god-mode/email.tsx @@ -26,15 +26,15 @@ const InstanceAdminEmailPage: NextPageWithLayout = observer(() => { ) : ( - - - - - - + + + + + + )}
- ) + ); }); InstanceAdminEmailPage.getLayout = function getLayout(page: ReactElement) { diff --git a/web/pages/admin/index.tsx b/web/pages/god-mode/index.tsx similarity index 100% rename from web/pages/admin/index.tsx rename to web/pages/god-mode/index.tsx diff --git a/web/pages/admin/openai.tsx b/web/pages/god-mode/openai.tsx similarity index 100% rename from web/pages/admin/openai.tsx rename to web/pages/god-mode/openai.tsx diff --git a/web/pages/me/profile/activity.tsx b/web/pages/me/profile/activity.tsx deleted file mode 100644 index 475ff05bf..000000000 --- a/web/pages/me/profile/activity.tsx +++ /dev/null @@ -1,199 +0,0 @@ -import { ReactElement } from "react"; -import useSWR from "swr"; -import { useRouter } from "next/router"; -import Link from "next/link"; -// services -import { UserService } from "services/user.service"; -// layouts -import { ProfileSettingsLayout } from "layouts/settings-layout"; -// components -import { ActivityIcon, ActivityMessage } from "components/core"; -import { RichReadOnlyEditor } from "@plane/rich-text-editor"; -import { ProfileSettingsHeader } from "components/headers"; -// icons -import { History, MessageSquare } from "lucide-react"; -// ui -import { ExternalLinkIcon, Loader } from "@plane/ui"; -// fetch-keys -import { USER_ACTIVITY } from "constants/fetch-keys"; -// helper -import { timeAgo } from "helpers/date-time.helper"; -// type -import { NextPageWithLayout } from "types/app"; - -const userService = new UserService(); - -const ProfileActivityPage: NextPageWithLayout = () => { - const router = useRouter(); - const { workspaceSlug } = router.query; - - const { data: userActivity } = useSWR(USER_ACTIVITY, () => userService.getUserActivity()); - - return ( - <> - {userActivity ? ( -
-
-

Activity

-
-
-
    - {userActivity.results.map((activityItem: any) => { - if (activityItem.field === "comment") { - return ( -
    -
    -
    - {activityItem.field ? ( - activityItem.new_value === "restore" && ( - - ) - ) : activityItem.actor_detail.avatar && activityItem.actor_detail.avatar !== "" ? ( - {activityItem.actor_detail.display_name} - ) : ( -
    - {activityItem.actor_detail.display_name?.charAt(0)} -
    - )} - - - -
    -
    -
    -
    - {activityItem.actor_detail.is_bot - ? activityItem.actor_detail.first_name + " Bot" - : activityItem.actor_detail.display_name} -
    -

    - Commented {timeAgo(activityItem.created_at)} -

    -
    -
    - -
    -
    -
    -
    - ); - } - - const message = - activityItem.verb === "created" && - activityItem.field !== "cycles" && - activityItem.field !== "modules" && - activityItem.field !== "attachment" && - activityItem.field !== "link" && - activityItem.field !== "estimate" ? ( - - created{" "} - - - this issue. - - - - ) : activityItem.field ? ( - - ) : ( - "created the issue." - ); - - if ("field" in activityItem && activityItem.field !== "updated_by") { - return ( -
  • -
    -
    - <> -
    -
    -
    -
    - {activityItem.field ? ( - activityItem.new_value === "restore" ? ( - - ) : ( - - ) - ) : activityItem.actor_detail.avatar && activityItem.actor_detail.avatar !== "" ? ( - {activityItem.actor_detail.display_name} - ) : ( -
    - {activityItem.actor_detail.display_name?.charAt(0)} -
    - )} -
    -
    -
    -
    -
    -
    - {activityItem.field === "archived_at" && activityItem.new_value !== "restore" ? ( - Plane - ) : activityItem.actor_detail.is_bot ? ( - - {activityItem.actor_detail.first_name} Bot - - ) : ( - - {activityItem.actor_detail.display_name} - - )}{" "} -
    - {message}{" "} - - {timeAgo(activityItem.created_at)} - -
    -
    -
    - -
    -
    -
  • - ); - } - })} -
-
-
- ) : ( - - - - - - - )} - - ); -}; - -ProfileActivityPage.getLayout = function getLayout(page: ReactElement) { - return }>{page}; -}; - -export default ProfileActivityPage; diff --git a/web/pages/profile/activity.tsx b/web/pages/profile/activity.tsx new file mode 100644 index 000000000..29e37e646 --- /dev/null +++ b/web/pages/profile/activity.tsx @@ -0,0 +1,197 @@ +import { ReactElement } from "react"; +import useSWR from "swr"; +import { useRouter } from "next/router"; +import Link from "next/link"; +// services +import { UserService } from "services/user.service"; +// layouts +import { ProfileSettingsLayout } from "layouts/settings-layout"; +// components +import { ActivityIcon, ActivityMessage } from "components/core"; +import { RichReadOnlyEditor } from "@plane/rich-text-editor"; +import { ProfileSettingsHeader } from "components/headers"; +// icons +import { History, MessageSquare } from "lucide-react"; +// ui +import { ExternalLinkIcon, Loader } from "@plane/ui"; +// fetch-keys +import { USER_ACTIVITY } from "constants/fetch-keys"; +// helper +import { timeAgo } from "helpers/date-time.helper"; +// type +import { NextPageWithLayout } from "types/app"; + +const userService = new UserService(); + +const ProfileActivityPage: NextPageWithLayout = () => { + const router = useRouter(); + const { workspaceSlug } = router.query; + + const { data: userActivity } = useSWR(USER_ACTIVITY, () => userService.getUserActivity()); + + return ( +
+
+

Activity

+
+ {userActivity ? ( +
+
    + {userActivity.results.map((activityItem: any) => { + if (activityItem.field === "comment") { + return ( +
    +
    +
    + {activityItem.field ? ( + activityItem.new_value === "restore" && ( + + ) + ) : activityItem.actor_detail.avatar && activityItem.actor_detail.avatar !== "" ? ( + {activityItem.actor_detail.display_name} + ) : ( +
    + {activityItem.actor_detail.display_name?.charAt(0)} +
    + )} + + + +
    +
    +
    +
    + {activityItem.actor_detail.is_bot + ? activityItem.actor_detail.first_name + " Bot" + : activityItem.actor_detail.display_name} +
    +

    + Commented {timeAgo(activityItem.created_at)} +

    +
    +
    + +
    +
    +
    +
    + ); + } + + const message = + activityItem.verb === "created" && + activityItem.field !== "cycles" && + activityItem.field !== "modules" && + activityItem.field !== "attachment" && + activityItem.field !== "link" && + activityItem.field !== "estimate" ? ( + + created{" "} + + + this issue. + + + + ) : activityItem.field ? ( + + ) : ( + "created the issue." + ); + + if ("field" in activityItem && activityItem.field !== "updated_by") { + return ( +
  • +
    +
    + <> +
    +
    +
    +
    + {activityItem.field ? ( + activityItem.new_value === "restore" ? ( + + ) : ( + + ) + ) : activityItem.actor_detail.avatar && activityItem.actor_detail.avatar !== "" ? ( + {activityItem.actor_detail.display_name} + ) : ( +
    + {activityItem.actor_detail.display_name?.charAt(0)} +
    + )} +
    +
    +
    +
    +
    +
    + {activityItem.field === "archived_at" && activityItem.new_value !== "restore" ? ( + Plane + ) : activityItem.actor_detail.is_bot ? ( + + {activityItem.actor_detail.first_name} Bot + + ) : ( + + {activityItem.actor_detail.display_name} + + )}{" "} +
    + {message}{" "} + + {timeAgo(activityItem.created_at)} + +
    +
    +
    + +
    +
    +
  • + ); + } + })} +
+
+ ) : ( + + + + + + + )} +
+ ); +}; + +ProfileActivityPage.getLayout = function getLayout(page: ReactElement) { + return }>{page}; +}; + +export default ProfileActivityPage; diff --git a/web/pages/me/profile/change-password.tsx b/web/pages/profile/change-password.tsx similarity index 98% rename from web/pages/me/profile/change-password.tsx rename to web/pages/profile/change-password.tsx index e7bc60a77..509837b55 100644 --- a/web/pages/me/profile/change-password.tsx +++ b/web/pages/profile/change-password.tsx @@ -87,9 +87,9 @@ const ChangePasswordPage: NextPageWithLayout = observer(() => { envConfig?.github_client_id ); - if (!enableEmailPassword) router.push("/me/profile"); + if (!enableEmailPassword) router.push("/profile"); else setIsPageLoading(false); - }, []); + }, [envConfig, router]); if (isPageLoading) return ( diff --git a/web/pages/me/profile/index.tsx b/web/pages/profile/index.tsx similarity index 100% rename from web/pages/me/profile/index.tsx rename to web/pages/profile/index.tsx diff --git a/web/pages/me/profile/preferences.tsx b/web/pages/profile/preferences.tsx similarity index 100% rename from web/pages/me/profile/preferences.tsx rename to web/pages/profile/preferences.tsx