diff --git a/src-tauri/src/commands/cobs.rs b/src-tauri/src/commands/cobs.rs index 14616368e..39a5a35df 100644 --- a/src-tauri/src/commands/cobs.rs +++ b/src-tauri/src/commands/cobs.rs @@ -4,7 +4,6 @@ use radicle::cob::ObjectId; use radicle::git::Oid; use radicle::identity::RepoId; use radicle::issue::cache::Issues; -use radicle::issue::IssueId; use radicle::patch::cache::Patches; use crate::error::Error; @@ -41,14 +40,14 @@ pub fn list_issues( pub fn issues_by_id( ctx: tauri::State, rid: RepoId, - id: IssueId, + id: Oid, ) -> Result, Error> { let (repo, _) = ctx.repo(rid)?; let issues = ctx.profile.issues(&repo)?; - let issue = issues.get(&id)?; + let issue = issues.get(&id.into())?; let aliases = &ctx.profile.aliases(); - let issue = issue.map(|issue| cobs::Issue::new(id, issue, aliases)); + let issue = issue.map(|issue| cobs::Issue::new(id.into(), issue, aliases)); Ok::<_, Error>(issue) } diff --git a/src/App.svelte b/src/App.svelte index 64ac4c762..3ade0efa5 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -2,6 +2,7 @@ import { onMount } from "svelte"; import { invoke } from "@tauri-apps/api/core"; + import { listen } from "@tauri-apps/api/event"; import * as router from "@app/lib/router"; import { nodeRunning } from "@app/lib/events"; @@ -10,9 +11,9 @@ import AuthenticationError from "@app/views/AuthenticationError.svelte"; import Home from "@app/views/Home.svelte"; + import Issue from "@app/views/repo/Issue.svelte"; import Issues from "@app/views/repo/Issues.svelte"; import Patches from "@app/views/repo/Patches.svelte"; - import { listen } from "@tauri-apps/api/event"; const activeRouteStore = router.activeRouteStore; @@ -51,6 +52,8 @@ {:else if $activeRouteStore.resource === "home"} +{:else if $activeRouteStore.resource === "repo.issue"} + {:else if $activeRouteStore.resource === "repo.issues"} {:else if $activeRouteStore.resource === "repo.patches"} diff --git a/src/components/InlineTitle.svelte b/src/components/InlineTitle.svelte index ad6b5c466..4246d3b12 100644 --- a/src/components/InlineTitle.svelte +++ b/src/components/InlineTitle.svelte @@ -16,6 +16,7 @@ font-family: var(--font-family-monospace); padding: 0.125rem 0.25rem; background-color: var(--color-fill-ghost); + font-size: inherit; } diff --git a/src/components/IssueTeaser.svelte b/src/components/IssueTeaser.svelte index f4870318a..1d57a30fe 100644 --- a/src/components/IssueTeaser.svelte +++ b/src/components/IssueTeaser.svelte @@ -1,22 +1,20 @@ -
+ +
{ + void push({ resource: "repo.issue", rid, issue: issue.id }); + }}>
+ style:color={issueStatusColor[issue.state.status]} + style:background-color={issueStatusBackgroundColor[issue.state.status]}>
= { + open: "var(--color-fill-success)", + closed: "var(--color-foreground-red)", +}; + +export const issueStatusBackgroundColor: Record< + Issue["state"]["status"], + string +> = { + open: "var(--color-fill-diff-green)", + closed: "var(--color-fill-diff-red)", +}; diff --git a/src/views/repo/Issue.svelte b/src/views/repo/Issue.svelte new file mode 100644 index 000000000..653478ad3 --- /dev/null +++ b/src/views/repo/Issue.svelte @@ -0,0 +1,144 @@ + + + + + + + + + + +
+ + {project.data.name} +
+ + + Issues +
+ + + + + + + +
+ +
+ Issues +
+
+ {project.meta.issues.open + project.meta.issues.closed} +
+
+
+ +
+ {#each issues as sidebarIssue} + +
+
+ +
+ + + +
+ + {/each} +
+
+ +
+
+ +
+
+ {#if issue.discussion[0].edits.slice(-1)[0].body !== ""} + + {:else} + No description. + {/if} +
+ + opened +
{formatOid(issue.id)}
+ {formatTimestamp(issue.timestamp)} +
+
+
+
diff --git a/src/views/repo/Issues.svelte b/src/views/repo/Issues.svelte index f9d382b5a..636e7ec6c 100644 --- a/src/views/repo/Issues.svelte +++ b/src/views/repo/Issues.svelte @@ -6,10 +6,13 @@ import Layout from "./Layout.svelte"; + import Border from "@app/components/Border.svelte"; + import CopyableId from "@app/components/CopyableId.svelte"; import Icon from "@app/components/Icon.svelte"; import IssueTeaser from "@app/components/IssueTeaser.svelte"; import Link from "@app/components/Link.svelte"; import NodeId from "@app/components/NodeId.svelte"; + import RepoHeader from "@app/components/RepoHeader.svelte"; export let repo: RepoInfo; export let issues: Issue[]; @@ -28,7 +31,7 @@ } - + + + + + + + + +
{#each issues as issue} - + {/each} {#if issues.length === 0} diff --git a/src/views/repo/Layout.svelte b/src/views/repo/Layout.svelte index 8c536fc2e..2f370718e 100644 --- a/src/views/repo/Layout.svelte +++ b/src/views/repo/Layout.svelte @@ -1,15 +1,7 @@ @@ -56,9 +48,11 @@ + - + + @@ -66,14 +60,6 @@
diff --git a/src/views/repo/Patches.svelte b/src/views/repo/Patches.svelte index f61bd309b..b66f42fe6 100644 --- a/src/views/repo/Patches.svelte +++ b/src/views/repo/Patches.svelte @@ -6,10 +6,13 @@ import Layout from "./Layout.svelte"; + import Border from "@app/components/Border.svelte"; + import CopyableId from "@app/components/CopyableId.svelte"; import Icon from "@app/components/Icon.svelte"; import Link from "@app/components/Link.svelte"; import NodeId from "@app/components/NodeId.svelte"; import PatchTeaser from "@app/components/PatchTeaser.svelte"; + import RepoHeader from "@app/components/RepoHeader.svelte"; export let repo: RepoInfo; export let patches: Patch[]; @@ -28,7 +31,7 @@ } - + Patches + + + + + + +
{ + const repo: RepoInfo = await invoke("repo_by_id", { + rid: route.rid, + }); + const config: Config = await invoke("config"); + const issues: Issue[] = await invoke("list_issues", { + rid: route.rid, + status: "all", + }); + const issue: Issue = await invoke("issues_by_id", { + rid: route.rid, + id: route.issue, + }); + + return { + resource: "repo.issue", + params: { repo, config, issue, issues }, + }; +} + export function repoRouteToPath(route: RepoRoute): string { const pathSegments = ["/repos", route.rid]; - if (route.resource === "repo.issues") { + if (route.resource === "repo.issue") { + const url = [...pathSegments, "issues", route.issue].join("/"); + return url; + } else if (route.resource === "repo.issues") { let url = [...pathSegments, "issues"].join("/"); const searchParams = new URLSearchParams(); if (route.status) { @@ -114,11 +158,20 @@ export function repoUrlToRoute( if (rid) { if (resource === "issues") { - const status = searchParams.get("status"); - if (status === "open" || status === "closed") { - return { resource: "repo.issues", rid, status }; + const id = segments.shift(); + if (id) { + return { + resource: "repo.issue", + rid, + issue: id, + }; } else { - return { resource: "repo.issues", rid, status: "all" }; + const status = searchParams.get("status"); + if (status === "open" || status === "closed") { + return { resource: "repo.issues", rid, status }; + } else { + return { resource: "repo.issues", rid, status: "all" }; + } } } else if (resource === "patches") { const status = searchParams.get("status");