From b2949d99100631fac778ba573975d1a21689af74 Mon Sep 17 00:00:00 2001 From: Alexis Sellier Date: Fri, 29 Oct 2021 11:04:56 +0200 Subject: [PATCH] Show branch name when project is at head Signed-off-by: Alexis Sellier --- public/index.css | 2 ++ src/base/projects/Browser.svelte | 40 ++++++++++++++++++++++++++++---- src/project.ts | 1 + 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/public/index.css b/public/index.css index 759f0a260..c7c4f4720 100644 --- a/public/index.css +++ b/public/index.css @@ -16,7 +16,9 @@ --color-primary-background-lighter: #ff55ff22; --color-secondary: #5555ff; --color-secondary-background: #5555ff11; + --color-secondary-background-darker: #5555ff09; --color-secondary-faded: #5555ff77; + --color-secondary-darker: #4343cc; --color-secondary-1: #212847; --color-secondary-2: #2c326d; --color-secondary-6: #e3e3ff; diff --git a/src/base/projects/Browser.svelte b/src/base/projects/Browser.svelte index ac5bcd6f4..2231a6906 100644 --- a/src/base/projects/Browser.svelte +++ b/src/base/projects/Browser.svelte @@ -104,11 +104,32 @@ } .commit { - display: inline-block; + display: flex; + align-items: center; + justify-content: center; font-family: var(--font-family-monospace); + } + .commit .branch { + padding: 0.5rem 0.75rem; + color: var(--color-secondary); + background-color: var(--color-secondary-background); + border-radius: inherit; + border-top-right-radius: 0; + border-bottom-right-radius: 0; + } + .commit .hash { + display: inline-block; color: var(--color-secondary); background-color: var(--color-secondary-background); padding: 0.5rem 0.75rem; + border-radius: inherit; + } + .branch + .hash { + color: var(--color-secondary-darker); + background-color: var(--color-secondary-background-darker); + border-radius: inherit; + border-top-left-radius: 0; + border-bottom-left-radius: 0; } .anchor { @@ -117,7 +138,7 @@ .anchor-widget { display: flex; padding: 0.5rem 0.75rem; - border-radius: 0.25rem; + border-radius: inherit; color: var(--color-tertiary); background-color: var(--color-tertiary-background); cursor: pointer; @@ -142,7 +163,7 @@ .seed { cursor: pointer; - border-radius: 0.25rem; + border-radius: inherit; } .seed:hover { background-color: var(--color-foreground-background-lighter); @@ -261,7 +282,18 @@ {:then tree}
- {commit} + {#if commit === project.head} +
+ {project.meta.defaultBranch} +
+
+ {commit.slice(0, 7)} +
+ {:else} +
+ {commit} +
+ {/if}
{#if anchors} diff --git a/src/project.ts b/src/project.ts index d29757731..0440f5ac4 100644 --- a/src/project.ts +++ b/src/project.ts @@ -18,6 +18,7 @@ export interface Info { export interface Meta { name: string; description: string; + defaultBranch: string; maintainers: Urn[]; }