From b3cec1f314fdc864ec146aa930166bb927fa43b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C5=ABdolfs=20O=C5=A1i=C5=86=C5=A1?= Date: Wed, 31 Aug 2022 10:46:26 +0200 Subject: [PATCH] Format *.ts, *.js, *.css, *.html, *.json and *.svelte MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rūdolfs Ošiņš --- .eslintrc.json | 38 +- .nycrc.json | 9 +- cypress/e2e/home.spec.ts | 38 +- cypress/e2e/project.spec.ts | 224 +++++--- cypress/fixtures/ceramicStream.json | 4 +- cypress/fixtures/projectCommit.json | 5 +- cypress/fixtures/projectInfo.json | 4 +- cypress/fixtures/projectIssues.json | 24 +- cypress/fixtures/projectList.json | 32 +- cypress/fixtures/projectPatches.json | 4 +- cypress/support/component.ts | 2 +- cypress/support/e2e.ts | 101 ++-- index.html | 26 +- public/index.css | 533 +++++++++--------- public/typography.css | 46 +- src/Address.svelte | 47 +- src/App.svelte | 48 +- src/Async.svelte | 3 +- src/Authorship.svelte | 15 +- src/Avatar.svelte | 14 +- src/BlockTimer.spec.ts | 52 +- src/BlockTimer.svelte | 5 +- src/Card.svelte | 35 +- src/Cards.svelte | 63 ++- src/Clipboard.svelte | 4 +- src/Comment.svelte | 19 +- src/Connect.svelte | 22 +- src/Diagram.svelte | 66 ++- src/Dropdown.svelte | 19 +- src/Error.spec.ts | 46 +- src/Error.svelte | 11 +- src/Floating.svelte | 4 +- src/Form.svelte | 103 ++-- src/Header.svelte | 70 ++- src/Icon.svelte | 34 +- src/Input.svelte | 4 +- src/LinearGradient.svelte | 2 +- src/Link.svelte | 6 +- src/Loading.svelte | 70 ++- src/Logo.svelte | 27 +- src/Markdown.svelte | 13 +- src/Message.svelte | 2 +- src/MobileNavbar.svelte | 14 +- src/Modal.svelte | 35 +- src/NotFound.spec.ts | 6 +- src/NotFound.svelte | 6 +- src/Options.svelte | 24 +- src/Placeholder.svelte | 4 +- src/Profile.svelte | 176 ++++-- src/RadicleUrn.svelte | 14 +- src/Reactions.svelte | 8 +- src/Review.svelte | 13 +- src/Search.spec.ts | 8 +- src/Search.svelte | 24 +- src/SeedAddress.spec.ts | 14 +- src/SeedAddress.svelte | 18 +- src/SeedDropdown.svelte | 22 +- src/SiweConnect.svelte | 5 +- src/ToggleButton.svelte | 6 +- src/WalletConnectSigner.ts | 56 +- src/anchors.ts | 16 +- src/api.ts | 19 +- src/base/faucet/Index.svelte | 62 +- src/base/faucet/Withdraw.svelte | 12 +- src/base/faucet/lib.ts | 44 +- src/base/home/Index.svelte | 56 +- src/base/orgs/Create.svelte | 93 +-- src/base/orgs/Index.svelte | 48 +- src/base/orgs/Org.ts | 152 ++--- src/base/orgs/Routes.svelte | 4 +- src/base/orgs/TransferOwnership.svelte | 85 +-- src/base/orgs/View/Projects.svelte | 15 +- src/base/profiles/AnchorActions.svelte | 97 ++-- src/base/profiles/AnchorBadge.svelte | 43 +- src/base/projects/Blob.svelte | 37 +- src/base/projects/BranchSelector.spec.ts | 130 +++-- src/base/projects/BranchSelector.svelte | 8 +- src/base/projects/Browser.svelte | 37 +- src/base/projects/CloneButton.svelte | 14 +- src/base/projects/Commit.svelte | 2 +- .../projects/Commit/CommitAuthorship.svelte | 26 +- src/base/projects/Commit/CommitTeaser.svelte | 5 +- .../Commit/CommitVerifiedBadge.svelte | 8 +- src/base/projects/Header.svelte | 21 +- src/base/projects/History.svelte | 48 +- src/base/projects/Issue.svelte | 18 +- src/base/projects/Issue/IssueTeaser.svelte | 13 +- src/base/projects/Issues.svelte | 21 +- src/base/projects/Patch.svelte | 10 +- src/base/projects/Patch/PatchTabBar.svelte | 12 +- src/base/projects/Patch/PatchTeaser.svelte | 13 +- src/base/projects/Patches.svelte | 21 +- src/base/projects/PeerSelector.spec.ts | 66 +-- src/base/projects/PeerSelector.svelte | 34 +- src/base/projects/Project.svelte | 75 ++- src/base/projects/ProjectMeta.svelte | 15 +- src/base/projects/ProjectRoute.svelte | 11 +- src/base/projects/Readme.svelte | 4 +- src/base/projects/Routes.svelte | 14 +- .../projects/SourceBrowser/Changeset.svelte | 4 +- .../projects/SourceBrowser/FileDiff.svelte | 12 +- src/base/projects/Tree.svelte | 10 +- src/base/projects/Tree/File.svelte | 2 +- src/base/projects/Tree/Folder.svelte | 2 +- src/base/projects/View.svelte | 73 ++- src/base/projects/Widget.svelte | 33 +- src/base/registrations/Index.svelte | 26 +- src/base/registrations/New.svelte | 49 +- src/base/registrations/Routes.svelte | 25 +- src/base/registrations/Submit.svelte | 40 +- src/base/registrations/Update.svelte | 39 +- src/base/registrations/View.svelte | 217 ++++--- src/base/registrations/registrar.ts | 249 +++++--- src/base/registrations/resolver.ts | 37 +- src/base/resolver/List.svelte | 56 +- src/base/resolver/Query.svelte | 34 +- src/base/resolver/Routes.svelte | 6 +- src/base/seeds/Routes.svelte | 8 +- src/base/seeds/Seed.ts | 43 +- src/base/seeds/View.svelte | 19 +- src/base/users/User.ts | 10 +- src/base/vesting/Index.svelte | 73 ++- src/base/vesting/vesting.ts | 29 +- src/blockies.ts | 12 +- src/cache.ts | 2 +- src/commit.ts | 36 +- src/components/Modal/ConnectWallet.svelte | 23 +- src/config.json | 12 +- src/config.ts | 102 ++-- src/ens/DomainInput.svelte | 13 +- src/ens/SetName.svelte | 102 ++-- src/error.ts | 16 +- src/issue.ts | 50 +- src/patch.ts | 102 ++-- src/polyfills/canvas.js | 2 +- src/polyfills/enc-utils.js | 21 +- src/polyfills/events.ts | 2 +- src/polyfills/fetch.js | 4 +- src/polyfills/stream.ts | 2 +- src/polyfills/typedarray-to-buffer.js | 4 +- src/profile.ts | 93 ++- src/project.ts | 166 ++++-- src/session.ts | 193 ++++--- src/siwe.ts | 30 +- src/utils.test.ts | 385 ++++++++----- src/utils.ts | 295 ++++++---- tsconfig.json | 15 +- vite.config.ts | 61 +- 148 files changed, 4040 insertions(+), 2555 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 0c55e5d93..3bb27de30 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -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", diff --git a/.nycrc.json b/.nycrc.json index 180baea18..4cd50966b 100644 --- a/.nycrc.json +++ b/.nycrc.json @@ -1,10 +1,5 @@ { "all": true, - "extension": [ - ".svelte", - ".ts" - ], - "include": [ - "src/**/*" - ] + "extension": [".svelte", ".ts"], + "include": ["src/**/*"] } diff --git a/cypress/e2e/home.spec.ts b/cypress/e2e/home.spec.ts index 3822d4ac2..99f12fbaa 100644 --- a/cypress/e2e/home.spec.ts +++ b/cypress/e2e/home.spec.ts @@ -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") diff --git a/cypress/e2e/project.spec.ts b/cypress/e2e/project.spec.ts index 79ffa50b2..49927a06c 100644 --- a/cypress/e2e/project.spec.ts +++ b/cypress/e2e/project.spec.ts @@ -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"); }); }); - diff --git a/cypress/fixtures/ceramicStream.json b/cypress/fixtures/ceramicStream.json index 7dd278162..c87397434 100644 --- a/cypress/fixtures/ceramicStream.json +++ b/cypress/fixtures/ceramicStream.json @@ -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", diff --git a/cypress/fixtures/projectCommit.json b/cypress/fixtures/projectCommit.json index edcb31fbf..2e8f7f93c 100644 --- a/cypress/fixtures/projectCommit.json +++ b/cypress/fixtures/projectCommit.json @@ -142,8 +142,5 @@ } ] }, - "branches": [ - "main", - "master" - ] + "branches": ["main", "master"] } diff --git a/cypress/fixtures/projectInfo.json b/cypress/fixtures/projectInfo.json index 9a373f747..ee92f84aa 100644 --- a/cypress/fixtures/projectInfo.json +++ b/cypress/fixtures/projectInfo.json @@ -7,9 +7,7 @@ { "type": "indirect", "urn": "rad:git:hnrkqz68g6nddigodpgjmc1u8ydpzb8fqq8ro", - "ids": [ - "hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke" - ] + "ids": ["hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke"] } ], "head": "56e4e029c294b08546386e1fb706b772c7433c49", diff --git a/cypress/fixtures/projectIssues.json b/cypress/fixtures/projectIssues.json index f406ab5e4..15c6014b6 100644 --- a/cypress/fixtures/projectIssues.json +++ b/cypress/fixtures/projectIssues.json @@ -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 } ] diff --git a/cypress/fixtures/projectList.json b/cypress/fixtures/projectList.json index 71b005836..f129c470b 100644 --- a/cypress/fixtures/projectList.json +++ b/cypress/fixtures/projectList.json @@ -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" + } +] diff --git a/cypress/fixtures/projectPatches.json b/cypress/fixtures/projectPatches.json index 7b75556c4..cc2596b50 100644 --- a/cypress/fixtures/projectPatches.json +++ b/cypress/fixtures/projectPatches.json @@ -29,9 +29,7 @@ } }, "body": "Signed-off-by: Sebastian Martinez ", - "reactions": { - - }, + "reactions": {}, "replies": null, "timestamp": 1656666433 }, diff --git a/cypress/support/component.ts b/cypress/support/component.ts index 691da185c..241628cd8 100644 --- a/cypress/support/component.ts +++ b/cypress/support/component.ts @@ -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 diff --git a/cypress/support/e2e.ts b/cypress/support/e2e.ts index 282fb3fac..a48aaceeb 100644 --- a/cypress/support/e2e.ts +++ b/cypress/support/e2e.ts @@ -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 { @@ -35,7 +39,9 @@ export class MockExtensionProvider extends ethers.providers.BaseProvider { return new Resolver(this, address, name, address); } - async lookupAddress(address: string | Promise): Promise { + async lookupAddress( + address: string | Promise, + ): Promise { 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 { + async request({ + method, + params, + }: { + method: string; + params: any; + }): Promise { 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 diff --git a/index.html b/index.html index 92730d48d..161647320 100644 --- a/index.html +++ b/index.html @@ -3,21 +3,33 @@ - + - + - + - - - - + + + + + {/if} diff --git a/src/Async.svelte b/src/Async.svelte index 38856f5b1..7535bb44d 100644 --- a/src/Async.svelte +++ b/src/Async.svelte @@ -12,7 +12,8 @@
- API request to {err.url} failed. + API request to {err.url} + failed.
diff --git a/src/Authorship.svelte b/src/Authorship.svelte index b0dadda59..cb1b351dc 100644 --- a/src/Authorship.svelte +++ b/src/Authorship.svelte @@ -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, + ); } }); @@ -42,7 +46,14 @@ {#if profile}
{:else if author.profile} diff --git a/src/Avatar.svelte b/src/Avatar.svelte index 863291b39..5f704bec8 100644 --- a/src/Avatar.svelte +++ b/src/Avatar.svelte @@ -1,6 +1,6 @@ - + @@ -87,11 +102,22 @@ {#if points.length > 0} - + {:else} - + {/if} diff --git a/src/Dropdown.svelte b/src/Dropdown.svelte index a3a281725..ef869b03f 100644 --- a/src/Dropdown.svelte +++ b/src/Dropdown.svelte @@ -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 @@