diff --git a/src/base/projects/Browser.svelte b/src/base/projects/Browser.svelte index 62acd1a3b..434d1e5fc 100644 --- a/src/base/projects/Browser.svelte +++ b/src/base/projects/Browser.svelte @@ -1,8 +1,6 @@
- {#await proj.getTree(urn, commit, "/", config)} - - {:then tree} -
-
- {#if commit === project.head} -
- {project.meta.defaultBranch} -
-
- {utils.formatCommit(commit)} -
- {:else} -
- {commit} -
-
- {utils.formatCommit(commit)} -
- {/if} -
-
- {#if anchors} - {#await getAnchor} - - {:then anchor} - {#if anchor} - - {#if commit == anchor[0] && commit === project.head} - - latest 🔐 - - - {:else if commit == anchor[0] && commit !== project.head} - navigateBrowser(project.head)}> - latest 🔐 - - - {:else if anchor?.includes(commit)} - navigateBrowser(anchor[0])}> - stale 🔒 - - - {:else} - navigateBrowser(anchor[0])}> - not anchored 🔓 - - {/if} - {:else} - - - not anchored 🔓 - - {/if} - {/await} - {/if} -
- {#if config.seed.git.host} - -
cloneDropdown = !cloneDropdown}> - Clone -
- -
- {/if} - - {#if config.seed.api.host} -
seedDropdown = !seedDropdown} title="Project data is fetched from this seed"> - {config.seed.api.host} -
- {/if} - -
-
- {tree.stats.commits} commit(s) -
-
- {tree.stats.contributors} contributor(s) -
-
-
diff --git a/src/base/projects/Header.svelte b/src/base/projects/Header.svelte new file mode 100644 index 000000000..3169877b8 --- /dev/null +++ b/src/base/projects/Header.svelte @@ -0,0 +1,292 @@ + + + + +
+
+ {#if commit === project.head} +
+ {project.meta.defaultBranch} +
+
+ {utils.formatCommit(commit)} +
+ {:else} +
+ {commit} +
+
+ {utils.formatCommit(commit)} +
+ {/if} +
+
+ {#if anchors} + {#await getAnchor} + + {:then anchor} + {#if anchor === commit} + {#if commit === project.head} + + anchored 🔒 + + {:else} + onClick({ detail: project.head })} + > + anchored 🔒 + + {/if} + {:else if anchor} + onClick({ detail: anchor })} + > + not anchored 🔓 + + {:else} + + not anchored 🔓 + + {/if} + {/await} + {/if} +
+ {#if config.seed.git.host} + +
(cloneDropdown = !cloneDropdown)}> + Clone +
+ +
+ {/if} + + {#if config.seed.api.host} +
(seedDropdown = !seedDropdown)} + title="Project data is fetched from this seed" + > + {config.seed.api.host} +
+ {/if} + +
+
+ {tree.stats.commits} commit(s) +
+
+ {tree.stats.contributors} contributor(s) +
+
diff --git a/src/base/projects/View.svelte b/src/base/projects/View.svelte index a614b7563..c8e450064 100644 --- a/src/base/projects/View.svelte +++ b/src/base/projects/View.svelte @@ -10,6 +10,7 @@ import { formatOrg } from '@app/utils'; import Browser from './Browser.svelte'; + import Header from './Header.svelte'; export let urn: string; export let org = ""; @@ -46,6 +47,10 @@ : `/users/${profile.nameOrAddress}`; }; + const onCommitChange = ({ detail: newCommit }: { detail: string }): void => { + commit = newCommit; + }; + $: if (projectInfo) { const baseName = parentName ? `${parentName}/${projectInfo.meta.name}` @@ -142,12 +147,28 @@
{urn}
{result.project.meta.description}
- + {#await proj.getTree(urn, commit, "/", config)} + + {:then tree} +
+ + {:catch err} +
+
+ + API request to {err.url} failed +
+
+ {/await} {:catch} 🏜️