mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-29 02:00:31 +08:00
Simplify the ProjectCard component
Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
This commit is contained in:
+10
-2
@@ -1,6 +1,7 @@
|
||||
import type { CommitHeader } from "@httpd-client";
|
||||
import type { BaseUrl, CommitHeader } from "@httpd-client";
|
||||
|
||||
import { getDaysPassed } from "@app/lib/utils";
|
||||
import { HttpdClient } from "@httpd-client";
|
||||
|
||||
// A set of commits grouped by time.
|
||||
interface CommitGroup {
|
||||
@@ -70,7 +71,7 @@ export function groupCommits(commits: CommitHeader[]): CommitGroup[] {
|
||||
}
|
||||
}
|
||||
|
||||
export function groupCommitsByWeek(commits: number[]): WeeklyActivity[] {
|
||||
function groupCommitsByWeek(commits: number[]): WeeklyActivity[] {
|
||||
const groupedCommits: WeeklyActivity[] = [];
|
||||
let groupDate: Date | undefined = undefined;
|
||||
|
||||
@@ -114,3 +115,10 @@ export function groupCommitsByWeek(commits: number[]): WeeklyActivity[] {
|
||||
|
||||
return groupedCommits;
|
||||
}
|
||||
|
||||
export async function loadProjectActivity(id: string, baseUrl: BaseUrl) {
|
||||
const api = new HttpdClient(baseUrl);
|
||||
const commits = await api.project.getActivity(id);
|
||||
|
||||
return groupCommitsByWeek(commits.activity);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user