Monorepo for Tangled tangled.org
12

Configure Feed

Select the types of activity you want to include in your feed.

1{{ define "title" }}{{ .String.Filename }} &middot; by {{ resolve .Owner.DID.String }} &middot; Tangled{{ end }} 2 3{{ define "extrameta" }} 4 {{ $ownerId := resolve .Owner.DID.String }} 5 <meta property="og:title" content="{{ .String.Filename }} · by {{ $ownerId }}" /> 6 <meta property="og:type" content="object" /> 7 <meta property="og:url" content="https://tangled.org/strings/{{ $ownerId }}/{{ .String.Rkey }}" /> 8 <meta property="og:description" content="{{ .String.Description }}" /> 9{{ end }} 10 11{{ define "content" }} 12{{ $ownerId := resolve .Owner.DID.String }} 13 <section id="string-header" class="mb-2 py-2 px-4 dark:text-white"> 14 <div class="text-lg flex flex-col sm:flex-row items-start gap-4 justify-between"> 15 <!-- left items --> 16 <div class="flex flex-col gap-2"> 17 <!-- string owner / string name --> 18 <div class="flex items-center gap-2 flex-wrap"> 19 {{ template "user/fragments/picHandleLink" .Owner.DID.String }} 20 <span class="select-none">/</span> 21 <a href="/strings/{{ $ownerId }}/{{ .String.Rkey }}" class="font-bold">{{ .String.Filename }}</a> 22 </div> 23 24 <span class="flex flex-wrap items-center gap-x-4 gap-y-2 text-sm text-gray-600 dark:text-gray-300"> 25 {{ if .String.Description }} 26 {{ .String.Description }} 27 {{ else }} 28 <span class="italic">This string has no description</span> 29 {{ end }} 30 </span> 31 </div> 32 33 <div class="w-full sm:w-fit grid grid-cols-3 gap-2 z-auto"> 34 {{ if and .LoggedInUser (eq .LoggedInUser.Did .String.Did) }} 35 <a class="btn text-sm no-underline hover:no-underline flex items-center gap-2 group" 36 hx-boost="true" 37 href="/strings/{{ .String.Did }}/{{ .String.Rkey }}/edit"> 38 {{ i "pencil" "w-4 h-4" }} 39 <span class="hidden md:inline">Edit</span> 40 {{ i "loader-circle" "w-4 h-4 animate-spin hidden group-[.htmx-request]:inline" }} 41 </a> 42 <button 43 class="btn text-sm text-red-500 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300 flex items-center gap-2 group" 44 title="Delete string" 45 hx-delete="/strings/{{ .String.Did }}/{{ .String.Rkey }}/" 46 hx-swap="none" 47 hx-confirm="Are you sure you want to delete the string `{{ .String.Filename }}`?" 48 > 49 {{ i "trash-2" "w-4 h-4" }} 50 <span class="hidden md:inline">Delete</span> 51 {{ i "loader-circle" "w-4 h-4 animate-spin hidden group-[.htmx-request]:inline" }} 52 </button> 53 {{ end }} 54 {{ template "fragments/starBtn" 55 (dict "SubjectAt" .String.AtUri 56 "IsStarred" .IsStarred 57 "StarCount" .StarCount) }} 58 </div> 59 </div> 60 </section> 61 <section class="bg-white dark:bg-gray-800 px-6 py-4 rounded relative w-full dark:text-white"> 62 <div class="flex flex-col md:flex-row md:justify-between md:items-center text-gray-500 dark:text-gray-400 text-sm md:text-base pb-2 mb-3 text-base border-b border-gray-200 dark:border-gray-700"> 63 <span> 64 {{ .String.Filename }} 65 <span class="select-none px-1 md:px-2 [&:before]:content-['·']"></span> 66 <span> 67 {{ with .String.Edited }} 68 edited {{ template "repo/fragments/shortTimeAgo" . }} 69 {{ else }} 70 {{ template "repo/fragments/shortTimeAgo" .String.Created }} 71 {{ end }} 72 </span> 73 </span> 74 <div> 75 <span>{{ .Stats.LineCount }} lines</span> 76 <span class="select-none px-1 md:px-2 [&:before]:content-['·']"></span> 77 <span>{{ byteFmt .Stats.ByteCount }}</span> 78 <span class="select-none px-1 md:px-2 [&:before]:content-['·']"></span> 79 <a href="/strings/{{ $ownerId }}/{{ .String.Rkey }}/raw">View raw</a> 80 {{ if .RenderToggle }} 81 <span class="select-none px-1 md:px-2 [&:before]:content-['·']"></span> 82 <a href="?code={{ .ShowRendered }}" hx-boost="true"> 83 View {{ if .ShowRendered }}code{{ else }}rendered{{ end }} 84 </a> 85 {{ end }} 86 </div> 87 </div> 88 <div class="overflow-x-auto overflow-y-hidden relative"> 89 {{ if .ShowRendered }} 90 <div id="blob-contents" class="prose dark:prose-invert">{{ .String.Contents | readme }}</div> 91 {{ else }} 92 <div id="blob-contents" class="whitespace-pre peer-target:bg-yellow-200 dark:peer-target:bg-yellow-900">{{ code .String.Contents .String.Filename | escapeHtml }}</div> 93 {{ end }} 94 </div> 95 {{ template "fragments/multiline-select" }} 96 </section> 97 <div class="flex flex-col gap-4 mt-4"> 98 {{ 99 template "fragments/comment/commentList" 100 (dict 101 "LoggedInUser" .LoggedInUser 102 "Reactions" .Reactions 103 "UserReacted" .UserReacted 104 "VouchRelationships" .VouchRelationships 105 "CommentList" .CommentList) 106 }} 107 {{ template "newComment" . }} 108 </div> 109{{ end }} 110 111{{ define "newComment" }} 112 {{ if .LoggedInUser }} 113 <form 114 hx-post="/comment" 115 hx-trigger="submit, keydown[(ctrlKey || metaKey) && key=='Enter'] from:find textarea" 116 hx-swap="none" 117 hx-disabled-elt="find button[type='submit']" 118 hx-on::after-request="if(event.detail.successful) this.reset()" 119 class="group/form" 120 > 121 <input name="subject-uri" type="hidden" value="{{ .String.AtUri }}"> 122 <div class="bg-white dark:bg-gray-800 rounded drop-shadow-sm py-4 px-4 relative w-full"> 123 <div class="text-sm pb-2 text-gray-500 dark:text-gray-400"> 124 {{ template "user/fragments/picHandleLink" .LoggedInUser.Did }} 125 </div> 126 <textarea 127 name="body" 128 class="w-full p-2 rounded" 129 placeholder="Add to the discussion. Markdown is supported." 130 rows="5" 131 required 132 ></textarea> 133 <div id="comment-error" class="error"></div> 134 </div> 135 <div class="flex gap-2 mt-2"> 136 <button 137 id="comment-button" 138 type="submit" 139 class="btn-create p-2 flex items-center gap-2 no-underline hover:no-underline" 140 > 141 {{ i "message-square-plus" "w-4 h-4 inline group-[.htmx-request]/form:hidden" }} 142 {{ i "loader-circle" "w-4 h-4 animate-spin hidden group-[.htmx-request]/form:inline" }} 143 Comment 144 </button> 145 </div> 146 </form> 147 {{ else }} 148 <div class="bg-amber-50 dark:bg-amber-900 border border-amber-500 rounded drop-shadow-sm p-6 relative flex gap-2 items-center"> 149 <a href="/signup" class="btn-create py-0 hover:no-underline hover:text-white flex items-center gap-2"> 150 Sign up 151 </a> 152 <span class="text-gray-500 dark:text-gray-400">or</span> 153 <a href="/login" class="underline">login</a> 154 to add to the discussion 155 </div> 156 {{ end }} 157{{ end }}