mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-21 22:30:41 +08:00
Make project head optional
This is useful since some seeds may not have delegates synced. Signed-off-by: Alexis Sellier <self@cloudhead.io>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import type { Readable } from 'svelte/store';
|
||||
import * as proj from '@app/project';
|
||||
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';
|
||||
@@ -21,10 +21,11 @@
|
||||
export let project: proj.Project;
|
||||
export let tree: proj.Tree;
|
||||
export let browserStore: Readable<proj.Browser>;
|
||||
export let commit: string;
|
||||
|
||||
$: browser = $browserStore;
|
||||
$: path = browser.path || "/";
|
||||
$: revision = browser.revision || project.branches[project.head];
|
||||
$: revision = browser.revision;
|
||||
|
||||
// When the component is loaded the first time, the blob is yet to be loaded.
|
||||
let state: State = { status: Status.Loading, path };
|
||||
@@ -70,7 +71,6 @@
|
||||
mobileFileTree = !mobileFileTree;
|
||||
};
|
||||
|
||||
$: commit = proj.getOid(revision, project.branches) || project.head;
|
||||
$: getBlob = loadBlob(path);
|
||||
$: loadingPath = state.status == Status.Loading ? state.path : null;
|
||||
</script>
|
||||
|
||||
@@ -141,7 +141,7 @@
|
||||
<Header {tree} {commit} {browserStore} {project} peerSelector={! project.profile} />
|
||||
|
||||
{#if content == proj.ProjectContent.Tree}
|
||||
<Browser {project} {tree} {browserStore} />
|
||||
<Browser {project} {commit} {tree} {browserStore} />
|
||||
{:else if content == proj.ProjectContent.History}
|
||||
<History {project} {commit} />
|
||||
{:else if content == proj.ProjectContent.Commit}
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
{#if project.head}
|
||||
{project.head}
|
||||
{:else}
|
||||
<span class="subtle">Could not retrieve HEAD</span>
|
||||
<span class="subtle">✗ No head</span>
|
||||
{/if}
|
||||
</slot>
|
||||
</span>
|
||||
@@ -104,7 +104,7 @@
|
||||
</span>
|
||||
<span class="anchor-badge">
|
||||
<slot name="anchor">
|
||||
{#if anchor}
|
||||
{#if anchor && project.head}
|
||||
<AnchorBadge
|
||||
commit={project.head}
|
||||
head={project.head} noText noBg
|
||||
|
||||
Reference in New Issue
Block a user