Radish alpha
r
Radicle web interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
Improve handling missing files and README
Sebastian Martinez committed 2 years ago
commit 24628f57d8790633d831187a786ed7a491aa1f65
parent 29a53f1ff6a7fc3dfdd83952f5f38e913b2e2b0d
2 files changed +22 -12
modified src/views/projects/Source.svelte
@@ -6,14 +6,12 @@
  import { HttpdClient } from "@httpd-client";

  import Button from "@app/components/Button.svelte";
-
  import File from "@app/components/File.svelte";
  import Header from "./Source/Header.svelte";
  import Layout from "./Layout.svelte";
  import Placeholder from "@app/components/Placeholder.svelte";

  import BlobComponent from "./Source/Blob.svelte";
  import TreeComponent from "./Source/Tree.svelte";
-
  import FilePath from "@app/components/FilePath.svelte";

  export let baseUrl: BaseUrl;
  export let rawPath: (commit?: string) => string;
@@ -98,6 +96,11 @@
    min-width: var(--content-min-width);
    width: 100%;
  }
+
  .placeholder {
+
    padding: 4rem 0;
+
    border: 1px solid var(--color-border-hint);
+
    border-radius: var(--border-radius-small);
+
  }

  .source-tree {
    overflow-x: hidden;
@@ -209,20 +212,19 @@
            blob={blobResult.blob}
            highlighted={blobResult.highlighted}
            rawPath={rawPath(tree.lastCommit.id)} />
+
        {:else if path === "/"}
+
          <div class="placeholder">
+
            <Placeholder iconName="no-file" caption="No README found." />
+
          </div>
        {:else}
-
          <File>
-
            <FilePath
-
              slot="left-header"
-
              filenameWithPath={blobResult.error.path} />
-
            <div style:margin="4rem 0" style:width="100%">
-
              <Placeholder iconName="no-file" caption="File not found" />
-
            </div>
-
          </File>
+
          <div class="placeholder">
+
            <Placeholder iconName="no-file" caption="File not found." />
+
          </div>
        {/if}
      </div>
    {:else}
-
      <div style:margin="4rem 0" style:width="100%">
-
        <Placeholder iconName="no-file" caption="No files at this revision" />
+
      <div class="placeholder">
+
        <Placeholder iconName="no-file" caption="No files at this revision." />
      </div>
    {/if}
  </div>
modified tests/visual/project.spec.ts
@@ -4,6 +4,7 @@ import {
  cobUrl,
  sourceBrowsingUrl,
  aliceRemote,
+
  markdownUrl,
} from "@tests/support/fixtures.js";

test("source page", async ({ page }) => {
@@ -84,6 +85,13 @@ test("project not found", async ({ page }) => {
  await expect(page).toHaveScreenshot();
});

+
test("readme not found", async ({ page }) => {
+
  await page.goto(`${markdownUrl}/tree`, {
+
    waitUntil: "networkidle",
+
  });
+
  await expect(page).toHaveScreenshot();
+
});
+

test("file not found", async ({ page }) => {
  await page.goto(`${sourceBrowsingUrl}/tree/this.file.does.not.exist`, {
    waitUntil: "networkidle",