mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-09 13:40:28 +08:00
Add timestamp and revisionCount to issue and patch listings
This commit is contained in:
@@ -8,4 +8,5 @@ export type Issue = {
|
||||
state: { status: "closed"; reason: "other" | "solved" } | { status: "open" };
|
||||
assignees: Array<Author>;
|
||||
labels: Array<string>;
|
||||
timestamp: number;
|
||||
};
|
||||
|
||||
@@ -23,4 +23,6 @@ export type Patch = {
|
||||
};
|
||||
assignees: Array<Author>;
|
||||
labels: Array<string>;
|
||||
timestamp: number;
|
||||
revisionCount: number;
|
||||
};
|
||||
|
||||
@@ -59,7 +59,7 @@ impl AppState {
|
||||
"issues": issues,
|
||||
"patches": patches,
|
||||
"head": head,
|
||||
"lastCommit": commit.time().seconds(),
|
||||
"lastCommit": commit.time().seconds() * 1000,
|
||||
},
|
||||
}))
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use radicle::cob::Label;
|
||||
use radicle::cob;
|
||||
use radicle::identity;
|
||||
use radicle::issue;
|
||||
use radicle::node::{Alias, AliasStore};
|
||||
@@ -27,6 +27,7 @@ impl Author {
|
||||
|
||||
#[derive(TS, Serialize)]
|
||||
#[ts(export)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Issue {
|
||||
#[ts(as = "String")]
|
||||
id: String,
|
||||
@@ -36,7 +37,9 @@ pub struct Issue {
|
||||
state: issue::State,
|
||||
assignees: Vec<Author>,
|
||||
#[ts(as = "Vec<String>")]
|
||||
labels: Vec<Label>,
|
||||
labels: Vec<cob::Label>,
|
||||
#[ts(type = "number")]
|
||||
timestamp: cob::Timestamp,
|
||||
}
|
||||
|
||||
impl Issue {
|
||||
@@ -51,12 +54,14 @@ impl Issue {
|
||||
.map(|did| Author::new(*did, aliases))
|
||||
.collect::<Vec<_>>(),
|
||||
labels: issue.labels().cloned().collect::<Vec<_>>(),
|
||||
timestamp: issue.timestamp(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(TS, Serialize)]
|
||||
#[ts(export)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Patch {
|
||||
#[ts(as = "String")]
|
||||
id: String,
|
||||
@@ -75,7 +80,10 @@ pub struct Patch {
|
||||
state: patch::State,
|
||||
assignees: Vec<Author>,
|
||||
#[ts(as = "Vec<String>")]
|
||||
labels: Vec<Label>,
|
||||
labels: Vec<cob::Label>,
|
||||
#[ts(type = "number")]
|
||||
timestamp: cob::Timestamp,
|
||||
revision_count: usize,
|
||||
}
|
||||
|
||||
impl Patch {
|
||||
@@ -90,6 +98,8 @@ impl Patch {
|
||||
.map(|did| Author::new(did, aliases))
|
||||
.collect::<Vec<_>>(),
|
||||
labels: patch.labels().cloned().collect::<Vec<_>>(),
|
||||
timestamp: patch.timestamp(),
|
||||
revision_count: patch.revisions().count(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import type { Issue } from "@bindings/Issue";
|
||||
|
||||
import { formatOid } from "@app/lib/utils";
|
||||
import { formatOid, formatTimestamp } from "@app/lib/utils";
|
||||
|
||||
import Icon from "./Icon.svelte";
|
||||
import InlineTitle from "./InlineTitle.svelte";
|
||||
@@ -68,6 +68,7 @@
|
||||
alias={issue.author.alias} />
|
||||
opened
|
||||
<div class="global-oid">{formatOid(issue.id)}</div>
|
||||
{formatTimestamp(issue.timestamp)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import type { Patch } from "@bindings/Patch";
|
||||
|
||||
import { formatOid } from "@app/lib/utils";
|
||||
import { formatOid, formatTimestamp } from "@app/lib/utils";
|
||||
|
||||
import Icon from "./Icon.svelte";
|
||||
import InlineTitle from "./InlineTitle.svelte";
|
||||
@@ -73,6 +73,7 @@
|
||||
alias={patch.author.alias} />
|
||||
opened
|
||||
<div class="global-oid">{formatOid(patch.id)}</div>
|
||||
{formatTimestamp(patch.timestamp)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -51,8 +51,6 @@ export const formatTimestamp = (
|
||||
second: 1000,
|
||||
};
|
||||
|
||||
// Multiplying timestamp with 1000 to convert from seconds to milliseconds
|
||||
timestamp = timestamp * 1000;
|
||||
const rtf = new Intl.RelativeTimeFormat("en", {
|
||||
numeric: "auto",
|
||||
style: "long",
|
||||
|
||||
Reference in New Issue
Block a user