mirror of
https://github.com/nathonius/obsidian-github-link.git
synced 2026-07-22 09:20:25 +00:00
Merge pull request #124 from nathonius/feat/123/assignee
✨ feat: #123 Add assignee column
This commit is contained in:
commit
d0496b1600
2 changed files with 22 additions and 10 deletions
|
|
@ -43,6 +43,8 @@ export type TimelineCrossReferencedEvent = OpenAPI.components["schemas"]["timeli
|
|||
export type IssueTimelineResponse = RestEndpointMethodTypes["issues"]["listEventsForTimeline"]["response"]["data"];
|
||||
export type CheckRunListResponse = RestEndpointMethodTypes["checks"]["listForRef"]["response"]["data"];
|
||||
|
||||
export type UserResponse = IssueListResponse[number]["user"];
|
||||
|
||||
// Param Types
|
||||
export type RepoSearchParams = RestEndpointMethodTypes["search"]["repos"]["parameters"];
|
||||
export type IssueListParams = PaginationParams & {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
import { parseUrl, repoAPIToBrowserUrl } from "../../github/url-parse";
|
||||
|
||||
import { DateFormat } from "../../util";
|
||||
import type { IssueListResponse } from "../../github/response";
|
||||
import type { IssueListResponse, UserResponse } from "../../github/response";
|
||||
import type { TableResult } from "../types";
|
||||
|
||||
export interface ColumnGetter<T> {
|
||||
|
|
@ -28,6 +28,18 @@ export function DateCell(value: string | undefined | null, el: HTMLTableCellElem
|
|||
el.setText(DateFormat.DATE_SHORT.format(asDate));
|
||||
}
|
||||
|
||||
export function UserCell(user: UserResponse, el: HTMLElement): void {
|
||||
const anchor = el.createEl("a", {
|
||||
cls: "github-link-table-author",
|
||||
href: user?.html_url ?? "#",
|
||||
attr: { target: "_blank" },
|
||||
});
|
||||
if (user?.avatar_url) {
|
||||
anchor.createEl("img", { cls: "github-link-table-avatar", attr: { src: user.avatar_url } });
|
||||
}
|
||||
anchor.createSpan({ text: user?.login });
|
||||
}
|
||||
|
||||
/**
|
||||
* Issue and PR columns share types, so some columns are shared
|
||||
*/
|
||||
|
|
@ -51,15 +63,13 @@ export const CommonIssuePRColumns: ColumnsMap = {
|
|||
author: {
|
||||
header: "Author",
|
||||
cell: (row, el) => {
|
||||
const anchor = el.createEl("a", {
|
||||
cls: "github-link-table-author",
|
||||
href: row.user?.html_url,
|
||||
attr: { target: "_blank" },
|
||||
});
|
||||
if (row.user?.avatar_url) {
|
||||
anchor.createEl("img", { cls: "github-link-table-avatar", attr: { src: row.user.avatar_url } });
|
||||
}
|
||||
anchor.createSpan({ text: row.user?.login });
|
||||
UserCell(row.user, el);
|
||||
},
|
||||
},
|
||||
assignee: {
|
||||
header: "Assignee",
|
||||
cell: (row, el) => {
|
||||
UserCell(row.assignee, el);
|
||||
},
|
||||
},
|
||||
created: {
|
||||
|
|
|
|||
Loading…
Reference in a new issue