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