Anchor is not clickable if already at head

Signed-off-by: Alexis Sellier <self@cloudhead.io>
This commit is contained in:
Alexis Sellier
2021-10-29 10:02:27 +02:00
parent 2c3f6c3238
commit 24aa0d5f80
+13 -3
View File
@@ -65,6 +65,7 @@
const navigateBrowser = (commit: string, path?: string) => {
// Replaces path with current path if none passed.
if (path === undefined) path = state.path;
if (org) {
navigate(proj.path({ urn, org, commit, path }));
} else if (user) {
@@ -135,6 +136,9 @@
.anchor-label:last-child {
margin-right: 0;
}
.anchor-latest {
cursor: default;
}
.seed {
cursor: pointer;
@@ -265,9 +269,15 @@
<Loading small margins />
{:then anchor}
{#if anchor === commit}
<span class="anchor-widget" on:click={() => navigateBrowser(project.head)}>
<span class="anchor-label" title="{anchors}">anchored 🔒</span>
</span>
{#if commit === project.head}
<span class="anchor-widget anchor-latest">
<span class="anchor-label" title="{anchors}">anchored 🔒</span>
</span>
{:else}
<span class="anchor-widget" on:click={() => navigateBrowser(project.head)}>
<span class="anchor-label" title="{anchors}">anchored 🔒</span>
</span>
{/if}
{:else if anchor}
<span class="anchor-widget not-anchored" on:click={() => navigateBrowser(anchor)}>
<span class="anchor-label">not anchored 🔓</span>