feat: user profile analytics, views and filters (#1698)

* feat: user profile overview

* chore: profile sidebar designed

* feat: user issues filters and view options

* refactor: filters

* refactor: mutation logic

* fix: percentage calculation logic and sidebar shadow
This commit is contained in:
Aaryan Khandelwal 2023-07-28 13:39:42 +05:30 committed by GitHub
parent 8930840a76
commit 10f145f85c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 2396 additions and 427 deletions

View file

@ -7,6 +7,8 @@ import type {
IIssue,
IUser,
IUserActivityResponse,
IUserProfileData,
IUserProfileProjectSegregation,
IUserWorkspaceDashboard,
} from "types";
@ -144,6 +146,55 @@ class UserService extends APIService {
throw error?.response?.data;
});
}
async getUserProfileData(workspaceSlug: string, userId: string): Promise<IUserProfileData> {
return this.get(`/api/workspaces/${workspaceSlug}/user-stats/${userId}/`)
.then((response) => response?.data)
.catch((error) => {
throw error?.response?.data;
});
}
async getUserProfileProjectsSegregation(
workspaceSlug: string,
userId: string
): Promise<IUserProfileProjectSegregation> {
return this.get(`/api/workspaces/${workspaceSlug}/user-profile/${userId}/`)
.then((response) => response?.data)
.catch((error) => {
throw error?.response?.data;
});
}
async getUserProfileActivity(
workspaceSlug: string,
userId: string
): Promise<IUserActivityResponse> {
return this.get(`/api/workspaces/${workspaceSlug}/user-activity/${userId}/?per_page=15`)
.then((response) => response?.data)
.catch((error) => {
throw error?.response?.data;
});
}
async getUserProfileIssues(
workspaceSlug: string,
userId: string,
params: any
): Promise<
| {
[key: string]: IIssue[];
}
| IIssue[]
> {
return this.get(`/api/workspaces/${workspaceSlug}/user-issues/${userId}/`, {
params,
})
.then((response) => response?.data)
.catch((error) => {
throw error?.response?.data;
});
}
}
export default new UserService();