Add submodules improvements

Also display submodules in nested folders, and show them as
`foreground-dim`.
Adds also a title to explain what the entry is and to look at the
nearest `.gitmodules` file
This commit is contained in:
Sebastian Martinez
2024-03-11 20:18:43 +01:00
parent 5b30269c7c
commit 2b318e5002
3 changed files with 15 additions and 5 deletions
+6
View File
@@ -53,6 +53,7 @@
| "online"
| "patch"
| "plus"
| "repo"
| "settings"
| "share"
| "user";
@@ -497,6 +498,11 @@
fill-rule="evenodd"
clip-rule="evenodd"
d="M13.1667 8C13.1667 8.27614 12.9428 8.5 12.6667 8.5L3.33334 8.5C3.0572 8.5 2.83334 8.27614 2.83334 8C2.83334 7.72386 3.0572 7.5 3.33334 7.5L12.6667 7.5C12.9428 7.5 13.1667 7.72386 13.1667 8Z" />
{:else if name === "repo"}
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M8.3143 2.03576C8.43351 1.98808 8.56649 1.98808 8.6857 2.03576L14.6857 4.43576C14.8755 4.51169 15 4.69555 15 4.9V12.1C15 12.3045 14.8755 12.4883 14.6857 12.5642L8.6857 14.9642C8.56649 15.0119 8.43351 15.0119 8.3143 14.9642L2.3143 12.5642C2.12448 12.4883 2 12.3045 2 12.1V4.9C2 4.69555 2.12448 4.51169 2.3143 4.43576L8.3143 2.03576ZM3 5.63852L8 7.63852V13.7615L3 11.7615V5.63852ZM9 13.7615L14 11.7615V5.63852L9 7.63852V13.7615ZM8.5 6.76148L13.1537 4.9L8.5 3.03852L3.84629 4.9L8.5 6.76148Z" />
{:else if name === "settings"}
<path
d="M12.5 4C12.5 3.44772 12.0523 3 11.5 3C10.9477 3 10.5 3.44772 10.5 4C10.5 4.55228 10.9477 5 11.5 5H14C14.2761 5 14.5 4.77614 14.5 4.5C14.5 4.22386 14.2761 4 14 4H12.5Z" />
@@ -8,6 +8,7 @@
import File from "./File.svelte";
import IconSmall from "@app/components/IconSmall.svelte";
import Submodule from "./Submodule.svelte";
export let baseUrl: BaseUrl;
export let currentPath: string;
@@ -107,6 +108,8 @@
{peer}
{projectId}
{revision} />
{:else if entry.kind === "submodule"}
<Submodule name={entry.name} oid={entry.oid} />
{:else}
<Link
route={{
@@ -7,7 +7,8 @@
</script>
<style>
.file {
.submodule {
color: var(--color-foreground-dim);
border-radius: var(--border-radius-tiny);
display: flex;
line-height: 1.5em;
@@ -21,13 +22,11 @@
user-select: none;
white-space: nowrap;
text-overflow: ellipsis !important;
color: var(--color-foreground-dim);
overflow: hidden;
font-size: var(--font-size-small);
font-weight: var(--font-weight-medium);
}
.icon-container {
color: var(--color-fill-secondary);
display: flex;
justify-content: center;
align-items: center;
@@ -35,9 +34,11 @@
}
</style>
<div class="file">
<div
class="submodule"
title="This is a git submodule, for more information look at the nearest .gitmodules file">
<div class="icon-container">
<IconSmall name="link" />
<IconSmall name="repo" />
</div>
<span class="name">{name} @ {formatCommit(oid)}</span>
</div>