Skip to content

Commit

Permalink
Remove canonical branch during search
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastinez committed Jun 13, 2024
1 parent 5986fe8 commit 29c0bbb
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 35 deletions.
68 changes: 33 additions & 35 deletions src/views/projects/Source/SourceSelector.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@
<style>
.dropdown {
border-radius: var(--border-radius-small);
min-width: 25rem;
width: 40rem;
max-height: 60vh;
overflow-y: auto;
padding: 0.25rem;
}
.dropdown-grid {
display: grid;
column-gap: 2rem;
grid-template-columns: [branch] minmax(20ch, 1fr) [commit] minmax(10ch 1fr);
grid-template-columns: [branch] minmax(20ch, 1fr) [commit] 10ch;
}
.dropdown-header {
display: grid;
Expand All @@ -55,9 +55,6 @@
padding: 0.5rem;
color: var(--color-foreground-dim);
}
/* .no-alias {
color: var(--color-foreground-dim);
} */
</style>

<div style="display: flex; gap: 1px;">
Expand Down Expand Up @@ -126,35 +123,6 @@
<div class="dropdown-header">Branch</div>
<div class="dropdown-header">Head</div>

<Link
style="display: grid; grid-template-columns: subgrid; grid-column: span 2;"
route={{
...$activeUnloadedRouteStore,
resource: "project.source",
peer: undefined,
revision: project.defaultBranch,
project: project.id,
node,
}}
on:afterNavigate={() => closeFocused()}>
<DropdownListItem
selected={false}
style="display: grid; gap: inherit; grid-template-columns: subgrid; grid-column: span 2;">
<div style="display: flex; align-items: center; gap: 0.5rem;">
<IconSmall name="branch" />
{project.defaultBranch}
<Badge title="Canonical branch" variant="foreground-emphasized">
Canonical
</Badge>
</div>
<div
class="txt-monospace"
style="color: var(--color-foreground-dim);">
{formatCommit(project.head)}
</div>
</DropdownListItem>
</Link>

{#if searchInput}
{#each searchResults as result}
{@const parsedResult = JSON.parse(result)}
Expand All @@ -175,7 +143,9 @@
style="display: grid; gap: inherit; grid-template-columns: subgrid; grid-column: span 2;">
<div style="display: flex; gap: 0.5rem;">
<IconSmall name="branch" />
{parsedResult.peer.alias || parsedResult.peer.id} / {parsedResult.revision}
<span class="txt-overflow">
{parsedResult.peer.alias || parsedResult.peer.id} / {parsedResult.revision}
</span>
</div>
<div
class="txt-monospace"
Expand All @@ -192,6 +162,34 @@
</div>
{/each}
{:else}
<Link
style="display: grid; grid-template-columns: subgrid; grid-column: span 2;"
route={{
...$activeUnloadedRouteStore,
resource: "project.source",
peer: undefined,
revision: project.defaultBranch,
project: project.id,
node,
}}
on:afterNavigate={() => closeFocused()}>
<DropdownListItem
selected={false}
style="display: grid; gap: inherit; grid-template-columns: subgrid; grid-column: span 2;">
<div style="display: flex; align-items: center; gap: 0.5rem;">
<IconSmall name="branch" />
{project.defaultBranch}
<Badge title="Canonical branch" variant="foreground-emphasized">
Canonical
</Badge>
</div>
<div
class="txt-monospace"
style="color: var(--color-foreground-dim);">
{formatCommit(project.head)}
</div>
</DropdownListItem>
</Link>
{#each peers as peer}
<PeerItem
projectId={project.id}
Expand Down
6 changes: 6 additions & 0 deletions src/views/projects/Source/SourceSelector/PeerItem.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
let expanded = false;
</script>

<style>
.no-alias {
color: var(--color-foreground-dim);
}
</style>

<div
style="display: grid; grid-template-columns: subgrid; grid-column: span 2;">
<div
Expand Down

0 comments on commit 29c0bbb

Please sign in to comment.