Format *.ts, *.js, *.css, *.html, *.json and *.svelte

Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
This commit is contained in:
Rūdolfs Ošiņš
2022-08-31 17:47:07 +02:00
parent 687174a8e0
commit b3cec1f314
148 changed files with 4040 additions and 2555 deletions
+26 -12
View File
@@ -4,10 +4,7 @@
"browser": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2020,
@@ -25,18 +22,31 @@
"curly": ["error", "multi-line", "consistent"],
"keyword-spacing": ["error"],
"no-implicit-globals": ["error"],
"no-restricted-globals": ["error", "name", "event", "frames", "history", "length", "content", "origin", "status"],
"no-restricted-globals": [
"error",
"name",
"event",
"frames",
"history",
"length",
"content",
"origin",
"status"
],
"no-trailing-spaces": ["error"],
"no-multi-spaces": ["error"],
"no-multiple-empty-lines": ["error"],
"space-before-blocks": ["error"],
"object-curly-spacing": ["error", "always"],
"array-bracket-spacing": ["error", "never"],
"space-before-function-paren": ["error", {
"anonymous": "always",
"named": "never",
"asyncArrow": "always"
}],
"space-before-function-paren": [
"error",
{
"anonymous": "always",
"named": "never",
"asyncArrow": "always"
}
],
"eol-last": ["error"],
"key-spacing": ["error"],
"@typescript-eslint/object-curly-spacing": ["error", "always"],
@@ -77,7 +87,8 @@
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/semi": ["error"],
"@typescript-eslint/member-delimiter-style": [
"error", {
"error",
{
"multiline": {
"delimiter": "semi",
"requireLast": true
@@ -90,7 +101,10 @@
],
// Disallow Unused Variables.
// https://eslint.org/docs/rules/no-unused-vars
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
"@typescript-eslint/no-unused-vars": [
"error",
{ "argsIgnorePattern": "^_" }
],
// Require using arrow functions as callbacks.
// https://eslint.org/docs/rules/prefer-arrow-callback
"prefer-arrow-callback": "error",
+2 -7
View File
@@ -1,10 +1,5 @@
{
"all": true,
"extension": [
".svelte",
".ts"
],
"include": [
"src/**/*"
]
"extension": [".svelte", ".ts"],
"include": ["src/**/*"]
}
+29 -9
View File
@@ -3,17 +3,37 @@ import { MockExtensionProvider } from "../support/e2e";
describe("Landing page", () => {
it("Loads projects", () => {
cy.intercept("https://willow.radicle.garden:8777/", { fixture: "projectHome.json" });
cy.intercept("https://willow.radicle.garden:8777/v1/peer", { fixture: "projectPeer.json" });
cy.intercept("https://pine.radicle.garden:8777/", { fixture: "projectHome.json" });
cy.intercept("https://pine.radicle.garden:8777/v1/peer", { fixture: "projectPeer.json" });
cy.intercept("https://maple.radicle.garden:8777/", { fixture: "projectHome.json" });
cy.intercept("https://maple.radicle.garden:8777/v1/peer", { fixture: "projectPeer.json" });
cy.intercept("https://maple.radicle.garden:8777/v1/projects/*", { fixture: "projectInfo.json" });
cy.intercept({ pathname: "/v1/projects/*" }, { fixture: "projectInfo.json" });
cy.intercept("https://willow.radicle.garden:8777/", {
fixture: "projectHome.json",
});
cy.intercept("https://willow.radicle.garden:8777/v1/peer", {
fixture: "projectPeer.json",
});
cy.intercept("https://pine.radicle.garden:8777/", {
fixture: "projectHome.json",
});
cy.intercept("https://pine.radicle.garden:8777/v1/peer", {
fixture: "projectPeer.json",
});
cy.intercept("https://maple.radicle.garden:8777/", {
fixture: "projectHome.json",
});
cy.intercept("https://maple.radicle.garden:8777/v1/peer", {
fixture: "projectPeer.json",
});
cy.intercept("https://maple.radicle.garden:8777/v1/projects/*", {
fixture: "projectInfo.json",
});
cy.intercept(
{ pathname: "/v1/projects/*" },
{ fixture: "projectInfo.json" },
);
cy.visit("/", {
onBeforeLoad(win) {
win.ethereum = new MockExtensionProvider("homestead", "0x3256a804085C24f3451cAb2C98a37e16DEEc5721");
win.ethereum = new MockExtensionProvider(
"homestead",
"0x3256a804085C24f3451cAb2C98a37e16DEEc5721",
);
},
});
cy.get(".project .name")
+157 -67
View File
@@ -13,12 +13,12 @@ const groupedCommits = [
description: "",
committer: {
name: "dabit3",
mail: "dabit3@gmail.com"
mail: "dabit3@gmail.com",
},
committerTime: "06:51 GMT+1"
}
}
]
committerTime: "06:51 GMT+1",
},
},
],
},
{
groupDate: "Wednesday, March 2, 2022",
@@ -30,10 +30,10 @@ const groupedCommits = [
description: "",
committer: {
name: "dabit3",
mail: "dabit3@gmail.com"
mail: "dabit3@gmail.com",
},
committerTime: "17:14 GMT+1"
}
committerTime: "17:14 GMT+1",
},
},
{
header: {
@@ -42,37 +42,80 @@ const groupedCommits = [
description: "this is the first commit of many",
committer: {
name: "dabit3",
mail: "dabit3@gmail.com"
mail: "dabit3@gmail.com",
},
committerTime: "16:58 GMT+1"
}
}
]
}
committerTime: "16:58 GMT+1",
},
},
],
},
];
describe("Project view", () => {
beforeEach(() => {
cy.intercept("https://willow.radicle.garden:8777/", { fixture: "projectHome.json" });
cy.intercept("https://willow.radicle.garden:8777/v1/peer", { fixture: "projectPeer.json" });
cy.intercept("https://willow.radicle.garden:8777/v1/projects/bright-forest-protocol", { fixture: "projectInfo.json" });
cy.intercept("https://willow.radicle.garden:8777/v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy", { fixture: "projectInfo.json" });
cy.intercept("https://willow.radicle.garden:8777/v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/remotes", { fixture: "projectRemotes.json" });
cy.intercept("https://willow.radicle.garden:8777/v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/issues", { fixture: "projectIssues.json" });
cy.intercept("https://willow.radicle.garden:8777/v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/patches", { fixture: "projectPatches.json" });
cy.intercept("https://willow.radicle.garden:8777/v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/tree/56e4e029c294b08546386e1fb706b772c7433c49", { fixture: "projectTree56e4e02.json" });
cy.intercept("https://willow.radicle.garden:8777/v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/tree/cbf5df499ab4f4a908f1756fbe2c236a4530516a", { fixture: "projectTreecbf5df4.json" });
cy.intercept("https://willow.radicle.garden:8777/v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/remotes/hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke", { fixture: "projectBranches.json" });
cy.intercept("https://willow.radicle.garden:8777/v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/readme/56e4e029c294b08546386e1fb706b772c7433c49", { fixture: "projectReadme.json" });
cy.intercept("https://willow.radicle.garden:8777/v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/commits?parent=cbf5df499ab4f4a908f1756fbe2c236a4530516a?verified=true", { fixture: "projectCommits.json" });
cy.intercept("https://willow.radicle.garden:8777/v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/readme/cbf5df499ab4f4a908f1756fbe2c236a4530516a", { fixture: "projectReadme.json" });
cy.intercept("https://willow.radicle.garden:8777/v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/commits/cbf5df499ab4f4a908f1756fbe2c236a4530516a", { fixture: "projectCommit.json" });
cy.intercept("https://willow.radicle.garden:8777/", {
fixture: "projectHome.json",
});
cy.intercept("https://willow.radicle.garden:8777/v1/peer", {
fixture: "projectPeer.json",
});
cy.intercept(
"https://willow.radicle.garden:8777/v1/projects/bright-forest-protocol",
{ fixture: "projectInfo.json" },
);
cy.intercept(
"https://willow.radicle.garden:8777/v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy",
{ fixture: "projectInfo.json" },
);
cy.intercept(
"https://willow.radicle.garden:8777/v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/remotes",
{ fixture: "projectRemotes.json" },
);
cy.intercept(
"https://willow.radicle.garden:8777/v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/issues",
{ fixture: "projectIssues.json" },
);
cy.intercept(
"https://willow.radicle.garden:8777/v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/patches",
{ fixture: "projectPatches.json" },
);
cy.intercept(
"https://willow.radicle.garden:8777/v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/tree/56e4e029c294b08546386e1fb706b772c7433c49",
{ fixture: "projectTree56e4e02.json" },
);
cy.intercept(
"https://willow.radicle.garden:8777/v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/tree/cbf5df499ab4f4a908f1756fbe2c236a4530516a",
{ fixture: "projectTreecbf5df4.json" },
);
cy.intercept(
"https://willow.radicle.garden:8777/v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/remotes/hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke",
{ fixture: "projectBranches.json" },
);
cy.intercept(
"https://willow.radicle.garden:8777/v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/readme/56e4e029c294b08546386e1fb706b772c7433c49",
{ fixture: "projectReadme.json" },
);
cy.intercept(
"https://willow.radicle.garden:8777/v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/commits?parent=cbf5df499ab4f4a908f1756fbe2c236a4530516a?verified=true",
{ fixture: "projectCommits.json" },
);
cy.intercept(
"https://willow.radicle.garden:8777/v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/readme/cbf5df499ab4f4a908f1756fbe2c236a4530516a",
{ fixture: "projectReadme.json" },
);
cy.intercept(
"https://willow.radicle.garden:8777/v1/projects/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/commits/cbf5df499ab4f4a908f1756fbe2c236a4530516a",
{ fixture: "projectCommit.json" },
);
});
it("Page header", () => {
cy.visit("/seeds/willow.radicle.garden/bright-forest-protocol", {
onBeforeLoad(win) {
win.ethereum = new MockExtensionProvider("homestead", "0x3256a804085C24f3451cAb2C98a37e16DEEc5721");
win.ethereum = new MockExtensionProvider(
"homestead",
"0x3256a804085C24f3451cAb2C98a37e16DEEc5721",
);
},
});
cy.get("div.title").contains("bright-forest-protocol");
@@ -81,25 +124,41 @@ describe("Project view", () => {
});
it("Browser", () => {
cy.get("div.column-right article div.markdown h1").should("have.text", "Basic Sample Hardhat Project");
cy.get("div.column-right article div.markdown h1").should(
"have.text",
"Basic Sample Hardhat Project",
);
});
it("Project Header", () => {
cy.get("div.stat.seed span").should("have.text", "willow.radicle.garden");
cy.get("div.stat.commit-count").should("have.text", "3 commit(s)");
cy.get("div.stat.contributor-count").should("have.text", "1 contributor(s)");
cy.get("div.stat.branch").should("have.class", "not-allowed").should("have.text", "main");
cy.get("div.stat.commit-count").should("have.text", "3\n commit(s)");
cy.get("div.stat.contributor-count").should(
"have.text",
"1\n contributor(s)",
);
cy.get("div.stat.branch")
.should("have.class", "not-allowed")
.should("have.text", "main");
cy.get("div.hash.desktop").should("have.text", "56e4e02");
cy.get("div.clone-button").click();
});
it("Peer selector", () => {
cy.get("div.selector").click();
cy.get("div.dropdown-item").contains("dabit3 hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke delegate").click();
cy.location().should((location) => {
expect(location.pathname).to.eq('/seeds/willow.radicle.garden/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/remotes/hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke/tree');
cy.get("div.dropdown-item")
.contains(
"dabit3 hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke delegate",
)
.click();
cy.location().should(location => {
expect(location.pathname).to.eq(
"/seeds/willow.radicle.garden/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/remotes/hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke/tree",
);
});
cy.get("span.peer-id span[title='hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke']").should("have.text", "hyndc7…j9oeke");
cy.get(
"span.peer-id span[title='hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke']",
).should("have.text", "hyndc7…j9oeke");
cy.get("div.stat.peer span.peer-id").should("have.text", "dabit3");
cy.get("div.stat.peer span.badge").should("have.text", "delegate");
});
@@ -112,78 +171,109 @@ describe("Project view", () => {
.next()
.contains("master")
.click();
cy.location().should((location) => {
expect(location.pathname).to.eq('/seeds/willow.radicle.garden/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/remotes/hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke/tree/master');
cy.location().should(location => {
expect(location.pathname).to.eq(
"/seeds/willow.radicle.garden/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/remotes/hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke/tree/master",
);
});
cy.get("div.stat.branch").should("have.text", "master");
cy.get("div.hash.desktop").should("have.text", "cbf5df4");
});
it("Commits button", () => {
cy.get("div.stat.commit-count")
.should("not.have.class", "active")
.click();
cy.location().should((location) => {
expect(location.pathname).to.eq('/seeds/willow.radicle.garden/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/remotes/hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke/history/master');
cy.get("div.stat.commit-count").should("not.have.class", "active").click();
cy.location().should(location => {
expect(location.pathname).to.eq(
"/seeds/willow.radicle.garden/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/remotes/hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke/history/master",
);
});
cy.get("div.stat.commit-count").should("have.class", "active");
});
it("Commit group & commit trailer", () => {
// This iterates over the commit groups and then over each commit.
cy.get(".commit-group").should("have.length", 2)
cy.get(".commit-group")
.should("have.length", 2)
.each((item, index) => {
expect(Cypress.$(item.children(".commit-date")).text()).to.eq(groupedCommits[index].groupDate);
expect(Cypress.$(item.children(".commit-date")).text()).to.eq(
groupedCommits[index].groupDate,
);
const $el = Cypress.$(item.find(".commit-teaser"));
cy.wrap($el).each((commit, commitIndex) => {
expect(Cypress.$(commit).find(".hash").text()).to.eq(groupedCommits[index].commits[commitIndex].header.sha);
expect(Cypress.$(commit).find(".summary").text()).to.eq(groupedCommits[index].commits[commitIndex].header.summary);
expect(Cypress.$(commit).find(".committer").first().text()).to.eq(groupedCommits[index].commits[commitIndex].header.committer.name);
expect(Cypress.$(commit).find(".hash").text()).to.eq(
groupedCommits[index].commits[commitIndex].header.sha,
);
expect(Cypress.$(commit).find(".summary").text()).to.eq(
groupedCommits[index].commits[commitIndex].header.summary,
);
expect(Cypress.$(commit).find(".committer").first().text()).to.eq(
groupedCommits[index].commits[commitIndex].header.committer.name,
);
});
});
cy.get('.commit-teaser .badge').trigger('mouseenter');
cy.get(".commit-teaser .badge").trigger("mouseenter");
// Checking that the initial commit has the Verified badge
cy.get(".popup .header").should("have.text", "✔ This commit was signed\n with the committer's radicle key.");
cy.get(".popup .peer").should("contain.text", "hyyg555wwkkutaysg6yr67qnu5d5ji54iur3n5uzzszndh8dp7ofue");
cy.get(".popup .header").should(
"have.text",
"✔ This commit was signed\n with the committer's radicle key.",
);
cy.get(".popup .peer").should(
"contain.text",
"hyyg555wwkkutaysg6yr67qnu5d5ji54iur3n5uzzszndh8dp7ofue",
);
cy.get(".popup .committer").should("contain.text", "dabit3");
cy.get(".commit").last().click();
});
it("Commit detail view", () => {
cy.location().should((location) => {
expect(location.pathname).to.eq('/seeds/willow.radicle.garden/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/remotes/hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke/commits/cbf5df499ab4f4a908f1756fbe2c236a4530516a');
cy.location().should(location => {
expect(location.pathname).to.eq(
"/seeds/willow.radicle.garden/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/remotes/hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke/commits/cbf5df499ab4f4a908f1756fbe2c236a4530516a",
);
});
cy.get("header .summary .text-medium").should("have.text", "initial commit");
cy.get("header pre.description").should("have.text", "this is the first commit of many");
cy.get("header .summary .text-medium").should(
"have.text",
"initial commit",
);
cy.get("header pre.description").should(
"have.text",
"this is the first commit of many",
);
cy.get("header .committer").should("have.text", "dabit3");
cy.get("div.changeset-summary").should("have.text", "1 file(s) changed, 1 file(s) created, 1 file(s) deleted\n with\n 0 addition(s)\n and\n 0 deletion(s)");
cy.get("div.changeset-summary").should(
"have.text",
"1 file(s) changed, 1 file(s) created, 1 file(s) deleted\n with\n 0 addition(s)\n and\n 0 deletion(s)",
);
cy.get("header.file-header:nth-child(1) p.file-path")
.first()
.should("have.text", "test.md")
.next()
.should("have.text", "created");
cy.get("tr.diff-line td.diff-line-number").contains("16");
cy.get("tr.diff-line td.diff-line-content").contains("To prevent front-running, the RAD/USDC balances are set through the Uniswap router *proxy* contract");
cy.get("tr.diff-line td.diff-line-content").contains(
"To prevent front-running, the RAD/USDC balances are set through the Uniswap router *proxy* contract",
);
});
it("Issues button", () => {
cy.get("div.stat.issue-count")
.click();
cy.location().should((location) => {
expect(location.pathname).to.eq('/seeds/willow.radicle.garden/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/remotes/hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke/issues');
cy.get("div.stat.issue-count").click();
cy.location().should(location => {
expect(location.pathname).to.eq(
"/seeds/willow.radicle.garden/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/remotes/hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke/issues",
);
});
cy.get("div.stat.issue-count").should("have.class", "active");
});
it("Patches button", () => {
cy.get("div.stat.patch-count")
.click();
cy.location().should((location) => {
expect(location.pathname).to.eq('/seeds/willow.radicle.garden/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/remotes/hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke/patches');
cy.get("div.stat.patch-count").click();
cy.location().should(location => {
expect(location.pathname).to.eq(
"/seeds/willow.radicle.garden/rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy/remotes/hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke/patches",
);
});
cy.get("div.stat.patch-count").should("have.class", "active");
});
});
+1 -3
View File
@@ -5,9 +5,7 @@
"content": "did:3:kjzl6cwe1jw1481xu9oyww9bhmueqr8f5uryk4xha9jzhj6vi063e0blpnil383",
"metadata": {
"family": "caip10-eip155:1",
"controllers": [
"0x5e813e48a81977c6fdd565ed5097eb600c73c4f0@eip155:1"
]
"controllers": ["0x5e813e48a81977c6fdd565ed5097eb600c73c4f0@eip155:1"]
},
"signature": 2,
"anchorStatus": "ANCHORED",
+1 -4
View File
@@ -142,8 +142,5 @@
}
]
},
"branches": [
"main",
"master"
]
"branches": ["main", "master"]
}
+1 -3
View File
@@ -7,9 +7,7 @@
{
"type": "indirect",
"urn": "rad:git:hnrkqz68g6nddigodpgjmc1u8ydpzb8fqq8ro",
"ids": [
"hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke"
]
"ids": ["hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke"]
}
],
"head": "56e4e029c294b08546386e1fb706b772c7433c49",
+6 -18
View File
@@ -27,18 +27,12 @@
}
},
"body": "We should define the scope we want to test in integration vs component testing (I don't mention E2E here on purpose since in our E2E tests we stubbed all responses and never hit a real server which equals to integration testing).\n\nWhile integration testing allows us to traverse the application and test navigation, component testing allows us to mount a component in isolation and check all the possible edge cases and possible regressions, and unit testing goes one step further to just individual functions on their correctness.\n\nIntegration testing npm run test:e2e eventually should be npm run test:integration\n\n**Connection through mocked Web3Provider**\n- Navigation through different URLs (e.g. the project pages, commits, issues, patches, etc.)\n- Assert the URLs we're hitting and that they update correctly, when state changes\n- Assert the least amount of display logic (we should leave that to component testing)\n If we are able to navigate to the correct URL and get the correct props, we shouldn't need to assert every piece of text.\nComponent testing npm run test:components\n\n- Assert the correct rendering\n- Test that the state of the component updates accordingly where applicable.\n**Unit tests npm run test:unit**\n\n- Util functions\nClasses (static and methods)\nI'll keep updating this issue.\nP.S.: Testing is not my expertise so any feedback is welcome.",
"reactions": {
},
"reactions": {},
"replies": null,
"timestamp": 1656509367
},
"discussion": [
],
"labels": [
"discussion"
],
"discussion": [],
"labels": ["discussion"],
"timestamp": 1656509367
},
{
@@ -69,18 +63,12 @@
}
},
"body": "We should define the scope we want to test in integration vs component testing (I don't mention E2E here on purpose since in our E2E tests we stubbed all responses and never hit a real server which equals to integration testing).\n\nWhile integration testing allows us to traverse the application and test navigation, component testing allows us to mount a component in isolation and check all the possible edge cases and possible regressions, and unit testing goes one step further to just individual functions on their correctness.\n\nIntegration testing npm run test:e2e eventually should be npm run test:integration\n\n**Connection through mocked Web3Provider**\n- Navigation through different URLs (e.g. the project pages, commits, issues, patches, etc.)\n- Assert the URLs we're hitting and that they update correctly, when state changes\n- Assert the least amount of display logic (we should leave that to component testing)\n If we are able to navigate to the correct URL and get the correct props, we shouldn't need to assert every piece of text.\nComponent testing npm run test:components\n\n- Assert the correct rendering\n- Test that the state of the component updates accordingly where applicable.\n**Unit tests npm run test:unit**\n\n- Util functions\nClasses (static and methods)\nI'll keep updating this issue.\nP.S.: Testing is not my expertise so any feedback is welcome.",
"reactions": {
},
"reactions": {},
"replies": null,
"timestamp": 1656509367
},
"discussion": [
],
"labels": [
"discussion"
],
"discussion": [],
"labels": ["discussion"],
"timestamp": 1656509367
}
]
+16 -16
View File
@@ -1,16 +1,16 @@
[{
"urn": "rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy",
"name": "mocked-seed-protocol",
"description": "bfc-sc",
"defaultBranch": "main",
"delegates": [
{
"type": "indirect",
"urn": "rad:git:hnrkqz68g6nddigodpgjmc1u8ydpzb8fqq8ro",
"ids": [
"hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke"
]
}
],
"head": "56e4e029c294b08546386e1fb706b772c7433c49"
}]
[
{
"urn": "rad:git:hnrk8mbpirp7ua7sy66o4t9soasbq4y8uwgoy",
"name": "mocked-seed-protocol",
"description": "bfc-sc",
"defaultBranch": "main",
"delegates": [
{
"type": "indirect",
"urn": "rad:git:hnrkqz68g6nddigodpgjmc1u8ydpzb8fqq8ro",
"ids": ["hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke"]
}
],
"head": "56e4e029c294b08546386e1fb706b772c7433c49"
}
]
+1 -3
View File
@@ -29,9 +29,7 @@
}
},
"body": "Signed-off-by: Sebastian Martinez <me@sebastinez.dev>",
"reactions": {
},
"reactions": {},
"replies": null,
"timestamp": 1656666433
},
+1 -1
View File
@@ -1,4 +1,4 @@
import '@testing-library/cypress/add-commands';
import "@testing-library/cypress/add-commands";
import { Buffer } from "buffer";
//@ts-expect-error We need Buffer on the window object in the test env for component testing
+65 -36
View File
@@ -1,8 +1,8 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import '@cypress/code-coverage/support';
import { JsonRpcProvider, JsonRpcSigner } from '@ethersproject/providers';
import '@testing-library/cypress/add-commands';
import { BigNumber, ethers } from 'ethers';
import "@cypress/code-coverage/support";
import { JsonRpcProvider, JsonRpcSigner } from "@ethersproject/providers";
import "@testing-library/cypress/add-commands";
import { BigNumber, ethers } from "ethers";
import { Resolver } from "@ethersproject/providers";
declare global {
@@ -27,7 +27,11 @@ export class MockExtensionProvider extends ethers.providers.BaseProvider {
}
getSigner(addressOrIndex?: string | number): JsonRpcSigner {
return new JsonRpcSigner({}, this as unknown as JsonRpcProvider, addressOrIndex);
return new JsonRpcSigner(
{},
this as unknown as JsonRpcProvider,
addressOrIndex,
);
}
async getResolver(name: string): Promise<null | Resolver> {
@@ -35,7 +39,9 @@ export class MockExtensionProvider extends ethers.providers.BaseProvider {
return new Resolver(this, address, name, address);
}
async lookupAddress(address: string | Promise<string>): Promise<string | null> {
async lookupAddress(
address: string | Promise<string>,
): Promise<string | null> {
return "mock.eth";
}
@@ -44,27 +50,33 @@ export class MockExtensionProvider extends ethers.providers.BaseProvider {
this.emit("accountsChanged", [address]);
}
async request({ method, params }: { method: string; params: any }): Promise<any> {
async request({
method,
params,
}: {
method: string;
params: any;
}): Promise<any> {
switch (method) {
case 'eth_chainId':
case "eth_chainId":
return this.network.chainId;
case 'net_version':
case "net_version":
return this.network.chainId;
case 'eth_call':
case "eth_call":
return resolveEthCall(params);
case 'eth_accounts':
case "eth_accounts":
return [this.currentAddress];
case 'eth_requestAccounts':
case "eth_requestAccounts":
return [this.currentAddress];
case 'eth_getCode':
case "eth_getCode":
return "0x";
case 'eth_blockNumber':
case "eth_blockNumber":
return BigNumber.from(1);
case 'eth_estimateGas':
case "eth_estimateGas":
return BigNumber.from(21000);
case 'eth_sendTransaction':
case "eth_sendTransaction":
return "0x8829dea7e20ebcf6dbfd942e3613d7ac49b9aef3ecbed396acfc5901713f5983";
case 'eth_getTransactionByHash':
case "eth_getTransactionByHash":
return {
hash: "0x8829dea7e20ebcf6dbfd942e3613d7ac49b9aef3ecbed396acfc5901713f5983",
to: "0x0000000000000000000000000000000000000000",
@@ -76,26 +88,29 @@ export class MockExtensionProvider extends ethers.providers.BaseProvider {
value: BigNumber.from(0),
chainId: 4,
};
case 'eth_getTransactionCount':
case "eth_getTransactionCount":
return BigNumber.from(123);
case 'eth_getTransactionReceipt':
case "eth_getTransactionReceipt":
return {
to: '0x01139F82659A3bD56D1f051D57D4Bc96a3b9Ef05',
from: '0x00192Fb10dF37c9FB26829eb2CC623cd1BF599E8',
to: "0x01139F82659A3bD56D1f051D57D4Bc96a3b9Ef05",
from: "0x00192Fb10dF37c9FB26829eb2CC623cd1BF599E8",
contractAddress: null,
transactionIndex: 338,
gasUsed: BigNumber.from('0x5208'),
logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
blockHash: '0xdbe7ca0dd26310cd5415202c67467d46795cfec922dbb47e4cc4ff388e7856d2',
transactionHash: '0x8829dea7e20ebcf6dbfd942e3613d7ac49b9aef3ecbed396acfc5901713f5983',
gasUsed: BigNumber.from("0x5208"),
logsBloom:
"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
blockHash:
"0xdbe7ca0dd26310cd5415202c67467d46795cfec922dbb47e4cc4ff388e7856d2",
transactionHash:
"0x8829dea7e20ebcf6dbfd942e3613d7ac49b9aef3ecbed396acfc5901713f5983",
logs: [],
blockNumber: 14451272,
confirmations: 53,
cumulativeGasUsed: BigNumber.from('0x01b11d57'),
effectiveGasPrice: BigNumber.from('0x0dffd03ca0'),
cumulativeGasUsed: BigNumber.from("0x01b11d57"),
effectiveGasPrice: BigNumber.from("0x0dffd03ca0"),
status: 1,
type: 2,
byzantium: true
byzantium: true,
};
default:
console.debug("Unknown method", method);
@@ -110,19 +125,33 @@ function resolveEthCall(params: { to: string; data: string }[]): string {
// Get Resolver
if (to === "0x00000000000c2e074ec69a0dfb2997ba6c7d2e1e") {
return "0x0000000000000000000000004976fb03c32e5b8cfe2b6ccb31c09ba78ebaba41";
// Get ENS Attributes
} else if (to === "0x4976fb03c32e5b8cfe2b6ccb31c09ba78ebaba41" && data === "0x59d1d43c567c364804de7bbedb53f583e483f6b73513fd2f44299e281024e4719da0b332000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000066176617461720000000000000000000000000000000000000000000000000000") {
// Get ENS Attributes
} else if (
to === "0x4976fb03c32e5b8cfe2b6ccb31c09ba78ebaba41" &&
data ===
"0x59d1d43c567c364804de7bbedb53f583e483f6b73513fd2f44299e281024e4719da0b332000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000066176617461720000000000000000000000000000000000000000000000000000"
) {
return "0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001f68747470733a2f2f636c6f7564686561642e696f2f6176617461722e706e6700";
// Get Org informations
} else if (to === "0x8152237402e0f194176154c3a6ea1eb99b611482" && data === "0x8da5cb5b") {
// Get Org informations
} else if (
to === "0x8152237402e0f194176154c3a6ea1eb99b611482" &&
data === "0x8da5cb5b"
) {
return "0x000000000000000000000000ceab094641905c209cc796fc8037dd9ecc87ca2f";
// Get Token Balance
} else if (to === "0x31c8eacbffdd875c74b94b077895bd78cf1e64a3" && data === "0x70a082310000000000000000000000003256a804085c24f3451cab2c98a37e16deec5721") {
} else if (
to === "0x31c8eacbffdd875c74b94b077895bd78cf1e64a3" &&
data ===
"0x70a082310000000000000000000000003256a804085c24f3451cab2c98a37e16deec5721"
) {
return "0x00000000000000000000000000000000000000000000000246DDF97976680000";
// getMaxWithdrawAmount
} else if (to === "0x9aa75397ed632a3060acb5de7f96e2457bceed8d" && data === "0xf516440c") {
// getMaxWithdrawAmount
} else if (
to === "0x9aa75397ed632a3060acb5de7f96e2457bceed8d" &&
data === "0xf516440c"
) {
return "0x000000000000000000000000000000000000000000000001D7D843DC3B480000";
// Get resolved address from ENS
// Get resolved address from ENS
} else if (to === "0x4976fb03c32e5b8cfe2b6ccb31c09ba78ebaba41") {
return "0x000000000000000000000000394b920c5d39e0ca40fca2871569b6b90d750c7c";
// Return 0 for token balances else
+19 -7
View File
@@ -3,21 +3,33 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="name" content="Radicle Interface">
<meta name="name" content="Radicle Interface" />
<meta name="description" content="Interact with Radicle" />
<meta name="theme-color" content="#0e171f">
<meta name="theme-color" content="#0e171f" />
<meta property="og:title" content="Radicle Interface" />
<meta property="og:description" content="Interact with Radicle." />
<meta property="og:url" content="https://app.radicle.xyz" />
<meta property="og:image" content="https://app.radicle.xyz/images/app.png" />
<meta
property="og:image"
content="https://app.radicle.xyz/images/app.png" />
<meta property="og:image:width" content="240" />
<meta property="og:image:height" content="240" />
<meta property="og:type" content="website" />
<link rel="stylesheet" type="text/css" href="/index.css" />
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
<link rel="icon" href="/favicon.ico">
<link rel="preload" href="/fonts/Inter-Regular.woff" as="font" type="font/woff" crossorigin="anonymous">
<link rel="preload" href="/fonts/Inter-SemiBold.otf" as="font" type="font/otf" crossorigin="anonymous">
<link rel="icon" href="/favicon.svg" type="image/svg+xml" />
<link rel="icon" href="/favicon.ico" />
<link
rel="preload"
href="/fonts/Inter-Regular.woff"
as="font"
type="font/woff"
crossorigin="anonymous" />
<link
rel="preload"
href="/fonts/Inter-SemiBold.otf"
as="font"
type="font/otf"
crossorigin="anonymous" />
<script type="text/javascript">
// Workaround to get `global` to work in old-school transitive
// dependencies.
+274 -259
View File
@@ -1,109 +1,109 @@
@import url(./typography.css);
* {
outline: none !important;
box-sizing: border-box;
outline: none !important;
box-sizing: border-box;
}
:root {
--color-primary: #ff55ff;
--color-primary-1: #382847;
--color-primary-2: #62326d;
--color-primary-5: #dd44dd;
--color-primary-6: #ffd4ff;
--color-primary-faded: #ff55ff77;
--color-primary-background: #ff55ff11;
--color-primary-background-lighter: #ff55ff22;
--color-secondary: #5555ff;
--color-secondary-background: #5555ff11;
--color-secondary-background-darker: #5555ff09;
--color-secondary-faded: #5555ff77;
--color-secondary-darker: #4343cc;
--color-secondary-1: #212847;
--color-secondary-2: #2c326d;
--color-secondary-6: #e3e3ff;
--color-tertiary: #55ffff;
--color-tertiary-faded: #ade4e4;
--color-tertiary-background: #55ffff11;
--color-tertiary-1: #214047;
--color-tertiary-2: #2c326d;
--color-tertiary-6: #e3e3ff;
--color-light: #add0e4;
--color-yellow: #ffff99;
--color-yellow-background: #ffff9911;
--color-yellow-background-solid: #222929;
--color-yellow-background-lighter: #ffff9922;
--color-positive: #53db53;
--color-positive-background: #53db5311;
--color-positive-1: #11332b;
--color-positive-2: #2c6837;
--color-positive-6: #e3ffe3;
--color-caution: #ffc555;
--color-caution-1: #2f312d;
--color-caution-2: #524a34;
--color-caution-6: #ffefcf;
--color-negative: #ff5555;
--color-negative-background: #ff555511;
--color-negative-1: #35202b;
--color-negative-2: #623237;
--color-negative-6: #ffd4d4;
--color-foreground: #ffffff;
--color-foreground-90: #ddddee;
--color-foreground-80: #aaaab6;
--color-foreground-70: #9999aa;
--color-foreground-faded: #777788;
--color-foreground-subtle: #444455;
--color-foreground-subtler: #333344;
--color-foreground-even-subtler: #292936;
--color-foreground-background: #121a21;
--color-foreground-background-subtle: #10171e;
--color-foreground-background-lighter: #151f24;
--color-foreground-1: #242e38;
--color-foreground-2: #29343d;
--color-foreground-3: #333e47;
--color-foreground-4: #5e6d7a;
--color-foreground-5: #8594a1;
--color-foreground-6: #d3dee8;
--color-background: #0b131a;
--color-shadow: rgba(0, 0, 0, 0.2);
--color-glow: #5555ff22;
--color-glow-error: #ff555522;
--color-scrollbar: var(--color-foreground-subtler);
--color-primary: #ff55ff;
--color-primary-1: #382847;
--color-primary-2: #62326d;
--color-primary-5: #dd44dd;
--color-primary-6: #ffd4ff;
--color-primary-faded: #ff55ff77;
--color-primary-background: #ff55ff11;
--color-primary-background-lighter: #ff55ff22;
--color-secondary: #5555ff;
--color-secondary-background: #5555ff11;
--color-secondary-background-darker: #5555ff09;
--color-secondary-faded: #5555ff77;
--color-secondary-darker: #4343cc;
--color-secondary-1: #212847;
--color-secondary-2: #2c326d;
--color-secondary-6: #e3e3ff;
--color-tertiary: #55ffff;
--color-tertiary-faded: #ade4e4;
--color-tertiary-background: #55ffff11;
--color-tertiary-1: #214047;
--color-tertiary-2: #2c326d;
--color-tertiary-6: #e3e3ff;
--color-light: #add0e4;
--color-yellow: #ffff99;
--color-yellow-background: #ffff9911;
--color-yellow-background-solid: #222929;
--color-yellow-background-lighter: #ffff9922;
--color-positive: #53db53;
--color-positive-background: #53db5311;
--color-positive-1: #11332b;
--color-positive-2: #2c6837;
--color-positive-6: #e3ffe3;
--color-caution: #ffc555;
--color-caution-1: #2f312d;
--color-caution-2: #524a34;
--color-caution-6: #ffefcf;
--color-negative: #ff5555;
--color-negative-background: #ff555511;
--color-negative-1: #35202b;
--color-negative-2: #623237;
--color-negative-6: #ffd4d4;
--color-foreground: #ffffff;
--color-foreground-90: #ddddee;
--color-foreground-80: #aaaab6;
--color-foreground-70: #9999aa;
--color-foreground-faded: #777788;
--color-foreground-subtle: #444455;
--color-foreground-subtler: #333344;
--color-foreground-even-subtler: #292936;
--color-foreground-background: #121a21;
--color-foreground-background-subtle: #10171e;
--color-foreground-background-lighter: #151f24;
--color-foreground-1: #242e38;
--color-foreground-2: #29343d;
--color-foreground-3: #333e47;
--color-foreground-4: #5e6d7a;
--color-foreground-5: #8594a1;
--color-foreground-6: #d3dee8;
--color-background: #0b131a;
--color-shadow: rgba(0, 0, 0, 0.2);
--color-glow: #5555ff22;
--color-glow-error: #ff555522;
--color-scrollbar: var(--color-foreground-subtler);
--font-family-sans-serif: Inter, sans-serif;
--font-family-monospace: monospace;
--font-weight-medium: 600;
--font-weight-bold: 700;
--border-radius: 0.75rem;
--border-radius-small: 0.5rem;
--border-radius-round: 10rem;
--box-shadow-color: var(--color-secondary-2);
--font-family-sans-serif: Inter, sans-serif;
--font-family-monospace: monospace;
--font-weight-medium: 600;
--font-weight-bold: 700;
--border-radius: 0.75rem;
--border-radius-small: 0.5rem;
--border-radius-round: 10rem;
--box-shadow-color: var(--color-secondary-2);
--content-max-width: 1920px;
--content-min-width: 480px;
--content-max-width: 1920px;
--content-min-width: 480px;
--scrollbar-width: 0.5rem;
--scrollbar-width: 0.5rem;
--button-regular-height: 2.5rem;
--button-small-height: 2rem;
--button-tiny-height: 1.5rem;
--button-regular-height: 2.5rem;
--button-small-height: 2rem;
--button-tiny-height: 1.5rem;
}
body {
font-size: 16px;
font-weight: 400;
line-height: 1.5;
min-width: var(--content-min-width);
height: 100%;
margin: 0;
padding: 0;
color: white;
text-align: left;
background-color: var(--color-background);
-webkit-font-smoothing: antialiased;
scrollbar-width: thin;
scrollbar-height: thin;
scrollbar-color: var(--color-scrollbar) transparent;
font-size: 16px;
font-weight: 400;
line-height: 1.5;
min-width: var(--content-min-width);
height: 100%;
margin: 0;
padding: 0;
color: white;
text-align: left;
background-color: var(--color-background);
-webkit-font-smoothing: antialiased;
scrollbar-width: thin;
scrollbar-height: thin;
scrollbar-color: var(--color-scrollbar) transparent;
}
@media (max-width: 720px) {
@@ -113,250 +113,262 @@ body {
}
html {
height: 100%;
overflow-y: scroll;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
-ms-overflow-style: scrollbar;
-webkit-tap-highlight-color: transparent;
height: 100%;
overflow-y: scroll;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
-ms-overflow-style: scrollbar;
-webkit-tap-highlight-color: transparent;
}
::-moz-selection {
background: var(--color-primary);
color: var(--color-background);
background: var(--color-primary);
color: var(--color-background);
}
::selection {
background: var(--color-primary);
color: var(--color-background);
background: var(--color-primary);
color: var(--color-background);
}
/* Chrome/Edge/Safari scrollbar */
*::-webkit-scrollbar {
width: var(--scrollbar-width);
height: var(--scrollbar-width);
width: var(--scrollbar-width);
height: var(--scrollbar-width);
}
*::-webkit-scrollbar-track {
background: transparent;
background: transparent;
}
*::-webkit-scrollbar-thumb {
background: transparent;
border-radius: var(--border-radius);
background: transparent;
border-radius: var(--border-radius);
}
*::-webkit-scrollbar-corner {
background: transparent;
background: transparent;
}
*:hover::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb {
background-color: var(--color-scrollbar);
background-color: var(--color-scrollbar);
}
.error::selection, .error ::selection {
background: var(--color-negative);
.error::selection,
.error ::selection {
background: var(--color-negative);
}
code {
font-family: monospace;
font-size: 0.95rem;
font-family: monospace;
font-size: 0.95rem;
}
main, section {
display: block;
main,
section {
display: block;
}
body, input, textarea, button {
font-family: var(--font-family-sans-serif);
font-feature-settings: "ss01", "ss02", "cv01", "cv03";
body,
input,
textarea,
button {
font-family: var(--font-family-sans-serif);
font-feature-settings: "ss01", "ss02", "cv01", "cv03";
}
button {
color: var(--color-foreground-6);
background: transparent;
font-size: 1rem;
padding: 0rem 1.5rem;
border: 1px solid var(--color-foreground-6);
border-radius: var(--border-radius-round);
cursor: pointer;
min-width: 6rem;
height: var(--button-regular-height);
display: inline-flex;
align-items: center;
justify-content: center;
color: var(--color-foreground-6);
background: transparent;
font-size: 1rem;
padding: 0rem 1.5rem;
border: 1px solid var(--color-foreground-6);
border-radius: var(--border-radius-round);
cursor: pointer;
min-width: 6rem;
height: var(--button-regular-height);
display: inline-flex;
align-items: center;
justify-content: center;
}
button:not([disabled]):hover {
color: var(--color-background);
background-color: var(--color-foreground);
border-color: transparent;
color: var(--color-background);
background-color: var(--color-foreground);
border-color: transparent;
}
button.waiting {
cursor: wait;
cursor: wait;
}
button.secondary {
color: var(--color-secondary);
border-color: var(--color-secondary);
color: var(--color-secondary);
border-color: var(--color-secondary);
}
button.secondary[disabled] {
color: var(--color-secondary-faded);
border-color: var(--color-secondary-faded);
color: var(--color-secondary-faded);
border-color: var(--color-secondary-faded);
}
button.secondary:not([disabled]):hover {
background-color: var(--color-secondary);
background-color: var(--color-secondary);
}
button.primary {
color: var(--color-primary);
border-color: var(--color-primary);
color: var(--color-primary);
border-color: var(--color-primary);
}
button.primary:hover, button.primary.active {
color: var(--color-background);
background-color: var(--color-primary);
button.primary:hover,
button.primary.active {
color: var(--color-background);
background-color: var(--color-primary);
}
button.primary[disabled] {
color: var(--color-primary-faded) !important;
border-color: var(--color-primary-faded) !important;
background-color: transparent;
color: var(--color-primary-faded) !important;
border-color: var(--color-primary-faded) !important;
background-color: transparent;
}
button.faded {
color: var(--color-foreground-90);
border-color: var(--color-foreground-90);
color: var(--color-foreground-90);
border-color: var(--color-foreground-90);
}
button[disabled] {
cursor: not-allowed !important;
color: var(--color-foreground-faded);
border-color: var(--color-foreground-faded);
cursor: not-allowed !important;
color: var(--color-foreground-faded);
border-color: var(--color-foreground-faded);
}
button[data-waiting] {
cursor: wait !important;
cursor: wait !important;
}
button.unstyled, button.unstyled:hover, button.unstyled:focus {
padding: 0;
margin: 0;
min-width: 0;
border: none;
color: var(--color-foreground);
background: transparent;
button.unstyled,
button.unstyled:hover,
button.unstyled:focus {
padding: 0;
margin: 0;
min-width: 0;
border: none;
color: var(--color-foreground);
background: transparent;
}
button.text {
color: var(--color-foreground-6);
background-color: transparent;
border: none;
min-width: 3rem;
color: var(--color-foreground-6);
background-color: transparent;
border: none;
min-width: 3rem;
}
button.text:hover {
background-color: var(--color-foreground);
background-color: var(--color-foreground);
}
button.regular {
padding-top: 0.5rem;
padding-bottom: 0.5rem;
min-width: 6rem;
height: var(--button-regular-height);
padding-top: 0.5rem;
padding-bottom: 0.5rem;
min-width: 6rem;
height: var(--button-regular-height);
}
button.small {
min-width: auto;
padding: 0 0.75rem;
height: 2rem;
min-width: auto;
padding: 0 0.75rem;
height: 2rem;
}
a {
color: inherit;
text-decoration: none;
color: inherit;
text-decoration: none;
}
a.link {
color: #d0d0d0;
text-decoration: none;
border-bottom: 1px dashed #444;
color: #d0d0d0;
text-decoration: none;
border-bottom: 1px dashed #444;
}
a.link:hover {
color: var(--color-foreground);
border-bottom-color: var(--color-foreground);
color: var(--color-foreground);
border-bottom-color: var(--color-foreground);
}
a.link.primary {
color: var(--color-primary);
border-bottom-color: var(--color-primary-faded);
color: var(--color-primary);
border-bottom-color: var(--color-primary-faded);
}
a.link.primary:hover {
color: var(--color-primary-faded);
border-bottom-color: var(--color-primary-faded);
color: var(--color-primary-faded);
border-bottom-color: var(--color-primary-faded);
}
a.address {
border-bottom-color: transparent;
border-bottom-color: transparent;
}
input[type="text"], button {
line-height: 1.6;
input[type="text"],
button {
line-height: 1.6;
}
input[type="text"] {
outline: none;
border: none;
font-size: 1rem;
color: var(--color-foreground);
background: transparent;
border: 1px solid var(--color-secondary);
border-radius: var(--border-radius-round);
padding: 1rem 1.5rem;
margin: 1rem;
height: var(--button-regular-height);
outline: none;
border: none;
font-size: 1rem;
color: var(--color-foreground);
background: transparent;
border: 1px solid var(--color-secondary);
border-radius: var(--border-radius-round);
padding: 1rem 1.5rem;
margin: 1rem;
height: var(--button-regular-height);
}
input[type="text"]::placeholder {
color: var(--color-secondary);
opacity: 1 !important;
color: var(--color-secondary);
opacity: 1 !important;
}
input[type="text"].small {
font-size: 0.875rem;
font-size: 0.875rem;
}
input.wide {
width: 44ch;
width: 44ch;
}
label.input {
text-align: left;
display: block;
text-align: left;
display: block;
}
.error {
color: var(--color-negative) !important;
border-color: var(--color-negative) !important;
--box-shadow-color: var(--color-negative-2) !important;
color: var(--color-negative) !important;
border-color: var(--color-negative) !important;
--box-shadow-color: var(--color-negative-2) !important;
}
.error-message {
background-color: var(--color-negative-background);
word-wrap: break-word;
text-overflow: ellipsis;
overflow-x: hidden;
padding: 1rem;
background-color: var(--color-negative-background);
word-wrap: break-word;
text-overflow: ellipsis;
overflow-x: hidden;
padding: 1rem;
}
.highlight, .secondary, .label {
color: var(--color-secondary);
.highlight,
.secondary,
.label {
color: var(--color-secondary);
}
.subtle {
color: var(--color-foreground-faded);
font-style: italic;
color: var(--color-foreground-faded);
font-style: italic;
}
.faded {
color: var(--color-foreground-faded);
color: var(--color-foreground-faded);
}
.bold {
font-weight: bold !important;
font-weight: bold !important;
}
.yellow {
color: var(--color-yellow);
background: var(--color-yellow-background-solid);
color: var(--color-yellow);
background: var(--color-yellow-background-solid);
}
.off-centered {
height: 100%;
padding-top: 5rem;
padding-bottom: 24vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100%;
padding-top: 5rem;
padding-bottom: 24vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.font-mono {
font-family: var(--font-family-monospace);
}
.mobile, .mobile-inline {
.mobile,
.mobile-inline {
display: none !important;
}
.desktop {
@@ -373,75 +385,78 @@ label.input {
.mobile-inline {
display: inline !important;
}
.desktop, .desktop-inline {
.desktop,
.desktop-inline {
display: none !important;
}
}
span.align {
display: flex;
align-items: center;
justify-content: flex-start;
display: flex;
align-items: center;
justify-content: flex-start;
}
span.small, .text-xsmall {
font-size: 0.75rem;
span.small,
.text-xsmall {
font-size: 0.75rem;
}
.text-small {
font-size: 0.875rem;
font-size: 0.875rem;
}
.text-medium {
font-size: 1.25rem;
font-size: 1.25rem;
}
.text-big {
font-size: 1.5rem;
font-size: 1.5rem;
}
.text-truncate {
white-space: nowrap;
text-overflow: ellipsis;
overflow-x: hidden;
white-space: nowrap;
text-overflow: ellipsis;
overflow-x: hidden;
}
.text-faded {
color: var(--color-foreground-faded);
color: var(--color-foreground-faded);
}
button.error:hover {
color: var(--color-background);
background-color: var(--color-negative);
color: var(--color-background);
background-color: var(--color-negative);
}
table {
table-layout: fixed;
border-collapse: separate;
border-spacing: 2rem 0;
table-layout: fixed;
border-collapse: separate;
border-spacing: 2rem 0;
}
td {
text-align: left;
text-overflow: ellipsis;
text-align: left;
text-overflow: ellipsis;
}
td strong {
font-weight: 600;
font-weight: 600;
}
h1, .title {
font-size: 1.75rem;
font-weight: normal;
color: var(--color-secondary);
text-align: left;
text-overflow: ellipsis;
overflow-x: hidden;
h1,
.title {
font-size: 1.75rem;
font-weight: normal;
color: var(--color-secondary);
text-align: left;
text-overflow: ellipsis;
overflow-x: hidden;
}
h1 {
margin-bottom: 2rem;
margin-bottom: 2rem;
}
h2 {
margin: 1.5rem 0;
margin: 1.5rem 0;
}
h3 {
margin: 1rem 0;
margin: 1rem 0;
}
p {
margin: 1rem 0;
margin: 1rem 0;
}
+23 -23
View File
@@ -1,37 +1,37 @@
@font-face {
font-family: "Inter";
font-style: normal;
font-weight: 400;
font-display: swap;
src: url("fonts/Inter-Regular.woff");
font-family: "Inter";
font-style: normal;
font-weight: 400;
font-display: swap;
src: url("fonts/Inter-Regular.woff");
}
@font-face {
font-family: "Inter";
font-style: bold;
font-weight: 600;
font-display: swap;
src: url("fonts/Inter-SemiBold.otf");
font-family: "Inter";
font-style: bold;
font-weight: 600;
font-display: swap;
src: url("fonts/Inter-SemiBold.otf");
}
@font-face {
font-family: "Inter";
font-style: bolder;
font-weight: 700;
font-display: swap;
src: url("fonts/Inter-Bold.otf");
font-family: "Inter";
font-style: bolder;
font-weight: 700;
font-display: swap;
src: url("fonts/Inter-Bold.otf");
}
@font-face {
font-family: "Source Code Pro";
font-style: bold;
font-weight: 600;
src: url("fonts/SourceCodePro-Semibold.otf");
font-family: "Source Code Pro";
font-style: bold;
font-weight: 600;
src: url("fonts/SourceCodePro-Semibold.otf");
}
@font-face {
font-family: "Source Code Pro";
font-style: bold;
font-weight: 700;
src: url("fonts/SourceCodePro-Bold.otf");
font-family: "Source Code Pro";
font-style: bold;
font-weight: 700;
src: url("fonts/SourceCodePro-Bold.otf");
}
+33 -14
View File
@@ -1,12 +1,19 @@
<script lang="ts">
import { onMount } from 'svelte';
import { link } from 'svelte-routing';
import { ethers } from 'ethers';
import { safeLink, explorerLink, identifyAddress, formatAddress, AddressType, parseEnsLabel } from '@app/utils';
import { Profile, ProfileType } from '@app/profile';
import { onMount } from "svelte";
import { link } from "svelte-routing";
import { ethers } from "ethers";
import {
safeLink,
explorerLink,
identifyAddress,
formatAddress,
AddressType,
parseEnsLabel,
} from "@app/utils";
import { Profile, ProfileType } from "@app/profile";
import Avatar from "@app/Avatar.svelte";
import Badge from "@app/Badge.svelte";
import type { Config } from '@app/config';
import type { Config } from "@app/config";
export let address: string;
export let config: Config;
@@ -25,18 +32,27 @@
const nameOrAddress = profile?.ens?.name || address;
onMount(async () => {
if (! profile) {
identifyAddress(address, config).then((t: AddressType) => addressType = t);
if (!profile) {
identifyAddress(address, config).then(
(t: AddressType) => (addressType = t),
);
if (resolve) {
Profile.get(address, ProfileType.Minimal, config).then(p => profile = p);
Profile.get(address, ProfileType.Minimal, config).then(
p => (profile = p),
);
}
} else {
// If there is a profile we can use the profile.type to avoid identifying it again.
addressType = profile.type;
}
});
$: addressLabel = resolve && profile?.name ? compact ? parseEnsLabel(profile.name, config) : profile.name : checksumAddress;
$: addressLabel =
resolve && profile?.name
? compact
? parseEnsLabel(profile.name, config)
: profile.name
: checksumAddress;
$: checksumAddress = compact
? formatAddress(address)
: ethers.utils.getAddress(address);
@@ -65,15 +81,17 @@
}
</style>
<div class="address" title={address}
<div
class="address"
title={address}
class:text-small={small}
class:text-xsmall={xsmall}
class:highlight>
{#if !noAvatar}
{#if resolve && profile?.avatar}
<Avatar inline source={profile.avatar} title={address}/>
<Avatar inline source={profile.avatar} title={address} />
{:else}
<Avatar inline source={address} title={address}/>
<Avatar inline source={address} title={address} />
{/if}
{/if}
<div class="wrapper">
@@ -94,7 +112,8 @@
{/if}
{:else if addressType === AddressType.EOA}
<a use:link href={`/${nameOrAddress}`}>{addressLabel}</a>
{:else} <!-- While we're waiting to find out what address type it is -->
{:else}
<!-- While we're waiting to find out what address type it is -->
<a href={explorerLink(address, config)} target="_blank">{addressLabel}</a>
{/if}
</div>
+24 -24
View File
@@ -1,21 +1,21 @@
<script lang="ts">
import { Router, Route } from "svelte-routing";
import { getConfig } from '@app/config';
import { Connection, state, session } from '@app/session';
import { getConfig } from "@app/config";
import { Connection, state, session } from "@app/session";
import Home from '@app/base/home/Index.svelte';
import Vesting from '@app/base/vesting/Index.svelte';
import Registrations from '@app/base/registrations/Routes.svelte';
import Orgs from '@app/base/orgs/Routes.svelte';
import Users from '@app/base/users/Routes.svelte';
import Seeds from '@app/base/seeds/Routes.svelte';
import Faucet from '@app/base/faucet/Routes.svelte';
import Projects from '@app/base/projects/Routes.svelte';
import Profile from '@app/Profile.svelte';
import Resolver from '@app/base/resolver/Routes.svelte';
import Header from '@app/Header.svelte';
import Loading from '@app/Loading.svelte';
import Modal from '@app/Modal.svelte';
import Home from "@app/base/home/Index.svelte";
import Vesting from "@app/base/vesting/Index.svelte";
import Registrations from "@app/base/registrations/Routes.svelte";
import Orgs from "@app/base/orgs/Routes.svelte";
import Users from "@app/base/users/Routes.svelte";
import Seeds from "@app/base/seeds/Routes.svelte";
import Faucet from "@app/base/faucet/Routes.svelte";
import Projects from "@app/base/projects/Routes.svelte";
import Profile from "@app/Profile.svelte";
import Resolver from "@app/base/resolver/Routes.svelte";
import Header from "@app/Header.svelte";
import Loading from "@app/Loading.svelte";
import Modal from "@app/Modal.svelte";
import LinearGradient from "@app/LinearGradient.svelte";
const loadConfig = getConfig().then(async cfg => {
@@ -34,9 +34,10 @@
});
function handleKeydown(event: KeyboardEvent) {
if (event.key === 'Enter') {
const elems = document.querySelectorAll<HTMLElement>('button.primary');
if (elems.length === 1) { // We only allow this when there's one primary button.
if (event.key === "Enter") {
const elems = document.querySelectorAll<HTMLElement>("button.primary");
if (elems.length === 1) {
// We only allow this when there's one primary button.
elems[0].click();
}
}
@@ -48,11 +49,7 @@
height: 100%;
display: flex;
flex-direction: column;
background: linear-gradient(
180deg,
#181a38 0%,
transparent 100%
);
background: linear-gradient(180deg, #181a38 0%, transparent 100%);
background-repeat: no-repeat;
background-size: 100% 6rem;
}
@@ -68,7 +65,10 @@
<svelte:head>
<title>Radicle</title>
{#if import.meta.env.PROD}
<script defer data-domain="app.radicle.xyz" src="https://plausible.io/js/plausible.js"></script>
<script
defer
data-domain="app.radicle.xyz"
src="https://plausible.io/js/plausible.js"></script>
{/if}
</svelte:head>
+2 -1
View File
@@ -12,7 +12,8 @@
<div class="commit">
<div class="error error-message text-xsmall">
<div>
API request to <code class="text-xsmall">{err.url}</code> failed.
API request to <code class="text-xsmall">{err.url}</code>
failed.
</div>
</div>
</div>
+13 -2
View File
@@ -15,7 +15,11 @@
onMount(async () => {
if (author.profile?.ens?.name) {
profile = await Profile.get(author.profile.ens.name, ProfileType.Minimal, config);
profile = await Profile.get(
author.profile.ens.name,
ProfileType.Minimal,
config,
);
}
});
</script>
@@ -42,7 +46,14 @@
<span class="authorship text-xsmall">
{#if profile}
<Address
xsmall highlight resolve noBadge compact {noAvatar} {config} {profile}
xsmall
highlight
resolve
noBadge
compact
{noAvatar}
{config}
{profile}
address={profile.address} />
{:else if author.profile}
<span class="highlight">
+10 -4
View File
@@ -1,6 +1,6 @@
<script lang="ts">
import { createIcon } from '@app/blockies';
import { isAddress, isPeerId, isRadicleId } from '@app/utils';
import { createIcon } from "@app/blockies";
import { isAddress, isPeerId, isRadicleId } from "@app/utils";
export let title: string;
export let source: string;
@@ -56,5 +56,11 @@
</style>
<!-- svelte-ignore a11y-missing-attribute -->
<img {title} src={source} class="avatar" on:error={handleMissingFile}
class:inline class:grayscale class:glowOnHover />
<img
{title}
src={source}
class="avatar"
on:error={handleMissingFile}
class:inline
class:grayscale
class:glowOnHover />
+31 -21
View File
@@ -3,8 +3,7 @@ import { render } from "@testing-library/svelte";
import "@public/index.css";
import type { EventType, Listener } from "@ethersproject/abstract-provider";
describe('BlockTimer', () => {
describe("BlockTimer", () => {
it("increases correctly the loading bar", () => {
let block = 1;
const props = {
@@ -14,33 +13,44 @@ describe('BlockTimer', () => {
if (event === "block") {
listener(block);
}
}
}
},
},
},
startBlock: 1,
duration: 3
duration: 3,
};
const { rerender } = render(BlockTimer, props);
cy.get("div.loader").should("have.attr", "style", "width: 0%;").then(() => {
block += 1;
rerender(props);
});
cy.get("div.loader")
.should("have.attr", "style", "width: 0%;")
.then(() => {
block += 1;
rerender(props);
});
cy.get("div.loader").last().should("have.attr", "style", "width: 33%;").then(() => {
block += 1;
rerender(props);
});
cy.get("div.loader")
.last()
.should("have.attr", "style", "width: 33%;")
.then(() => {
block += 1;
rerender(props);
});
cy.get("div.loader").last().should("have.attr", "style", "width: 66%;").then(() => {
block += 1;
rerender(props);
});
cy.get("div.loader")
.last()
.should("have.attr", "style", "width: 66%;")
.then(() => {
block += 1;
rerender(props);
});
cy.get("div.loader").last().should("have.attr", "style", "width: 99%;").then(() => {
block += 1;
rerender(props);
});
cy.get("div.loader")
.last()
.should("have.attr", "style", "width: 99%;")
.then(() => {
block += 1;
rerender(props);
});
});
});
+4 -1
View File
@@ -29,5 +29,8 @@
</style>
<div class="parent">
<div class="loader" style="width: {(currentBlock - startBlock) * Math.floor(100 / duration)}%" />
<div
class="loader"
style="width: {(currentBlock - startBlock) *
Math.floor(100 / duration)}%" />
</div>
+20 -15
View File
@@ -1,18 +1,21 @@
<script lang="ts">
import { onMount } from 'svelte';
import { Link } from 'svelte-routing';
import Avatar from '@app/Avatar.svelte';
import type { Profile } from '@app/profile';
import type { Config } from '@app/config';
import { formatName, formatAddress } from '@app/utils';
import type { Seed } from '@app/base/seeds/Seed';
import Loading from '@app/Loading.svelte';
import { onMount } from "svelte";
import { Link } from "svelte-routing";
import Avatar from "@app/Avatar.svelte";
import type { Profile } from "@app/profile";
import type { Config } from "@app/config";
import { formatName, formatAddress } from "@app/utils";
import type { Seed } from "@app/base/seeds/Seed";
import Loading from "@app/Loading.svelte";
export let profile: Profile | {
address: string;
avatar?: string;
name?: string;
} | null = null;
export let profile:
| Profile
| {
address: string;
avatar?: string;
name?: string;
}
| null = null;
export let seed: Seed | null = null;
export let config: Config;
export let path: string;
@@ -43,7 +46,7 @@
.card::last-child {
margin-right: 0;
}
.card:hover {
.card:hover {
background: var(--color-foreground-background-lighter);
}
.card-avatar {
@@ -88,7 +91,9 @@
<div class="card" class:seed={!!seed}>
<div class="card-avatar">
{#if profile}
<Avatar source={profile.avatar ?? profile.address} title={profile.address} />
<Avatar
source={profile.avatar ?? profile.address}
title={profile.address} />
{:else if seed}
<span class="seed-emoji">
{seed.emoji}
+35 -28
View File
@@ -1,10 +1,10 @@
<script lang="ts">
import { onMount } from 'svelte';
import { Profile, ProfileType } from '@app/profile';
import Card from '@app/Card.svelte';
import type { Org } from '@app/base/orgs/Org';
import type { Config } from '@app/config';
import type { Seed } from '@app/base/seeds/Seed';
import { onMount } from "svelte";
import { Profile, ProfileType } from "@app/profile";
import Card from "@app/Card.svelte";
import type { Org } from "@app/base/orgs/Org";
import type { Config } from "@app/config";
import type { Seed } from "@app/base/seeds/Seed";
export let config: Config;
export let orgs: Org[] = [];
@@ -37,28 +37,35 @@
}
</style>
<div class="list">
{#each orgs as org}
{#await Profile.get(org.name ?? org.address, ProfileType.Minimal, config)}
<Card profile={{ address: org.address }} {config} path={`/${org.address}`} />
{:then profile}
{#if orgMembers[profile.address]?.length}
<Card {profile} {config} path={`/${profile.nameOrAddress}`} members={orgMembers[profile.address]} />
{:else}
<Card {profile} {config} path={`/${profile.nameOrAddress}`} />
{/if}
{/await}
{/each}
<div class="list">
{#each orgs as org}
{#await Profile.get(org.name ?? org.address, ProfileType.Minimal, config)}
<Card
profile={{ address: org.address }}
{config}
path={`/${org.address}`} />
{:then profile}
{#if orgMembers[profile.address]?.length}
<Card
{profile}
{config}
path={`/${profile.nameOrAddress}`}
members={orgMembers[profile.address]} />
{:else}
<Card {profile} {config} path={`/${profile.nameOrAddress}`} />
{/if}
{/await}
{/each}
{#each profiles as profile}
<Card {profile} {config} path={`/${profile.nameOrAddress}`} />
{/each}
{#each profiles as profile}
<Card {profile} {config} path={`/${profile.nameOrAddress}`} />
{/each}
{#each seeds as seed}
<Card {seed} {config} path={`/seeds/${seed.host}`} />
{/each}
{#each seeds as seed}
<Card {seed} {config} path={`/seeds/${seed.host}`} />
{/each}
{#if !orgs.length && !profiles.length && !seeds.length}
<slot />
{/if}
</div>
{#if !orgs.length && !profiles.length && !seeds.length}
<slot />
{/if}
</div>
+2 -2
View File
@@ -1,6 +1,6 @@
<script lang="ts">
import Icon from '@app/Icon.svelte';
import { toClipboard } from '@app/utils';
import Icon from "@app/Icon.svelte";
import { toClipboard } from "@app/utils";
import { createEventDispatcher } from "svelte";
const dispatch = createEventDispatcher();
+13 -6
View File
@@ -20,15 +20,18 @@
onMount(async () => {
if (comment.author.profile?.ens?.name) {
profile = await Profile.get(comment.author.profile.ens.name, ProfileType.Minimal, config);
profile = await Profile.get(
comment.author.profile.ens.name,
ProfileType.Minimal,
config,
);
}
});
$: source = profile?.avatar || comment.author.urn;
$: title = profile?.name ||
(comment.author.profile
? comment.author.profile.name
: comment.author.urn);
$: title =
profile?.name ||
(comment.author.profile ? comment.author.profile.name : comment.author.urn);
const selectReaction = (event: { detail: string }) => {
// TODO: Once we allow adding reactions through the http-api, we should call it here.
@@ -78,7 +81,11 @@
</div>
<div class="card">
<div class="card-header">
<Authorship noAvatar {config} {caption} {profile}
<Authorship
noAvatar
{config}
{caption}
{profile}
author={comment.author}
timestamp={comment.timestamp} />
<ReactionSelector on:select={selectReaction} />
+14 -8
View File
@@ -1,9 +1,9 @@
<script lang="ts">
import { get } from "svelte/store";
import { Connection, state } from "@app/session";
import type { Err } from '@app/error';
import Error from '@app/Error.svelte';
import type { Config } from '@app/config';
import type { Err } from "@app/error";
import Error from "@app/Error.svelte";
import type { Config } from "@app/config";
import ConnectWallet from "@app/components/Modal/ConnectWallet.svelte";
export let caption = "Connect";
@@ -39,8 +39,7 @@
{style}
class="connect {className}"
disabled={connecting}
data-waiting={connecting || null}
>
data-waiting={connecting || null}>
{#if connecting}
Connecting...
{:else}
@@ -49,8 +48,15 @@
</button>
{#if $walletConnectState.state === "open"}
<ConnectWallet {config} uri={$walletConnectState.uri} on:close={onModalClose} />
<ConnectWallet
{config}
uri={$walletConnectState.uri}
on:close={onModalClose} />
{:else if error}
<Error floating emoji="👛" title="Connection failed" {error} on:close={() => error = null} />
<Error
floating
emoji="👛"
title="Connection failed"
{error}
on:close={() => (error = null)} />
{/if}
+46 -20
View File
@@ -39,32 +39,43 @@
function createPath() {
let i = 1;
if (commitCountArray.length < 52) commitCountArray.push(...new Array(52 - commitCountArray.length).fill(0));
if (commitCountArray.length < 52) {
commitCountArray.push(...new Array(52 - commitCountArray.length).fill(0));
}
const maxValue = Math.max(...commitCountArray);
const minValue = Math.min(...commitCountArray);
// Normalizes the values to the viewBox dimensions
const normalizedArray =
commitCountArray.map(c => {
// If we are not crossing the `viewBoxHeight` we want to return the actual value,
// and don't want to normalize <`minimalHeight` commit counts as huge spikes.
if (maxValue < viewBoxHeight && c >= minimalHeight) { return c; }
// If the value is 0..minimalHeight though we don't want to set it to the minimalHeight.
else if (c > 0 && c < minimalHeight) { return minimalHeight; }
// If the count is 0 we have to make sure the normalization is not being run since it would return NaN
else { return c === 0 ? 0 : (viewBoxHeight - 0) * (c - minValue) / (maxValue - minValue); }
});
const normalizedArray = commitCountArray.map(c => {
// If we are not crossing the `viewBoxHeight` we want to return the actual value,
// and don't want to normalize <`minimalHeight` commit counts as huge spikes.
if (maxValue < viewBoxHeight && c >= minimalHeight) {
return c;
}
// If the value is 0..minimalHeight though we don't want to set it to the minimalHeight.
else if (c > 0 && c < minimalHeight) {
return minimalHeight;
}
// If the count is 0 we have to make sure the normalization is not being run since it would return NaN
else {
return c === 0
? 0
: ((viewBoxHeight - 0) * (c - minValue)) / (maxValue - minValue);
}
});
const path = normalizedArray
.slice(1)
.reduce((acc, curr) => {
const s = `${viewBoxWidth - widthIteration * i},${viewBoxHeight - curr}`;
const path = normalizedArray.slice(1).reduce(
(acc, curr) => {
const s = `${viewBoxWidth - widthIteration * i},${
viewBoxHeight - curr
}`;
lastWidthPoint = viewBoxWidth - widthIteration * i;
i += 1;
return acc.concat(s);
},
[`M${viewBoxWidth},${viewBoxHeight - normalizedArray[0]}`]);
[`M${viewBoxWidth},${viewBoxHeight - normalizedArray[0]}`],
);
return path.join();
}
@@ -72,11 +83,15 @@
// Creates the stroke path with the array of points
path = createPath();
// Concats a path closing for it to be the area under the stroke
areaPath = path.concat(`L${lastWidthPoint},${viewBoxHeight}L${viewBoxWidth},${viewBoxHeight}Z`);
areaPath = path.concat(
`L${lastWidthPoint},${viewBoxHeight}L${viewBoxWidth},${viewBoxHeight}Z`,
);
});
</script>
<svg viewBox="0 0 {viewBoxWidth} {heightWithPadding}" xmlns="http://www.w3.org/2000/svg">
<svg
viewBox="0 0 {viewBoxWidth} {heightWithPadding}"
xmlns="http://www.w3.org/2000/svg">
<svg style="height: 0; width: 0;" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient id="fillGradient" x1="0" y1="1" x2="0" y2="0">
@@ -87,11 +102,22 @@
</svg>
{#if points.length > 0}
<g>
<path fill="transparent" stroke="url(#gradient)" stroke-width={strokeWidth} stroke-linejoin="round" d={path} />
<path
fill="transparent"
stroke="url(#gradient)"
stroke-width={strokeWidth}
stroke-linejoin="round"
d={path} />
<path fill="url(#fillGradient)" stroke="transparent" d={areaPath} />
</g>
{:else}
<!-- If no commits have been made in a year, we show a straight line -->
<line x1="0" y1={viewBoxHeight} x2="600" y2={viewBoxHeight} stroke="#ff55ff" stroke-width={1} />
<line
x1="0"
y1={viewBoxHeight}
x2="600"
y2={viewBoxHeight}
stroke="#ff55ff"
stroke-width={1} />
{/if}
</svg>
+15 -4
View File
@@ -2,7 +2,12 @@
import { createEventDispatcher } from "svelte";
import Badge from "@app/Badge.svelte";
export let items: { key: string; title: string; value: string; badge: string | null }[];
export let items: {
key: string;
title: string;
value: string;
badge: string | null;
}[];
export let selected: string | null = null;
const dispatch = createEventDispatcher();
@@ -30,7 +35,8 @@
align-items: center;
gap: 0.5rem;
}
.dropdown-item:hover, .selected {
.dropdown-item:hover,
.selected {
background-color: var(--color-foreground-background-lighter);
}
@media (max-width: 720px) {
@@ -42,9 +48,14 @@
</style>
<div class="dropdown">
{#each items as {key, value, badge, title}}
{#each items as { key, value, badge, title }}
{#if key && value}
<div class="dropdown-item" class:selected={value === selected} on:click={() => onSelect(value)} {title}>{@html key}
<div
class="dropdown-item"
class:selected={value === selected}
on:click={() => onSelect(value)}
{title}>
{@html key}
{#if badge}
<Badge variant="primary">{badge}</Badge>
{/if}
+26 -20
View File
@@ -1,18 +1,20 @@
import Error from "./Error.svelte";
import { render } from "@testing-library/svelte";
import { Failure } from '@app/error';
import { Failure } from "@app/error";
import "@public/index.css";
describe('Error', () => {
describe("Error", () => {
it("should show passed in props", () => {
render(Error, { props: {
subtitle: "Subtitle of Modal",
error: {
type: Failure.InsufficientBalance,
txHash: "0x8b678e51f970c5307bf45a8bcea373b597f9acbcea5c5ba784a1d383361a89d1",
message: "Not enough RAD"
}
}
render(Error, {
props: {
subtitle: "Subtitle of Modal",
error: {
type: Failure.InsufficientBalance,
txHash:
"0x8b678e51f970c5307bf45a8bcea373b597f9acbcea5c5ba784a1d383361a89d1",
message: "Not enough RAD",
},
},
});
cy.findByText("Error");
cy.findByText("Subtitle of Modal");
@@ -21,20 +23,24 @@ describe('Error', () => {
});
it("should show custom error message", () => {
render(Error, { props: {
subtitle: "Subtitle of Modal",
message: "Error message to check for",
} });
render(Error, {
props: {
subtitle: "Subtitle of Modal",
message: "Error message to check for",
},
});
cy.findByText("Error message to check for");
});
it("should change button label to Close when floating", () => {
render(Error, { props: {
title: "Title of Modal",
subtitle: "Subtitle of Modal",
message: "Error message to check for",
floating: true
} });
render(Error, {
props: {
title: "Title of Modal",
subtitle: "Subtitle of Modal",
message: "Error message to check for",
floating: true,
},
});
cy.findByText("Close");
});
});
+6 -5
View File
@@ -1,7 +1,7 @@
<script lang="ts">
import { createEventDispatcher } from 'svelte';
import Modal from '@app/Modal.svelte';
import type { Err } from '@app/error';
import { createEventDispatcher } from "svelte";
import Modal from "@app/Modal.svelte";
import type { Err } from "@app/error";
const dispatch = createEventDispatcher();
@@ -31,13 +31,14 @@
<span slot="body">
<slot>
<strong>Error:</strong> {body}
<strong>Error:</strong>
{body}
</slot>
</span>
<span slot="actions">
<slot name="actions">
<button on:click={() => dispatch('close')}>
<button on:click={() => dispatch("close")}>
{action}
</button>
</slot>
+2 -2
View File
@@ -14,13 +14,13 @@
let thisComponent: HTMLDivElement;
function clickOutside(ev: MouseEvent) {
if (! $focused?.contains(ev.target as HTMLDivElement)) {
if (!$focused?.contains(ev.target as HTMLDivElement)) {
closeFocused();
}
}
function toggle() {
if (! disabled) {
if (!disabled) {
expanded = !expanded;
if ($focused === thisComponent) {
closeFocused();
+62 -41
View File
@@ -14,13 +14,13 @@
}
const validationExamples: Record<string, string> = {
"URL": "https://acme.xyz/",
"URN": "eip155:1:0xd1bb21bd5a432d2919c82bcefe1bc7f8cc9207d9",
"handle": "acme",
"id": "hydkkcf6k9be5fuszdhpqbctu3q3fuwagj874wx2puia8ti8coygh1",
"identity": "rad:git:hnrkqdpm9ub19oc8dccx44echy75hzfsezyio",
"domain": "seed.acme.xyz",
"address": "0x17a8c096733BD5F87aD43D7A2A4d1C42ab8A2A70",
URL: "https://acme.xyz/",
URN: "eip155:1:0xd1bb21bd5a432d2919c82bcefe1bc7f8cc9207d9",
handle: "acme",
id: "hydkkcf6k9be5fuszdhpqbctu3q3fuwagj874wx2puia8ti8coygh1",
identity: "rad:git:hnrkqdpm9ub19oc8dccx44echy75hzfsezyio",
domain: "seed.acme.xyz",
address: "0x17a8c096733BD5F87aD43D7A2A4d1C42ab8A2A70",
};
const validationTypes: { [index: string]: RegExp } = {
@@ -45,11 +45,11 @@
<script lang="ts">
import { link } from "svelte-routing";
import { createEventDispatcher } from 'svelte';
import { marked } from 'marked';
import { capitalize, isUrl, isAddress, formatSeedId } from '@app/utils';
import Address from '@app/Address.svelte';
import type { Config } from '@app/config';
import { createEventDispatcher } from "svelte";
import { marked } from "marked";
import { capitalize, isUrl, isAddress, formatSeedId } from "@app/utils";
import Address from "@app/Address.svelte";
import type { Config } from "@app/config";
export let fields: Field[];
export let editable = false;
@@ -65,12 +65,14 @@
formFields = formFields.map(field => {
if (field.name === name && field.validate) {
hasErrors = value.length > 0 ? !validationTypes[field.validate].test(value) : false;
return { ...field,
hasErrors =
value.length > 0
? !validationTypes[field.validate].test(value)
: false;
return {
...field,
value: value,
error: hasErrors
? `Must be a valid ${field.validate}`
: undefined,
error: hasErrors ? `Must be a valid ${field.validate}` : undefined,
example: validationExamples[field.validate],
};
}
@@ -79,20 +81,22 @@
};
const cleanup = (fields: Field[]): { name: string; value?: string }[] => {
return fields.filter(field => field.editable).map(field => {
return {
name: field.name,
// We only allow to have a trueish value or an empty string.
value: field.value ? field.value.trim() : "",
};
});
return fields
.filter(field => field.editable)
.map(field => {
return {
name: field.name,
// We only allow to have a trueish value or an empty string.
value: field.value ? field.value.trim() : "",
};
});
};
const dispatch = createEventDispatcher();
const save = () => dispatch('save', cleanup(formFields));
const validate = (event: Event) => dispatch('validate', check(event));
const save = () => dispatch("save", cleanup(formFields));
const validate = (event: Event) => dispatch("validate", check(event));
const cancel = () => {
formFields = fields;
dispatch('cancel');
dispatch("cancel");
};
</script>
@@ -184,28 +188,43 @@
</div>
<div>
{#if field.editable && editable}
<input name={field.name} class="field" placeholder={field.placeholder}
on:change={validate} on:input={() => field.error = null}
value={field.value || ""} type="text" {disabled} />
<input
name={field.name}
class="field"
placeholder={field.placeholder}
on:change={validate}
on:input={() => (field.error = null)}
value={field.value || ""}
type="text"
{disabled} />
{:else}
<span class="field">
{#if field.value}
{#if isUrl(field.value)}
<span class="ellipsis">
<a class="link" href="{field.value}" target="_blank">{field.value}</a>
<a class="link" href={field.value} target="_blank">
{field.value}
</a>
</span>
{:else if isAddress(field.value)}
<div class="desktop-inline">
<Address resolve={field.resolve ?? false} address={field.value} {config} />
<Address
resolve={field.resolve ?? false}
address={field.value}
{config} />
</div>
<div class="mobile-inline">
<Address compact resolve={field.resolve ?? false} address={field.value} {config} />
<Address
compact
resolve={field.resolve ?? false}
address={field.value}
{config} />
</div>
{:else if (field.url)}
{:else if field.url}
<div>
<a class="link" use:link href="{field.url}">{field.value}</a>
<a class="link" use:link href={field.url}>{field.value}</a>
</div>
{:else if (field.validate === "id")}
{:else if field.validate === "id"}
<div class="mobile">
{formatSeedId(field.value)}
</div>
@@ -223,7 +242,8 @@
{#if field.error}
<div class="description invalid text-small faded">
{#if field.example}
{field.error}, eg. <em>{field.example}</em>
{field.error}, eg.
<em>{field.example}</em>
{:else}
{field.error}
{/if}
@@ -238,10 +258,11 @@
</div>
<div class="actions" class:editable>
<button on:click={cancel} {disabled} class="regular">
Cancel
</button>
<button on:click={save} disabled={hasErrors || disabled} class="regular primary">
<button on:click={cancel} {disabled} class="regular">Cancel</button>
<button
on:click={save}
disabled={hasErrors || disabled}
class="regular primary">
Save
</button>
</div>
+40 -30
View File
@@ -1,16 +1,16 @@
<script lang="ts">
import { link } from "svelte-routing";
import { formatAddress, formatBalance } from "@app/utils";
import { error, Failure } from '@app/error';
import { error, Failure } from "@app/error";
import { disconnectWallet } from "@app/session";
import type { Session } from '@app/session';
import Loading from '@app/Loading.svelte';
import Logo from '@app/Logo.svelte';
import Connect from '@app/Connect.svelte';
import type { Config } from '@app/config';
import type { Session } from "@app/session";
import Loading from "@app/Loading.svelte";
import Logo from "@app/Logo.svelte";
import Connect from "@app/Connect.svelte";
import type { Config } from "@app/config";
import { Profile, ProfileType } from "@app/profile";
import Avatar from '@app/Avatar.svelte';
import Search from '@app/Search.svelte';
import Avatar from "@app/Avatar.svelte";
import Search from "@app/Search.svelte";
import Floating from "@app/Floating.svelte";
import Icon from "./Icon.svelte";
import MobileNavbar from "./MobileNavbar.svelte";
@@ -37,12 +37,13 @@
align-items: center;
margin: 0;
padding: 1.5rem;
height: 5.5rem;
height: 5.5rem;
}
header .left, header .right {
header .left,
header .right {
display: flex;
align-items: center;
height: var(--button-regular-height);
height: var(--button-regular-height);
}
header .nav {
display: inline-block;
@@ -68,8 +69,8 @@
.logo {
display: flex;
height: var(--button-regular-height);
align-items: center;
height: var(--button-regular-height);
align-items: center;
}
.error {
text-align: center;
@@ -131,8 +132,11 @@
div.toggle {
display: none;
}
@media(max-width: 720px) {
.network, .search, header .nav, .balance {
@media (max-width: 720px) {
.network,
.search,
header .nav,
.balance {
display: none;
}
div.toggle {
@@ -152,9 +156,13 @@
{#if $error.type === Failure.TransactionFailed}
<div class="error">
{#if $error.message}
<strong>Error:</strong> {$error.message}
<strong>Error:</strong>
{$error.message}
{:else if $error.txHash}
<strong>Error:</strong> Transaction <a href="https://etherscan.io/tx/{$error.txHash}">{$error.txHash}</a> failed.
<strong>Error:</strong>
Transaction
<a href="https://etherscan.io/tx/{$error.txHash}">{$error.txHash}</a>
failed.
{/if}
</div>
{/if}
@@ -172,9 +180,7 @@
{#if session && Object.keys(session.siwe).length > 0}
<span class="seeds-container">
<Floating>
<span slot="toggle" class="nav-link">
Seeds
</span>
<span slot="toggle" class="nav-link">Seeds</span>
<svelte:fragment slot="modal">
<SeedDropdown seeds={session.siwe} {config} />
</svelte:fragment>
@@ -185,9 +191,9 @@
</div>
<div class="right">
{#if config && config.network.name === 'rinkeby'}
{#if config && config.network.name === "rinkeby"}
<span class="network">Rinkeby</span>
{:else if config && config.network.name === 'homestead'}
{:else if config && config.network.name === "homestead"}
<!-- Don't show anything -->
{:else}
<span class="network unavailable">No Network</span>
@@ -196,26 +202,30 @@
{#if address}
<span class="balance">
{#if tokenBalance}
{formatBalance(tokenBalance)} <strong>RAD</strong>
{formatBalance(tokenBalance)}
<strong>RAD</strong>
{:else}
<Loading small />
{/if}
</span>
<button class="address outline regular"
<button
class="address outline regular"
on:click={() => disconnectWallet(config)}
on:mouseover={() => sessionButtonHover = true}
on:focus={() => sessionButtonHover = true}
on:mouseout={() => sessionButtonHover = false}
on:blur={() => sessionButtonHover = false}
>
on:mouseover={() => (sessionButtonHover = true)}
on:focus={() => (sessionButtonHover = true)}
on:mouseout={() => (sessionButtonHover = false)}
on:blur={() => (sessionButtonHover = false)}>
{#await Profile.get(address, ProfileType.Minimal, config)}
<Loading small center />
{:then profile}
{#if sessionButtonHover}
Disconnect
{:else}
<Avatar source={profile.avatar ?? address} title={address} inline />{formatAddress(address)}
<Avatar
source={profile.avatar ?? address}
title={address}
inline />{formatAddress(address)}
{/if}
{/await}
</button>
+23 -11
View File
@@ -27,7 +27,8 @@
fill="currentColor"
viewBox="0 0 24 24">
{#if name === "browse"}
<path d="M8.46934 7.23871C8.61151 7.10623 8.79956 7.03411 8.99386
<path
d="M8.46934 7.23871C8.61151 7.10623 8.79956 7.03411 8.99386
7.03753C9.18816 7.04096 9.37355 7.11967 9.51096 7.25709C9.64838 7.3945
9.72709 7.57988 9.73052 7.77419C9.73394 7.96849 9.66182 8.15653 9.52934
8.29871L5.80934 12.0187L9.52934 15.7387C9.60303 15.8074 9.66213 15.8902
@@ -52,17 +53,25 @@
12.5487C19.4198 12.4081 19.4987 12.2175 19.4987 12.0187C19.4987 11.82
19.4198 11.6293 19.2793 11.4887L15.0293 7.23871V7.23871Z" />
{:else if name === "clipboard"}
<path d="M9 5H14.7071L18 8.29289V17H9V5ZM10 6V16H17V9H14V6H10ZM15
<path
d="M9 5H14.7071L18 8.29289V17H9V5ZM10 6V16H17V9H14V6H10ZM15
6.70711L16.2929 8H15V6.70711ZM7 8H8V18H15V19H7V8Z" />
{:else if name === "clipboard-small"}
<path fill-rule="evenodd" clip-rule="evenodd" d="M14 7L17 10V16H10V7H14ZM13
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M14 7L17 10V16H10V7H14ZM13
8H11V15H16V11H13V8ZM14 8.41421V10H15.5858L14 8.41421ZM8
10H9V17H14V18H8V10Z" />
{:else if name === "ellipsis"}
<path d="M7 12a2 2 0 1 1-4.001-.001A2 2 0 0 1 7 12zm12-2a2 2 0 1 0 .001
4.001A2 2 0 0 0 19 10zm-7 0a2 2 0 1 0 .001 4.001A2 2 0 0 0 12 10z"/>
<path
d="M7 12a2 2 0 1 1-4.001-.001A2 2 0 0 1 7 12zm12-2a2 2 0 1 0 .001
4.001A2 2 0 0 0 19 10zm-7 0a2 2 0 1 0 .001 4.001A2 2 0 0 0 12 10z" />
{:else if name === "fork"}
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.34375 6.9375C7.5671
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M8.34375 6.9375C7.5671
6.9375 6.9375 7.5671 6.9375 8.34375C6.9375 9.1204 7.5671 9.75 8.34375
9.75C9.1204 9.75 9.75 9.1204 9.75 8.34375C9.75 7.5671 9.1204 6.9375 8.34375
6.9375ZM8.8125 10.6406C9.8823 10.4235 10.6875 9.47764 10.6875
@@ -96,7 +105,8 @@
20.0625 13.5 19.4329 13.5 18.6562C13.5 17.8796 12.8704 17.25 12.0938
17.25Z" />
{:else if name === "github"}
<path d="M12 4C7.58 4 4 7.67295 4 12.2031C4 15.8282 6.292 18.9023 9.47
<path
d="M12 4C7.58 4 4 7.67295 4 12.2031C4 15.8282 6.292 18.9023 9.47
19.9858C9.87 20.0631 10.0167 19.8095 10.0167 19.5914C10.0167 19.3966 10.01
18.8805 10.0067 18.1969C7.78133 18.6918 7.312 17.0963 7.312 17.0963C6.948
16.1495 6.422 15.8966 6.422 15.8966C5.69733 15.388 6.478 15.3982 6.478
@@ -113,7 +123,8 @@
19.5852C13.9593 19.8006 14.0993 20.0569 14.5093 19.9749C17.71 18.8989 20
15.8227 20 12.2031C20 7.67295 16.418 4 12 4" />
{:else if name === "url"}
<path d="M18.7566 11.2493L15.7531 14.2518C14.0953 15.9107 11.4059 15.9107
<path
d="M18.7566 11.2493L15.7531 14.2518C14.0953 15.9107 11.4059 15.9107
9.74803 14.2518C9.48676 13.9916 9.28252 13.6982 9.10313 13.3954L10.4987
11.9999C10.565 11.933 10.6469 11.8947 10.7252 11.8496C10.8216 12.1793
10.9901 12.4914 11.2493 12.7505C12.0772 13.5789 13.4245 13.5779 14.2518
@@ -129,9 +140,10 @@
14.2518 9.74809C12.594 8.08978 9.90462 8.08978 8.24627 9.74809L5.24374
12.7506C3.58542 14.4094 3.58542 17.0978 5.24374 18.7566C6.90207 20.4145
9.59097 20.4145 11.2493 18.7566L13.5251 16.4809C12.6158 16.6146 11.6822
16.5234 10.8164 16.1865Z"/>
16.5234 10.8164 16.1865Z" />
{:else if name === "twitter"}
<path d="M19.9687 7.54849C19.3697 7.81214 18.7351 7.98617 18.0853
<path
d="M19.9687 7.54849C19.3697 7.81214 18.7351 7.98617 18.0853
8.06498C18.7694 7.65395 19.2816 7.00936 19.5273 6.25025C18.8933 6.62013
18.1907 6.88937 17.4427 7.03932C16.9492 6.51179 16.2952 6.1619 15.5824
6.04399C14.8696 5.92608 14.1378 6.04675 13.5006 6.38727C12.8635 6.72778
@@ -145,7 +157,7 @@
8.848 16.1696C7.68769 17.0799 6.25498 17.574 4.78 17.5725C4.52 17.5725
4.26067 17.5571 4 17.5278C5.50381 18.4904 7.25234 19.0013 9.038 19C15.0733
19 18.37 14.0043 18.37 9.67978C18.37 9.53982 18.37 9.39987 18.36
9.25992C19.004 8.79665 19.5595 8.22147 20 7.56182L19.9687 7.54849Z"/>
9.25992C19.004 8.79665 19.5595 8.22147 20 7.56182L19.9687 7.54849Z" />
{:else}
{unreachable(name)}
{/if}
+2 -2
View File
@@ -1,6 +1,6 @@
<script lang="ts">
import Clipboard from '@app/Clipboard.svelte';
import { closeFocused } from '@app/Floating.svelte';
import Clipboard from "@app/Clipboard.svelte";
import { closeFocused } from "@app/Floating.svelte";
export let name: string;
export let value: string;
+1 -1
View File
@@ -1,6 +1,6 @@
<script lang="ts">
export let id: string;
export let fillColor="#ff55ff";
export let fillColor = "#ff55ff";
</script>
<svg style="height: 0; width: 0;" xmlns="http://www.w3.org/2000/svg">
+3 -3
View File
@@ -6,12 +6,12 @@
function getProps(/* props: any */) {
if (primary) {
return { "class": "primary link" };
return { class: "primary link" };
}
return { "class": "link" };
return { class: "link" };
}
</script>
<Link to="{to}" getProps="{getProps}">
<Link {to} {getProps}>
<slot />
</Link>
+50 -20
View File
@@ -66,32 +66,48 @@
}
@-webkit-keyframes sk-bouncedelay-condensed {
0%, 100% { -webkit-transform: scale(0.2) }
50% { -webkit-transform: scale(1.0) }
0%,
100% {
-webkit-transform: scale(0.2);
}
50% {
-webkit-transform: scale(1);
}
}
@keyframes sk-bouncedelay-condensed {
0%, 100% {
0%,
100% {
-webkit-transform: scale(0.2);
transform: scale(0.2);
} 50% {
-webkit-transform: scale(1.0);
transform: scale(1.0);
}
50% {
-webkit-transform: scale(1);
transform: scale(1);
}
}
@-webkit-keyframes sk-bouncedelay {
0%, 80%, 100% { -webkit-transform: scale(0) }
40% { -webkit-transform: scale(1.0) }
0%,
80%,
100% {
-webkit-transform: scale(0);
}
40% {
-webkit-transform: scale(1);
}
}
@keyframes sk-bouncedelay {
0%, 80%, 100% {
0%,
80%,
100% {
-webkit-transform: scale(0);
transform: scale(0);
} 40% {
-webkit-transform: scale(1.0);
transform: scale(1.0);
}
40% {
-webkit-transform: scale(1);
transform: scale(1);
}
}
@@ -103,21 +119,35 @@
}
@keyframes fadeIn {
0% { opacity: 0 }
100% { opacity: 1 }
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
@-webkit-keyframes fadeIn {
0% { opacity: 0 }
100% { opacity: 1 }
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
</style>
<div class="container">
<div class="spinner" class:fade-in={fadeIn} class:small class:center class:margins class:condensed>
<div class="bounce1" style="background-color: var(--color-{color})"></div>
<div
class="spinner"
class:fade-in={fadeIn}
class:small
class:center
class:margins
class:condensed>
<div class="bounce1" style="background-color: var(--color-{color})" />
{#if !condensed}
<div class="bounce2" style="background-color: var(--color-{color})"></div>
<div class="bounce3" style="background-color: var(--color-{color})"></div>
<div class="bounce2" style="background-color: var(--color-{color})" />
<div class="bounce3" style="background-color: var(--color-{color})" />
{/if}
</div>
</div>
+22 -5
View File
@@ -5,12 +5,29 @@
<style>
</style>
<svg {style} width="36" height="34" viewBox="0 0 36 34" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M18.5687 19.0417C18.8572 18.2253 19.1389 17.3905 19.4228 16.5491C21.8513 9.35112 24.4399 1.67842 32.8537 1.04244C33.2252 1.01436 33.608 0.999997 34.0027 1C33.8296 1.23078 33.6991 1.57621 33.5907 2.00565C33.4423 2.59325 33.3351 3.33814 33.2167 4.16182C32.9561 5.97456 32.6405 8.16891 31.7092 9.90809C29.8743 13.3345 24.8285 15.024 22.3056 14.4765C19.91 17.0735 19.3178 22.4338 19.6913 26.411C19.7597 27.1398 19.9076 27.8537 20.0495 28.5387C20.2456 29.4852 20.4302 30.3765 20.3779 31.1756C20.2485 33.6081 15.8912 33.6081 15.7618 31.1756C15.7095 30.3765 15.8941 29.4852 16.0902 28.5387C16.2321 27.8537 16.38 27.1398 16.4484 26.411C16.4675 26.2077 16.4867 26.0074 16.5057 25.8098C16.851 22.2059 17.1059 19.5453 14.9571 17.3278C14.7314 17.095 14.4792 16.867 14.1979 16.6433C14.0258 16.9617 13.8419 17.2404 13.65 17.4841C12.3774 19.0998 10.747 19.1773 9.79299 19.0722C7.61437 18.8321 6.17 17.0674 4.7655 15.3513C4.19335 14.6522 3.62781 13.9612 3.02196 13.3847C2.73293 13.1097 2.43473 12.8607 2.12225 12.6493C2.50137 12.4981 2.88393 12.3708 3.26863 12.2664C8.84538 10.7528 14.8744 14.0475 17.488 19.1056C17.7066 19.5286 17.9013 19.964 18.0699 20.4099C18.2394 19.9612 18.4052 19.5044 18.5687 19.0417ZM17.9276 17.8531C18.1082 17.3281 18.2871 16.7974 18.4681 16.2608C18.7688 15.3688 19.0751 14.4605 19.4034 13.5352C20.1931 11.3094 21.0827 9.07249 22.24 7.08373C23.3997 5.09089 24.849 3.31009 26.777 2.02993C28.7159 0.742458 31.0812 -2.21724e-05 34.0028 4.96602e-10L36 1.51401e-05L34.7986 1.60152C34.7172 1.71 34.5923 2.01783 34.4627 2.67346C34.3703 3.14034 34.2933 3.67532 34.2058 4.28372C34.1774 4.48175 34.1477 4.68756 34.1161 4.90133C33.8683 6.5769 33.5108 8.656 32.5867 10.3815C31.5278 12.359 29.5921 13.7639 27.6601 14.6007C25.9891 15.3244 24.1674 15.6886 22.7093 15.5483C21.8724 16.6529 21.2826 18.2584 20.9395 20.1091C20.5575 22.1692 20.504 24.4096 20.6831 26.3172C20.7459 26.9858 20.8806 27.6368 21.0222 28.3216C21.05 28.4558 21.078 28.5913 21.1058 28.7285C21.2666 29.5219 21.4262 30.3985 21.3724 31.2354C21.3203 32.1765 20.8453 32.8995 20.1952 33.3606C19.5677 33.8056 18.7957 34 18.0699 34C17.344 34 16.572 33.8056 15.9446 33.3606C15.2944 32.8995 14.8193 32.1764 14.7673 31.2353C14.7135 30.3984 14.8731 29.5219 15.0339 28.7285C15.0617 28.5913 15.0897 28.4558 15.1175 28.3216C15.2591 27.6368 15.3938 26.9858 15.4566 26.3172C15.475 26.1207 15.4933 25.9286 15.5113 25.7404C15.6955 23.8092 15.8394 22.3004 15.6535 20.9804C15.5062 19.9343 15.1504 19.0223 14.3789 18.1701C13.7456 18.9517 13.02 19.4494 12.2823 19.7434C11.2786 20.1434 10.3271 20.1371 9.68428 20.0662C7.5339 19.8293 6.04107 18.3873 4.8627 17.0257C4.56533 16.6821 4.2767 16.3294 3.9997 15.991L3.99119 15.9806C3.70843 15.6351 3.4379 15.3048 3.16528 14.9905C2.61589 14.3573 2.10048 13.8405 1.56544 13.4785L0 12.4195L1.75443 11.7199C7.89421 9.27172 14.7119 12.5328 17.9276 17.8531Z" fill="url(#paint0_radial)" fill-opacity="0.84"/>
<svg
{style}
width="36"
height="34"
viewBox="0 0 36 34"
fill="none"
xmlns="http://www.w3.org/2000/svg">
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M18.5687 19.0417C18.8572 18.2253 19.1389 17.3905 19.4228 16.5491C21.8513 9.35112 24.4399 1.67842 32.8537 1.04244C33.2252 1.01436 33.608 0.999997 34.0027 1C33.8296 1.23078 33.6991 1.57621 33.5907 2.00565C33.4423 2.59325 33.3351 3.33814 33.2167 4.16182C32.9561 5.97456 32.6405 8.16891 31.7092 9.90809C29.8743 13.3345 24.8285 15.024 22.3056 14.4765C19.91 17.0735 19.3178 22.4338 19.6913 26.411C19.7597 27.1398 19.9076 27.8537 20.0495 28.5387C20.2456 29.4852 20.4302 30.3765 20.3779 31.1756C20.2485 33.6081 15.8912 33.6081 15.7618 31.1756C15.7095 30.3765 15.8941 29.4852 16.0902 28.5387C16.2321 27.8537 16.38 27.1398 16.4484 26.411C16.4675 26.2077 16.4867 26.0074 16.5057 25.8098C16.851 22.2059 17.1059 19.5453 14.9571 17.3278C14.7314 17.095 14.4792 16.867 14.1979 16.6433C14.0258 16.9617 13.8419 17.2404 13.65 17.4841C12.3774 19.0998 10.747 19.1773 9.79299 19.0722C7.61437 18.8321 6.17 17.0674 4.7655 15.3513C4.19335 14.6522 3.62781 13.9612 3.02196 13.3847C2.73293 13.1097 2.43473 12.8607 2.12225 12.6493C2.50137 12.4981 2.88393 12.3708 3.26863 12.2664C8.84538 10.7528 14.8744 14.0475 17.488 19.1056C17.7066 19.5286 17.9013 19.964 18.0699 20.4099C18.2394 19.9612 18.4052 19.5044 18.5687 19.0417ZM17.9276 17.8531C18.1082 17.3281 18.2871 16.7974 18.4681 16.2608C18.7688 15.3688 19.0751 14.4605 19.4034 13.5352C20.1931 11.3094 21.0827 9.07249 22.24 7.08373C23.3997 5.09089 24.849 3.31009 26.777 2.02993C28.7159 0.742458 31.0812 -2.21724e-05 34.0028 4.96602e-10L36 1.51401e-05L34.7986 1.60152C34.7172 1.71 34.5923 2.01783 34.4627 2.67346C34.3703 3.14034 34.2933 3.67532 34.2058 4.28372C34.1774 4.48175 34.1477 4.68756 34.1161 4.90133C33.8683 6.5769 33.5108 8.656 32.5867 10.3815C31.5278 12.359 29.5921 13.7639 27.6601 14.6007C25.9891 15.3244 24.1674 15.6886 22.7093 15.5483C21.8724 16.6529 21.2826 18.2584 20.9395 20.1091C20.5575 22.1692 20.504 24.4096 20.6831 26.3172C20.7459 26.9858 20.8806 27.6368 21.0222 28.3216C21.05 28.4558 21.078 28.5913 21.1058 28.7285C21.2666 29.5219 21.4262 30.3985 21.3724 31.2354C21.3203 32.1765 20.8453 32.8995 20.1952 33.3606C19.5677 33.8056 18.7957 34 18.0699 34C17.344 34 16.572 33.8056 15.9446 33.3606C15.2944 32.8995 14.8193 32.1764 14.7673 31.2353C14.7135 30.3984 14.8731 29.5219 15.0339 28.7285C15.0617 28.5913 15.0897 28.4558 15.1175 28.3216C15.2591 27.6368 15.3938 26.9858 15.4566 26.3172C15.475 26.1207 15.4933 25.9286 15.5113 25.7404C15.6955 23.8092 15.8394 22.3004 15.6535 20.9804C15.5062 19.9343 15.1504 19.0223 14.3789 18.1701C13.7456 18.9517 13.02 19.4494 12.2823 19.7434C11.2786 20.1434 10.3271 20.1371 9.68428 20.0662C7.5339 19.8293 6.04107 18.3873 4.8627 17.0257C4.56533 16.6821 4.2767 16.3294 3.9997 15.991L3.99119 15.9806C3.70843 15.6351 3.4379 15.3048 3.16528 14.9905C2.61589 14.3573 2.10048 13.8405 1.56544 13.4785L0 12.4195L1.75443 11.7199C7.89421 9.27172 14.7119 12.5328 17.9276 17.8531Z"
fill="url(#paint0_radial)"
fill-opacity="0.84" />
<defs>
<radialGradient id="paint0_radial" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(14.6116 21.5361) rotate(67.3618) scale(26.8971 26.8264)">
<stop stop-color="#5555FF"/>
<stop offset="1" stop-color="#FF55FF"/>
<radialGradient
id="paint0_radial"
cx="0"
cy="0"
r="1"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(14.6116 21.5361) rotate(67.3618) scale(26.8971 26.8264)">
<stop stop-color="#5555FF" />
<stop offset="1" stop-color="#FF55FF" />
</radialGradient>
</defs>
</svg>
+9 -4
View File
@@ -20,7 +20,7 @@
...getDefaultWhiteList(),
img: ["src"],
audio: ["src"],
video: ["src"]
video: ["src"],
},
stripIgnoreTag: false,
});
@@ -76,8 +76,12 @@
padding-left: 0.5rem;
}
.markdown :global(h1), .markdown :global(h2), .markdown :global(h3),
.markdown :global(h4), .markdown :global(h5), .markdown :global(h6) {
.markdown :global(h1),
.markdown :global(h2),
.markdown :global(h3),
.markdown :global(h4),
.markdown :global(h5),
.markdown :global(h6) {
color: var(--color-foreground);
}
@@ -182,7 +186,8 @@
display: none;
}
.markdown :global(a), .markdown :global(a > code) {
.markdown :global(a),
.markdown :global(a > code) {
background: none;
padding: 0;
color: var(--color-foreground);
+1 -1
View File
@@ -14,5 +14,5 @@
</style>
<div class="message" class:message-error={error}>
<slot></slot>
<slot />
</div>
+6 -8
View File
@@ -1,7 +1,7 @@
<script lang="ts">
import { link } from 'svelte-routing';
import { createEventDispatcher } from 'svelte';
import Search from './Search.svelte';
import { link } from "svelte-routing";
import { createEventDispatcher } from "svelte";
import Search from "./Search.svelte";
import { clickOutside } from "@app/utils";
const dispatch = createEventDispatcher();
@@ -25,10 +25,10 @@
display: flex;
align-items: center;
justify-content: center;
background-color: #000000BF;
background-color: #000000bf;
}
.modal {
position:absolute;
position: absolute;
top: 90px;
right: 1.5rem;
padding: 1.5rem;
@@ -66,9 +66,7 @@
<Search size={20} on:search={() => dispatch("select")} />
</div>
<div>
<a use:link on:click={() => dispatch("select")} href="/orgs">
Orgs
</a>
<a use:link on:click={() => dispatch("select")} href="/orgs">Orgs</a>
<a use:link on:click={() => dispatch("select")} href="/registrations">
Register
</a>
+16 -19
View File
@@ -8,7 +8,8 @@
</script>
<style>
.modal-floating, .modal-overlay {
.modal-floating,
.modal-overlay {
position: fixed;
top: 0;
left: 0;
@@ -24,7 +25,7 @@
}
.modal-overlay {
z-index: 200;
background-color: rgba(0, 0, 0, .75);
background-color: rgba(0, 0, 0, 0.75);
}
.modal {
padding: 2rem 3rem;
@@ -48,16 +49,10 @@
.modal.modal-subtle {
border: none;
box-shadow: none;
background: radial-gradient(
var(--color-glow) 0%,
transparent 70%
);
background: radial-gradient(var(--color-glow) 0%, transparent 70%);
}
.modal.modal-subtle.error {
background: radial-gradient(
var(--color-glow-error) 0%,
transparent 70%
);
background: radial-gradient(var(--color-glow-error) 0%, transparent 70%);
}
.modal-title {
color: var(--color-foreground);
@@ -100,27 +95,29 @@
</style>
{#if floating}
<div class="modal-overlay"></div>
<div class="modal-overlay" />
{/if}
<div class:modal-floating={floating} class:off-centered={!center}>
<div class="modal" class:error
class:modal-subtle={subtle}
class:modal-narrow={narrow}
class:modal-small={small}>
<div
class="modal"
class:error
class:modal-subtle={subtle}
class:modal-narrow={narrow}
class:modal-small={small}>
<div class="modal-title">
<slot name="title"></slot>
<slot name="title" />
</div>
<div class="modal-subtitle">
<slot name="subtitle"></slot>
<slot name="subtitle" />
</div>
{#if $$slots.body && !small}
<div class="modal-body">
<slot name="body"></slot>
<slot name="body" />
</div>
{/if}
<div class="modal-actions">
<slot name="actions"></slot>
<slot name="actions" />
</div>
</div>
</div>
+3 -3
View File
@@ -2,13 +2,13 @@ import NotFound from "./NotFound.svelte";
import { render } from "@testing-library/svelte";
import "@public/index.css";
describe('NotFound', () => {
describe("NotFound", () => {
it("shows passed props correctly", () => {
render(NotFound, {
props: {
title: "nakamoto",
subtitle: "Sorry, the requested project was not found."
}
subtitle: "Sorry, the requested project was not found.",
},
});
cy.findByText("nakamoto");
cy.findByText("Sorry, the requested project was not found.");
+2 -4
View File
@@ -1,5 +1,5 @@
<script lang="ts">
import Modal from '@app/Modal.svelte';
import Modal from "@app/Modal.svelte";
export let title = "";
export let subtitle = "";
@@ -14,8 +14,6 @@
<p>{subtitle}</p>
</span>
<span slot="actions">
<button on:click={back}>
Back
</button>
<button on:click={back}>Back</button>
</span>
</Modal>
+17 -7
View File
@@ -1,8 +1,12 @@
<script lang="ts">
import { marked } from "marked";
import { createEventDispatcher } from 'svelte';
import { createEventDispatcher } from "svelte";
export let options: { label: string; value: string; description?: string[] }[];
export let options: {
label: string;
value: string;
description?: string[];
}[];
export let name: string;
export let selected = "";
export let disabled = false;
@@ -27,7 +31,8 @@
.options label:last-child {
margin-bottom: 0.5rem;
}
.options label, .options input {
.options label,
.options input {
cursor: pointer;
}
.options input {
@@ -64,10 +69,15 @@
<main>
<div class="options">
{#each options as option}
<label for="{option.value}">
<input type="radio" {disabled} checked={selected === option.value} {name}
id="{option.value}" value="{option.value}"
on:click={() => dispatch('changed', option.value)}>
<label for={option.value}>
<input
type="radio"
{disabled}
checked={selected === option.value}
{name}
id={option.value}
value={option.value}
on:click={() => dispatch("changed", option.value)} />
{option.label}
</label>
{#if option.description}
+2 -2
View File
@@ -23,7 +23,7 @@
<div class="error error-message placeholder">
<header>
<div class="icon">{icon}</div>
<slot name="title"></slot>
<slot name="title" />
</header>
<slot name="body"></slot>
<slot name="body" />
</div>
+117 -59
View File
@@ -1,26 +1,26 @@
<script lang="ts">
import type { SvelteComponent } from 'svelte';
import type { Config } from '@app/config';
import Address from '@app/Address.svelte';
import Avatar from '@app/Avatar.svelte';
import Icon from '@app/Icon.svelte';
import SetName from '@app/ens/SetName.svelte';
import SeedAddress from '@app/SeedAddress.svelte';
import TransferOwnership from '@app/base/orgs/TransferOwnership.svelte';
import Link from '@app/Link.svelte';
import { getBalance, Profile, ProfileType } from '@app/profile';
import Loading from '@app/Loading.svelte';
import * as utils from '@app/utils';
import { session } from '@app/session';
import { Org } from '@app/base/orgs/Org';
import Message from '@app/Message.svelte';
import Error from '@app/Error.svelte';
import { User } from '@app/base/users/User';
import Projects from '@app/base/orgs/View/Projects.svelte';
import { MissingReverseRecord, NotFoundError } from '@app/error';
import NotFound from '@app/NotFound.svelte';
import RadicleUrn from '@app/RadicleUrn.svelte';
import Badge from '@app/Badge.svelte';
import type { SvelteComponent } from "svelte";
import type { Config } from "@app/config";
import Address from "@app/Address.svelte";
import Avatar from "@app/Avatar.svelte";
import Icon from "@app/Icon.svelte";
import SetName from "@app/ens/SetName.svelte";
import SeedAddress from "@app/SeedAddress.svelte";
import TransferOwnership from "@app/base/orgs/TransferOwnership.svelte";
import Link from "@app/Link.svelte";
import { getBalance, Profile, ProfileType } from "@app/profile";
import Loading from "@app/Loading.svelte";
import * as utils from "@app/utils";
import { session } from "@app/session";
import { Org } from "@app/base/orgs/Org";
import Message from "@app/Message.svelte";
import Error from "@app/Error.svelte";
import { User } from "@app/base/users/User";
import Projects from "@app/base/orgs/View/Projects.svelte";
import { MissingReverseRecord, NotFoundError } from "@app/error";
import NotFound from "@app/NotFound.svelte";
import RadicleUrn from "@app/RadicleUrn.svelte";
import Badge from "@app/Badge.svelte";
export let config: Config;
export let addressOrName: string;
@@ -38,10 +38,11 @@
};
$: account = $session && $session.address;
$: isOwner = (org: Org): boolean => $session
? utils.isAddressEqual(org.owner, $session.address)
: false;
$: getOrgTreasury = async (org: Org): Promise<Array<utils.Token>| undefined> => {
$: isOwner = (org: Org): boolean =>
$session ? utils.isAddressEqual(org.owner, $session.address) : false;
$: getOrgTreasury = async (
org: Org,
): Promise<Array<utils.Token> | undefined> => {
const addressType = await utils.identifyAddress(org.owner, config);
// We query the org treasury only for Gnosis Safes, to maintain some privacy for EOA org owners.
if (addressType === utils.AddressType.Safe) {
@@ -49,9 +50,18 @@
const tokens = await utils.getTokens(org.owner, config);
const balance = await getBalance(org.owner, config);
if (! balance.isZero()) {
if (!balance.isZero()) {
// To maintain the format we hardcode the ETH specs.
return [{ balance, decimals: 18, logo: "", name: "Ethereum", symbol: "ETH" }, ...tokens];
return [
{
balance,
decimals: 18,
logo: "",
name: "Ethereum",
symbol: "ETH",
},
...tokens,
];
} else {
return tokens;
}
@@ -184,15 +194,21 @@
<main>
<header>
<div class="avatar">
<Avatar source={profile.avatar ?? profile.address} title={profile.address} />
<Avatar
source={profile.avatar ?? profile.address}
title={profile.address} />
</div>
<div class="info">
<span class="title">
<span class="bold desktop">
{profile.name ? utils.formatName(profile.name, config) : profile.address}
{profile.name
? utils.formatName(profile.name, config)
: profile.address}
</span>
<span class="bold mobile">
{profile.name ? utils.formatName(profile.name, config) : utils.formatAddress(profile.address)}
{profile.name
? utils.formatName(profile.name, config)
: utils.formatAddress(profile.address)}
</span>
{#if profile.name && profile.org}
<Badge variant="foreground">org</Badge>
@@ -236,14 +252,22 @@
{/if}
<!-- Address -->
<div class="label">Address</div>
<div class="desktop"><Address {config} {profile} address={profile.address} /></div>
<div class="mobile"><Address compact {config} {profile} address={profile.address} /></div>
<div class="desktop">
<Address {config} {profile} address={profile.address} />
</div>
<div class="mobile">
<Address compact {config} {profile} address={profile.address} />
</div>
<div class="desktop" />
<!-- Owner -->
{#if profile.org}
<div class="label">Owner</div>
<div class="desktop"><Address resolve {config} address={profile.org.owner} /></div>
<div class="mobile"><Address compact resolve {config} address={profile.org.owner} /></div>
<div class="desktop">
<Address resolve {config} address={profile.org.owner} />
</div>
<div class="mobile">
<Address compact resolve {config} address={profile.org.owner} />
</div>
<div class="desktop">
{#await account && profile.org.isMember(account, config) then isMember}
{#if isOwner(profile.org) || isMember}
@@ -259,7 +283,9 @@
<div class="label">Treasury</div>
<div>
{#each tokens as token}
{` ${utils.formatBalance(token.balance, token.decimals)} ${token.symbol} `}
{` ${utils.formatBalance(token.balance, token.decimals)} ${
token.symbol
} `}
{/each}
</div>
<div class="desktop" />
@@ -269,8 +295,12 @@
<!-- Project anchors -->
{#if profile.anchorsAccount}
<div class="label">Anchors</div>
<div class="desktop"><Address {config} address={profile.anchorsAccount} /></div>
<div class="mobile"><Address compact {config} address={profile.anchorsAccount} /></div>
<div class="desktop">
<Address {config} address={profile.anchorsAccount} />
</div>
<div class="mobile">
<Address compact {config} address={profile.anchorsAccount} />
</div>
<div class="desktop" />
{/if}
{/if}
@@ -290,9 +320,7 @@
<!-- Loading -->
{:then authorized}
{#if authorized}
<button class="small secondary" on:click={setName}>
Set
</button>
<button class="small secondary" on:click={setName}>Set</button>
{/if}
{/await}
</div>
@@ -302,9 +330,11 @@
{#if safe}
<div class="label">Quorum</div>
<div>
{safe.threshold} <span class="faded">of</span> {safe.owners.length}
{safe.threshold}
<span class="faded">of</span>
{safe.owners.length}
</div>
<div class="desktop"/>
<div class="desktop" />
{/if}
{/await}
{:else}
@@ -318,9 +348,7 @@
</div>
<div class="desktop">
{#if isUserAuthorized(profile.address)}
<button class="small secondary" on:click={setName}>
Set
</button>
<button class="small secondary" on:click={setName}>Set</button>
{/if}
</div>
{/if}
@@ -331,7 +359,7 @@
<Loading center />
{:then members}
{#if members.length > 0}
<!-- We don't need to catch errors here, since it's not defined by user input and defaults to ETH addresses -->
<!-- We don't need to catch errors here, since it's not defined by user input and defaults to ETH addresses -->
{#await Profile.getMulti(members, config)}
<div class="members loading">
<Loading small />
@@ -342,12 +370,20 @@
<div class="member">
<div class="member-icon">
<Link to="/{profile.address}">
<Avatar source={profile.avatar ?? profile.address} title={profile.address} />
<Avatar
source={profile.avatar ?? profile.address}
title={profile.address} />
</Link>
</div>
<div class="desktop">
<Address address={profile.address} compact
resolve noBadge noAvatar {profile} {config} />
<Address
address={profile.address}
compact
resolve
noBadge
noAvatar
{profile}
{config} />
</div>
</div>
{/each}
@@ -356,7 +392,8 @@
{/if}
{:catch err}
<Message error>
<strong>Error: </strong> failed to load org members: {err.message}.
<strong>Error:</strong>
failed to load org members: {err.message}.
</Message>
{/await}
{:else}
@@ -373,12 +410,20 @@
{:then profile}
<div class="member-icon">
<Link to="/{profile.address}">
<Avatar source={profile.avatar ?? profile.address} title={profile.address} />
<Avatar
source={profile.avatar ?? profile.address}
title={profile.address} />
</Link>
</div>
<div class="desktop">
<Address address={profile.address} compact
resolve noBadge noAvatar {profile} {config} />
<Address
address={profile.address}
compact
resolve
noBadge
noAvatar
{profile}
{config} />
</div>
{/await}
</div>
@@ -387,7 +432,8 @@
{/if}
{:catch err}
<Message error>
<strong>Error: </strong> failed to load orgs: {err.message}.
<strong>Error:</strong>
failed to load orgs: {err.message}.
</Message>
{/await}
{/if}
@@ -396,13 +442,25 @@
{/if}
</main>
<svelte:component this={setNameForm} entity={profile.org ?? new User(profile.address)} {config} on:close={() => setNameForm = null} />
<svelte:component this={transferOwnerForm} org={profile.org} {config} on:close={() => transferOwnerForm = null} />
<svelte:component
this={setNameForm}
entity={profile.org ?? new User(profile.address)}
{config}
on:close={() => (setNameForm = null)} />
<svelte:component
this={transferOwnerForm}
org={profile.org}
{config}
on:close={() => (transferOwnerForm = null)} />
{:catch err}
{#if err instanceof NotFoundError}
<NotFound title={addressOrName} subtitle="Sorry, the requested address or domain was not found." />
<NotFound
title={addressOrName}
subtitle="Sorry, the requested address or domain was not found." />
{:else if err instanceof MissingReverseRecord}
<NotFound title={addressOrName} subtitle="Sorry, the requested name has no reverse record set." />
<NotFound
title={addressOrName}
subtitle="Sorry, the requested name has no reverse record set." />
{:else}
<Error error={err} />
{/if}
+7 -7
View File
@@ -6,12 +6,13 @@
let copied = false;
const copy = () => {
return () => toClipboard(urn).then(() => {
copied = true;
setTimeout(() => {
copied = false;
}, 3000);
});
return () =>
toClipboard(urn).then(() => {
copied = true;
setTimeout(() => {
copied = false;
}, 3000);
});
};
</script>
@@ -32,7 +33,6 @@
}
</style>
<div class="desktop">
<div class="urn">
<span class="icon">🌱</span>
+6 -2
View File
@@ -19,8 +19,12 @@
<div class="reactions">
{#each Object.entries(reactions) as [reaction, count]}
<!-- TODO: Remove the disabled attribute once we are able to increment reactions -->
<button disabled class="reaction text-xsmall" on:click={() => dispatch("click", reaction)}>
{reaction} {count}
<button
disabled
class="reaction text-xsmall"
on:click={() => dispatch("click", reaction)}>
{reaction}
{count}
</button>
{/each}
</div>
+9 -4
View File
@@ -19,7 +19,7 @@
profile = await Profile.get(
review.author.profile.ens.name,
ProfileType.Minimal,
config
config,
);
}
});
@@ -32,11 +32,16 @@
</style>
{#if review.comment.body}
<Comment {config} {getImage}
comment={review.comment} caption={formatVerdict(review.verdict)} />
<Comment
{config}
{getImage}
comment={review.comment}
caption={formatVerdict(review.verdict)} />
{:else}
<div>
<Authorship {config} {profile}
<Authorship
{config}
{profile}
author={review.author}
timestamp={review.timestamp}
caption={formatVerdict(review.verdict)} />
+6 -2
View File
@@ -2,10 +2,14 @@ import Search from "./Search.svelte";
import { fireEvent, render } from "@testing-library/svelte";
import "@public/index.css";
describe('Logic', () => {
describe("Logic", () => {
it("show a appropiate placeholder", () => {
render(Search);
cy.get("input").should("have.attr", "placeholder", "Search a name or address...");
cy.get("input").should(
"have.attr",
"placeholder",
"Search a name or address...",
);
});
it("allow input a query and navigates accordingly", () => {
+11 -13
View File
@@ -1,6 +1,6 @@
<script lang="ts">
import { navigate } from 'svelte-routing';
import { createEventDispatcher } from 'svelte';
import { navigate } from "svelte-routing";
import { createEventDispatcher } from "svelte";
export let size = 40;
@@ -8,11 +8,9 @@
const dispatch = createEventDispatcher();
const handleKeydown = (event: KeyboardEvent) => {
if (event.key === 'Enter') {
if (event.key === "Enter") {
dispatch("search");
navigate(`/resolver/query?${
new URLSearchParams({ q: input })
}`);
navigate(`/resolver/query?${new URLSearchParams({ q: input })}`);
}
};
</script>
@@ -24,15 +22,15 @@
font-size: 0.875rem;
text-overflow: ellipsis;
margin: 0;
padding: 0.5rem 1.25rem;
padding: 0.5rem 1.25rem;
border-style: dashed;
height: var(--button-regular-height);
height: var(--button-regular-height);
}
</style>
<input
size="{size}"
type="text"
bind:value={input}
on:keydown={handleKeydown}
placeholder="Search a name or address..." />
{size}
type="text"
bind:value={input}
on:keydown={handleKeydown}
placeholder="Search a name or address..." />
+8 -6
View File
@@ -2,7 +2,7 @@ import SeedAddress from "./SeedAddress.svelte";
import { render } from "@testing-library/svelte";
import "@public/index.css";
describe('SeedAddress', () => {
describe("SeedAddress", () => {
it("shows the seed emoji and seed host", () => {
render(SeedAddress, {
props: {
@@ -11,11 +11,13 @@ describe('SeedAddress', () => {
emoji: "🐱",
host: "seed.cloudhead.io",
},
port: 8776
}
port: 8776,
},
});
cy.get("span.seed-icon").should("have.text", "🐱");
cy.findByText("seed.cloudhead.io").should("have.attr", "href", "/seeds/seed.cloudhead.io").should("be.visible");
cy.findByText("seed.cloudhead.io")
.should("have.attr", "href", "/seeds/seed.cloudhead.io")
.should("be.visible");
});
it("shows the full seed id", () => {
@@ -27,8 +29,8 @@ describe('SeedAddress', () => {
host: "seed.cloudhead.io",
},
port: 8776,
full: true
}
full: true,
},
});
cy.get("span.seed-icon").should("have.text", "🐱");
cy.findByText("hydkkk…coygh1@seed.cloudhead.io").should("be.visible");
+14 -4
View File
@@ -34,12 +34,22 @@
<div class="seed-address">
<span class="seed-icon">{seed.emoji}</span>
{#if full}
<span><a href="/seeds/{formatSeedHost(seed.host)}" class="link">{formatSeedId(seed.id)}@{seed.host}</a></span>
<span>
<a href="/seeds/{formatSeedHost(seed.host)}" class="link">
{formatSeedId(seed.id)}@{seed.host}
</a>
</span>
<span class="faded">:{port}</span>
{:else}
<span><a href="/seeds/{formatSeedHost(seed.host)}" class="link">{formatSeedHost(seed.host)}</a></span>
<span>
<a href="/seeds/{formatSeedHost(seed.host)}" class="link">
{formatSeedHost(seed.host)}
</a>
</span>
{/if}
</div>
<Clipboard small text={full ? formatSeedAddress(seed.id, seed.host, port) : seed.host} />
<Clipboard
small
text={full ? formatSeedAddress(seed.id, seed.host, port) : seed.host} />
</div>
<div class="desktop"/>
<div class="desktop" />
+14 -8
View File
@@ -11,12 +11,19 @@
// When a user signs into a new seed we want to update the seed listing
$: formatSeeds = async () => {
return await Promise.all(Object.values(seeds).map(async session => {
const seed = await Seed.lookup(session.domain, config);
const key = `${seed.emoji} ${seed.host}`;
return await Promise.all(
Object.values(seeds).map(async session => {
const seed = await Seed.lookup(session.domain, config);
const key = `${seed.emoji} ${seed.host}`;
return { key, value: seed.host, title: `Go to ${seed.host}`, badge: null };
}));
return {
key,
value: seed.host,
title: `Go to ${seed.host}`,
badge: null,
};
}),
);
};
</script>
@@ -24,9 +31,8 @@
<Dropdown
{items}
selected={null}
on:select={(item) => {
on:select={item => {
closeFocused();
navigate(`/seeds/${item.detail}`);
}}
/>
}} />
{/await}
+2 -3
View File
@@ -25,7 +25,7 @@
<button
class="small secondary"
title={tooltip}
disabled={disabled || (connection === Connection.Connecting)}
disabled={disabled || connection === Connection.Connecting}
on:click={async () => {
connection = Connection.Connecting;
try {
@@ -34,8 +34,7 @@
console.error("Sign in", e);
connection = Connection.Disconnected;
}
}}
>
}}>
<span class="align">
{#if address}
<Avatar title={address} source={address} inline />
+4 -2
View File
@@ -41,12 +41,14 @@
border: none;
min-width: 0;
}
button:hover, button.active {
button:hover,
button.active {
cursor: pointer;
color: var(--color-foreground);
background-color: var(--color-foreground-background);
}
button[disabled], button[disabled]:hover {
button[disabled],
button[disabled]:hover {
cursor: not-allowed;
color: var(--color-foreground-80);
}
+38 -18
View File
@@ -1,11 +1,17 @@
import type WalletConnect from "@walletconnect/client";
import * as ethers from "ethers";
import * as ethersBytes from "@ethersproject/bytes";
import type { TransactionRequest, TransactionResponse } from "@ethersproject/abstract-provider";
import type {
TransactionRequest,
TransactionResponse,
} from "@ethersproject/abstract-provider";
import { resolveProperties } from "@ethersproject/properties";
import type { Deferrable } from "@ethersproject/properties";
import { _TypedDataEncoder } from "ethers/lib/utils";
import type { TypedDataDomain, TypedDataField } from "@ethersproject/abstract-signer";
import type {
TypedDataDomain,
TypedDataField,
} from "@ethersproject/abstract-signer";
export class WalletConnectSigner extends ethers.Signer {
public walletConnect: WalletConnect;
@@ -23,35 +29,49 @@ export class WalletConnectSigner extends ethers.Signer {
async getAddress(): Promise<string> {
const accountAddress = this.walletConnect.accounts[0];
if (! accountAddress) {
if (!accountAddress) {
throw new Error(
"The connected wallet has no accounts or there is a connection problem"
"The connected wallet has no accounts or there is a connection problem",
);
}
return ethers.utils.getAddress(accountAddress);
}
async _signTypedData(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): Promise<string> {
async _signTypedData(
domain: TypedDataDomain,
types: Record<string, Array<TypedDataField>>,
value: Record<string, any>,
): Promise<string> {
// Populate any ENS names (in-place)
const populated = await _TypedDataEncoder.resolveNames(domain, types, value, async (name: string) => {
const address = await this.provider.resolveName(name);
if (address === null) throw Error("resolver or addr is not configured for ENS name");
return address;
});
const populated = await _TypedDataEncoder.resolveNames(
domain,
types,
value,
async (name: string) => {
const address = await this.provider.resolveName(name);
if (address === null) {
throw Error("resolver or addr is not configured for ENS name");
}
return address;
},
);
const address = await this.getAddress();
const signature = await this.walletConnect.signTypedData([
address.toLowerCase(),
JSON.stringify(_TypedDataEncoder.getPayload(populated.domain, types, populated.value)),
JSON.stringify(
_TypedDataEncoder.getPayload(populated.domain, types, populated.value),
),
]);
return signature;
}
async signMessage(message: ethers.Bytes | string): Promise<string> {
const prefix = ethers.utils.toUtf8Bytes(
`\x19Ethereum Signed Message:\n${message.length}`
`\x19Ethereum Signed Message:\n${message.length}`,
);
const data = ((typeof (message) === "string") ? ethers.utils.toUtf8Bytes(message) : message);
const data =
typeof message === "string" ? ethers.utils.toUtf8Bytes(message) : message;
const msg = ethers.utils.concat([prefix, data]);
const address = await this.getAddress();
@@ -65,7 +85,7 @@ export class WalletConnectSigner extends ethers.Signer {
}
async sendTransaction(
transaction: Deferrable<TransactionRequest>
transaction: Deferrable<TransactionRequest>,
): Promise<TransactionResponse> {
const tx = await resolveProperties(transaction);
const from = tx.from || (await this.getAddress());
@@ -88,12 +108,12 @@ export class WalletConnectSigner extends ethers.Signer {
from: from,
wait: (confirmations?: number) => {
return this.provider?.waitForTransaction(txHash, confirmations);
}
},
};
}
async signTransaction(
transaction: Deferrable<TransactionRequest>
transaction: Deferrable<TransactionRequest>,
): Promise<string> {
const tx = await resolveProperties(transaction);
const from = tx.from || (await this.getAddress());
@@ -117,7 +137,7 @@ export class WalletConnectSigner extends ethers.Signer {
}
function maybeBigNumberToString(
bn: ethers.BigNumberish | undefined
bn: ethers.BigNumberish | undefined,
): string | undefined {
if (bn === undefined) {
return undefined;
@@ -127,7 +147,7 @@ function maybeBigNumberToString(
}
function bytesLikeToString(
bytes: ethersBytes.BytesLike | undefined
bytes: ethersBytes.BytesLike | undefined,
): string | undefined {
if (bytes === undefined) {
return undefined;
+12 -4
View File
@@ -16,11 +16,19 @@ interface AnchorObject {
multihash: string;
}
export async function getProjectAnchors(urn: string, anchorsStorage: string, config: Config): Promise<string[]> {
export async function getProjectAnchors(
urn: string,
anchorsStorage: string,
config: Config,
): Promise<string[]> {
const unpadded = decodeRadicleId(urn);
const id = ethers.utils.hexZeroPad(unpadded, 32);
const allAnchors = await querySubgraph(config.orgs.subgraph, GetAllAnchors, { project: id, org: anchorsStorage });
const allAnchors = await querySubgraph(config.orgs.subgraph, GetAllAnchors, {
project: id,
org: anchorsStorage,
});
return allAnchors.anchors
.map((anchor: AnchorObject) => formatProjectHash(ethers.utils.arrayify(anchor.multihash)));
return allAnchors.anchors.map((anchor: AnchorObject) =>
formatProjectHash(ethers.utils.arrayify(anchor.multihash)),
);
}
+11 -8
View File
@@ -25,8 +25,8 @@ export class Request {
const urlString = this.createUrl(search);
return await Request.exec(urlString, {
method: 'GET',
headers: { ...headers, 'Accept': 'application/json' }
method: "GET",
headers: { ...headers, Accept: "application/json" },
});
}
@@ -38,9 +38,9 @@ export class Request {
const urlString = this.createUrl();
return await Request.exec(urlString, {
method: 'POST',
method: "POST",
body: JSON.stringify(body),
headers: { ...headers, 'Content-Type': 'application/json' }
headers: { ...headers, "Content-Type": "application/json" },
});
}
@@ -52,14 +52,17 @@ export class Request {
const urlString = this.createUrl();
return await Request.exec(urlString, {
method: 'PUT',
method: "PUT",
body: JSON.stringify(body),
headers: { ...headers, 'Content-Type': 'application/json' }
headers: { ...headers, "Content-Type": "application/json" },
});
}
// Executes a request and returns the response.
static async exec(urlString: string, props: Record<string, any>): Promise<any> {
static async exec(
urlString: string,
props: Record<string, any>,
): Promise<any> {
let response = null;
try {
response = await fetch(urlString, props);
@@ -67,7 +70,7 @@ export class Request {
throw new ApiError("API request failed", urlString);
}
if (! response.ok) {
if (!response.ok) {
throw new ApiError(response.statusText, urlString);
}
return response.json();
+42 -20
View File
@@ -5,7 +5,11 @@
import { setOpenGraphMetaTag, toWei } from "@app/utils";
import { formatEther } from "@ethersproject/units";
import { navigate } from "svelte-routing";
import { getMaxWithdrawAmount, lastWithdrawalByUser, calculateTimeLock } from "./lib";
import {
getMaxWithdrawAmount,
lastWithdrawalByUser,
calculateTimeLock,
} from "./lib";
export let config: Config;
@@ -17,7 +21,7 @@
setOpenGraphMetaTag([
{ prop: "og:title", content: "Radicle Faucet" },
{ prop: "og:description", content: "Rinkeby Testnet Faucet" },
{ prop: "og:url", content: window.location.href }
{ prop: "og:url", content: window.location.href },
]);
async function withdraw() {
@@ -28,15 +32,31 @@
async function isAbleToWithdraw(amount: string): Promise<[boolean, string?]> {
try {
if (! $session) { return [false]; }
if (!amount || amount === "0") { return [false, "Not able to withdraw zero tokens"]; }
if (toWei(amount).gt(maxWithdrawAmount)) return [false, `Reduce amount, max withdrawal is ${formatEther(maxWithdrawAmount)}`];
if (!$session) {
return [false];
}
if (!amount || amount === "0") {
return [false, "Not able to withdraw zero tokens"];
}
if (toWei(amount).gt(maxWithdrawAmount)) {
return [
false,
`Reduce amount, max withdrawal is ${formatEther(maxWithdrawAmount)}`,
];
}
const currentTime = new Date().getTime();
const timelock = await calculateTimeLock(amount, $session.signer, config);
// Converting a 10 digit to 13 digit timestamp by multiplying by 1000
// since JS doesn't display a correct Date string when passing a 10 digit timestamp.
const nextAvailableWithdraw = lastWithdrawal.add(timelock).mul(1000);
if (nextAvailableWithdraw.gt(currentTime)) return [false, `Not ready to withdraw, return after ${new Date(nextAvailableWithdraw.toNumber()).toLocaleString('en-GB')}`];
if (nextAvailableWithdraw.gt(currentTime)) {
return [
false,
`Not ready to withdraw, return after ${new Date(
nextAvailableWithdraw.toNumber(),
).toLocaleString("en-GB")}`,
];
}
return [true];
} catch (e: any) {
@@ -48,8 +68,12 @@
}
$: if ($session) {
getMaxWithdrawAmount($session.signer, config).then(x => maxWithdrawAmount = x);
lastWithdrawalByUser($session.signer, config).then(x => lastWithdrawal = x);
getMaxWithdrawAmount($session.signer, config).then(
x => (maxWithdrawAmount = x),
);
lastWithdrawalByUser($session.signer, config).then(
x => (lastWithdrawal = x),
);
}
</script>
@@ -89,7 +113,6 @@
.description.invalid {
color: var(--color-negative) !important;
}
</style>
<svelte:head>
@@ -100,13 +123,13 @@
<div>
{#if config.network.name === "homestead"}
<div class="input-caption">
To get RAD tokens on <strong>{config.network.name}</strong>, please
check the known exchanges.
To get RAD tokens on <strong>{config.network.name}</strong>
, please check the known exchanges.
</div>
{:else if !$session}
<div class="input-caption">
To get RAD tokens on <strong>{config.network.name}</strong>, please
connect your wallet.
To get RAD tokens on <strong>{config.network.name}</strong>
, please connect your wallet.
</div>
{:else}
<div class="input-caption">
@@ -118,16 +141,15 @@
type="text"
placeholder="Set amount to withdraw"
bind:value={amount}
on:input={() => error = ""}
/>
<button disabled={false} class="primary" on:click={withdraw}>
on:input={() => (error = "")} />
<button disabled={false} class="primary" on:click={withdraw}>
Withdraw
</button>
</button>
</div>
{#if error}
<div class="error description invalid text-small faded">
{error}
</div>
<div class="error description invalid text-small faded">
{error}
</div>
{/if}
</div>
{/if}
+4 -8
View File
@@ -7,7 +7,7 @@
import Err from "@app/Error.svelte";
import { Status, State } from "@app/utils";
import { withdraw } from "./lib";
import { session } from '@app/session';
import { session } from "@app/session";
export let config: Config;
@@ -17,7 +17,7 @@
status: Status.Failed,
error: "Error withdrawing, something happened.",
};
$: requester = ($session && $session.address);
$: requester = $session && $session.address;
const back = () => navigate(`/faucet`);
@@ -49,11 +49,7 @@
</style>
{#if error}
<Err
title="Transaction failed"
message={error.message}
on:close={back}
/>
<Err title="Transaction failed" message={error.message} on:close={back} />
{:else}
<Modal>
<span slot="title">
@@ -84,7 +80,7 @@
<span slot="actions">
{#if state.status === Status.Success}
<button on:click={back}> Back </button>
<button on:click={back}>Back</button>
{/if}
</span>
</Modal>
+29 -15
View File
@@ -1,51 +1,65 @@
import * as ethers from 'ethers';
import * as ethers from "ethers";
import type { Config } from '@app/config';
import { assert } from '@app/error';
import type { TransactionResponse } from '@ethersproject/providers';
import { toWei } from '@app/utils';
import type { Config } from "@app/config";
import { assert } from "@app/error";
import type { TransactionResponse } from "@ethersproject/providers";
import { toWei } from "@app/utils";
import type { WalletConnectSigner } from "@app/WalletConnectSigner";
import type { TypedDataSigner } from '@ethersproject/abstract-signer';
import type { TypedDataSigner } from "@ethersproject/abstract-signer";
type Signer = ethers.Signer & TypedDataSigner | WalletConnectSigner | null;
type Signer = (ethers.Signer & TypedDataSigner) | WalletConnectSigner | null;
export async function withdraw(amount: string, signer: Signer, config: Config): Promise<TransactionResponse> {
export async function withdraw(
amount: string,
signer: Signer,
config: Config,
): Promise<TransactionResponse> {
assert(signer);
const faucet = new ethers.Contract(
config.radToken.faucet,
config.abi.faucet,
signer
signer,
);
return faucet.withdraw(config.radToken.address, toWei(amount));
}
export async function getMaxWithdrawAmount(signer: Signer, config: Config): Promise<ethers.BigNumber> {
export async function getMaxWithdrawAmount(
signer: Signer,
config: Config,
): Promise<ethers.BigNumber> {
assert(signer);
const faucet = new ethers.Contract(
config.radToken.faucet,
config.abi.faucet,
signer
signer,
);
return faucet.maxWithdrawAmount();
}
export async function calculateTimeLock(amount: string, signer: Signer, config: Config): Promise<ethers.BigNumber> {
export async function calculateTimeLock(
amount: string,
signer: Signer,
config: Config,
): Promise<ethers.BigNumber> {
assert(signer);
const faucet = new ethers.Contract(
config.radToken.faucet,
config.abi.faucet,
signer
signer,
);
return faucet.calculateTimeLock(toWei(amount));
}
export async function lastWithdrawalByUser(signer: Signer, config: Config): Promise<ethers.BigNumber> {
export async function lastWithdrawalByUser(
signer: Signer,
config: Config,
): Promise<ethers.BigNumber> {
assert(signer);
const address = signer.getAddress();
@@ -53,7 +67,7 @@ export async function lastWithdrawalByUser(signer: Signer, config: Config): Prom
const faucet = new ethers.Contract(
config.radToken.faucet,
config.abi.faucet,
signer
signer,
);
return faucet.lastWithdrawalByUser(address);
+33 -23
View File
@@ -1,33 +1,36 @@
<script lang="ts">
import { navigate } from 'svelte-routing';
import type { Config } from '@app/config';
import Loading from '@app/Loading.svelte';
import Widget from '@app/base/projects/Widget.svelte';
import { Project, ProjectInfo } from '@app/project';
import type { Host } from '@app/api';
import { navigate } from "svelte-routing";
import type { Config } from "@app/config";
import Loading from "@app/Loading.svelte";
import Widget from "@app/base/projects/Widget.svelte";
import { Project, ProjectInfo } from "@app/project";
import type { Host } from "@app/api";
import * as proj from "@app/project";
import Message from '@app/Message.svelte';
import { setOpenGraphMetaTag } from '@app/utils';
import Message from "@app/Message.svelte";
import { setOpenGraphMetaTag } from "@app/utils";
export let config: Config;
setOpenGraphMetaTag([
{ prop: "og:title", content: "Radicle Interface" },
{ prop: "og:description", content: "Interact with Radicle" },
{ prop: "og:url", content: window.location.href }
{ prop: "og:url", content: window.location.href },
]);
const getProjects = config.projects.pinned.length > 0
? Project.getMulti(config.projects.pinned)
: Promise.resolve([]);
const getProjects =
config.projects.pinned.length > 0
? Project.getMulti(config.projects.pinned)
: Promise.resolve([]);
const onClick = (project: ProjectInfo, seed: Host) => {
navigate(proj.path({
urn: project.urn,
seed: seed.host,
profile: null,
revision: project.head,
}));
navigate(
proj.path({
urn: project.urn,
seed: seed.host,
profile: null,
revision: project.head,
}),
);
};
</script>
@@ -82,8 +85,10 @@
<main>
<div class="blurb">
<p>Radicle 🌱 enables developers 🧙 to securely collaborate 🔐 on software over a
peer-to-peer network 🌐 built on Git.</p>
<p>
Radicle 🌱 enables developers 🧙 to securely collaborate 🔐 on software
over a peer-to-peer network 🌐 built on Git.
</p>
</div>
{#await getProjects}
@@ -93,13 +98,17 @@
{:then results}
{#if results.length}
<div class="heading">
Explore <strong>projects</strong> on the Radicle network.
Explore <strong>projects</strong>
on the Radicle network.
</div>
<div class="projects">
{#each results as result}
<div class="project">
<Widget compact project={result.info} seed={{ api: result.seed }}
<Widget
compact
project={result.info}
seed={{ api: result.seed }}
on:click={() => onClick(result.info, result.seed)} />
</div>
{/each}
@@ -108,7 +117,8 @@
{:catch}
<div class="padding">
<Message error>
<strong>Error: </strong> failed to load projects.
<strong>Error:</strong>
failed to load projects.
</Message>
</div>
{/await}
+54 -39
View File
@@ -1,14 +1,14 @@
<script lang="ts">
import { createEventDispatcher } from 'svelte';
import { navigate } from 'svelte-routing';
import Modal from '@app/Modal.svelte';
import Error from '@app/Error.svelte';
import type { Err } from '@app/error';
import { Org } from '@app/base/orgs/Org';
import type { Config } from '@app/config';
import Loading from '@app/Loading.svelte';
import Options from '@app/Options.svelte';
import Address from '@app/Address.svelte';
import { createEventDispatcher } from "svelte";
import { navigate } from "svelte-routing";
import Modal from "@app/Modal.svelte";
import Error from "@app/Error.svelte";
import type { Err } from "@app/error";
import { Org } from "@app/base/orgs/Org";
import type { Config } from "@app/config";
import Loading from "@app/Loading.svelte";
import Options from "@app/Options.svelte";
import Address from "@app/Address.svelte";
export let config: Config;
export let owner: string;
@@ -26,21 +26,23 @@
}
const orgTypes = [
{ label: "Multi-signature",
{
label: "Multi-signature",
description: [
"Creates an org with a multi-signature contract as its owner, and the specified account as the first member.",
"A [Gnosis Safe](https://gnosis-safe.io) will be deployed for your org.",
"Transactions such as anchoring have to be approved by a quorum of signers."
"Transactions such as anchoring have to be approved by a quorum of signers.",
],
value: Governance.Quorum
value: Governance.Quorum,
},
{ label: "Existing owner",
{
label: "Existing owner",
description: [
`Creates an org with the specified account as the sole owner.`,
`Org transactions such as anchoring are signed and executed from that account.`,
`This option allows for using an existing contract or EOA as the owner of the org.`
`This option allows for using an existing contract or EOA as the owner of the org.`,
],
value: Governance.Existing
value: Governance.Existing,
},
];
@@ -54,9 +56,10 @@
state = State.Signing;
try {
const tx = governance === Governance.Quorum
? await Org.createMultiSig([owner], 1, config)
: await Org.create(owner, config);
const tx =
governance === Governance.Quorum
? await Org.createMultiSig([owner], 1, config)
: await Org.create(owner, config);
state = State.Pending;
@@ -73,8 +76,12 @@
const onGovernanceChanged = (event: { detail: string }) => {
switch (event.detail) {
case "existing": governance = Governance.Existing; break;
case "quorum": governance = Governance.Quorum; break;
case "existing":
governance = Governance.Existing;
break;
case "quorum":
governance = Governance.Quorum;
break;
}
};
</script>
@@ -122,11 +129,10 @@
{#if error}
<Error {error} floating on:close />
{:else if org} <!-- Org created -->
{:else if org}
<!-- Org created -->
<Modal floating on:close>
<span slot="title">
🎉
</span>
<span slot="title">🎉</span>
<span slot="subtitle">
<strong>Your org was successfully created.</strong>
@@ -143,12 +149,11 @@
</span>
<span slot="actions">
<button on:click={() => navigate(`/${org?.address}`)}>
Done
</button>
<button on:click={() => navigate(`/${org?.address}`)}>Done</button>
</span>
</Modal>
{:else} <!-- Org creation flow -->
{:else}
<!-- Org creation flow -->
<Modal floating on:close center>
<span slot="title">
<div>🎪</div>
@@ -159,7 +164,9 @@
{#if state === State.Idle}
<div class="highlight">Select how you'd like to create your org</div>
{:else if state === State.Signing}
<div class="highlight">Please confirm the transaction in your wallet.</div>
<div class="highlight">
Please confirm the transaction in your wallet.
</div>
{:else if state === State.Pending}
<div class="highlight">Waiting for transaction to be processed...</div>
{/if}
@@ -169,18 +176,27 @@
{#if state === State.Idle}
<div class="configuration">
<div class="notice">
<strong>Notice:</strong> Orgs V1 are being deprecated. It is recommended
not to create new orgs at this point.
<strong>Notice:</strong>
Orgs V1 are being deprecated. It is recommended not to create new orgs
at this point.
</div>
<div class="governance">
<Options name="governance" disabled={state !== State.Idle}
selected="{governance}" options={orgTypes}
on:changed={onGovernanceChanged} />
<Options
name="governance"
disabled={state !== State.Idle}
selected={governance}
options={orgTypes}
on:changed={onGovernanceChanged} />
</div>
<label class="input" for="address">Ethereum account address</label>
<input name="address" class="small" type="text" maxlength="42" bind:value={owner} />
<input
name="address"
class="small"
type="text"
maxlength="42"
bind:value={owner} />
</div>
{:else}
<Loading center small />
@@ -193,12 +209,11 @@
on:click={createOrg}
class="primary regular"
data-waiting={[State.Signing, State.Pending].includes(state) || null}
disabled={state !== State.Idle}
>
disabled={state !== State.Idle}>
Create
</button>
<button on:click={() => dispatch('close')} class="text regular">
<button on:click={() => dispatch("close")} class="text regular">
Close
</button>
{/if}
+31 -17
View File
@@ -1,23 +1,23 @@
<script lang="ts">
import type { SvelteComponent } from 'svelte';
import { session } from '@app/session';
import Create from '@app/base/orgs/Create.svelte';
import { Org } from '@app/base/orgs/Org';
import type { Config } from '@app/config';
import Loading from '@app/Loading.svelte';
import Message from '@app/Message.svelte';
import Cards from '@app/Cards.svelte';
import { setOpenGraphMetaTag } from '@app/utils';
import type { SvelteComponent } from "svelte";
import { session } from "@app/session";
import Create from "@app/base/orgs/Create.svelte";
import { Org } from "@app/base/orgs/Org";
import type { Config } from "@app/config";
import Loading from "@app/Loading.svelte";
import Message from "@app/Message.svelte";
import Cards from "@app/Cards.svelte";
import { setOpenGraphMetaTag } from "@app/utils";
export let config: Config;
setOpenGraphMetaTag([
{ prop: "og:title", content: "Radicle Orgs" },
{ prop: "og:description", content: "Orgs of the Radicle Network" },
{ prop: "og:url", content: window.location.href }
{ prop: "og:url", content: window.location.href },
]);
const onCreate = () => modal = Create;
const onCreate = () => (modal = Create);
let modal: typeof SvelteComponent | null = null;
$: account = $session && $session.address;
@@ -65,8 +65,13 @@
{#if account}
<div class="my-orgs">
<header>
<span>My <strong>Orgs</strong></span>
<button class="create regular secondary" on:click={onCreate} disabled={!account}>
<span>
My <strong>Orgs</strong>
</span>
<button
class="create regular secondary"
on:click={onCreate}
disabled={!account}>
Create
</button>
</header>
@@ -82,7 +87,8 @@
{:catch}
<div>
<Message error>
<strong>Error: </strong> failed to load orgs.
<strong>Error:</strong>
failed to load orgs.
</Message>
</div>
{/await}
@@ -90,7 +96,10 @@
{/if}
<header>
<span><strong>Orgs</strong> of the Radicle network</span>
<span>
<strong>Orgs</strong>
of the Radicle network
</span>
</header>
{#await Org.getAll(config)}
@@ -104,10 +113,15 @@
{:catch}
<div>
<Message error>
<strong>Error: </strong> failed to load orgs.
<strong>Error:</strong>
failed to load orgs.
</Message>
</div>
{/await}
</main>
<svelte:component this={modal} owner={account} {config} on:close={() => modal = null} />
<svelte:component
this={modal}
owner={account}
{config}
on:close={() => (modal = null)} />
+85 -67
View File
@@ -1,16 +1,16 @@
import * as ethers from 'ethers';
import type { TransactionResponse } from '@ethersproject/providers';
import type { ContractReceipt } from '@ethersproject/contracts';
import * as ethers from "ethers";
import type { TransactionResponse } from "@ethersproject/providers";
import type { ContractReceipt } from "@ethersproject/contracts";
import { OperationType } from "@gnosis.pm/safe-core-sdk-types";
import { assert } from '@app/error';
import * as utils from '@app/utils';
import { assert } from "@app/error";
import * as utils from "@app/utils";
import * as cache from "@app/cache";
import type { SafeMultisigTransactionListResponse } from '@gnosis.pm/safe-service-client';
import type SafeServiceClient from '@gnosis.pm/safe-service-client';
import type { Safe } from '@app/utils';
import type { Config } from '@app/config';
import type { PendingAnchor, Anchor } from '@app/project';
import type { SafeMultisigTransactionListResponse } from "@gnosis.pm/safe-service-client";
import type SafeServiceClient from "@gnosis.pm/safe-service-client";
import type { Safe } from "@app/utils";
import type { Config } from "@app/config";
import type { PendingAnchor, Anchor } from "@app/project";
const GetProjects = `
query GetProjects($org: ID!) {
@@ -75,7 +75,12 @@ export class Org {
name?: string | null;
safe?: Safe | null;
constructor(address: string, owner: string, name?: string | null, safe?: Safe | null) {
constructor(
address: string,
owner: string,
name?: string | null,
safe?: Safe | null,
) {
assert(ethers.utils.isAddress(address), "address must be valid");
this.address = address.toLowerCase(); // Don't store address checksum.
@@ -90,10 +95,11 @@ export class Org {
const org = new ethers.Contract(
this.address,
config.abi.org,
config.signer
config.signer,
);
return org.setName(name, config.provider.network.ensAddress,
{ gasLimit: 200_000 });
return org.setName(name, config.provider.network.ensAddress, {
gasLimit: 200_000,
});
}
async setNameMultisig(name: string, config: Config): Promise<void> {
@@ -105,7 +111,7 @@ export class Org {
const org = new ethers.Contract(
this.address,
config.abi.org,
config.signer
config.signer,
);
const unsignedTx = await org.populateTransaction.setName(
name,
@@ -113,8 +119,10 @@ export class Org {
);
const txData = unsignedTx.data;
if (! txData) {
throw new Error("Org::setNameMultisig: Could not generate transaction for `setName` call");
if (!txData) {
throw new Error(
"Org::setNameMultisig: Could not generate transaction for `setName` call",
);
}
const safeTx = {
@@ -126,13 +134,16 @@ export class Org {
await utils.proposeSafeTransaction(safeTx, safeAddress, config);
}
async setOwner(address: string, config: Config): Promise<TransactionResponse> {
async setOwner(
address: string,
config: Config,
): Promise<TransactionResponse> {
assert(config.signer);
const org = new ethers.Contract(
this.address,
config.abi.org,
config.signer
config.signer,
);
return org.setOwner(address);
}
@@ -146,15 +157,15 @@ export class Org {
const org = new ethers.Contract(
this.address,
config.abi.org,
config.signer
);
const unsignedTx = await org.populateTransaction.setOwner(
owner
config.signer,
);
const unsignedTx = await org.populateTransaction.setOwner(owner);
const txData = unsignedTx.data;
if (! txData) {
throw new Error("Org::setOwnerMultisig: Could not generate transaction for `setOwner` call");
if (!txData) {
throw new Error(
"Org::setOwnerMultisig: Could not generate transaction for `setOwner` call",
);
}
const safeTx = {
@@ -191,7 +202,7 @@ export class Org {
const result = await utils.querySubgraph(
config.orgs.subgraph,
GetProjects,
{ org: this.address }
{ org: this.address },
);
const projects: Anchor[] = [];
@@ -203,7 +214,7 @@ export class Org {
anchor: {
stateHash: utils.formatProjectHash(
ethers.utils.arrayify(p.anchor.multihash),
)
),
},
};
projects.push(proj);
@@ -215,12 +226,13 @@ export class Org {
}
async getPendingProjects(config: Config): Promise<PendingAnchor[]> {
if (! config.safe.client) return [];
if (!config.safe.client) return [];
try {
const orgAddr = ethers.utils.getAddress(this.address);
const response = await getPendingProjects(
ethers.utils.getAddress(this.owner), config.safe.client
ethers.utils.getAddress(this.owner),
config.safe.client,
);
const projects: PendingAnchor[] = [];
@@ -246,17 +258,17 @@ export class Org {
}
}
static async getAnchor(orgAddr: string, urn: string, config: Config): Promise<string | null> {
const org = new ethers.Contract(
orgAddr,
config.abi.org,
config.provider
);
static async getAnchor(
orgAddr: string,
urn: string,
config: Config,
): Promise<string | null> {
const org = new ethers.Contract(orgAddr, config.abi.org, config.provider);
const unpadded = utils.decodeRadicleId(urn);
const id = ethers.utils.zeroPad(unpadded, 32);
try {
const [,hash] = await org.anchors(id);
const [, hash] = await org.anchors(id);
const anchor = utils.formatProjectHash(ethers.utils.arrayify(hash));
return anchor;
@@ -288,7 +300,7 @@ export class Org {
}
static fromReceipt(receipt: ContractReceipt): Org | null {
const event = receipt.events?.find(e => e.event === 'OrgCreated');
const event = receipt.events?.find(e => e.event === "OrgCreated");
if (event && event.args) {
const address = event.args[0];
@@ -299,10 +311,7 @@ export class Org {
return null;
}
static async get(
addressOrName: string,
config: Config,
): Promise<Org | null> {
static async get(addressOrName: string, config: Config): Promise<Org | null> {
const org = await getOrgContract(addressOrName, config);
try {
@@ -327,10 +336,20 @@ export class Org {
// TODO: We use two subgraph queries since we can't do a filter query yet in the subgraph
// https://github.com/graphprotocol/graph-node/issues/2539#issuecomment-855979841
const safesByOwner = await utils.querySubgraph(config.orgs.subgraph, GetSafesByOwners, { owners: [owner] });
const safesByOwner = await utils.querySubgraph(
config.orgs.subgraph,
GetSafesByOwners,
{ owners: [owner] },
);
const safes = safesByOwner.safes.reduce(
(prev: any, curr: Safe) => prev.concat(curr.id), []);
const orgsByOwner = await utils.querySubgraph(config.orgs.subgraph, GetOrgsByOwners, { owners: [...safes, owner] });
(prev: any, curr: Safe) => prev.concat(curr.id),
[],
);
const orgsByOwner = await utils.querySubgraph(
config.orgs.subgraph,
GetOrgsByOwners,
{ owners: [...safes, owner] },
);
const orgs: { id: string; owner: string }[] = [...orgsByOwner.orgs];
return orgs.map(o => new Org(o.id, o.owner));
@@ -346,11 +365,11 @@ export class Org {
const orgFactory = new ethers.Contract(
config.orgFactory.address,
config.abi.orgFactory,
config.signer
config.signer,
);
return orgFactory['createOrg(address[],uint256)'](owners, threshold, {
gasLimit: config.gasLimits.createOrg
return orgFactory["createOrg(address[],uint256)"](owners, threshold, {
gasLimit: config.gasLimits.createOrg,
});
}
@@ -363,16 +382,19 @@ export class Org {
const orgFactory = new ethers.Contract(
config.orgFactory.address,
config.abi.orgFactory,
config.signer
config.signer,
);
return orgFactory['createOrg(address)'](owner, {
gasLimit: config.gasLimits.createOrg
return orgFactory["createOrg(address)"](owner, {
gasLimit: config.gasLimits.createOrg,
});
}
}
export function parseAnchorTx(data: string, config: Config): { id: string; stateHash: string } | null {
export function parseAnchorTx(
data: string,
config: Config,
): { id: string; stateHash: string } | null {
const iface = new ethers.utils.Interface(config.abi.org);
const parsedTx = iface.parseTransaction({ data });
@@ -380,7 +402,7 @@ export function parseAnchorTx(data: string, config: Config): { id: string; state
const encodedProjectUrn = parsedTx.args[0];
const encodedCommitHash = parsedTx.args[2];
const id = utils.formatRadicleId(
ethers.utils.arrayify(`${encodedProjectUrn}`)
ethers.utils.arrayify(`${encodedProjectUrn}`),
);
const byteArray = ethers.utils.arrayify(encodedCommitHash);
const stateHash = utils.formatProjectHash(byteArray);
@@ -392,35 +414,31 @@ export function parseAnchorTx(data: string, config: Config): { id: string; state
export const getOrgContract = cache.cached(
async (addressOrName: string, config: Config) => {
return new ethers.Contract(
addressOrName,
config.abi.org,
config.provider
);
return new ethers.Contract(addressOrName, config.abi.org, config.provider);
},
(addressOrName) => addressOrName
addressOrName => addressOrName,
);
export const resolveOrgOwner = cache.cached(
async (org: ethers.Contract) => {
return await Promise.all([
org.owner(),
org.resolvedAddress,
]);
return await Promise.all([org.owner(), org.resolvedAddress]);
},
(org) => org.address,
org => org.address,
);
export const getPendingProjects = cache.cached(
async (owner: string, client: SafeServiceClient): Promise<SafeMultisigTransactionListResponse> => {
async (
owner: string,
client: SafeServiceClient,
): Promise<SafeMultisigTransactionListResponse> => {
try {
return await client.getPendingTransactions(
ethers.utils.getAddress(owner)
ethers.utils.getAddress(owner),
);
} catch (e) {
return { count: 0, results: [] };
}
},
(owner) => owner,
{ max: 1000, ttl: 5 * 60 * 1000 } // Cache results for 5 minutes.
owner => owner,
{ max: 1000, ttl: 5 * 60 * 1000 }, // Cache results for 5 minutes.
);
+3 -1
View File
@@ -5,7 +5,9 @@
</script>
<Route path="/orgs">
<NotFound title="404" subtitle="Radicle Orgs are in the process of being re-designed." />
<NotFound
title="404"
subtitle="Radicle Orgs are in the process of being re-designed." />
</Route>
<Route path="/orgs/:addressOrName" let:params>
+46 -39
View File
@@ -1,14 +1,14 @@
<script lang="ts">
import { onMount, createEventDispatcher } from 'svelte';
import Modal from '@app/Modal.svelte';
import type { Config } from '@app/config';
import { onMount, createEventDispatcher } from "svelte";
import Modal from "@app/Modal.svelte";
import type { Config } from "@app/config";
import { formatAddress, isAddress } from "@app/utils";
import Loading from '@app/Loading.svelte';
import { assert } from '@app/error';
import * as utils from '@app/utils';
import Address from '@app/Address.svelte';
import Loading from "@app/Loading.svelte";
import { assert } from "@app/error";
import * as utils from "@app/utils";
import Address from "@app/Address.svelte";
import type { Org } from './Org';
import type { Org } from "./Org";
const dispatch = createEventDispatcher();
@@ -46,14 +46,14 @@
const onSubmit = async () => {
assert(newOwner);
if (! isAddress(newOwner)) {
if (!isAddress(newOwner)) {
state = State.Failed;
error = `"${newOwner}" is not a valid Ethereum address.`;
return;
}
try {
if (org && await utils.isSafe(org.owner, config)) {
if (org && (await utils.isSafe(org.owner, config))) {
state = State.Proposing;
await org.setOwnerMultisig(newOwner, config);
state = State.Proposed;
@@ -74,37 +74,37 @@
{#if state === State.Success && newOwner}
<Modal floating small>
<div slot="title">
✅
</div>
<div slot="title">✅</div>
<div slot="subtitle">
The ownership of <strong>{formatAddress(org.address)}</strong> was
successfully transfered to <strong>{newOwner}</strong>.
The ownership of <strong>{formatAddress(org.address)}</strong>
was successfully transfered to
<strong>{newOwner}</strong>
.
</div>
<div slot="actions">
<button class="regular" on:click={() => dispatch('close')}>
Done
</button>
<button class="regular" on:click={() => dispatch("close")}>Done</button>
</div>
</Modal>
{:else if state === State.Proposed && org}
<Modal floating>
<div slot="title">
🪴
</div>
<div slot="title">🪴</div>
<div slot="subtitle">
<p>The transaction to set the owner of <strong>{formatAddress(org.address)}</strong>
to <strong>{newOwner}</strong> was proposed to:</p>
<p>
The transaction to set the owner of <strong>
{formatAddress(org.address)}
</strong>
to
<strong>{newOwner}</strong>
was proposed to:
</p>
<p><Address address={org.owner} {config} compact /></p>
</div>
<div slot="actions">
<button class="regular" on:click={() => dispatch('close')}>
Done
</button>
<button class="regular" on:click={() => dispatch("close")}>Done</button>
</div>
</Modal>
{:else}
@@ -121,10 +121,13 @@
Waiting for transaction to be processed...
{:else if state === State.Proposing && org}
Proposal is being submitted to the safe
<strong>{formatAddress(org.owner)}</strong>,
please sign the transaction in your wallet.
<strong>{formatAddress(org.owner)}</strong>
, please sign the transaction in your wallet.
{:else if state === State.Idle}
Transfer the ownership of Org <strong>{formatAddress(org.address)}</strong> to a new address.
Transfer the ownership of Org <strong>
{formatAddress(org.address)}
</strong>
to a new address.
{:else if state === State.Failed}
<div class="error">
{error}
@@ -134,7 +137,12 @@
<div slot="body">
{#if state === State.Idle}
<input type="text" size="40" disabled={state !== State.Idle} bind:this={input} bind:value={newOwner} />
<input
type="text"
size="40"
disabled={state !== State.Idle}
bind:this={input}
bind:value={newOwner} />
{:else if state === State.Pending || state === State.Proposing || state === State.Signing}
<Loading small center />
{:else if state === State.Failed}
@@ -144,25 +152,24 @@
<div slot="actions">
{#if state === State.Signing}
<button class="regular" on:click={() => dispatch('close')}>
<button class="regular" on:click={() => dispatch("close")}>
Cancel
</button>
{:else if state === State.Pending}
<button class="regular" on:click={() => dispatch('close')}>
<button class="regular" on:click={() => dispatch("close")}>
Close
</button>
{:else if state === State.Failed}
<button class="regular" on:click={resetForm}>
Back
</button>
<button class="regular" on:click={resetForm}>Back</button>
{:else}
<button class="primary" on:click={onSubmit} disabled={!newOwner || state !== State.Idle}>
<button
class="primary"
on:click={onSubmit}
disabled={!newOwner || state !== State.Idle}>
Submit
</button>
<button class="text" on:click={() => dispatch('close')}>
Cancel
</button>
<button class="text" on:click={() => dispatch("close")}>Cancel</button>
{/if}
</div>
</Modal>
+10 -5
View File
@@ -5,7 +5,7 @@
import * as proj from "@app/project";
import Loading from "@app/Loading.svelte";
import Message from "@app/Message.svelte";
import Widget from '@app/base/projects/Widget.svelte';
import Widget from "@app/base/projects/Widget.svelte";
import type { Profile } from "@app/profile";
import type { ProjectInfo, Anchor, PendingAnchor } from "@app/project";
import type { Seed } from "@app/base/seeds/Seed";
@@ -38,7 +38,7 @@
seed: seed?.host,
profile: profile?.name ?? profile?.address,
revision: project.head,
})
}),
);
};
@@ -70,9 +70,13 @@
<Widget {project} {seed} {anchor} on:click={() => onClick(project)}>
<span class="actions" slot="actions">
{#if profile?.org?.safe && account && anchor}
{#if pendingAnchor} <!-- Pending anchor -->
{#if pendingAnchor}
<!-- Pending anchor -->
<AnchorActions
{account} {config} anchor={pendingAnchor} safe={profile.org.safe}
{account}
{config}
anchor={pendingAnchor}
safe={profile.org.safe}
on:success={() => loadAnchors()} />
{/if}
{/if}
@@ -83,7 +87,8 @@
{/each}
{:catch err}
<Message error>
<strong>Error: </strong> failed to load projects: {err.message}.
<strong>Error:</strong>
failed to load projects: {err.message}.
</Message>
{/await}
</div>
+60 -37
View File
@@ -6,7 +6,7 @@
import * as utils from "@app/utils";
import Modal from "@app/Modal.svelte";
import Avatar from "@app/Avatar.svelte";
import { createEventDispatcher } from 'svelte';
import { createEventDispatcher } from "svelte";
import Badge from "@app/Badge.svelte";
export let safe: Safe;
@@ -44,7 +44,11 @@
try {
action = Action.Execute;
state = State.Signing;
const txResult = await utils.executeSignedSafeTransaction(safe.address, safeTxHash, config);
const txResult = await utils.executeSignedSafeTransaction(
safe.address,
safeTxHash,
config,
);
state = State.Submitting;
await txResult.transactionResponse?.wait();
@@ -61,7 +65,11 @@
try {
action = Action.Sign;
state = State.Signing;
const signature = await utils.signSafeTransaction(safe.address, safeTxHash, config);
const signature = await utils.signSafeTransaction(
safe.address,
safeTxHash,
config,
);
state = State.Submitting;
await config.safe.client?.confirmTransaction(safeTxHash, signature.data);
@@ -74,9 +82,7 @@
}
};
$: isSigned = anchor.confirmations.includes(
ethers.utils.getAddress(account)
);
$: isSigned = anchor.confirmations.includes(ethers.utils.getAddress(account));
</script>
<style>
@@ -89,10 +95,12 @@
grid-gap: 1rem;
text-align: left;
}
.table > *:nth-child(odd) { /* Labels */
.table > *:nth-child(odd) {
/* Labels */
color: var(--color-secondary);
}
.table > *:nth-child(even) { /* Values */
.table > *:nth-child(even) {
/* Values */
display: flex;
align-items: center;
justify-content: left;
@@ -110,7 +118,8 @@
<span class="confirmations">
{#if pending > 0}
<strong>{pending}</strong> signature(s) pending
<strong>{pending}</strong>
signature(s) pending
{/if}
</span>
@@ -122,20 +131,24 @@
<!-- Check whether the threshold has been matched or passed -->
{#if pending <= 0}
<button on:click|stopPropagation={() => {
action = Action.Execute;
state = State.Confirm;
}} class="small execute">
<button
on:click|stopPropagation={() => {
action = Action.Execute;
state = State.Confirm;
}}
class="small execute">
<Avatar inline source={account} title={account} /> Execute
</button>
<!-- Check whether or not we've signed this proposal -->
{:else if isSigned}
<Badge variant="caution">✓ signed</Badge>
{:else}
<button on:click|stopPropagation={() => {
action = Action.Sign;
state = State.Confirm;
}} class="small">
<button
on:click|stopPropagation={() => {
action = Action.Sign;
state = State.Confirm;
}}
class="small">
Confirm
</button>
{/if}
@@ -165,8 +178,10 @@
<span slot="body">
{#if state === State.Confirm}
<div class="table">
<div>Project</div><code>{anchor.id}</code>
<div>Hash</div><code>{anchor.anchor.stateHash}</code>
<div>Project</div>
<code>{anchor.id}</code>
<div>Hash</div>
<code>{anchor.anchor.stateHash}</code>
</div>
{:else if state === State.Failed}
<div>{error}</div>
@@ -175,17 +190,20 @@
<span slot="actions">
{#if state === State.Confirm}
<button class="primary" on:click={() => confirmAnchor(anchor.safeTxHash)}>
<button
class="primary"
on:click={() => confirmAnchor(anchor.safeTxHash)}>
Confirm
</button>
<button class="text" on:click={close}>
Cancel
</button>
<button class="text" on:click={close}>Cancel</button>
{:else if state === State.Success || state === State.Failed}
<button on:click={() => {
close();
dispatch("success");
}}>Done</button>
<button
on:click={() => {
close();
dispatch("success");
}}>
Done
</button>
{/if}
</span>
</Modal>
@@ -213,8 +231,10 @@
<span slot="body">
{#if state === State.Confirm}
<div class="table">
<div>TxHash</div><code>{utils.formatHash(anchor.safeTxHash)}</code>
<div>Quorum</div><code>{anchor.confirmations.length} of {safe.threshold}</code>
<div>TxHash</div>
<code>{utils.formatHash(anchor.safeTxHash)}</code>
<div>Quorum</div>
<code>{anchor.confirmations.length} of {safe.threshold}</code>
</div>
{:else if state === State.Failed}
<div>{error}</div>
@@ -223,17 +243,20 @@
<span slot="actions">
{#if state === State.Confirm}
<button class="primary" on:click={() => executeTransaction(anchor.safeTxHash)}>
<button
class="primary"
on:click={() => executeTransaction(anchor.safeTxHash)}>
Confirm
</button>
<button class="text" on:click={close}>
Cancel
</button>
<button class="text" on:click={close}>Cancel</button>
{:else if state === State.Success || state === State.Failed}
<button on:click={() => {
close();
dispatch("success");
}}>Done</button>
<button
on:click={() => {
close();
dispatch("success");
}}>
Done
</button>
{/if}
</span>
</Modal>
+31 -12
View File
@@ -1,5 +1,5 @@
<script lang="ts">
import { createEventDispatcher } from 'svelte';
import { createEventDispatcher } from "svelte";
const dispatch = createEventDispatcher();
@@ -48,27 +48,46 @@
<!-- commit is head and latest anchor -->
{#if commit === anchors[0] && commit === head}
<span class="anchor-widget anchor-latest" class:no-bg={noBg}>
<span class="anchor-label" title="{anchors[0]}">{#if text}latest&nbsp;{/if}🔐</span>
<span class="anchor-label" title={anchors[0]}>
{#if text}latest&nbsp;{/if}🔐
</span>
</span>
<!-- commit is not head but latest anchor -->
<!-- commit is not head but latest anchor -->
{:else if commit === anchors[0] && commit !== head}
<span class="anchor-widget" class:no-bg={noBg} on:click={() => dispatch("click", head)}>
<span class="anchor-label" title="{anchors[0]}">{#if text}latest&nbsp;{/if}🔐</span>
<span
class="anchor-widget"
class:no-bg={noBg}
on:click={() => dispatch("click", head)}>
<span class="anchor-label" title={anchors[0]}>
{#if text}latest&nbsp;{/if}🔐
</span>
</span>
<!-- commit is not head a stale anchor -->
<!-- commit is not head a stale anchor -->
{:else if anchors.includes(commit)}
<span class="anchor-widget" class:no-bg={noBg} on:click={() => dispatch("click", anchors[0])}>
<span class="anchor-label" title="{commit}">{#if text}stale&nbsp;{/if}🔒</span>
<span
class="anchor-widget"
class:no-bg={noBg}
on:click={() => dispatch("click", anchors[0])}>
<span class="anchor-label" title={commit}>
{#if text}stale&nbsp;{/if}🔒
</span>
</span>
<!-- commit is not anchored, could be head or any other commit -->
<!-- commit is not anchored, could be head or any other commit -->
{:else}
<span class="anchor-widget not-anchored" class:no-bg={noBg} on:click={() => dispatch("click", anchors[0])}>
<span class="anchor-label">{#if text}not anchored&nbsp;{/if}🔓</span>
<span
class="anchor-widget not-anchored"
class:no-bg={noBg}
on:click={() => dispatch("click", anchors[0])}>
<span class="anchor-label">
{#if text}not anchored&nbsp;{/if}🔓
</span>
</span>
{/if}
{:else}
<!-- commit is not head and neither an anchor, and there are no anchors available -->
<span class="anchor-widget not-anchored not-allowed" class:no-bg={noBg}>
<span class="anchor-label">{#if text}not anchored&nbsp;{/if}🔓</span>
<span class="anchor-label">
{#if text}not anchored&nbsp;{/if}🔓
</span>
</span>
{/if}
+25 -12
View File
@@ -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}
+75 -55
View File
@@ -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;
});
});
});
+5 -3
View File
@@ -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}
+18 -19
View File
@@ -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}
+8 -6
View File
@@ -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>
+1 -1
View File
@@ -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>&nbsp;committed</span>
{:else}
<span class="desktop-inline committer">{commit.header.committer.name}</span>
<span class="desktop-inline committer">
{commit.header.committer.name}
</span>
<span>&nbsp;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>&nbsp;authored&nbsp;</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>&nbsp;</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>
+4 -1
View File
@@ -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>
+12 -9
View File
@@ -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>
+31 -17
View File
@@ -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>
+8 -10
View File
@@ -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>
+9 -4
View File
@@ -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} />
+15 -6
View File
@@ -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} />
+5 -5
View File
@@ -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>
+9 -3
View File
@@ -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>
+9 -4
View File
@@ -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} />
+14 -7
View File
@@ -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} />
+34 -32
View File
@@ -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;
});
});
});
+23 -11
View File
@@ -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>
+48 -27
View File
@@ -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}
+12 -3
View File
@@ -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>
+5 -6
View File
@@ -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} />
+2 -2
View File
@@ -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>;
+9 -5
View File
@@ -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}

Some files were not shown because too many files have changed in this diff Show More