From 703fb3845fdc8816a0653c8c058064fd196d4882 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C5=ABdolfs=20O=C5=A1i=C5=86=C5=A1?= Date: Thu, 22 Feb 2024 09:20:52 +0000 Subject: [PATCH] Hide git clone behind a tab in the Clone button --- src/components/IconSmall.svelte | 4 ++ src/views/projects/Header/CloneButton.svelte | 65 +++++++++++++++----- tests/e2e/clipboard.spec.ts | 1 + tests/e2e/project.spec.ts | 3 +- 4 files changed, 57 insertions(+), 16 deletions(-) diff --git a/src/components/IconSmall.svelte b/src/components/IconSmall.svelte index 452fe1cf6..3168c2c63 100644 --- a/src/components/IconSmall.svelte +++ b/src/components/IconSmall.svelte @@ -36,6 +36,7 @@ | "file" | "folder" | "folder-open" + | "git" | "globe" | "help" | "home" @@ -324,6 +325,9 @@ fill-rule="evenodd" clip-rule="evenodd" d="M3.672 6.97a1.25 1.25 0 011.24-1.095h8.238a1.25 1.25 0 011.24 1.405l-.562 4.5a1.25 1.25 0 01-1.24 1.095H3.585a.575.575 0 01-.57-.646l.657-5.259zm1.24-.095a.25.25 0 00-.248.219l-.598 4.781h8.522a.25.25 0 00.248-.219l.563-4.5a.25.25 0 00-.249-.281H4.912z" /> + {:else if name === "git"} + {:else if name === "globe"} import type { BaseUrl } from "@httpd-client"; - import { parseRepositoryId } from "@app/lib/utils"; import { config } from "@app/lib/config"; + import { parseRepositoryId } from "@app/lib/utils"; import Button from "@app/components/Button.svelte"; import Command from "@app/components/Command.svelte"; - import ExternalLink from "@app/components/ExternalLink.svelte"; import Icon from "@app/components/Icon.svelte"; + import IconSmall from "@app/components/IconSmall.svelte"; import Popover from "@app/components/Popover.svelte"; + import Radio from "@app/components/Radio.svelte"; export let baseUrl: BaseUrl; export let id: string; export let name: string; + let radicle: boolean = true; + $: radCloneUrl = `rad clone ${id}`; $: portFragment = baseUrl.scheme === config.nodes.defaultHttpdScheme && @@ -26,10 +29,12 @@ @@ -40,19 +45,49 @@ -
+
- - + + + +
-
- - -
+ {#if radicle} + + + {:else} +
+ + +
+ Note that a Git clone does not include any of the social artifacts + such as issues or patches. +
+
+ {/if}
diff --git a/tests/e2e/clipboard.spec.ts b/tests/e2e/clipboard.spec.ts index 3d56fc613..ababb2e71 100644 --- a/tests/e2e/clipboard.spec.ts +++ b/tests/e2e/clipboard.spec.ts @@ -49,6 +49,7 @@ test("copy to clipboard", async ({ page, browserName, context }) => { // `git clone` URL. { + await page.getByRole("button", { name: "Git" }).click(); await page.getByText("git clone").locator(".clipboard").first().click(); await expectClipboard( `git clone http://127.0.0.1/${sourceBrowsingRid.replace( diff --git a/tests/e2e/project.spec.ts b/tests/e2e/project.spec.ts index bb00c37ab..d88e3e396 100644 --- a/tests/e2e/project.spec.ts +++ b/tests/e2e/project.spec.ts @@ -258,8 +258,9 @@ test("markdown files", async ({ page }) => { test("clone modal", async ({ page }) => { await page.goto(sourceBrowsingUrl); - await page.getByText("Clone").click(); + await page.getByRole("button", { name: "Clone" }).click(); await expect(page.getByText(`rad clone ${sourceBrowsingRid}`)).toBeVisible(); + await page.getByRole("button", { name: "Git" }).click(); await expect( page.getByText( `http://127.0.0.1/${sourceBrowsingRid.replace("rad:", "")}.git`,