From 5e76e03a55bd9a49adc3367d84af2eb62c9baa0c Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com> Date: Mon, 14 Aug 2023 16:20:53 +0530 Subject: [PATCH] style: profile activity loader (#1858) --- .../workspace/sidebar-quick-action.tsx | 6 +- .../[workspaceSlug]/me/profile/activity.tsx | 326 +++++++++--------- 2 files changed, 165 insertions(+), 167 deletions(-) diff --git a/apps/app/components/workspace/sidebar-quick-action.tsx b/apps/app/components/workspace/sidebar-quick-action.tsx index 781ef353f..3f6982903 100644 --- a/apps/app/components/workspace/sidebar-quick-action.tsx +++ b/apps/app/components/workspace/sidebar-quick-action.tsx @@ -15,7 +15,7 @@ export const WorkspaceSidebarQuickAction = () => { }`} > @@ -40,7 +40,7 @@ export const WorkspaceSidebarQuickAction = () => { document.dispatchEvent(e); }} > - + ); diff --git a/apps/app/pages/[workspaceSlug]/me/profile/activity.tsx b/apps/app/pages/[workspaceSlug]/me/profile/activity.tsx index 1b04388e6..ce6fd0d3d 100644 --- a/apps/app/pages/[workspaceSlug]/me/profile/activity.tsx +++ b/apps/app/pages/[workspaceSlug]/me/profile/activity.tsx @@ -27,17 +27,6 @@ const ProfileActivity = () => { const { data: userActivity } = useSWR(USER_ACTIVITY, () => userService.getUserActivity()); - if (!userActivity) { - return ( - - - - - - - ); - } - return ( { - {userActivity && userActivity.results.length > 0 && ( -
-
    - {userActivity.results.map((activityItem: any, activityIdx: number) => { - 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)} -
    - )} + {userActivity ? ( + userActivity.results.length > 0 ? ( +
    +
      + {userActivity.results.map((activityItem: any, activityIdx: number) => { + 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)} -

      + +
      -
      - +
      +
      +
      + {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." - ); + 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 ( -
    • -
      - {userActivity.results.length > 1 && - activityIdx !== userActivity.results.length - 1 ? ( -
    • - ); - } - })} -
    -
    + + ); + } + })} +
+
+ ) : null + ) : ( + + + + + + )}