mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-29 02:00:31 +08:00
Redesign node view and use it as the landing-page
This commit is contained in:
@@ -1,20 +1,24 @@
|
||||
<script lang="ts">
|
||||
import type { BaseUrl, Commit, Project, SeedingPolicy } from "@http-client";
|
||||
|
||||
import { formatObjectId } from "@app/lib/utils";
|
||||
|
||||
import Button from "@app/components/Button.svelte";
|
||||
import Changeset from "@app/views/projects/Changeset.svelte";
|
||||
import CommitAuthorship from "@app/views/projects/Commit/CommitAuthorship.svelte";
|
||||
import IconSmall from "@app/components/IconSmall.svelte";
|
||||
import Id from "@app/components/Id.svelte";
|
||||
import InlineTitle from "@app/views/projects/components/InlineTitle.svelte";
|
||||
import Layout from "./Layout.svelte";
|
||||
import Link from "@app/components/Link.svelte";
|
||||
import Separator from "./Separator.svelte";
|
||||
import Share from "./Share.svelte";
|
||||
import Id from "@app/components/Id.svelte";
|
||||
|
||||
export let baseUrl: BaseUrl;
|
||||
export let seedingPolicy: SeedingPolicy;
|
||||
export let commit: Commit;
|
||||
export let project: Project;
|
||||
export let nodeAvatarUrl: string | undefined;
|
||||
|
||||
$: header = commit.commit;
|
||||
</script>
|
||||
@@ -45,7 +49,27 @@
|
||||
}
|
||||
</style>
|
||||
|
||||
<Layout {seedingPolicy} {baseUrl} {project}>
|
||||
<Layout {nodeAvatarUrl} {seedingPolicy} {baseUrl} {project}>
|
||||
<svelte:fragment slot="breadcrumb">
|
||||
<Separator />
|
||||
<Link
|
||||
route={{
|
||||
resource: "project.history",
|
||||
project: project.id,
|
||||
node: baseUrl,
|
||||
}}>
|
||||
Commits
|
||||
</Link>
|
||||
<Separator />
|
||||
<span class="id">
|
||||
<div class="global-hide-on-small-desktop-down">
|
||||
{commit.commit.id}
|
||||
</div>
|
||||
<div class="global-hide-on-medium-desktop-up">
|
||||
{formatObjectId(commit.commit.id)}
|
||||
</div>
|
||||
</span>
|
||||
</svelte:fragment>
|
||||
<div class="commit">
|
||||
<div class="header">
|
||||
<div style="display:flex; flex-direction: column; gap: 0.5rem;">
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
CommitHeader,
|
||||
Project,
|
||||
Remote,
|
||||
Tree,
|
||||
SeedingPolicy,
|
||||
Tree,
|
||||
} from "@http-client";
|
||||
import type { ProjectRoute } from "./router";
|
||||
|
||||
@@ -19,9 +19,11 @@
|
||||
import ErrorMessage from "@app/components/ErrorMessage.svelte";
|
||||
import Header from "./Source/Header.svelte";
|
||||
import Layout from "./Layout.svelte";
|
||||
import Link from "@app/components/Link.svelte";
|
||||
import List from "@app/components/List.svelte";
|
||||
import Loading from "@app/components/Loading.svelte";
|
||||
import ProjectNameHeader from "./Source/ProjectNameHeader.svelte";
|
||||
import Separator from "./Separator.svelte";
|
||||
|
||||
export let baseUrl: BaseUrl;
|
||||
export let seedingPolicy: SeedingPolicy;
|
||||
@@ -32,6 +34,7 @@
|
||||
export let project: Project;
|
||||
export let revision: string | undefined;
|
||||
export let tree: Tree;
|
||||
export let nodeAvatarUrl: string | undefined;
|
||||
|
||||
const api = new HttpdClient(baseUrl);
|
||||
|
||||
@@ -89,7 +92,18 @@
|
||||
}
|
||||
</style>
|
||||
|
||||
<Layout {seedingPolicy} {baseUrl} {project} activeTab="source">
|
||||
<Layout {nodeAvatarUrl} {seedingPolicy} {baseUrl} {project} activeTab="source">
|
||||
<svelte:fragment slot="breadcrumb">
|
||||
<Separator />
|
||||
<Link
|
||||
route={{
|
||||
resource: "project.history",
|
||||
project: project.id,
|
||||
node: baseUrl,
|
||||
}}>
|
||||
Commits
|
||||
</Link>
|
||||
</svelte:fragment>
|
||||
<ProjectNameHeader {project} {baseUrl} slot="header" />
|
||||
|
||||
<div style:margin="1rem" slot="subheader">
|
||||
|
||||
@@ -15,9 +15,11 @@
|
||||
import InlineTitle from "@app/views/projects/components/InlineTitle.svelte";
|
||||
import Labels from "@app/views/projects/Cob/Labels.svelte";
|
||||
import Layout from "./Layout.svelte";
|
||||
import Link from "@app/components/Link.svelte";
|
||||
import Markdown from "@app/components/Markdown.svelte";
|
||||
import NodeId from "@app/components/NodeId.svelte";
|
||||
import Reactions from "@app/components/Reactions.svelte";
|
||||
import Separator from "./Separator.svelte";
|
||||
import Share from "@app/views/projects/Share.svelte";
|
||||
import ThreadComponent from "@app/components/Thread.svelte";
|
||||
|
||||
@@ -26,6 +28,7 @@
|
||||
export let issue: Issue;
|
||||
export let project: Project;
|
||||
export let rawPath: (commit?: string) => string;
|
||||
export let nodeAvatarUrl: string | undefined;
|
||||
|
||||
$: uniqueEmbeds = uniqBy(
|
||||
issue.discussion.flatMap(comment => comment.embeds),
|
||||
@@ -110,6 +113,11 @@
|
||||
align-items: center;
|
||||
margin-left: -0.25rem;
|
||||
}
|
||||
.id {
|
||||
font-size: var(--font-size-small);
|
||||
font-family: var(--font-family-monospace);
|
||||
font-weight: var(--font-weight-semibold);
|
||||
}
|
||||
@media (max-width: 719.98px) {
|
||||
.bottom {
|
||||
padding: 0;
|
||||
@@ -118,11 +126,33 @@
|
||||
</style>
|
||||
|
||||
<Layout
|
||||
{seedingPolicy}
|
||||
{baseUrl}
|
||||
{nodeAvatarUrl}
|
||||
{project}
|
||||
{seedingPolicy}
|
||||
activeTab="issues"
|
||||
stylePaddingBottom="0">
|
||||
<svelte:fragment slot="breadcrumb">
|
||||
<Separator />
|
||||
<Link
|
||||
route={{
|
||||
resource: "project.issues",
|
||||
project: project.id,
|
||||
node: baseUrl,
|
||||
}}>
|
||||
Issues
|
||||
</Link>
|
||||
<Separator />
|
||||
<span class="id">
|
||||
<div class="global-hide-on-small-desktop-down">
|
||||
{issue.id}
|
||||
</div>
|
||||
<div class="global-hide-on-medium-desktop-up">
|
||||
{utils.formatObjectId(issue.id)}
|
||||
</div>
|
||||
</span>
|
||||
</svelte:fragment>
|
||||
|
||||
<div class="issue">
|
||||
<div class="main">
|
||||
<CobHeader>
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
import Loading from "@app/components/Loading.svelte";
|
||||
import Placeholder from "@app/components/Placeholder.svelte";
|
||||
import Popover from "@app/components/Popover.svelte";
|
||||
import Separator from "./Separator.svelte";
|
||||
import Share from "./Share.svelte";
|
||||
|
||||
export let baseUrl: BaseUrl;
|
||||
@@ -32,6 +33,7 @@
|
||||
export let issues: Issue[];
|
||||
export let project: Project;
|
||||
export let status: IssueState["status"];
|
||||
export let nodeAvatarUrl: string | undefined;
|
||||
|
||||
let loading = false;
|
||||
let page = 0;
|
||||
@@ -115,7 +117,18 @@
|
||||
}
|
||||
</style>
|
||||
|
||||
<Layout {seedingPolicy} {baseUrl} {project} activeTab="issues">
|
||||
<Layout {nodeAvatarUrl} {seedingPolicy} {baseUrl} {project} activeTab="issues">
|
||||
<svelte:fragment slot="breadcrumb">
|
||||
<Separator />
|
||||
<Link
|
||||
route={{
|
||||
resource: "project.issues",
|
||||
project: project.id,
|
||||
node: baseUrl,
|
||||
}}>
|
||||
Issues
|
||||
</Link>
|
||||
</svelte:fragment>
|
||||
<div slot="header" class="header">
|
||||
<Popover
|
||||
popoverPadding="0"
|
||||
|
||||
@@ -2,12 +2,11 @@
|
||||
import type { ActiveTab } from "./Header.svelte";
|
||||
import type { BaseUrl, Project, SeedingPolicy } from "@http-client";
|
||||
|
||||
import AppHeader from "@app/App/Header.svelte";
|
||||
|
||||
import Button from "@app/components/Button.svelte";
|
||||
import IconSmall from "@app/components/IconSmall.svelte";
|
||||
import Link from "@app/components/Link.svelte";
|
||||
import MobileFooter from "@app/App/MobileFooter.svelte";
|
||||
import Separator from "./Separator.svelte";
|
||||
import Sidebar from "@app/views/projects/Sidebar.svelte";
|
||||
|
||||
export let activeTab: ActiveTab | undefined = undefined;
|
||||
@@ -15,6 +14,7 @@
|
||||
export let baseUrl: BaseUrl;
|
||||
export let project: Project;
|
||||
export let stylePaddingBottom: string = "2.5rem";
|
||||
export let nodeAvatarUrl: string | undefined;
|
||||
</script>
|
||||
|
||||
<style>
|
||||
@@ -29,6 +29,21 @@
|
||||
border-bottom: 1px solid var(--color-fill-separator);
|
||||
}
|
||||
|
||||
header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
margin: 0;
|
||||
padding: 0.5rem 0.5rem 0.5rem 1rem;
|
||||
height: 3.5rem;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.logo {
|
||||
height: var(--button-regular-height);
|
||||
margin: 0 0.5rem;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
grid-column: 1 / 2;
|
||||
border-right: 1px solid var(--color-fill-separator);
|
||||
@@ -43,6 +58,29 @@
|
||||
display: none;
|
||||
}
|
||||
|
||||
.breadcrumbs {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
column-gap: 0.25rem;
|
||||
line-height: 1rem;
|
||||
font-weight: var(--font-weight-semibold);
|
||||
font-size: var(--font-size-small);
|
||||
white-space: nowrap;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.breadcrumb {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.25rem;
|
||||
}
|
||||
.breadcrumb :global(a:hover) {
|
||||
color: var(--color-fill-secondary);
|
||||
}
|
||||
.avatar {
|
||||
border-radius: var(--border-radius-tiny);
|
||||
margin-right: 0.5rem;
|
||||
}
|
||||
|
||||
@media (max-width: 719.98px) {
|
||||
.desktop-header {
|
||||
display: none;
|
||||
@@ -62,7 +100,60 @@
|
||||
|
||||
<div class="layout">
|
||||
<div class="desktop-header">
|
||||
<AppHeader />
|
||||
<header>
|
||||
<div class="breadcrumbs">
|
||||
<span class="breadcrumb">
|
||||
<Link
|
||||
style="display: flex; align-items: center; gap: 0.25rem;"
|
||||
route={{
|
||||
resource: "nodes",
|
||||
params: {
|
||||
baseUrl,
|
||||
projectPageIndex: 0,
|
||||
},
|
||||
}}>
|
||||
<img
|
||||
width="24"
|
||||
height="24"
|
||||
class="avatar"
|
||||
alt="Radicle logo"
|
||||
src={nodeAvatarUrl
|
||||
? nodeAvatarUrl
|
||||
: "/images/default-seed-avatar.png"} />
|
||||
{baseUrl.hostname}
|
||||
</Link>
|
||||
</span>
|
||||
|
||||
<Separator />
|
||||
|
||||
<span class="breadcrumb">
|
||||
<Link
|
||||
route={{
|
||||
resource: "project.source",
|
||||
project: project.id,
|
||||
node: baseUrl,
|
||||
}}>
|
||||
<div class="breadcrumb">
|
||||
{project.name}
|
||||
</div>
|
||||
</Link>
|
||||
</span>
|
||||
|
||||
<div class="breadcrumb">
|
||||
<slot name="breadcrumb" />
|
||||
</div>
|
||||
</div>
|
||||
<Link
|
||||
style="display: flex; align-items: center;"
|
||||
route={{ resource: "nodes", params: undefined }}>
|
||||
<img
|
||||
width="24"
|
||||
height="24"
|
||||
class="logo"
|
||||
alt="Radicle logo"
|
||||
src="/radicle.svg" />
|
||||
</Link>
|
||||
</header>
|
||||
</div>
|
||||
|
||||
<div class="sidebar global-hide-on-medium-desktop-down">
|
||||
|
||||
@@ -71,6 +71,7 @@
|
||||
import Reviews from "@app/views/projects/Cob/Reviews.svelte";
|
||||
import RevisionComponent from "@app/views/projects/Cob/Revision.svelte";
|
||||
import RevisionSelector from "@app/views/projects/Patch/RevisionSelector.svelte";
|
||||
import Separator from "./Separator.svelte";
|
||||
import Share from "@app/views/projects/Share.svelte";
|
||||
|
||||
export let baseUrl: BaseUrl;
|
||||
@@ -80,6 +81,7 @@
|
||||
export let rawPath: (commit?: string) => string;
|
||||
export let project: Project;
|
||||
export let view: PatchView;
|
||||
export let nodeAvatarUrl: string | undefined;
|
||||
|
||||
function badgeColor(status: string): ComponentProps<Badge>["variant"] {
|
||||
if (status === "draft") {
|
||||
@@ -278,6 +280,11 @@
|
||||
gap: 0.5rem;
|
||||
width: 100%;
|
||||
}
|
||||
.id {
|
||||
font-size: var(--font-size-small);
|
||||
font-family: var(--font-family-monospace);
|
||||
font-weight: var(--font-weight-semibold);
|
||||
}
|
||||
@media (max-width: 719.98px) {
|
||||
.patch {
|
||||
display: block;
|
||||
@@ -289,11 +296,32 @@
|
||||
</style>
|
||||
|
||||
<Layout
|
||||
{seedingPolicy}
|
||||
{baseUrl}
|
||||
{project}
|
||||
{nodeAvatarUrl}
|
||||
{seedingPolicy}
|
||||
activeTab="patches"
|
||||
stylePaddingBottom="0">
|
||||
<svelte:fragment slot="breadcrumb">
|
||||
<Separator />
|
||||
<Link
|
||||
route={{
|
||||
resource: "project.patches",
|
||||
project: project.id,
|
||||
node: baseUrl,
|
||||
}}>
|
||||
Patches
|
||||
</Link>
|
||||
<Separator />
|
||||
<span class="id">
|
||||
<div class="global-hide-on-small-desktop-down">
|
||||
{patch.id}
|
||||
</div>
|
||||
<div class="global-hide-on-medium-desktop-up">
|
||||
{utils.formatObjectId(patch.id)}
|
||||
</div>
|
||||
</span>
|
||||
</svelte:fragment>
|
||||
<div class="patch">
|
||||
<div class="main">
|
||||
<CobHeader>
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
import PatchTeaser from "./Patch/PatchTeaser.svelte";
|
||||
import Placeholder from "@app/components/Placeholder.svelte";
|
||||
import Popover, { closeFocused } from "@app/components/Popover.svelte";
|
||||
import Separator from "./Separator.svelte";
|
||||
import Share from "./Share.svelte";
|
||||
|
||||
export let baseUrl: BaseUrl;
|
||||
@@ -32,6 +33,7 @@
|
||||
export let patches: Patch[];
|
||||
export let project: Project;
|
||||
export let status: PatchState["status"];
|
||||
export let nodeAvatarUrl: string | undefined;
|
||||
|
||||
let loading = false;
|
||||
let page = 0;
|
||||
@@ -123,7 +125,18 @@
|
||||
}
|
||||
</style>
|
||||
|
||||
<Layout {seedingPolicy} {baseUrl} {project} activeTab="patches">
|
||||
<Layout {nodeAvatarUrl} {seedingPolicy} {baseUrl} {project} activeTab="patches">
|
||||
<svelte:fragment slot="breadcrumb">
|
||||
<Separator />
|
||||
<Link
|
||||
route={{
|
||||
resource: "project.patches",
|
||||
project: project.id,
|
||||
node: baseUrl,
|
||||
}}>
|
||||
Patches
|
||||
</Link>
|
||||
</svelte:fragment>
|
||||
<div slot="header" class="header">
|
||||
<Popover
|
||||
popoverPadding="0"
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<script lang="ts">
|
||||
import IconSmall from "@app/components/IconSmall.svelte";
|
||||
</script>
|
||||
|
||||
<span style:color="var(--color-foreground-dim)">
|
||||
<IconSmall name="chevron-right" />
|
||||
</span>
|
||||
@@ -139,13 +139,6 @@
|
||||
opacity: 1;
|
||||
transition: opacity 150ms ease-in-out;
|
||||
}
|
||||
.collapse-label {
|
||||
display: none;
|
||||
}
|
||||
.collapse-label.expanded {
|
||||
display: block;
|
||||
transition: opacity 30ms ease-in-out;
|
||||
}
|
||||
.icon {
|
||||
transform: rotate(180deg);
|
||||
transition: transform 150ms ease-in-out;
|
||||
@@ -301,36 +294,37 @@
|
||||
<div class="icon" class:expanded>
|
||||
<IconSmall name="chevron-left" />
|
||||
</div>
|
||||
<span class="collapse-label" class:expanded>Collapse</span>
|
||||
</Button>
|
||||
<div class="horizontal-buttons" class:expanded>
|
||||
<Popover popoverPositionBottom="2.5rem" popoverPositionLeft="0">
|
||||
<Button
|
||||
variant="background"
|
||||
title="Settings"
|
||||
slot="toggle"
|
||||
let:toggle
|
||||
on:click={toggle}>
|
||||
<IconSmall name="settings" />
|
||||
Settings
|
||||
</Button>
|
||||
<div class="global-flex-item">
|
||||
<div class="horizontal-buttons" class:expanded>
|
||||
<Popover popoverPositionBottom="2.5rem" popoverPositionLeft="0">
|
||||
<Button
|
||||
variant="outline"
|
||||
title="Settings"
|
||||
slot="toggle"
|
||||
let:toggle
|
||||
on:click={toggle}>
|
||||
<IconSmall name="settings" />
|
||||
Settings
|
||||
</Button>
|
||||
|
||||
<Settings slot="popover" />
|
||||
</Popover>
|
||||
</div>
|
||||
<div class="horizontal-buttons" class:expanded>
|
||||
<Popover popoverPositionBottom="2.5rem" popoverPositionLeft="0">
|
||||
<Button
|
||||
variant="background"
|
||||
title="Help"
|
||||
slot="toggle"
|
||||
let:toggle
|
||||
on:click={toggle}>
|
||||
<IconSmall name="help" />
|
||||
Help
|
||||
</Button>
|
||||
<Help slot="popover" />
|
||||
</Popover>
|
||||
<Settings slot="popover" />
|
||||
</Popover>
|
||||
</div>
|
||||
<div class="horizontal-buttons" class:expanded>
|
||||
<Popover popoverPositionBottom="2.5rem" popoverPositionLeft="0">
|
||||
<Button
|
||||
variant="outline"
|
||||
title="Help"
|
||||
slot="toggle"
|
||||
let:toggle
|
||||
on:click={toggle}>
|
||||
<IconSmall name="help" />
|
||||
Help
|
||||
</Button>
|
||||
<Help slot="popover" />
|
||||
</Popover>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -16,8 +16,10 @@
|
||||
import Placeholder from "@app/components/Placeholder.svelte";
|
||||
|
||||
import BlobComponent from "./Source/Blob.svelte";
|
||||
import TreeComponent from "./Source/Tree.svelte";
|
||||
import FilePath from "@app/components/FilePath.svelte";
|
||||
import ProjectNameHeader from "./Source/ProjectNameHeader.svelte";
|
||||
import Separator from "./Separator.svelte";
|
||||
import TreeComponent from "./Source/Tree.svelte";
|
||||
|
||||
export let baseUrl: BaseUrl;
|
||||
export let blobResult: BlobResult;
|
||||
@@ -26,10 +28,11 @@
|
||||
export let peer: string | undefined;
|
||||
export let peers: Remote[];
|
||||
export let project: Project;
|
||||
export let seedingPolicy: SeedingPolicy;
|
||||
export let rawPath: (commit?: string) => string;
|
||||
export let revision: string | undefined;
|
||||
export let seedingPolicy: SeedingPolicy;
|
||||
export let tree: Tree;
|
||||
export let nodeAvatarUrl: string | undefined;
|
||||
|
||||
let mobileFileTree = false;
|
||||
|
||||
@@ -117,11 +120,18 @@
|
||||
</style>
|
||||
|
||||
<Layout
|
||||
{seedingPolicy}
|
||||
{baseUrl}
|
||||
{nodeAvatarUrl}
|
||||
{project}
|
||||
{seedingPolicy}
|
||||
activeTab="source"
|
||||
stylePaddingBottom="0">
|
||||
<svelte:fragment slot="breadcrumb">
|
||||
{#if path !== "/"}
|
||||
<Separator />
|
||||
<FilePath filenameWithPath={path} />
|
||||
{/if}
|
||||
</svelte:fragment>
|
||||
<ProjectNameHeader {project} {baseUrl} slot="header" />
|
||||
|
||||
<div style:margin="1rem" slot="subheader">
|
||||
|
||||
@@ -120,6 +120,7 @@ export type ProjectLoadedRoute =
|
||||
path: string;
|
||||
rawPath: (commit?: string) => string;
|
||||
blobResult: BlobResult;
|
||||
nodeAvatarUrl: string | undefined;
|
||||
};
|
||||
}
|
||||
| {
|
||||
@@ -134,6 +135,7 @@ export type ProjectLoadedRoute =
|
||||
revision: string | undefined;
|
||||
tree: Tree;
|
||||
commitHeaders: CommitHeader[];
|
||||
nodeAvatarUrl: string | undefined;
|
||||
};
|
||||
}
|
||||
| {
|
||||
@@ -143,6 +145,7 @@ export type ProjectLoadedRoute =
|
||||
seedingPolicy: SeedingPolicy;
|
||||
project: Project;
|
||||
commit: Commit;
|
||||
nodeAvatarUrl: string | undefined;
|
||||
};
|
||||
}
|
||||
| {
|
||||
@@ -153,6 +156,7 @@ export type ProjectLoadedRoute =
|
||||
project: Project;
|
||||
rawPath: (commit?: string) => string;
|
||||
issue: Issue;
|
||||
nodeAvatarUrl: string | undefined;
|
||||
};
|
||||
}
|
||||
| {
|
||||
@@ -163,6 +167,7 @@ export type ProjectLoadedRoute =
|
||||
project: Project;
|
||||
issues: Issue[];
|
||||
status: IssueState["status"];
|
||||
nodeAvatarUrl: string | undefined;
|
||||
};
|
||||
}
|
||||
| {
|
||||
@@ -173,6 +178,7 @@ export type ProjectLoadedRoute =
|
||||
project: Project;
|
||||
patches: Patch[];
|
||||
status: PatchState["status"];
|
||||
nodeAvatarUrl: string | undefined;
|
||||
};
|
||||
}
|
||||
| {
|
||||
@@ -185,6 +191,7 @@ export type ProjectLoadedRoute =
|
||||
patch: Patch;
|
||||
stats: Diff["stats"];
|
||||
view: PatchView;
|
||||
nodeAvatarUrl: string | undefined;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -264,10 +271,11 @@ export async function loadProjectRoute(
|
||||
} else if (route.resource === "project.history") {
|
||||
return await loadHistoryView(route);
|
||||
} else if (route.resource === "project.commit") {
|
||||
const [project, commit, seedingPolicy] = await Promise.all([
|
||||
const [project, commit, seedingPolicy, node] = await Promise.all([
|
||||
api.project.getById(route.project),
|
||||
api.project.getCommitBySha(route.project, route.commit),
|
||||
api.getPoliciesById(route.project),
|
||||
api.getNode(),
|
||||
]);
|
||||
|
||||
return {
|
||||
@@ -277,6 +285,7 @@ export async function loadProjectRoute(
|
||||
seedingPolicy,
|
||||
project,
|
||||
commit,
|
||||
nodeAvatarUrl: node.avatarUrl,
|
||||
},
|
||||
};
|
||||
} else if (route.resource === "project.issue") {
|
||||
@@ -310,7 +319,7 @@ async function loadPatchesView(
|
||||
const searchParams = new URLSearchParams(route.search || "");
|
||||
const status = (searchParams.get("status") as PatchState["status"]) || "open";
|
||||
|
||||
const [project, patches, seedingPolicy] = await Promise.all([
|
||||
const [project, patches, seedingPolicy, node] = await Promise.all([
|
||||
api.project.getById(route.project),
|
||||
api.project.getAllPatches(route.project, {
|
||||
status,
|
||||
@@ -318,6 +327,7 @@ async function loadPatchesView(
|
||||
perPage: PATCHES_PER_PAGE,
|
||||
}),
|
||||
api.getPoliciesById(route.project),
|
||||
api.getNode(),
|
||||
]);
|
||||
|
||||
return {
|
||||
@@ -328,6 +338,7 @@ async function loadPatchesView(
|
||||
patches,
|
||||
status,
|
||||
project,
|
||||
nodeAvatarUrl: node.avatarUrl,
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -338,7 +349,7 @@ async function loadIssuesView(
|
||||
const api = new HttpdClient(route.node);
|
||||
const status = route.status || "open";
|
||||
|
||||
const [project, issues, seedingPolicy] = await Promise.all([
|
||||
const [project, issues, seedingPolicy, node] = await Promise.all([
|
||||
api.project.getById(route.project),
|
||||
api.project.getAllIssues(route.project, {
|
||||
status,
|
||||
@@ -346,6 +357,7 @@ async function loadIssuesView(
|
||||
perPage: ISSUES_PER_PAGE,
|
||||
}),
|
||||
api.getPoliciesById(route.project),
|
||||
api.getNode(),
|
||||
]);
|
||||
|
||||
return {
|
||||
@@ -356,6 +368,7 @@ async function loadIssuesView(
|
||||
issues,
|
||||
status,
|
||||
project,
|
||||
nodeAvatarUrl: node.avatarUrl,
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -387,10 +400,11 @@ async function loadTreeView(
|
||||
seedingPolicyPromise = api.getPoliciesById(route.project);
|
||||
}
|
||||
|
||||
const [project, peers, seedingPolicy] = await Promise.all([
|
||||
const [project, peers, seedingPolicy, node] = await Promise.all([
|
||||
projectPromise,
|
||||
peersPromise,
|
||||
seedingPolicyPromise,
|
||||
api.getNode(),
|
||||
]);
|
||||
|
||||
let branchMap: Record<string, string> = {
|
||||
@@ -438,6 +452,7 @@ async function loadTreeView(
|
||||
tree,
|
||||
path,
|
||||
blobResult,
|
||||
nodeAvatarUrl: node.avatarUrl,
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -496,11 +511,12 @@ async function loadHistoryView(
|
||||
): Promise<ProjectLoadedRoute> {
|
||||
const api = new HttpdClient(route.node);
|
||||
|
||||
const [project, peers, seedingPolicy, branchMap] = await Promise.all([
|
||||
const [project, peers, seedingPolicy, branchMap, node] = await Promise.all([
|
||||
api.project.getById(route.project),
|
||||
api.project.getAllRemotes(route.project),
|
||||
api.getPoliciesById(route.project),
|
||||
getPeerBranches(api, route.project, route.peer),
|
||||
api.getNode(),
|
||||
]);
|
||||
|
||||
let commitId;
|
||||
@@ -539,6 +555,7 @@ async function loadHistoryView(
|
||||
revision: route.revision,
|
||||
tree,
|
||||
commitHeaders,
|
||||
nodeAvatarUrl: node.avatarUrl,
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -552,10 +569,11 @@ async function loadIssueView(
|
||||
route.project
|
||||
}${commit ? `/${commit}` : ""}`;
|
||||
|
||||
const [project, issue, seedingPolicy] = await Promise.all([
|
||||
const [project, issue, seedingPolicy, node] = await Promise.all([
|
||||
api.project.getById(route.project),
|
||||
api.project.getIssueById(route.project, route.issue),
|
||||
api.getPoliciesById(route.project),
|
||||
api.getNode(),
|
||||
]);
|
||||
return {
|
||||
resource: "project.issue",
|
||||
@@ -565,6 +583,7 @@ async function loadIssueView(
|
||||
project,
|
||||
rawPath,
|
||||
issue,
|
||||
nodeAvatarUrl: node.avatarUrl,
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -578,10 +597,11 @@ async function loadPatchView(
|
||||
route.project
|
||||
}${commit ? `/${commit}` : ""}`;
|
||||
|
||||
const [project, patch, seedingPolicy] = await Promise.all([
|
||||
const [project, patch, seedingPolicy, node] = await Promise.all([
|
||||
api.project.getById(route.project),
|
||||
api.project.getPatchById(route.project, route.patch),
|
||||
api.getPoliciesById(route.project),
|
||||
api.getNode(),
|
||||
]);
|
||||
const latestRevision = patch.revisions[patch.revisions.length - 1];
|
||||
const { diff } = await api.project.getDiff(
|
||||
@@ -643,6 +663,7 @@ async function loadPatchView(
|
||||
patch,
|
||||
stats: diff.stats,
|
||||
view,
|
||||
nodeAvatarUrl: node.avatarUrl,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user