profile.html
·
108 lines
·
4.6 KB
| 1 | {{define "content"}} |
| 2 | <div class="container"> |
| 3 | <!-- Profile header --> |
| 4 | <div class="card p-4 mb-4"> |
| 5 | <div class="flex items-start gap-4 flex-wrap"> |
| 6 | {{avatar .ProfileUser.Username .ProfileUser.AvatarURL "avatar-xl"}} |
| 7 | <div class="min-w-0 flex-1"> |
| 8 | <div class="flex items-center gap-2 flex-wrap"> |
| 9 | <h1 class="text-xl font-bold" style="margin:0;line-height:1.2;">{{if .ProfileUser.FullName}}{{.ProfileUser.FullName}}{{else}}{{.ProfileUser.Username}}{{end}}</h1> |
| 10 | {{if .ProfileUser.IsAdmin}} |
| 11 | <span class="badge badge-primary">{{t .Lang "admin.role.admin"}}</span> |
| 12 | {{end}} |
| 13 | </div> |
| 14 | <div class="text-sm text-muted font-mono">@{{.ProfileUser.Username}}</div> |
| 15 | |
| 16 | {{if .ProfileUser.Bio}} |
| 17 | <p class="text-sm" style="margin:0.45rem 0 0;max-width:38rem;">{{.ProfileUser.Bio}}</p> |
| 18 | {{end}} |
| 19 | |
| 20 | <div class="flex items-center flex-wrap gap-3 text-xs text-muted mt-2"> |
| 21 | {{if .ProfileUser.Location}} |
| 22 | <span class="flex items-center gap-1"> |
| 23 | {{icon "map-pin" "size-3.5"}} |
| 24 | <span>{{.ProfileUser.Location}}</span> |
| 25 | </span> |
| 26 | {{end}} |
| 27 | {{if .ProfileUser.Website}} |
| 28 | <a href="{{.ProfileUser.Website}}" target="_blank" rel="noopener noreferrer" class="flex items-center gap-1" style="color:hsl(var(--foreground));"> |
| 29 | {{icon "link" "size-3.5"}} |
| 30 | <span>{{.ProfileUser.Website}}</span> |
| 31 | </a> |
| 32 | {{end}} |
| 33 | <span class="flex items-center gap-1"> |
| 34 | {{icon "calendar" "size-3.5"}} |
| 35 | <span>{{t .Lang "profile.joined"}}: {{formatShortDate .ProfileUser.CreatedAt}}</span> |
| 36 | </span> |
| 37 | </div> |
| 38 | </div> |
| 39 | |
| 40 | <div class="flex items-center gap-2"> |
| 41 | {{if .CurrentUser}} |
| 42 | {{if eq .CurrentUser.ID .ProfileUser.ID}} |
| 43 | <a href="/settings" class="btn btn-outline btn-sm"> |
| 44 | {{icon "edit" "size-3.5"}} |
| 45 | <span>{{t .Lang "profile.edit"}}</span> |
| 46 | </a> |
| 47 | {{end}} |
| 48 | {{end}} |
| 49 | </div> |
| 50 | </div> |
| 51 | </div> |
| 52 | |
| 53 | <!-- Repositories --> |
| 54 | <div class="flex items-center justify-between flex-wrap gap-2 mb-3"> |
| 55 | <h2 class="text-base font-semibold" style="margin:0;"> |
| 56 | {{t .Lang "nav.repositories"}} |
| 57 | <span class="text-muted font-mono text-sm" style="font-weight:400;">{{len .Repos}}</span> |
| 58 | </h2> |
| 59 | <div class="flex items-center gap-2"> |
| 60 | <div class="flex items-center" style="position:relative;"> |
| 61 | <input type="text" class="input" style="height:1.85rem;width:14rem;padding-right:1.8rem;" placeholder="{{t .Lang "repo.filter_ph"}}" data-search-input data-file-filter> |
| 62 | <kbd class="kbd" style="position:absolute;right:0.4rem;pointer-events:none;">/</kbd> |
| 63 | </div> |
| 64 | {{if .CurrentUser}} |
| 65 | {{if eq .CurrentUser.ID .ProfileUser.ID}} |
| 66 | <a href="/new" class="btn btn-primary btn-sm" style="height:1.85rem;"> |
| 67 | {{icon "plus" "size-3.5"}} |
| 68 | <span>{{t .Lang "nav.new_repo"}}</span> |
| 69 | </a> |
| 70 | {{end}} |
| 71 | {{end}} |
| 72 | </div> |
| 73 | </div> |
| 74 | |
| 75 | {{if .Repos}} |
| 76 | <div class="grid-2"> |
| 77 | {{range .Repos}} |
| 78 | <div class="card p-3 flex flex-col gap-2" data-tree-row data-tree-name="{{.Name}} {{.Description}}"> |
| 79 | <div class="flex items-center justify-between gap-2"> |
| 80 | <a href="/{{.OwnerUsername}}/{{.Name}}" class="font-semibold text-sm flex items-center gap-1.5 truncate"> |
| 81 | {{if .IsPrivate}} |
| 82 | {{icon "lock" "size-3.5"}} |
| 83 | {{else}} |
| 84 | {{icon "git-branch" "size-3.5"}} |
| 85 | {{end}} |
| 86 | <span class="truncate">{{.Name}}</span> |
| 87 | </a> |
| 88 | <span class="text-xs text-muted flex-shrink-0">{{timeAgo .UpdatedAt $.Lang}}</span> |
| 89 | </div> |
| 90 | {{if .Description}} |
| 91 | <p class="text-xs text-muted" style="margin:0;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;">{{.Description}}</p> |
| 92 | {{end}} |
| 93 | <div class="text-xs text-muted font-mono flex items-center gap-1.5"> |
| 94 | {{icon "git-branch" "size-3.5"}} |
| 95 | <span>{{.DefaultBranch}}</span> |
| 96 | </div> |
| 97 | </div> |
| 98 | {{end}} |
| 99 | </div> |
| 100 | {{else}} |
| 101 | {{if and .CurrentUser (eq .CurrentUser.ID .ProfileUser.ID)}} |
| 102 | {{template "ui_empty_state" (dict "Icon" "git-branch" "Title" (t .Lang "repo.empty_list") "Subtitle" (t .Lang "repo.empty_list_sub") "ActionHref" "/new" "ActionLabel" (t .Lang "repo.new.title") "ActionIcon" "plus")}} |
| 103 | {{else}} |
| 104 | {{template "ui_empty_state" (dict "Icon" "git-branch" "Title" (t .Lang "repo.empty_list"))}} |
| 105 | {{end}} |
| 106 | {{end}} |
| 107 | </div> |
| 108 | {{end}} |