fix: profile activity workspace slug (#1752)

This commit is contained in:
Aaryan Khandelwal 2023-08-01 18:38:33 +05:30 committed by GitHub
parent 0e0e09c4fd
commit d22e4b8212
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,7 @@
import React from "react";
import { useRouter } from "next/router";
import Link from "next/link";
// icons
@ -99,7 +101,11 @@ const activityDetails: {
},
};
export const Feeds: React.FC<any> = ({ activities }) => (
export const Feeds: React.FC<any> = ({ activities }) => {
const router = useRouter();
const { workspaceSlug } = router.query;
return (
<div>
<ul role="list" className="-mb-4">
{activities.map((activity: any, activityIdx: number) => {
@ -152,11 +158,11 @@ export const Feeds: React.FC<any> = ({ activities }) => (
activity.field !== "link" &&
activity.field !== "estimate"
) {
const { workspace_detail, project, issue } = activity;
const { project, issue } = activity;
value = (
<span className="text-custom-text-200">
created{" "}
<Link href={`/${workspace_detail.slug}/projects/${project}/issues/${issue}`}>
<Link href={`/${workspaceSlug}/projects/${project}/issues/${issue}`}>
<a className="inline-flex items-center hover:underline">
this issue. <ArrowTopRightOnSquareIcon className="ml-1 h-3.5 w-3.5" />
</a>
@ -193,7 +199,8 @@ export const Feeds: React.FC<any> = ({ activities }) => (
value = "link";
} else if (activity.field === "estimate_point") {
value = activity.new_value
? activity.new_value + ` Point${parseInt(activity.new_value ?? "", 10) > 1 ? "s" : ""}`
? activity.new_value +
` Point${parseInt(activity.new_value ?? "", 10) > 1 ? "s" : ""}`
: "None";
}
@ -235,7 +242,9 @@ export const Feeds: React.FC<any> = ({ activities }) => (
<div>
<div className="text-xs">
{activity.actor_detail.first_name}
{activity.actor_detail.is_bot ? "Bot" : " " + activity.actor_detail.last_name}
{activity.actor_detail.is_bot
? "Bot"
: " " + activity.actor_detail.last_name}
</div>
<p className="mt-0.5 text-xs text-custom-text-200">
Commented {timeAgo(activity.created_at)}
@ -276,7 +285,8 @@ export const Feeds: React.FC<any> = ({ activities }) => (
<div className="mt-1.5">
<div className="ring-6 flex h-7 w-7 items-center justify-center rounded-full bg-custom-background-80 text-custom-text-200 ring-white">
{activity.field ? (
activityDetails[activity.field as keyof typeof activityDetails]?.icon
activityDetails[activity.field as keyof typeof activityDetails]
?.icon
) : activity.actor_detail.avatar &&
activity.actor_detail.avatar !== "" ? (
<img
@ -328,4 +338,5 @@ export const Feeds: React.FC<any> = ({ activities }) => (
})}
</ul>
</div>
);
);
};