mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-29 02:00:31 +08:00
Format *.ts, *.js, *.css, *.html, *.json and *.svelte
Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
This commit is contained in:
@@ -7,8 +7,13 @@
|
||||
|
||||
const lastCommit = blob.info.lastCommit;
|
||||
const lines = blob.binary ? 0 : (blob.content.match(/\n/g) || []).length;
|
||||
const lineNumbers = Array(lines).fill(0).map((_, index) => index + 1);
|
||||
const parentDir = blob.path.match(/^.*\/|/)?.values().next().value;
|
||||
const lineNumbers = Array(lines)
|
||||
.fill(0)
|
||||
.map((_, index) => index + 1);
|
||||
const parentDir = blob.path
|
||||
.match(/^.*\/|/)
|
||||
?.values()
|
||||
.next().value;
|
||||
|
||||
// Waiting onMount, due to the line numbers still loading.
|
||||
onMount(() => {
|
||||
@@ -66,7 +71,8 @@
|
||||
.line-number {
|
||||
display: block;
|
||||
}
|
||||
.line-number:hover, .line-number.highlighted {
|
||||
.line-number:hover,
|
||||
.line-number.highlighted {
|
||||
color: var(--color-foreground-90);
|
||||
}
|
||||
|
||||
@@ -80,7 +86,7 @@
|
||||
display: flex;
|
||||
border: 1px solid var(--color-foreground-subtle);
|
||||
border-top-style: dashed;
|
||||
border-bottom-left-radius: var(--border-radius-small);
|
||||
border-bottom-left-radius: var(--border-radius-small);
|
||||
border-bottom-right-radius: var(--border-radius-small);
|
||||
}
|
||||
|
||||
@@ -116,7 +122,8 @@
|
||||
}
|
||||
|
||||
@media (max-width: 960px) {
|
||||
.code, .line-numbers {
|
||||
.code,
|
||||
.line-numbers {
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
.highlight {
|
||||
@@ -130,9 +137,10 @@
|
||||
<header>
|
||||
<div class="file-header">
|
||||
<span class="file-name">
|
||||
<span class="faded">{parentDir}</span><span>{blob.info.name}</span>
|
||||
<span class="faded">{parentDir}</span>
|
||||
<span>{blob.info.name}</span>
|
||||
</span>
|
||||
<div class="last-commit" title="{lastCommit.author.name}">
|
||||
<div class="last-commit" title={lastCommit.author.name}>
|
||||
<span class="hash">{lastCommit.sha1.slice(0, 7)}</span>
|
||||
{lastCommit.summary}
|
||||
</div>
|
||||
@@ -146,14 +154,19 @@
|
||||
</div>
|
||||
{:else}
|
||||
{#if line}
|
||||
<div class="highlight" style="top: {line === 1 ? 1 : (1.5 * line) - 0.5}rem" />
|
||||
<div
|
||||
class="highlight"
|
||||
style="top: {line === 1 ? 1 : 1.5 * line - 0.5}rem" />
|
||||
{/if}
|
||||
<div class="line-numbers">
|
||||
{#each lineNumbers as lineNumber}
|
||||
<a href="#L{lineNumber}"
|
||||
class="line-number"
|
||||
class:highlighted={lineNumber === line}
|
||||
id="L{lineNumber}">{lineNumber}</a>
|
||||
<a
|
||||
href="#L{lineNumber}"
|
||||
class="line-number"
|
||||
class:highlighted={lineNumber === line}
|
||||
id="L{lineNumber}">
|
||||
{lineNumber}
|
||||
</a>
|
||||
{/each}
|
||||
</div>
|
||||
{#if blob.html}
|
||||
|
||||
@@ -7,26 +7,27 @@ const defaultProps = {
|
||||
head: "e678629cd37c770c640a2cd997fc76303c815772",
|
||||
urn: "rad:git:hnrkqdpm9ub19oc8dccx44echy76hzfsezyio",
|
||||
name: "nakamoto",
|
||||
description: "Privacy-preserving Bitcoin light-client implementation in Rust",
|
||||
description:
|
||||
"Privacy-preserving Bitcoin light-client implementation in Rust",
|
||||
defaultBranch: "master",
|
||||
maintainers: [
|
||||
"rad:git:hnrkqdpm9ub19oc8dccx44echy76hzfsezyio"
|
||||
],
|
||||
delegates: [
|
||||
"hyn9diwfnytahjq8u3iw63h9jte1ydcatxax3saymwdxqu1zo645pe"
|
||||
]
|
||||
maintainers: ["rad:git:hnrkqdpm9ub19oc8dccx44echy76hzfsezyio"],
|
||||
delegates: ["hyn9diwfnytahjq8u3iw63h9jte1ydcatxax3saymwdxqu1zo645pe"],
|
||||
},
|
||||
branches: { "master": "e678629cd37c770c640a2cd997fc76303c815772" },
|
||||
branches: { master: "e678629cd37c770c640a2cd997fc76303c815772" },
|
||||
revision: "e678629cd37c770c640a2cd997fc76303c815772",
|
||||
};
|
||||
|
||||
describe('Logic', () => {
|
||||
describe("Logic", () => {
|
||||
it("should show defaultBranch label and head commit if revision === head", () => {
|
||||
const { rerender } = render(BranchSelector, {
|
||||
props: defaultProps,
|
||||
});
|
||||
cy.get("div.stat.branch").should("be.visible").should("have.text", "master");
|
||||
cy.get("div.hash.mobile").should("be.visible").should("have.text", "e678629");
|
||||
cy.get("div.stat.branch")
|
||||
.should("be.visible")
|
||||
.should("have.text", "master");
|
||||
cy.get("div.hash.mobile")
|
||||
.should("be.visible")
|
||||
.should("have.text", "e678629");
|
||||
|
||||
// If project.head is null we should get the head from branches.
|
||||
rerender({
|
||||
@@ -36,19 +37,20 @@ describe('Logic', () => {
|
||||
head: null,
|
||||
urn: "rad:git:hnrkqdpm9ub19oc8dccx44echy76hzfsezyio",
|
||||
name: "nakamoto",
|
||||
description: "Privacy-preserving Bitcoin light-client implementation in Rust",
|
||||
description:
|
||||
"Privacy-preserving Bitcoin light-client implementation in Rust",
|
||||
defaultBranch: "master",
|
||||
maintainers: [
|
||||
"rad:git:hnrkqdpm9ub19oc8dccx44echy76hzfsezyio"
|
||||
],
|
||||
delegates: [
|
||||
"hyn9diwfnytahjq8u3iw63h9jte1ydcatxax3saymwdxqu1zo645pe"
|
||||
]
|
||||
}
|
||||
}
|
||||
maintainers: ["rad:git:hnrkqdpm9ub19oc8dccx44echy76hzfsezyio"],
|
||||
delegates: ["hyn9diwfnytahjq8u3iw63h9jte1ydcatxax3saymwdxqu1zo645pe"],
|
||||
},
|
||||
},
|
||||
});
|
||||
cy.get("div.stat.branch").should("be.visible").should("have.text", "master");
|
||||
cy.get("div.hash.mobile").should("be.visible").should("have.text", "e678629");
|
||||
cy.get("div.stat.branch")
|
||||
.should("be.visible")
|
||||
.should("have.text", "master");
|
||||
cy.get("div.hash.mobile")
|
||||
.should("be.visible")
|
||||
.should("have.text", "e678629");
|
||||
});
|
||||
|
||||
it("should show the branch dropdown if branches available", () => {
|
||||
@@ -56,18 +58,19 @@ describe('Logic', () => {
|
||||
props: {
|
||||
...defaultProps,
|
||||
branches: {
|
||||
"master": "e678629cd37c770c640a2cd997fc76303c815772",
|
||||
master: "e678629cd37c770c640a2cd997fc76303c815772",
|
||||
"feature-branch": "29e8b7b0f3019b8e8a6d9bfb0964ee78f4ff12f5",
|
||||
"xyz": "debf82ef3623ec11751a993bda85bac2ff1c6f00",
|
||||
xyz: "debf82ef3623ec11751a993bda85bac2ff1c6f00",
|
||||
},
|
||||
}
|
||||
},
|
||||
});
|
||||
cy.get("div.commit div.stat.branch").click();
|
||||
cy.get("div.dropdown div.dropdown-item")
|
||||
.first()
|
||||
.should("contain.text", "feature-branch")
|
||||
.next()
|
||||
.should("contain.text", "master").should("have.class", "selected")
|
||||
.should("contain.text", "master")
|
||||
.should("have.class", "selected")
|
||||
.next()
|
||||
.should("contain.text", "xyz");
|
||||
});
|
||||
@@ -75,16 +78,21 @@ describe('Logic', () => {
|
||||
it("should show feature-branch label and head commit, if branch label is passed as revision", () => {
|
||||
render(BranchSelector, {
|
||||
props: {
|
||||
...defaultProps, branches: {
|
||||
"master": "e678629cd37c770c640a2cd997fc76303c815772",
|
||||
...defaultProps,
|
||||
branches: {
|
||||
master: "e678629cd37c770c640a2cd997fc76303c815772",
|
||||
"feature-branch": "29e8b7b0f3019b8e8a6d9bfb0964ee78f4ff12f5",
|
||||
"xyz": "debf82ef3623ec11751a993bda85bac2ff1c6f00",
|
||||
xyz: "debf82ef3623ec11751a993bda85bac2ff1c6f00",
|
||||
},
|
||||
revision: "feature-branch"
|
||||
}
|
||||
revision: "feature-branch",
|
||||
},
|
||||
});
|
||||
cy.get("div.stat.branch").should("be.visible").should("have.text", "feature-branch");
|
||||
cy.get("div.hash.mobile").should("be.visible").should("have.text", "29e8b7b");
|
||||
cy.get("div.stat.branch")
|
||||
.should("be.visible")
|
||||
.should("have.text", "feature-branch");
|
||||
cy.get("div.hash.mobile")
|
||||
.should("be.visible")
|
||||
.should("have.text", "29e8b7b");
|
||||
});
|
||||
|
||||
it("should show only commit if no branchLabel nor branches are available", () => {
|
||||
@@ -92,12 +100,16 @@ describe('Logic', () => {
|
||||
props: {
|
||||
...defaultProps,
|
||||
revision: "debf82ef3623ec11751a993bda85bac2ff1c6f00",
|
||||
branches: {}
|
||||
}
|
||||
branches: {},
|
||||
},
|
||||
});
|
||||
cy.get("div.hash.mobile").should("be.visible").should("have.text", "debf82e");
|
||||
cy.get("div.hash.mobile")
|
||||
.should("be.visible")
|
||||
.should("have.text", "debf82e");
|
||||
cy.viewport("macbook-13");
|
||||
cy.get("div.hash.desktop").should("be.visible").should("have.text", "debf82ef3623ec11751a993bda85bac2ff1c6f00");
|
||||
cy.get("div.hash.desktop")
|
||||
.should("be.visible")
|
||||
.should("have.text", "debf82ef3623ec11751a993bda85bac2ff1c6f00");
|
||||
});
|
||||
|
||||
it("should show only commit if branches are available but no branchLabel", () => {
|
||||
@@ -105,11 +117,15 @@ describe('Logic', () => {
|
||||
props: {
|
||||
...defaultProps,
|
||||
revision: "debf82ef3623ec11751a993bda85bac2ff1c6f00",
|
||||
}
|
||||
},
|
||||
});
|
||||
cy.get("div.hash.mobile").should("be.visible").should("have.text", "debf82e");
|
||||
cy.get("div.hash.mobile")
|
||||
.should("be.visible")
|
||||
.should("have.text", "debf82e");
|
||||
cy.viewport("macbook-13");
|
||||
cy.get("div.hash.desktop").should("be.visible").should("have.text", "debf82ef3623ec11751a993bda85bac2ff1c6f00");
|
||||
cy.get("div.hash.desktop")
|
||||
.should("be.visible")
|
||||
.should("have.text", "debf82ef3623ec11751a993bda85bac2ff1c6f00");
|
||||
});
|
||||
|
||||
it("should show defaultBranch label if revision === head", () => {
|
||||
@@ -117,10 +133,12 @@ describe('Logic', () => {
|
||||
props: {
|
||||
...defaultProps,
|
||||
revision: "e678629cd37c770c640a2cd997fc76303c815772",
|
||||
branches: {}
|
||||
}
|
||||
branches: {},
|
||||
},
|
||||
});
|
||||
cy.get("div.stat.branch.not-allowed").should("be.visible").should("have.text", "master");
|
||||
cy.get("div.stat.branch.not-allowed")
|
||||
.should("be.visible")
|
||||
.should("have.text", "master");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -129,8 +147,8 @@ describe("Layout", () => {
|
||||
render(BranchSelector, {
|
||||
props: {
|
||||
...defaultProps,
|
||||
revision: "e678629cd37c770c640a2cd997fc76303c815772"
|
||||
}
|
||||
revision: "e678629cd37c770c640a2cd997fc76303c815772",
|
||||
},
|
||||
});
|
||||
cy.viewport("iphone-x");
|
||||
cy.get("div.hash.mobile").should("be.visible");
|
||||
@@ -149,19 +167,21 @@ describe("Events", () => {
|
||||
revision: "feature-branch",
|
||||
branches: {
|
||||
"feature-branch": "29e8b7b0f3019b8e8a6d9bfb0964ee78f4ff12f5",
|
||||
"xyz": "debf82ef3623ec11751a993bda85bac2ff1c6f00",
|
||||
}
|
||||
}
|
||||
xyz: "debf82ef3623ec11751a993bda85bac2ff1c6f00",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
cy.get("div.commit div.stat.branch").click().then(() => {
|
||||
const branchLabel = getByText("xyz");
|
||||
cy.get("div.commit div.stat.branch")
|
||||
.click()
|
||||
.then(() => {
|
||||
const branchLabel = getByText("xyz");
|
||||
|
||||
const mock = cy.spy();
|
||||
component.$on("branchChanged", mock);
|
||||
const mock = cy.spy();
|
||||
component.$on("branchChanged", mock);
|
||||
|
||||
fireEvent.click(branchLabel);
|
||||
expect(mock).to.have.been.calledOnce;
|
||||
});
|
||||
fireEvent.click(branchLabel);
|
||||
expect(mock).to.have.been.calledOnce;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -16,7 +16,9 @@
|
||||
|
||||
let branchLabel: string | null = null;
|
||||
|
||||
$: branchList = Object.keys(branches).sort().map(b => ({ key: b, value: b, title: `Switch to ${b}`, badge: null }));
|
||||
$: branchList = Object.keys(branches)
|
||||
.sort()
|
||||
.map(b => ({ key: b, value: b, title: `Switch to ${b}`, badge: null }));
|
||||
$: showSelector = branchList.length > 1;
|
||||
$: head = project.head ?? branches[project.defaultBranch];
|
||||
$: commit = getOid(revision, branches) || head;
|
||||
@@ -82,7 +84,7 @@
|
||||
<Dropdown
|
||||
items={branchList}
|
||||
selected={branchLabel}
|
||||
on:select={(e) => switchBranch(e.detail)} />
|
||||
on:select={e => switchBranch(e.detail)} />
|
||||
</svelte:fragment>
|
||||
</Floating>
|
||||
<div class="hash desktop">
|
||||
@@ -96,7 +98,7 @@
|
||||
<div class="hash mobile">
|
||||
{formatCommit(commit)}
|
||||
</div>
|
||||
<!-- If there is no branch listing available, show default branch name if commit is head and else show entire commit -->
|
||||
<!-- If there is no branch listing available, show default branch name if commit is head and else show entire commit -->
|
||||
{:else if commit === head}
|
||||
<div class="stat branch not-allowed">
|
||||
{project.defaultBranch}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<script lang="ts">
|
||||
import type { Readable } from 'svelte/store';
|
||||
import type * as proj from '@app/project';
|
||||
import Loading from '@app/Loading.svelte';
|
||||
import Placeholder from '@app/Placeholder.svelte';
|
||||
import * as utils from '@app/utils';
|
||||
import type { Readable } from "svelte/store";
|
||||
import type * as proj from "@app/project";
|
||||
import Loading from "@app/Loading.svelte";
|
||||
import Placeholder from "@app/Placeholder.svelte";
|
||||
import * as utils from "@app/utils";
|
||||
|
||||
import Tree from './Tree.svelte';
|
||||
import Blob from './Blob.svelte';
|
||||
import Readme from './Readme.svelte';
|
||||
import Tree from "./Tree.svelte";
|
||||
import Blob from "./Blob.svelte";
|
||||
import Readme from "./Readme.svelte";
|
||||
|
||||
enum Status {
|
||||
Loading,
|
||||
@@ -15,7 +15,7 @@
|
||||
}
|
||||
|
||||
type State =
|
||||
{ status: Status.Loading; path: string }
|
||||
| { status: Status.Loading; path: string }
|
||||
| { status: Status.Loaded; path: string; blob: proj.Blob };
|
||||
|
||||
export let project: proj.Project;
|
||||
@@ -38,9 +38,10 @@
|
||||
}
|
||||
|
||||
const isMarkdownPath = utils.isMarkdownPath(path);
|
||||
const promise = path === "/"
|
||||
? project.getReadme(commit)
|
||||
: project.getBlob(commit, path, { highlight: !isMarkdownPath });
|
||||
const promise =
|
||||
path === "/"
|
||||
? project.getReadme(commit)
|
||||
: project.getBlob(commit, path, { highlight: !isMarkdownPath });
|
||||
|
||||
state = { status: Status.Loading, path };
|
||||
state = { status: Status.Loaded, path, blob: await promise };
|
||||
@@ -160,7 +161,9 @@
|
||||
<!-- Mobile navigation -->
|
||||
{#if tree.entries.length > 0}
|
||||
<nav class="mobile">
|
||||
<button class="regular browse secondary center-content" on:click={toggleMobileFileTree}>
|
||||
<button
|
||||
class="regular browse secondary center-content"
|
||||
on:click={toggleMobileFileTree}>
|
||||
Browse
|
||||
</button>
|
||||
</nav>
|
||||
@@ -202,12 +205,8 @@
|
||||
{:else}
|
||||
<div class="placeholder">
|
||||
<Placeholder icon="👀">
|
||||
<span slot="title">
|
||||
Nothing to show
|
||||
</span>
|
||||
<span slot="body">
|
||||
We couldn't find any files at this revision.
|
||||
</span>
|
||||
<span slot="title">Nothing to show</span>
|
||||
<span slot="body">We couldn't find any files at this revision.</span>
|
||||
</Placeholder>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -48,9 +48,7 @@
|
||||
</style>
|
||||
|
||||
<Floating>
|
||||
<div slot="toggle" class="clone-button">
|
||||
Clone
|
||||
</div>
|
||||
<div slot="toggle" class="clone-button">Clone</div>
|
||||
<svelte:fragment slot="modal">
|
||||
<div class="dropdown">
|
||||
<Input
|
||||
@@ -62,7 +60,10 @@
|
||||
Use the <a
|
||||
target="_blank"
|
||||
href="https://radicle.xyz/get-started.html"
|
||||
class="link">Radicle CLI</a> to clone this project.
|
||||
class="link">
|
||||
Radicle CLI
|
||||
</a>
|
||||
to clone this project.
|
||||
</label>
|
||||
<br />
|
||||
<Input
|
||||
@@ -70,8 +71,9 @@
|
||||
value="https://{seedHost}/{utils.parseRadicleId(urn)}.git"
|
||||
class="yellow"
|
||||
clipboard />
|
||||
<label for="git-clone-url"
|
||||
>Use Git to clone this repository from the URL above.</label>
|
||||
<label for="git-clone-url">
|
||||
Use Git to clone this repository from the URL above.
|
||||
</label>
|
||||
</div>
|
||||
</svelte:fragment>
|
||||
</Floating>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
project.navigateTo({
|
||||
content: proj.ProjectContent.Tree,
|
||||
revision: commit.header.sha1,
|
||||
path: event.detail
|
||||
path: event.detail,
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
color: var(--color-foreground-faded);
|
||||
padding: 0.125rem 0;
|
||||
}
|
||||
.authorship .author, .authorship .committer {
|
||||
.authorship .author,
|
||||
.authorship .committer {
|
||||
color: var(--color-foreground);
|
||||
white-space: nowrap;
|
||||
}
|
||||
@@ -37,23 +38,34 @@
|
||||
|
||||
<span class="authorship text-xsmall">
|
||||
{#if commit.header.author.email === commit.header.committer.email}
|
||||
<img class="avatar" alt="avatar" src="{gravatarURL(commit.header.committer.email)}" />
|
||||
<img
|
||||
class="avatar"
|
||||
alt="avatar"
|
||||
src={gravatarURL(commit.header.committer.email)} />
|
||||
{#if commit.context?.committer}
|
||||
<span class="bold committer verified-committer">
|
||||
{commit.context?.committer.peer.person.name}
|
||||
</span>
|
||||
<span> committed</span>
|
||||
{:else}
|
||||
<span class="desktop-inline committer">{commit.header.committer.name}</span>
|
||||
<span class="desktop-inline committer">
|
||||
{commit.header.committer.name}
|
||||
</span>
|
||||
<span> committed</span>
|
||||
{/if}
|
||||
{:else}
|
||||
{#if showAuthor}
|
||||
<img class="avatar" alt="avatar" src="{gravatarURL(commit.header.author.email)}" />
|
||||
<img
|
||||
class="avatar"
|
||||
alt="avatar"
|
||||
src={gravatarURL(commit.header.author.email)} />
|
||||
<span class="desktop-inline author">{commit.header.author.name}</span>
|
||||
<span> authored </span>
|
||||
{/if}
|
||||
<img class="avatar" alt="avatar" src="{gravatarURL(commit.header.committer.email)}" />
|
||||
<img
|
||||
class="avatar"
|
||||
alt="avatar"
|
||||
src={gravatarURL(commit.header.committer.email)} />
|
||||
{#if commit.context?.committer}
|
||||
<span class="bold committer verified-committer">
|
||||
{commit.context?.committer.peer.person.name}
|
||||
@@ -68,6 +80,8 @@
|
||||
{/if}
|
||||
{#if showTime}
|
||||
<span> </span>
|
||||
<span class="desktop-inline text-xsmall time">{formatTimestamp(commit.header.committerTime)}</span>
|
||||
<span class="desktop-inline text-xsmall time">
|
||||
{formatTimestamp(commit.header.committerTime)}
|
||||
</span>
|
||||
{/if}
|
||||
</span>
|
||||
|
||||
@@ -100,7 +100,10 @@
|
||||
</div>
|
||||
{/if}
|
||||
<span class="secondary hash">{formatCommit(commit.header.sha1)}</span>
|
||||
<div class="browse" title="View file" on:click|stopPropagation={() => browseCommit(commit.header.sha1)}>
|
||||
<div
|
||||
class="browse"
|
||||
title="View file"
|
||||
on:click|stopPropagation={() => browseCommit(commit.header.sha1)}>
|
||||
<Icon name="browse" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -45,8 +45,12 @@
|
||||
|
||||
<Badge
|
||||
variant="tertiary"
|
||||
on:mouseenter={() => {hover = true;}}
|
||||
on:mouseleave={() => {hover = false;}}>
|
||||
on:mouseenter={() => {
|
||||
hover = true;
|
||||
}}
|
||||
on:mouseleave={() => {
|
||||
hover = false;
|
||||
}}>
|
||||
Verified
|
||||
</Badge>
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
const updateRevision = (revision: string) => {
|
||||
project.navigateTo({ revision });
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
@@ -96,14 +95,14 @@
|
||||
<PeerSelector
|
||||
{peers}
|
||||
peer={browser.peer}
|
||||
on:peerChanged={(event) => updatePeer(event.detail)} />
|
||||
on:peerChanged={event => updatePeer(event.detail)} />
|
||||
{/if}
|
||||
|
||||
<BranchSelector
|
||||
{branches}
|
||||
{project}
|
||||
{revision}
|
||||
on:branchChanged={(event) => updateRevision(event.detail)} />
|
||||
on:branchChanged={event => updateRevision(event.detail)} />
|
||||
|
||||
{#if !noAnchor}
|
||||
<div class="anchor widget">
|
||||
@@ -111,12 +110,12 @@
|
||||
{commit}
|
||||
{anchors}
|
||||
head={project.head}
|
||||
on:click={(event) => updateRevision(event.detail)} />
|
||||
on:click={event => updateRevision(event.detail)} />
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if seed.git.host}
|
||||
<CloneButton seedHost={seed.git.host} {urn}/>
|
||||
<CloneButton seedHost={seed.git.host} {urn} />
|
||||
{/if}
|
||||
<span>
|
||||
{#if seed.api.host}
|
||||
@@ -132,7 +131,8 @@
|
||||
class="stat commit-count clickable widget"
|
||||
class:active={content === ProjectContent.History}
|
||||
on:click={() => toggleContent(ProjectContent.History, true)}>
|
||||
<strong>{tree.stats.commits}</strong> commit(s)
|
||||
<strong>{tree.stats.commits}</strong>
|
||||
commit(s)
|
||||
</div>
|
||||
{#if project.issues}
|
||||
<div
|
||||
@@ -141,7 +141,8 @@
|
||||
class:not-allowed={project.issues === 0}
|
||||
class:clickable={project.issues > 0}
|
||||
on:click={() => toggleContent(ProjectContent.Issues, false)}>
|
||||
<strong>{project.issues}</strong> issue(s)
|
||||
<strong>{project.issues}</strong>
|
||||
issue(s)
|
||||
</div>
|
||||
{/if}
|
||||
{#if project.patches}
|
||||
@@ -151,10 +152,12 @@
|
||||
class:not-allowed={project.patches === 0}
|
||||
class:clickable={project.patches > 0}
|
||||
on:click={() => toggleContent(ProjectContent.Patches, false)}>
|
||||
<strong>{project.patches}</strong> patch(es)
|
||||
<strong>{project.patches}</strong>
|
||||
patch(es)
|
||||
</div>
|
||||
{/if}
|
||||
<div class="stat contributor-count widget">
|
||||
<strong>{tree.stats.contributors}</strong> contributor(s)
|
||||
<strong>{tree.stats.contributors}</strong>
|
||||
contributor(s)
|
||||
</div>
|
||||
</header>
|
||||
|
||||
@@ -7,11 +7,22 @@
|
||||
export let history: GroupedCommitsHistory;
|
||||
|
||||
const navigateHistory = (revision: string, content?: ProjectContent) => {
|
||||
project.navigateTo({ content, revision, issue: null, patch: null, path: null });
|
||||
project.navigateTo({
|
||||
content,
|
||||
revision,
|
||||
issue: null,
|
||||
patch: null,
|
||||
path: null,
|
||||
});
|
||||
};
|
||||
|
||||
const browseCommit = (event: { detail: string }) => {
|
||||
project.navigateTo({ content: ProjectContent.Tree, revision: event.detail, issue: null, path: null });
|
||||
project.navigateTo({
|
||||
content: ProjectContent.Tree,
|
||||
revision: event.detail,
|
||||
issue: null,
|
||||
path: null,
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -53,19 +64,22 @@
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="history">
|
||||
{#each history.headers as group (group.time)}
|
||||
<div class="commit-group">
|
||||
<header class="commit-date">
|
||||
<p>{group.date}</p>
|
||||
</header>
|
||||
<div class="commit-group-headers">
|
||||
{#each group.commits as commit (commit.header.sha1)}
|
||||
<div class="commit" on:click={() => navigateHistory(commit.header.sha1, ProjectContent.Commit)}>
|
||||
<CommitTeaser {commit} on:browseCommit={browseCommit} />
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
<div class="history">
|
||||
{#each history.headers as group (group.time)}
|
||||
<div class="commit-group">
|
||||
<header class="commit-date">
|
||||
<p>{group.date}</p>
|
||||
</header>
|
||||
<div class="commit-group-headers">
|
||||
{#each group.commits as commit (commit.header.sha1)}
|
||||
<div
|
||||
class="commit"
|
||||
on:click={() =>
|
||||
navigateHistory(commit.header.sha1, ProjectContent.Commit)}>
|
||||
<CommitTeaser {commit} on:browseCommit={browseCommit} />
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
@@ -121,13 +121,15 @@
|
||||
<div
|
||||
class="summary-state"
|
||||
class:closed={issue.state.status === "closed"}
|
||||
class:open={issue.state.status === "open"}
|
||||
>
|
||||
class:open={issue.state.status === "open"}>
|
||||
{capitalize(issue.state.status)}
|
||||
</div>
|
||||
</div>
|
||||
<Authorship {config}
|
||||
author={issue.author} timestamp={issue.timestamp} caption="opened on" />
|
||||
<Authorship
|
||||
{config}
|
||||
author={issue.author}
|
||||
timestamp={issue.timestamp}
|
||||
caption="opened on" />
|
||||
</header>
|
||||
<main>
|
||||
<div class="comments">
|
||||
@@ -145,18 +147,14 @@
|
||||
</div>
|
||||
<div class="metadata desktop">
|
||||
<div class="metadata-section">
|
||||
<div class="metadata-section-header">
|
||||
Labels
|
||||
</div>
|
||||
<div class="metadata-section-header">Labels</div>
|
||||
<div class="metadata-section-body">
|
||||
{#if issue.labels?.length}
|
||||
{#each issue.labels as label}
|
||||
<span class="label">{label}</span>
|
||||
{/each}
|
||||
{:else}
|
||||
<div class="metadata-section-empty">
|
||||
No labels.
|
||||
</div>
|
||||
<div class="metadata-section-empty">No labels.</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -14,7 +14,11 @@
|
||||
|
||||
onMount(async () => {
|
||||
if (issue.author.profile?.ens?.name) {
|
||||
profile = await Profile.get(issue.author.profile.ens.name, ProfileType.Minimal, config);
|
||||
profile = await Profile.get(
|
||||
issue.author.profile.ens.name,
|
||||
ProfileType.Minimal,
|
||||
config,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -100,8 +104,7 @@
|
||||
<div
|
||||
class="state-icon"
|
||||
class:closed={issue.state.status === "closed"}
|
||||
class:open={issue.state.status === "open"}
|
||||
/>
|
||||
class:open={issue.state.status === "open"} />
|
||||
</div>
|
||||
<div class="column-left">
|
||||
<div class="summary">
|
||||
@@ -109,7 +112,9 @@
|
||||
{issue.title}
|
||||
<span class="issue-id">{formatObjectId(issue.id)}</span>
|
||||
</div>
|
||||
<Authorship {profile} {config}
|
||||
<Authorship
|
||||
{profile}
|
||||
{config}
|
||||
caption="opened"
|
||||
author={issue.author}
|
||||
timestamp={issue.timestamp} />
|
||||
|
||||
@@ -25,16 +25,18 @@
|
||||
const { open, closed } = groupIssues(issues);
|
||||
|
||||
$: filteredIssues = state === "open" ? open : closed;
|
||||
$: sortedIssues = filteredIssues.sort(({ timestamp: t1 }, { timestamp: t2 }) => t2 - t1);
|
||||
$: sortedIssues = filteredIssues.sort(
|
||||
({ timestamp: t1 }, { timestamp: t2 }) => t2 - t1,
|
||||
);
|
||||
|
||||
$: options = [
|
||||
{
|
||||
value: "open",
|
||||
count: open.length
|
||||
count: open.length,
|
||||
},
|
||||
{
|
||||
value: "closed",
|
||||
count: closed.length
|
||||
count: closed.length,
|
||||
},
|
||||
];
|
||||
</script>
|
||||
@@ -61,19 +63,26 @@
|
||||
|
||||
<div class="issues">
|
||||
<div style="margin-bottom: 1rem;">
|
||||
<ToggleButton {options} on:select={(e) => {navigate(`?state=${e.detail}`);}} active={state} />
|
||||
<ToggleButton
|
||||
{options}
|
||||
on:select={e => {
|
||||
navigate(`?state=${e.detail}`);
|
||||
}}
|
||||
active={state} />
|
||||
</div>
|
||||
|
||||
{#if filteredIssues.length}
|
||||
<div class="issues-list">
|
||||
{#each sortedIssues as issue}
|
||||
<div class="teaser" on:click={() => {
|
||||
<div
|
||||
class="teaser"
|
||||
on:click={() => {
|
||||
project.navigateTo({
|
||||
content: ProjectContent.Issue,
|
||||
issue: issue.id,
|
||||
patch: null,
|
||||
revision: null,
|
||||
path: null
|
||||
path: null,
|
||||
});
|
||||
}}>
|
||||
<IssueTeaser {config} {issue} />
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
content: ProjectContent.Tree,
|
||||
revision,
|
||||
patch: null,
|
||||
path: event.detail
|
||||
path: event.detail,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -111,7 +111,9 @@
|
||||
{capitalize(patch.state)}
|
||||
</div>
|
||||
</div>
|
||||
<Authorship noAvatar {config}
|
||||
<Authorship
|
||||
noAvatar
|
||||
{config}
|
||||
author={patch.author}
|
||||
timestamp={patch.timestamp}
|
||||
caption="opened" />
|
||||
@@ -137,9 +139,7 @@
|
||||
on:browse={e => onBrowse(e, revision.oid)} />
|
||||
{:else if activeTab === PatchTab.Diff}
|
||||
<Placeholder icon="🍳">
|
||||
<span slot="title">
|
||||
No changeset found
|
||||
</span>
|
||||
<span slot="title">No changeset found</span>
|
||||
<span slot="body">
|
||||
We couldn't find a changeset related to this patch or revision
|
||||
</span>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
const formatRevisionName = (revision: Revision, index: number) => {
|
||||
return `R${index} ${formatCommit(revision.oid)} ${formatTimestamp(
|
||||
revision.timestamp
|
||||
revision.timestamp,
|
||||
)}`;
|
||||
};
|
||||
|
||||
@@ -72,7 +72,12 @@
|
||||
</style>
|
||||
|
||||
<div class="bar text-small">
|
||||
<ToggleButton {options} on:select={(e) => {dispatch("switchTab", e.detail);}} active={activeTab} />
|
||||
<ToggleButton
|
||||
{options}
|
||||
on:select={e => {
|
||||
dispatch("switchTab", e.detail);
|
||||
}}
|
||||
active={activeTab} />
|
||||
|
||||
<Floating disabled={revisions.length <= 1}>
|
||||
<button
|
||||
@@ -84,7 +89,8 @@
|
||||
|
||||
<svelte:fragment slot="modal">
|
||||
<Dropdown
|
||||
items={revisionList} selected={revisionNumber.toString()}
|
||||
items={revisionList}
|
||||
selected={revisionNumber.toString()}
|
||||
on:select={onRevisionChange} />
|
||||
</svelte:fragment>
|
||||
</Floating>
|
||||
|
||||
@@ -14,7 +14,11 @@
|
||||
|
||||
onMount(async () => {
|
||||
if (patch.author.profile?.ens?.name) {
|
||||
profile = await Profile.get(patch.author.profile.ens.name, ProfileType.Minimal, config);
|
||||
profile = await Profile.get(
|
||||
patch.author.profile.ens.name,
|
||||
ProfileType.Minimal,
|
||||
config,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -100,8 +104,7 @@
|
||||
<div
|
||||
class="state-icon"
|
||||
class:closed={patch.state === "archived"}
|
||||
class:open={patch.state === "proposed"}
|
||||
/>
|
||||
class:open={patch.state === "proposed"} />
|
||||
</div>
|
||||
<div class="column-left">
|
||||
<div class="summary">
|
||||
@@ -109,7 +112,9 @@
|
||||
{patch.title}
|
||||
<span class="patch-id">{formatObjectId(patch.id)}</span>
|
||||
</div>
|
||||
<Authorship {profile} {config}
|
||||
<Authorship
|
||||
{profile}
|
||||
{config}
|
||||
caption="opened"
|
||||
author={patch.author}
|
||||
timestamp={patch.timestamp} />
|
||||
|
||||
@@ -25,16 +25,16 @@
|
||||
$: options = [
|
||||
{
|
||||
value: "proposed",
|
||||
count: sortedPatches.proposed.length
|
||||
count: sortedPatches.proposed.length,
|
||||
},
|
||||
{
|
||||
value: "draft",
|
||||
count: sortedPatches.draft.length
|
||||
count: sortedPatches.draft.length,
|
||||
},
|
||||
{
|
||||
value: "archived",
|
||||
count: sortedPatches.archived.length
|
||||
}
|
||||
count: sortedPatches.archived.length,
|
||||
},
|
||||
];
|
||||
</script>
|
||||
|
||||
@@ -60,19 +60,26 @@
|
||||
|
||||
<div class="patches">
|
||||
<div style="margin-bottom: 1rem;">
|
||||
<ToggleButton {options} on:select={(e) => {state = e.detail;}} active={state} />
|
||||
<ToggleButton
|
||||
{options}
|
||||
on:select={e => {
|
||||
state = e.detail;
|
||||
}}
|
||||
active={state} />
|
||||
</div>
|
||||
|
||||
{#if filteredPatches.length}
|
||||
<div class="patches-list">
|
||||
{#each filteredPatches as patch}
|
||||
<div class="teaser" on:click={() => {
|
||||
<div
|
||||
class="teaser"
|
||||
on:click={() => {
|
||||
project.navigateTo({
|
||||
content: ProjectContent.Patch,
|
||||
patch: patch.id,
|
||||
issue: null,
|
||||
revision: null,
|
||||
path: null
|
||||
path: null,
|
||||
});
|
||||
}}>
|
||||
<PatchTeaser {config} {patch} />
|
||||
|
||||
@@ -6,17 +6,17 @@ const defaultProps = {
|
||||
peer: "hyyg555wwkkutaysg6yr67qnu5d5ji54iur3n5uzzszndh8dp7ofue",
|
||||
peers: [
|
||||
{
|
||||
"id": "hyyg555wwkkutaysg6yr67qnu5d5ji54iur3n5uzzszndh8dp7ofue",
|
||||
"person": { "name": "sebastinez" },
|
||||
"delegate": true
|
||||
}
|
||||
id: "hyyg555wwkkutaysg6yr67qnu5d5ji54iur3n5uzzszndh8dp7ofue",
|
||||
person: { name: "sebastinez" },
|
||||
delegate: true,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
describe('Logic', () => {
|
||||
describe("Logic", () => {
|
||||
it("show delegate name and badge", () => {
|
||||
render(PeerSelector, {
|
||||
props: defaultProps
|
||||
props: defaultProps,
|
||||
});
|
||||
cy.get("span.peer-id").should("have.text", "sebastinez");
|
||||
cy.get("span.badge.primary").should("have.text", "delegate");
|
||||
@@ -28,11 +28,11 @@ describe('Logic', () => {
|
||||
...defaultProps,
|
||||
peers: [
|
||||
{
|
||||
"id": "hyyg555wwkkutaysg6yr67qnu5d5ji54iur3n5uzzszndh8dp7ofue",
|
||||
"delegate": true
|
||||
}
|
||||
id: "hyyg555wwkkutaysg6yr67qnu5d5ji54iur3n5uzzszndh8dp7ofue",
|
||||
delegate: true,
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
});
|
||||
cy.get("span.peer-id").should("have.text", "hyyg55…p7ofue");
|
||||
cy.get("span.badge.primary").should("have.text", "delegate");
|
||||
@@ -44,10 +44,10 @@ describe('Logic', () => {
|
||||
...defaultProps,
|
||||
peers: [
|
||||
{
|
||||
"id": "hyyg555wwkkutaysg6yr67qnu5d5ji54iur3n5uzzszndh8dp7ofue",
|
||||
}
|
||||
]
|
||||
}
|
||||
id: "hyyg555wwkkutaysg6yr67qnu5d5ji54iur3n5uzzszndh8dp7ofue",
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
cy.get("span.peer-id").should("have.text", "hyyg55…p7ofue");
|
||||
});
|
||||
@@ -56,14 +56,14 @@ describe('Logic', () => {
|
||||
describe("Layout", () => {
|
||||
it("should highlight the current peer", () => {
|
||||
render(PeerSelector, {
|
||||
props: { ...defaultProps }
|
||||
props: { ...defaultProps },
|
||||
});
|
||||
cy.get("div.selector").click();
|
||||
cy.get("div.dropdown-item").should("have.class", "selected");
|
||||
});
|
||||
});
|
||||
|
||||
describe('Events', () => {
|
||||
describe("Events", () => {
|
||||
it("dispatch peerChanged event if clicking on a peer", () => {
|
||||
cy.viewport("macbook-13");
|
||||
const { getByText, component } = render(PeerSelector, {
|
||||
@@ -71,26 +71,28 @@ describe('Events', () => {
|
||||
...defaultProps,
|
||||
peers: [
|
||||
{
|
||||
"id": "hyy841u4phudmr8s5rg1jjwd1ct7x7438wmjwtsm464y8uyxyhyi6c",
|
||||
"person": { "name": "cloudhead" },
|
||||
"delegate": true
|
||||
id: "hyy841u4phudmr8s5rg1jjwd1ct7x7438wmjwtsm464y8uyxyhyi6c",
|
||||
person: { name: "cloudhead" },
|
||||
delegate: true,
|
||||
},
|
||||
{
|
||||
"id": "hyyg555wwkkutaysg6yr67qnu5d5ji54iur3n5uzzszndh8dp7ofue",
|
||||
"person": { "name": "sebastinez" },
|
||||
"delegate": true
|
||||
}
|
||||
]
|
||||
}
|
||||
id: "hyyg555wwkkutaysg6yr67qnu5d5ji54iur3n5uzzszndh8dp7ofue",
|
||||
person: { name: "sebastinez" },
|
||||
delegate: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
cy.get("div.selector").click().then(() => {
|
||||
const peer = getByText("cloudhead");
|
||||
const mock = cy.spy();
|
||||
component.$on("peerChanged", mock);
|
||||
cy.get("div.selector")
|
||||
.click()
|
||||
.then(() => {
|
||||
const peer = getByText("cloudhead");
|
||||
const mock = cy.spy();
|
||||
component.$on("peerChanged", mock);
|
||||
|
||||
fireEvent.click(peer);
|
||||
expect(mock).to.have.been.calledOnce;
|
||||
});
|
||||
fireEvent.click(peer);
|
||||
expect(mock).to.have.been.calledOnce;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -12,20 +12,36 @@
|
||||
|
||||
let meta: Peer | undefined;
|
||||
// List of items to be created for the Dropdown component.
|
||||
let items: { key: string; value: string; title: string; badge: string | null }[] = [];
|
||||
let items: {
|
||||
key: string;
|
||||
value: string;
|
||||
title: string;
|
||||
badge: string | null;
|
||||
}[] = [];
|
||||
|
||||
function createTitle(p: Peer): string {
|
||||
const name = p.person?.name ? p.person.name : p.id;
|
||||
return p.delegate ? `${name} is a delegate of this project` : `${name} is a peer tracked by this seed`;
|
||||
return p.delegate
|
||||
? `${name} is a delegate of this project`
|
||||
: `${name} is a peer tracked by this seed`;
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
meta = peers.find(p => p.id === peer);
|
||||
items = peers.map(p => {
|
||||
if (! p.person?.name) console.debug("Not able to resolve peer identity for: ", p.id);
|
||||
const key = p.person?.name ? `<strong>${p.person.name}</strong> ${p.id}` : p.id;
|
||||
if (!p.person?.name) {
|
||||
console.debug("Not able to resolve peer identity for: ", p.id);
|
||||
}
|
||||
const key = p.person?.name
|
||||
? `<strong>${p.person.name}</strong> ${p.id}`
|
||||
: p.id;
|
||||
|
||||
return { key, value: p.id, title: createTitle(p), badge: p.delegate ? "delegate" : null };
|
||||
return {
|
||||
key,
|
||||
value: p.id,
|
||||
title: createTitle(p),
|
||||
badge: p.delegate ? "delegate" : null,
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
@@ -80,7 +96,7 @@
|
||||
{#if meta.delegate}
|
||||
<Badge variant="primary">delegate</Badge>
|
||||
{/if}
|
||||
<!-- If the delegate metadata is not found -->
|
||||
<!-- If the delegate metadata is not found -->
|
||||
{:else if peer}
|
||||
<span class="peer-id">
|
||||
{formatSeedId(peer)}
|
||||
@@ -90,10 +106,6 @@
|
||||
</div>
|
||||
|
||||
<svelte:fragment slot="modal">
|
||||
<Dropdown
|
||||
{items}
|
||||
selected={peer}
|
||||
on:select={(e) => switchPeer(e.detail)}
|
||||
/>
|
||||
<Dropdown {items} selected={peer} on:select={e => switchPeer(e.detail)} />
|
||||
</svelte:fragment>
|
||||
</Floating>
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
<script lang="ts">
|
||||
import type { Config } from '@app/config';
|
||||
import type { State as IssueState } from './Issues.svelte';
|
||||
import type { Config } from "@app/config";
|
||||
import type { State as IssueState } from "./Issues.svelte";
|
||||
|
||||
import * as proj from '@app/project';
|
||||
import Placeholder from '@app/Placeholder.svelte';
|
||||
import Loading from '@app/Loading.svelte';
|
||||
import { formatProfile, formatSeedId, setOpenGraphMetaTag } from '@app/utils';
|
||||
import { browserStore } from '@app/project';
|
||||
import { fetchCommits } from '@app/commit';
|
||||
import * as proj from "@app/project";
|
||||
import Placeholder from "@app/Placeholder.svelte";
|
||||
import Loading from "@app/Loading.svelte";
|
||||
import { formatProfile, formatSeedId, setOpenGraphMetaTag } from "@app/utils";
|
||||
import { browserStore } from "@app/project";
|
||||
import { fetchCommits } from "@app/commit";
|
||||
import * as patch from "@app/patch";
|
||||
import * as issue from "@app/issue";
|
||||
|
||||
import Header from '@app/base/projects/Header.svelte';
|
||||
import Async from '@app/Async.svelte';
|
||||
import Header from "@app/base/projects/Header.svelte";
|
||||
import Async from "@app/Async.svelte";
|
||||
|
||||
import Browser from "./Browser.svelte";
|
||||
import Commit from "./Commit.svelte";
|
||||
import History from "./History.svelte";
|
||||
import Issues from './Issues.svelte';
|
||||
import Issue from './Issue.svelte';
|
||||
import ProjectMeta from './ProjectMeta.svelte';
|
||||
import Patches from './Patches.svelte';
|
||||
import Patch from './Patch.svelte';
|
||||
import Issues from "./Issues.svelte";
|
||||
import Issue from "./Issue.svelte";
|
||||
import ProjectMeta from "./ProjectMeta.svelte";
|
||||
import Patches from "./Patches.svelte";
|
||||
import Patch from "./Patch.svelte";
|
||||
|
||||
export let peer: string | null = null;
|
||||
export let config: Config;
|
||||
@@ -29,14 +29,14 @@
|
||||
export let content: proj.ProjectContent;
|
||||
export let revision: string | null;
|
||||
|
||||
const parentName = project.profile ? formatProfile(project.profile.nameOrAddress, config) : null;
|
||||
const parentName = project.profile
|
||||
? formatProfile(project.profile.nameOrAddress, config)
|
||||
: null;
|
||||
let pageTitle = parentName ? `${parentName}/${project.name}` : project.name;
|
||||
|
||||
$: issueFilter = $browserStore.search?.get("state") as IssueState ?? "open";
|
||||
$: issueFilter = ($browserStore.search?.get("state") as IssueState) ?? "open";
|
||||
|
||||
const baseName = parentName
|
||||
? `${parentName}/${project.name}`
|
||||
: project.name;
|
||||
const baseName = parentName ? `${parentName}/${project.name}` : project.name;
|
||||
|
||||
if (project.description) {
|
||||
pageTitle = `${baseName}: ${project.description}`;
|
||||
@@ -47,7 +47,7 @@
|
||||
setOpenGraphMetaTag([
|
||||
{ prop: "og:title", content: project.name },
|
||||
{ prop: "og:description", content: project.description },
|
||||
{ prop: "og:url", content: window.location.href }
|
||||
{ prop: "og:url", content: window.location.href },
|
||||
]);
|
||||
</script>
|
||||
|
||||
@@ -66,7 +66,10 @@
|
||||
<title>{pageTitle}</title>
|
||||
</svelte:head>
|
||||
|
||||
<ProjectMeta noDescription={content !== proj.ProjectContent.Tree} {project} {peer} />
|
||||
<ProjectMeta
|
||||
noDescription={content !== proj.ProjectContent.Tree}
|
||||
{project}
|
||||
{peer} />
|
||||
|
||||
{#if revision}
|
||||
{#await project.getRoot(revision)}
|
||||
@@ -90,25 +93,43 @@
|
||||
<div class="error error-message text-xsmall">
|
||||
<!-- TODO: Differentiate between (1) commit doesn't exist and (2) failed
|
||||
to fetch - this needs a change to the backend. -->
|
||||
API request to <code class="text-xsmall">{err.url}</code> failed
|
||||
API request to
|
||||
<code class="text-xsmall">{err.url}</code>
|
||||
failed
|
||||
</div>
|
||||
</div>
|
||||
{/await}
|
||||
|
||||
{#if content === proj.ProjectContent.Issues}
|
||||
<Async fetch={issue.Issue.getIssues(project.urn, project.seed.api)} let:result>
|
||||
<Async
|
||||
fetch={issue.Issue.getIssues(project.urn, project.seed.api)}
|
||||
let:result>
|
||||
<Issues {project} state={issueFilter} {config} issues={result} />
|
||||
</Async>
|
||||
{:else if content === proj.ProjectContent.Issue && $browserStore.issue}
|
||||
<Async fetch={issue.Issue.getIssue(project.urn, $browserStore.issue, project.seed.api)} let:result>
|
||||
<Async
|
||||
fetch={issue.Issue.getIssue(
|
||||
project.urn,
|
||||
$browserStore.issue,
|
||||
project.seed.api,
|
||||
)}
|
||||
let:result>
|
||||
<Issue {project} {config} issue={result} />
|
||||
</Async>
|
||||
{:else if content === proj.ProjectContent.Patches}
|
||||
<Async fetch={patch.Patch.getPatches(project.urn, project.seed.api)} let:result>
|
||||
<Async
|
||||
fetch={patch.Patch.getPatches(project.urn, project.seed.api)}
|
||||
let:result>
|
||||
<Patches {project} {config} patches={result} />
|
||||
</Async>
|
||||
{:else if content === proj.ProjectContent.Patch && $browserStore.patch}
|
||||
<Async fetch={patch.Patch.getPatch(project.urn, $browserStore.patch, project.seed.api)} let:result>
|
||||
<Async
|
||||
fetch={patch.Patch.getPatch(
|
||||
project.urn,
|
||||
$browserStore.patch,
|
||||
project.seed.api,
|
||||
)}
|
||||
let:result>
|
||||
<Patch {project} {config} patch={result} />
|
||||
</Async>
|
||||
{/if}
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
.title .peer-id {
|
||||
color: var(--color-foreground-subtle);
|
||||
font-weight: normal;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.org-avatar {
|
||||
display: inline-block;
|
||||
@@ -74,8 +76,13 @@
|
||||
<header class="content">
|
||||
<div class="title bold">
|
||||
{#if project.profile}
|
||||
<a class="org-avatar" title={project.profile.nameOrAddress} href="/{project.profile.nameOrAddress}">
|
||||
<Avatar source={project.profile.avatar || project.profile.address} title={project.profile.address}/>
|
||||
<a
|
||||
class="org-avatar"
|
||||
title={project.profile.nameOrAddress}
|
||||
href="/{project.profile.nameOrAddress}">
|
||||
<Avatar
|
||||
source={project.profile.avatar || project.profile.address}
|
||||
title={project.profile.address} />
|
||||
</a>
|
||||
<span class="divider">/</span>
|
||||
{/if}
|
||||
@@ -84,7 +91,9 @@
|
||||
</span>
|
||||
{#if peer}
|
||||
<span class="peer-id">
|
||||
<span class="divider">/</span><span title={peer}>{formatSeedId(peer)}</span><Clipboard text={peer} />
|
||||
<span class="divider">/</span>
|
||||
<span title={peer}>{formatSeedId(peer)}</span>
|
||||
<Clipboard text={peer} />
|
||||
</span>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<script lang="ts">
|
||||
import type { Writable } from 'svelte/store';
|
||||
import type { Writable } from "svelte/store";
|
||||
import type { Config } from "@app/config";
|
||||
import { formatLocationHash } from '@app/utils';
|
||||
import * as proj from '@app/project';
|
||||
import { formatLocationHash } from "@app/utils";
|
||||
import * as proj from "@app/project";
|
||||
import type { RouteLocation } from "@app/index";
|
||||
|
||||
import Project from '@app/base/projects/Project.svelte';
|
||||
import Project from "@app/base/projects/Project.svelte";
|
||||
|
||||
export let browserStore: Writable<proj.Browser> = proj.browserStore;
|
||||
export let route: string | null = null;
|
||||
@@ -56,5 +56,4 @@
|
||||
revision={browser.revision || head}
|
||||
content={browser.content}
|
||||
{project}
|
||||
{config}
|
||||
/>
|
||||
{config} />
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import Markdown from '@app/Markdown.svelte';
|
||||
import type * as proj from '@app/project';
|
||||
import Markdown from "@app/Markdown.svelte";
|
||||
import type * as proj from "@app/project";
|
||||
|
||||
export let content: string;
|
||||
export let getImage: (path: string) => Promise<proj.Blob>;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { Route } from "svelte-routing";
|
||||
import View from '@app/base/projects/View.svelte';
|
||||
import type { Config } from '@app/config';
|
||||
import View from "@app/base/projects/View.svelte";
|
||||
import type { Config } from "@app/config";
|
||||
import Redirect from "@app/Redirect.svelte";
|
||||
|
||||
export let config: Config;
|
||||
@@ -19,16 +19,20 @@
|
||||
|
||||
<!-- Explicit user and org context, will at some point be replaced by the generic route -->
|
||||
<Route path="/orgs/:addressOrName/projects/:id/*" let:params>
|
||||
<Redirect to="/{params.addressOrName}/{params.id}/{params["*"]}" />
|
||||
<Redirect to="/{params.addressOrName}/{params.id}/{params['*']}" />
|
||||
</Route>
|
||||
|
||||
<Route path="/users/:addressOrName/projects/:id/*" let:params>
|
||||
<Redirect to="/{params.addressOrName}/{params.id}/{params["*"]}" />
|
||||
<Redirect to="/{params.addressOrName}/{params.id}/{params['*']}" />
|
||||
</Route>
|
||||
<!-- End of eventual dropped routes -->
|
||||
|
||||
<Route path="/:profile/:id/remotes/:peer/*" let:params>
|
||||
<View {config} profileName={params.profile} id={params.id} peer={params.peer} />
|
||||
<View
|
||||
{config}
|
||||
profileName={params.profile}
|
||||
id={params.id}
|
||||
peer={params.peer} />
|
||||
</Route>
|
||||
|
||||
<Route path="/:profile/:id/*" let:params>
|
||||
|
||||
@@ -38,9 +38,9 @@
|
||||
<div class="changeset-summary">
|
||||
<span>{diffDescription(diff)}</span>
|
||||
with
|
||||
<span class="additions"> {stats.additions} addition(s) </span>
|
||||
<span class="additions">{stats.additions} addition(s)</span>
|
||||
and
|
||||
<span class="deletions"> {stats.deletions} deletion(s) </span>
|
||||
<span class="deletions">{stats.deletions} deletion(s)</span>
|
||||
</div>
|
||||
<div class="diff-listing">
|
||||
{#each diff.created as file}
|
||||
|
||||
@@ -126,7 +126,9 @@
|
||||
<Badge variant="negative">deleted</Badge>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="browse clickable" on:click|stopPropagation={() => dispatch("browse", file.path)}>
|
||||
<div
|
||||
class="browse clickable"
|
||||
on:click|stopPropagation={() => dispatch("browse", file.path)}>
|
||||
<span title="View file" style="transform: scale(1.25);">
|
||||
<Icon name="browse" />
|
||||
</span>
|
||||
@@ -145,14 +147,10 @@
|
||||
</tr>
|
||||
{#each hunk.lines as line}
|
||||
<tr class="diff-line" data-expanded data-type={lineSign(line)}>
|
||||
<td
|
||||
class="diff-line-number left"
|
||||
data-type={lineSign(line)}>
|
||||
<td class="diff-line-number left" data-type={lineSign(line)}>
|
||||
{lineNumberL(line)}
|
||||
</td>
|
||||
<td
|
||||
class="diff-line-number right"
|
||||
data-type={lineSign(line)}>
|
||||
<td class="diff-line-number right" data-type={lineSign(line)}>
|
||||
{lineNumberR(line)}
|
||||
</td>
|
||||
<td class="diff-line-type" data-type={line.type}>
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
import type { Tree } from "@app/project";
|
||||
import { ObjectType } from "@app/project";
|
||||
|
||||
import File from './Tree/File.svelte';
|
||||
import Folder from './Tree/Folder.svelte';
|
||||
import File from "./Tree/File.svelte";
|
||||
import Folder from "./Tree/Folder.svelte";
|
||||
|
||||
export let fetchTree: (path: string) => Promise<Tree>;
|
||||
export let path: string;
|
||||
@@ -26,14 +26,12 @@
|
||||
name={entry.info.name}
|
||||
prefix={`${entry.path}/`}
|
||||
currentPath={path}
|
||||
on:select={onSelect}
|
||||
/>
|
||||
on:select={onSelect} />
|
||||
{:else}
|
||||
<File
|
||||
active={entry.path === path}
|
||||
loading={entry.path === loadingPath}
|
||||
name={entry.info.name}
|
||||
on:click={() => onSelect({ detail: entry.path })}
|
||||
/>
|
||||
on:click={() => onSelect({ detail: entry.path })} />
|
||||
{/if}
|
||||
{/each}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import Loading from '@app/Loading.svelte';
|
||||
import Loading from "@app/Loading.svelte";
|
||||
|
||||
export let active: boolean;
|
||||
export let loading: boolean;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { createEventDispatcher } from "svelte";
|
||||
|
||||
import Loading from '@app/Loading.svelte';
|
||||
import Loading from "@app/Loading.svelte";
|
||||
import type { Tree } from "@app/project";
|
||||
import { ObjectType } from "@app/project";
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<script lang="ts">
|
||||
import type { Config } from '@app/config';
|
||||
import type { Config } from "@app/config";
|
||||
import { Route, Router } from "svelte-routing";
|
||||
import { Project, ProjectContent } from '@app/project';
|
||||
import Loading from '@app/Loading.svelte';
|
||||
import NotFound from '@app/NotFound.svelte';
|
||||
import { Project, ProjectContent } from "@app/project";
|
||||
import Loading from "@app/Loading.svelte";
|
||||
import NotFound from "@app/NotFound.svelte";
|
||||
|
||||
import ProjectRoute from "./ProjectRoute.svelte";
|
||||
|
||||
@@ -51,35 +51,82 @@
|
||||
<ProjectRoute content={ProjectContent.Tree} {peer} {project} {config} />
|
||||
</Route>
|
||||
<Route path="/tree/*" let:params let:location>
|
||||
<ProjectRoute route={params["*"]} content={ProjectContent.Tree} {location} {peer} {project} {config} />
|
||||
<ProjectRoute
|
||||
route={params["*"]}
|
||||
content={ProjectContent.Tree}
|
||||
{location}
|
||||
{peer}
|
||||
{project}
|
||||
{config} />
|
||||
</Route>
|
||||
|
||||
<Route path="/history">
|
||||
<ProjectRoute content={ProjectContent.History} {peer} {project} {config} />
|
||||
<ProjectRoute
|
||||
content={ProjectContent.History}
|
||||
{peer}
|
||||
{project}
|
||||
{config} />
|
||||
</Route>
|
||||
<Route path="/history/*" let:params let:location>
|
||||
<ProjectRoute route={params["*"]} content={ProjectContent.History} {location} {peer} {project} {config} />
|
||||
<ProjectRoute
|
||||
route={params["*"]}
|
||||
content={ProjectContent.History}
|
||||
{location}
|
||||
{peer}
|
||||
{project}
|
||||
{config} />
|
||||
</Route>
|
||||
|
||||
<Route path="/commits/:commit" let:params>
|
||||
<ProjectRoute revision={params.commit} content={ProjectContent.Commit} {peer} {project} {config} />
|
||||
<ProjectRoute
|
||||
revision={params.commit}
|
||||
content={ProjectContent.Commit}
|
||||
{peer}
|
||||
{project}
|
||||
{config} />
|
||||
</Route>
|
||||
<Route path="/commits/*" let:params let:location>
|
||||
<ProjectRoute route={params["*"]} content={ProjectContent.Commit} {location} {peer} {project} {config} />
|
||||
<ProjectRoute
|
||||
route={params["*"]}
|
||||
content={ProjectContent.Commit}
|
||||
{location}
|
||||
{peer}
|
||||
{project}
|
||||
{config} />
|
||||
</Route>
|
||||
|
||||
<Route path="/issues" let:location>
|
||||
<ProjectRoute content={ProjectContent.Issues} {peer} {project} {location} {config} />
|
||||
<ProjectRoute
|
||||
content={ProjectContent.Issues}
|
||||
{peer}
|
||||
{project}
|
||||
{location}
|
||||
{config} />
|
||||
</Route>
|
||||
<Route path="/issues/:issue" let:params let:location>
|
||||
<ProjectRoute content={ProjectContent.Issue} issue={params.issue} {peer} {project} {location} {config} />
|
||||
<ProjectRoute
|
||||
content={ProjectContent.Issue}
|
||||
issue={params.issue}
|
||||
{peer}
|
||||
{project}
|
||||
{location}
|
||||
{config} />
|
||||
</Route>
|
||||
|
||||
<Route path="/patches">
|
||||
<ProjectRoute content={ProjectContent.Patches} {peer} {project} {config} />
|
||||
<ProjectRoute
|
||||
content={ProjectContent.Patches}
|
||||
{peer}
|
||||
{project}
|
||||
{config} />
|
||||
</Route>
|
||||
<Route path="/patches/:patch" let:params>
|
||||
<ProjectRoute content={ProjectContent.Patch} patch={params.patch} {peer} {project} {config} />
|
||||
<ProjectRoute
|
||||
content={ProjectContent.Patch}
|
||||
patch={params.patch}
|
||||
{peer}
|
||||
{project}
|
||||
{config} />
|
||||
</Route>
|
||||
</Router>
|
||||
{:catch}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<script lang="ts">
|
||||
import type * as proj from '@app/project';
|
||||
import AnchorBadge from '@app/base/profiles/AnchorBadge.svelte';
|
||||
import Diagram from '@app/Diagram.svelte';
|
||||
import { groupCommitsByWeek } from '@app/commit';
|
||||
import type { Host } from '@app/api';
|
||||
import { Project } from '@app/project';
|
||||
import { formatCommit } from '@app/utils';
|
||||
import type * as proj from "@app/project";
|
||||
import AnchorBadge from "@app/base/profiles/AnchorBadge.svelte";
|
||||
import Diagram from "@app/Diagram.svelte";
|
||||
import { groupCommitsByWeek } from "@app/commit";
|
||||
import type { Host } from "@app/api";
|
||||
import { Project } from "@app/project";
|
||||
import { formatCommit } from "@app/utils";
|
||||
|
||||
export let project: proj.ProjectInfo;
|
||||
export let seed: { api: Host };
|
||||
@@ -101,13 +101,15 @@
|
||||
article .actions {
|
||||
margin-right: 1rem;
|
||||
}
|
||||
article .commit, article .actions {
|
||||
article .commit,
|
||||
article .actions {
|
||||
font-family: var(--font-family-monospace);
|
||||
}
|
||||
article.project-faded .anchor {
|
||||
color: var(--color-foreground-faded);
|
||||
}
|
||||
article .id, article .anchor {
|
||||
article .id,
|
||||
article .anchor {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
@@ -165,15 +167,16 @@
|
||||
<div class="anchor">
|
||||
<span class="anchor-info">
|
||||
<span class="actions">
|
||||
<slot name="actions">
|
||||
</slot>
|
||||
<slot name="actions" />
|
||||
</span>
|
||||
<span class="anchor-badge">
|
||||
<slot name="anchor">
|
||||
{#if anchor && project.head}
|
||||
<AnchorBadge
|
||||
commit={project.head}
|
||||
head={project.head} noText noBg
|
||||
head={project.head}
|
||||
noText
|
||||
noBg
|
||||
anchors={[anchor.anchor.stateHash]} />
|
||||
{/if}
|
||||
</slot>
|
||||
@@ -182,11 +185,11 @@
|
||||
</div>
|
||||
{#await loadCommits() then points}
|
||||
<div class="desktop activity">
|
||||
<Diagram {points}
|
||||
<Diagram
|
||||
{points}
|
||||
strokeWidth={3}
|
||||
viewBoxHeight={100}
|
||||
viewBoxWidth={600}
|
||||
/>
|
||||
viewBoxWidth={600} />
|
||||
</div>
|
||||
{/await}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user