Add loading more commits in History component

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
This commit is contained in:
Sebastian Martinez
2022-09-09 11:43:09 +02:00
parent b1e0c7a1b5
commit 91cfaf08b3
3 changed files with 42 additions and 42 deletions
+1 -22
View File
@@ -1,4 +1,4 @@
import { Stats, Person, Project } from "@app/project";
import type { Stats, Person } from "@app/project";
import type { Diff } from "@app/diff";
import { ApiError } from "@app/api";
import { getDaysPassed } from "@app/utils";
@@ -12,10 +12,6 @@ export interface CommitMetadata {
header: CommitHeader;
context: CommitContext;
}
export interface GroupedCommitsHistory {
headers: CommitGroup[];
stats: Stats;
}
export interface Author {
email: string;
@@ -89,12 +85,6 @@ export function formatGroupTime(timestamp: number): string {
});
}
export const groupCommitHistory = (
history: CommitsHistory,
): GroupedCommitsHistory => {
return { ...history, headers: groupCommits(history.headers) };
};
export function groupCommits(
commits: { header: CommitHeader; context: CommitContext }[],
): CommitGroup[] {
@@ -141,17 +131,6 @@ export function groupCommits(
}
}
export async function fetchCommits(
project: Project,
parentCommit: string,
): Promise<GroupedCommitsHistory> {
const commitsQuery = await Project.getCommits(project.urn, project.seed.api, {
parent: parentCommit,
verified: true,
});
return groupCommitHistory(commitsQuery);
}
export function groupCommitsByWeek(commits: number[]): WeeklyActivity[] {
const groupedCommits: WeeklyActivity[] = [];
let groupDate: Date | undefined = undefined;