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