1{{ define "repo/fragments/artifact" }}
2{{ $unique := .Artifact.BlobCid.String }}
3 <div id="artifact-{{ $unique }}" class="flex items-center justify-between p-2 border-b border-gray-200 dark:border-gray-700">
4 <div id="left-side" class="flex items-center gap-2 min-w-0 max-w-[60%]">
5 {{ i "box" "w-4 h-4" }}
6 <a href="/{{ .RepoInfo.FullName }}/tags/{{ .Artifact.Tag.String }}/download/{{ .Artifact.Name | urlquery }}" class="no-underline hover:no-underline">
7 {{ .Artifact.Name }}
8 </a>
9 <span class="text-gray-500 dark:text-gray-400 pl-2 text-sm">{{ byteFmt .Artifact.Size }}</span>
10 </div>
11
12 <div id="right-side" class="text-gray-500 dark:text-gray-400 flex items-center flex-shrink-0 gap-2 text-sm">
13 <span class="hidden md:inline">{{ template "repo/fragments/time" .Artifact.CreatedAt }}</span>
14 <span class=" md:hidden">{{ template "repo/fragments/shortTime" .Artifact.CreatedAt }}</span>
15
16 <span class="select-none after:content-['·'] hidden md:inline"></span>
17 <span class="truncate max-w-[100px] hidden md:inline">{{ .Artifact.MimeType }}</span>
18
19 {{ if and .LoggedInUser (eq .LoggedInUser.Did .Artifact.Did) }}
20 <button
21 id="delete-{{ $unique }}"
22 class="btn text-red-500 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300 gap-2"
23 title="Delete artifact"
24 hx-delete="/{{ .RepoInfo.FullName }}/tags/{{ .Artifact.Tag.String }}/{{ .Artifact.Name | urlquery }}"
25 hx-swap="outerHTML"
26 hx-target="#artifact-{{ $unique }}"
27 hx-disabled-elt="#delete-{{ $unique }}"
28 hx-confirm="Are you sure you want to delete the artifact '{{ .Artifact.Name }}'?">
29 {{ i "trash-2" "w-4 h-4" }}
30 </button>
31 {{ end }}
32 </div>
33 </div>
34{{ end }}