mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-20 22:00:43 +08:00
Add verified badge to commit listing
Signed-off-by: Sebastian Martinez <sebastinez@me.com>
This commit is contained in:
+25
-6
@@ -2,9 +2,14 @@ import type { Stats } from "@app/project";
|
||||
import type { Diff } from "@app/diff";
|
||||
|
||||
export interface CommitsHistory {
|
||||
headers: CommitHeader[];
|
||||
headers: CommitHeaderWithContext[];
|
||||
stats: Stats;
|
||||
}
|
||||
|
||||
export interface CommitHeaderWithContext {
|
||||
header: CommitHeader;
|
||||
context: CommitContext;
|
||||
}
|
||||
export interface GroupedCommitsHistory {
|
||||
headers: CommitGroup[];
|
||||
stats: Stats;
|
||||
@@ -27,6 +32,20 @@ export interface GroupedCommitsHistory {
|
||||
stats: Stats;
|
||||
}
|
||||
|
||||
export interface Person {
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface CommitContext {
|
||||
committer: {
|
||||
peer: {
|
||||
id: string;
|
||||
person: Person;
|
||||
delegate: boolean;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
export interface CommitHeader {
|
||||
author: Author;
|
||||
committer: Author;
|
||||
@@ -39,7 +58,7 @@ export interface CommitHeader {
|
||||
// A set of commits grouped by time.
|
||||
export interface CommitGroup {
|
||||
time: string;
|
||||
commits: CommitHeader[];
|
||||
commits: CommitHeaderWithContext[];
|
||||
}
|
||||
|
||||
export interface CommitStats {
|
||||
@@ -69,14 +88,14 @@ export const groupCommitHistory = (
|
||||
return { ...history, headers: groupCommits(history.headers) };
|
||||
};
|
||||
|
||||
export function groupCommits(commits: CommitHeader[]): CommitGroup[] {
|
||||
export function groupCommits(commits: { header: CommitHeader; context: CommitContext }[]): CommitGroup[] {
|
||||
const groupedCommits: CommitGroup[] = [];
|
||||
let groupDate: Date | undefined = undefined;
|
||||
|
||||
commits = commits.sort((a, b) => {
|
||||
if (a.committerTime > b.committerTime) {
|
||||
if (a.header.committerTime > b.header.committerTime) {
|
||||
return -1;
|
||||
} else if (a.committerTime < b.committerTime) {
|
||||
} else if (a.header.committerTime < b.header.committerTime) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -84,7 +103,7 @@ export function groupCommits(commits: CommitHeader[]): CommitGroup[] {
|
||||
});
|
||||
|
||||
for (const commit of commits) {
|
||||
const time = commit.committerTime * 1000;
|
||||
const time = commit.header.committerTime * 1000;
|
||||
const date = new Date(time);
|
||||
const isNewDay =
|
||||
!groupedCommits.length ||
|
||||
|
||||
Reference in New Issue
Block a user