Monorepo for Tangled
at 74318eac9fdd72cf69e916276814351931ed0dcb 143 lines 5.6 kB view raw
1{{ define "title" }}{{ resolve .Card.UserDid }}{{ end }} 2 3{{ define "extrameta" }} 4 {{ $handle := resolve .Card.UserDid }} 5 {{ $avatarUrl := profileAvatarUrl .Card.Profile "" }} 6 {{ $description := or .Card.Profile.Description (printf "%s on Tangled" $handle) }} 7 {{ $url := printf "https://tangled.org/%s" $handle }} 8 9 <!-- Open Graph Meta Tags --> 10 <meta property="og:title" content="{{ $handle }}" /> 11 <meta property="og:type" content="profile" /> 12 <meta property="og:url" content="{{ $url }}" /> 13 <meta property="og:description" content="{{ $description }}" /> 14 <meta property="og:image" content="{{ $avatarUrl }}" /> 15 <meta property="og:image:width" content="512" /> 16 <meta property="og:image:height" content="512" /> 17 <meta property="og:image:alt" content="{{ $handle }}'s avatar" /> 18 <meta property="profile:username" content="{{ $handle }}" /> 19 20 <!-- Twitter Card Meta Tags --> 21 <meta name="twitter:card" content="summary" /> 22 <meta name="twitter:title" content="{{ $handle }}" /> 23 <meta name="twitter:description" content="{{ $description }}" /> 24 <meta name="twitter:image" content="{{ $avatarUrl }}" /> 25 <meta name="twitter:image:alt" content="{{ $handle }}'s avatar" /> 26 27 <!-- Additional SEO --> 28 <meta name="description" content="{{ $description }}" /> 29 <link rel="canonical" href="{{ $url }}" /> 30{{ end }} 31 32{{ define "content" }} 33 {{ if not .Card.HasProfile }} 34 <section class="bg-white dark:bg-gray-800 px-2 py-6 md:p-6 rounded w-full dark:text-white drop-shadow-sm"> 35 <div class="flex items-center gap-6 p-4"> 36 <img class="w-28 h-28 shrink-0 object-cover rounded-full" src="{{ profileAvatarUrl .Card.Profile "" }}" /> 37 <div> 38 <p class="text-lg font-bold">{{ resolve .Card.UserDid }}</p> 39 <p class="text-gray-700 dark:text-gray-300 mt-2">This user hasn't joined Tangled yet.</p> 40 <p class="text-sm text-gray-500 dark:text-gray-400 mt-1">Let them know we're waiting for them!</p> 41 </div> 42 </div> 43 </section> 44 {{ else }} 45 {{ template "profileTabs" . }} 46 <section class="bg-white dark:bg-gray-800 px-2 py-6 md:p-6 rounded w-full dark:text-white drop-shadow-sm"> 47 <div class="grid grid-cols-1 md:grid-cols-11 gap-4"> 48 {{ $style := "hidden md:block md:col-span-3" }} 49 {{ if eq $.Active "overview" }} 50 {{ $style = "md:col-span-3" }} 51 {{ end }} 52 <div class="{{ $style }} order-1 order-1"> 53 <div class="flex flex-col gap-4"> 54 {{ template "user/fragments/profileCard" .Card }} 55 {{ block "punchcard" .Card.Punchcard }} {{ end }} 56 </div> 57 </div> 58 59 {{ block "profileContent" . }} {{ end }} 60 </div> 61 </section> 62 {{ end }} 63{{ end }} 64 65{{ define "profileTabs" }} 66<nav class="w-full pl-4 overflow-x-auto overflow-y-hidden"> 67 <div class="flex z-60"> 68 {{ $activeTabStyles := "-mb-px bg-white dark:bg-gray-800" }} 69 {{ $tabs := .Card.GetTabs }} 70 {{ $tabmeta := dict "x" "y" }} 71 {{ range $item := $tabs }} 72 {{ $key := index $item 0 }} 73 {{ $value := index $item 1 }} 74 {{ $icon := index $item 2 }} 75 {{ $meta := index $item 3 }} 76 <a 77 href="?tab={{ $value }}" 78 class="relative -mr-px group no-underline hover:no-underline" 79 hx-boost="true"> 80 <div 81 class="px-4 py-1 mr-1 text-black dark:text-white min-w-[80px] text-center relative rounded-t whitespace-nowrap 82 {{ if eq $.Active $key }} 83 {{ $activeTabStyles }} 84 {{ else }} 85 group-hover:bg-gray-100/25 group-hover:dark:bg-gray-700/25 86 {{ end }} 87 "> 88 <span class="flex items-center justify-center"> 89 {{ i $icon "w-4 h-4 mr-2" }} 90 {{ $key }} 91 {{ if $meta }} 92 <span class="bg-gray-200 dark:bg-gray-700 rounded py-1/2 px-1 text-sm ml-1">{{ $meta }}</span> 93 {{ end }} 94 </span> 95 </div> 96 </a> 97 {{ end }} 98 </div> 99</nav> 100{{ end }} 101 102{{ define "punchcard" }} 103 {{ $now := now }} 104 <div> 105 <p class="px-2 pb-4 flex gap-2 text-sm font-bold dark:text-white"> 106 PUNCHCARD 107 <span class="font-mono font-normal text-sm text-gray-500 dark:text-gray-400 "> 108 {{ .Total | int64 | commaFmt }} commits 109 </span> 110 </p> 111 <div class="grid grid-cols-28 md:grid-cols-14 gap-y-3 w-full h-full"> 112 {{ range .Punches }} 113 {{ $count := .Count }} 114 {{ $theme := "bg-gray-200 dark:bg-gray-700 size-[4px]" }} 115 {{ if lt $count 1 }} 116 {{ $theme = "bg-gray-200 dark:bg-gray-700 size-[4px]" }} 117 {{ else if lt $count 2 }} 118 {{ $theme = "bg-green-200 dark:bg-green-900 size-[5px]" }} 119 {{ else if lt $count 4 }} 120 {{ $theme = "bg-green-300 dark:bg-green-800 size-[5px]" }} 121 {{ else if lt $count 8 }} 122 {{ $theme = "bg-green-400 dark:bg-green-700 size-[6px]" }} 123 {{ else }} 124 {{ $theme = "bg-green-500 dark:bg-green-600 size-[7px]" }} 125 {{ end }} 126 127 {{ if .Date.After $now }} 128 {{ $theme = "border border-gray-200 dark:border-gray-700 size-[4px]" }} 129 {{ end }} 130 <div class="w-full h-full flex justify-center items-center"> 131 <div 132 class="aspect-square rounded-full transition-all duration-300 {{ $theme }} max-w-full max-h-full" 133 title="{{ .Date.Format "2006-01-02" }}: {{ .Count }} commits"> 134 </div> 135 </div> 136 {{ end }} 137 </div> 138 </div> 139{{ end }} 140 141{{ define "layouts/profilebase" }} 142 {{ template "layouts/base" . }} 143{{ end }}