-
Notifications
You must be signed in to change notification settings - Fork 3.6k
improvement: enhance activity components and types modularity #6262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| export type TBaseActivity< | ||
| TFieldKey extends string = string, | ||
| TVerbKey extends string = string, | ||
| > = { | ||
| id: string; | ||
| field: TFieldKey | undefined; | ||
| epoch: number; | ||
| verb: TVerbKey; | ||
| comment: string | undefined; | ||
| // updates | ||
| old_value: string | undefined; | ||
| new_value: string | undefined; | ||
| old_identifier: string | undefined; | ||
| new_identifier: string | undefined; | ||
| // actor detail | ||
| actor: string; | ||
| // timestamp | ||
| created_at: string; | ||
| updated_at: string; | ||
| }; | ||
|
|
||
| export type TWorkspaceBaseActivity< | ||
| K extends string = string, | ||
| V extends string = string, | ||
| > = TBaseActivity<K, V> & { | ||
| workspace: string; | ||
| }; | ||
|
|
||
| export type TProjectBaseActivity< | ||
| K extends string = string, | ||
| V extends string = string, | ||
| > = TWorkspaceBaseActivity<K, V> & { | ||
| project: string; | ||
| }; | ||
|
|
||
| export type TBaseActivityVerbs = "created" | "updated" | "deleted"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,25 +1,3 @@ | ||
| export interface TProjectActivity { | ||
| id: string; | ||
| content: string; | ||
| createdAt: string; | ||
| updatedAt: string; | ||
| userId: string; | ||
| projectId: string; | ||
| created_at: string; | ||
| field: string; | ||
| verb: string; | ||
| actor_detail: { | ||
| display_name: string; | ||
| id: string; | ||
| }; | ||
| workspace_detail: { | ||
| slug: string; | ||
| }; | ||
| project_detail: { | ||
| name: string; | ||
| }; | ||
| new_value: string; | ||
| old_value: string; | ||
| project: string; | ||
| new_identifier?: string; | ||
| } | ||
| import { TProjectBaseActivity } from "@plane/types"; | ||
|
|
||
| export type TProjectActivity = TProjectBaseActivity; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,27 +1,37 @@ | ||
| import { FC } from "react"; | ||
| import { observer } from "mobx-react"; | ||
| import Link from "next/link"; | ||
| import { TProjectActivity } from "@/plane-web/types"; | ||
| // types | ||
| import { TWorkspaceBaseActivity } from "@plane/types"; | ||
| // store hooks | ||
| import { useMember, useWorkspace } from "@/hooks/store"; | ||
|
|
||
| type TUser = { | ||
| activity: TProjectActivity; | ||
| activity: TWorkspaceBaseActivity; | ||
| customUserName?: string; | ||
| }; | ||
|
|
||
| export const User: FC<TUser> = (props) => { | ||
| export const User: FC<TUser> = observer((props) => { | ||
| const { activity, customUserName } = props; | ||
| // store hooks | ||
| const { getUserDetails } = useMember(); | ||
| const { getWorkspaceById } = useWorkspace(); | ||
| // derived values | ||
| const actorDetail = getUserDetails(activity.actor); | ||
| const workspaceDetail = getWorkspaceById(activity.workspace); | ||
|
|
||
| return ( | ||
| <> | ||
| {customUserName || activity.actor_detail?.display_name.includes("-intake") ? ( | ||
| {customUserName || actorDetail?.display_name.includes("-intake") ? ( | ||
| <span className="text-custom-text-100 font-medium">{customUserName || "Plane"}</span> | ||
| ) : ( | ||
| <Link | ||
| href={`/${activity?.workspace_detail?.slug}/profile/${activity?.actor_detail?.id}`} | ||
| href={`/${workspaceDetail?.slug}/profile/${actorDetail?.id}`} | ||
| className="hover:underline text-custom-text-100 font-medium" | ||
| > | ||
| {activity.actor_detail?.display_name} | ||
| {actorDetail?.display_name} | ||
| </Link> | ||
| )} | ||
| </> | ||
| ); | ||
| }; | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
Type change requires updates in dependent files
The type hierarchy shows that
TProjectActivity(which is an alias forTProjectBaseActivity) extendsTWorkspaceBaseActivitywith an additionalprojectfield. The change fromTProjectActivitytoTWorkspaceBaseActivityinactivity-block.tsxcould lead to missing project information in the following files that still useTProjectActivity:web/core/components/common/activity/activity-item.tsxweb/core/components/common/activity/helper.tsxThese files need to be reviewed and potentially updated to handle the absence of project information or maintain consistency with the type being used.
🔗 Analysis chain
Type definition upgraded to TWorkspaceBaseActivity.
Switching from TProjectActivity to TWorkspaceBaseActivity ensures consistency with the new workspace-driven approach. Confirm that all references to the old type are removed or updated across the codebase.
Let me gather more information about the TWorkspaceBaseActivity type and its relationship with TProjectActivity.
Let me check the type definitions to understand the relationship between these types.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 2140
Script:
Length of output: 4384
Script:
Length of output: 1031