mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-29 18:20:30 +08:00
Add loading more commits in History component
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
This commit is contained in:
+1
-22
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user