mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-21 06:10:44 +08:00
Improve handling missing files and README
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user