Monorepo for Tangled
at master 145 lines 5.7 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 {{ if .Card.Punchcard }} 56 {{ block "punchcard" .Card.Punchcard }} {{ end }} 57 {{ end }} 58 </div> 59 </div> 60 61 {{ block "profileContent" . }} {{ end }} 62 </div> 63 </section> 64 {{ end }} 65{{ end }} 66 67{{ define "profileTabs" }} 68<nav class="w-full pl-4 overflow-x-auto overflow-y-hidden"> 69 <div class="flex z-60"> 70 {{ $activeTabStyles := "-mb-px bg-white dark:bg-gray-800" }} 71 {{ $tabs := .Card.GetTabs }} 72 {{ $tabmeta := dict "x" "y" }} 73 {{ range $item := $tabs }} 74 {{ $key := index $item 0 }} 75 {{ $value := index $item 1 }} 76 {{ $icon := index $item 2 }} 77 {{ $meta := index $item 3 }} 78 <a 79 href="?tab={{ $value }}" 80 class="relative -mr-px group no-underline hover:no-underline" 81 hx-boost="true"> 82 <div 83 class="px-4 py-1 mr-1 text-black dark:text-white min-w-[80px] text-center relative rounded-t whitespace-nowrap 84 {{ if eq $.Active $key }} 85 {{ $activeTabStyles }} 86 {{ else }} 87 group-hover:bg-gray-100/25 group-hover:dark:bg-gray-700/25 88 {{ end }} 89 "> 90 <span class="flex items-center justify-center"> 91 {{ i $icon "w-4 h-4 mr-2" }} 92 {{ $key }} 93 {{ if $meta }} 94 <span class="bg-gray-200 dark:bg-gray-700 rounded py-1/2 px-1 text-sm ml-1">{{ $meta }}</span> 95 {{ end }} 96 </span> 97 </div> 98 </a> 99 {{ end }} 100 </div> 101</nav> 102{{ end }} 103 104{{ define "punchcard" }} 105 {{ $now := now }} 106 <div> 107 <p class="px-2 pb-4 flex gap-2 text-sm font-bold dark:text-white"> 108 PUNCHCARD 109 <span class="font-mono font-normal text-sm text-gray-500 dark:text-gray-400 "> 110 {{ .Total | int64 | commaFmt }} commits 111 </span> 112 </p> 113 <div class="grid grid-cols-28 md:grid-cols-14 gap-y-3 w-full h-full"> 114 {{ range .Punches }} 115 {{ $count := .Count }} 116 {{ $theme := "bg-gray-200 dark:bg-gray-700 size-[4px]" }} 117 {{ if lt $count 1 }} 118 {{ $theme = "bg-gray-200 dark:bg-gray-700 size-[4px]" }} 119 {{ else if lt $count 2 }} 120 {{ $theme = "bg-green-200 dark:bg-green-900 size-[5px]" }} 121 {{ else if lt $count 4 }} 122 {{ $theme = "bg-green-300 dark:bg-green-800 size-[5px]" }} 123 {{ else if lt $count 8 }} 124 {{ $theme = "bg-green-400 dark:bg-green-700 size-[6px]" }} 125 {{ else }} 126 {{ $theme = "bg-green-500 dark:bg-green-600 size-[7px]" }} 127 {{ end }} 128 129 {{ if .Date.After $now }} 130 {{ $theme = "border border-gray-200 dark:border-gray-700 size-[4px]" }} 131 {{ end }} 132 <div class="w-full h-full flex justify-center items-center"> 133 <div 134 class="aspect-square rounded-full transition-all duration-300 {{ $theme }} max-w-full max-h-full" 135 title="{{ .Date.Format "2006-01-02" }}: {{ .Count }} commits"> 136 </div> 137 </div> 138 {{ end }} 139 </div> 140 </div> 141{{ end }} 142 143{{ define "layouts/profilebase" }} 144 {{ template "layouts/base" . }} 145{{ end }}