improvement: enhance activity components and types modularity (#6262)

This commit is contained in:
Prateek Shourya 2024-12-23 20:03:42 +05:30 committed by GitHub
parent ac47cc62ee
commit 6070ed4d36
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 77 additions and 47 deletions

36
packages/types/src/activity.d.ts vendored Normal file
View file

@ -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";

View file

@ -4,10 +4,7 @@ export enum EUserPermissions {
GUEST = 5,
}
export type TUserPermissions =
| EUserPermissions.ADMIN
| EUserPermissions.MEMBER
| EUserPermissions.GUEST;
export type TUserPermissions = EUserPermissions.ADMIN | EUserPermissions.MEMBER | EUserPermissions.GUEST;
// project pages
export enum EPageAccess {
@ -62,4 +59,5 @@ export enum EFileAssetType {
TEAM_SPACE_DESCRIPTION = "TEAM_SPACE_DESCRIPTION",
INITIATIVE_DESCRIPTION = "INITIATIVE_DESCRIPTION",
PROJECT_DESCRIPTION = "PROJECT_DESCRIPTION",
TEAM_SPACE_COMMENT_DESCRIPTION = "TEAM_SPACE_COMMENT_DESCRIPTION",
}

View file

@ -35,3 +35,4 @@ export * from "./file";
export * from "./workspace-draft-issues/base";
export * from "./command-palette";
export * from "./timezone";
export * from "./activity";