Experimental browser for the Atmosphere
{ "uri": "at://did:plc:hwevmowznbiukdf6uk5dwrrq/sh.tangled.repo.pull/3lmn6mmqwr322", "cid": "bafyreib7fifh3zhknn7qn6cpogaq62jlvuar2hywypn2sca5pob3b7lsmm", "value": { "$type": "sh.tangled.repo.pull", "patch": "diff --git a/appview/pages/templates/fragments/issueComment.html b/appview/pages/templates/fragments/issueComment.html\nindex 1c3161a73ff79d6f601a758b8084988f1f79ad92..1716a8089111f1b472575599a7a4353a71fb9e59 100644\n--- a/appview/pages/templates/fragments/issueComment.html\n+++ b/appview/pages/templates/fragments/issueComment.html\n@@ -5,16 +5,7 @@ <div class=\"flex items-center gap-2 mb-2 text-gray-500 text-sm\">\n {{ $owner := index $.DidHandleMap .OwnerDid }}\n <a href=\"/{{ $owner }}\" class=\"no-underline hover:underline\">{{ $owner }}</a>\n \n- <!-- show user \"hats\" -->\n- {{ $isIssueAuthor := eq .OwnerDid $.Issue.OwnerDid }}\n- {{ if $isIssueAuthor }}\n- <span class=\"before:content-['·']\"></span>\n- <span class=\"rounded bg-gray-100 dark:bg-gray-700 text-black dark:text-white font-mono px-2 mx-1/2 inline-flex items-center\">\n- author\n- </span>\n- {{ end }}\n-\n- <span class=\"before:content-['·']\"></span>\n+ <span class=\"before:content-['·']\"></span>\n <a\n href=\"#{{ .CommentId }}\"\n class=\"text-gray-500 hover:text-gray-500 hover:underline no-underline\"\n@@ -27,6 +18,14 @@ {{ else }}\n {{ .Created | timeFmt }}\n {{ end }}\n </a>\n+ \n+ <!-- show user \"hats\" -->\n+ {{ $isIssueAuthor := eq .OwnerDid $.Issue.OwnerDid }}\n+ {{ if $isIssueAuthor }}\n+ <span class=\"text-xs rounded bg-gray-100 dark:bg-gray-700 text-black dark:text-white font-mono px-2 mx-1/2 inline-flex items-center\">\n+ author\n+ </span>\n+ {{ end }}\n \n {{ $isCommentOwner := and $.LoggedInUser (eq $.LoggedInUser.Did .OwnerDid) }}\n {{ if and $isCommentOwner (not .Deleted) }}\ndiff --git a/appview/pages/templates/fragments/pullActions.html b/appview/pages/templates/fragments/pullActions.html\nindex 0078306951997f1fae5a482003fd05bc60d323fa..4af59429dcac08ad25b687dfcaf57702840cd1cb 100644\n--- a/appview/pages/templates/fragments/pullActions.html\n+++ b/appview/pages/templates/fragments/pullActions.html\n@@ -12,7 +12,6 @@ {{ $isLastRound := eq $roundNumber $lastIdx }}\n {{ $isSameRepoBranch := .Pull.IsSameRepoBranch }}\n {{ $isUpToDate := .ResubmitCheck.No }}\n <div class=\"relative w-fit\">\n- <div class=\"absolute left-8 -top-2 w-px h-2 bg-gray-300 dark:bg-gray-600\"></div>\n <div id=\"actions-{{$roundNumber}}\" class=\"flex flex-wrap gap-2\">\n <button \n hx-get=\"/{{ .RepoInfo.FullName }}/pulls/{{ .Pull.PullId }}/round/{{ $roundNumber }}/comment\"\ndiff --git a/appview/pages/templates/repo/issues/issue.html b/appview/pages/templates/repo/issues/issue.html\nindex d4c0de462a5c1657f59b3c66cc5ba8e0545f0ab7..611d1707fa2d8f2d11c1f4c13dbb61cde5ad20fb 100644\n--- a/appview/pages/templates/repo/issues/issue.html\n+++ b/appview/pages/templates/repo/issues/issue.html\n@@ -45,17 +45,14 @@ {{ end }}\n \n {{ define \"repoAfter\" }}\n {{ if gt (len .Comments) 0 }}\n- <section id=\"comments\" class=\"mt-8 space-y-4 relative\">\n+ <section id=\"comments\" class=\"my-4 space-y-2 relative\">\n {{ range $index, $comment := .Comments }}\n <div\n id=\"comment-{{ .CommentId }}\"\n- class=\"rounded bg-white px-6 py-4 relative dark:bg-gray-800\">\n- {{ if eq $index 0 }}\n- <div class=\"absolute left-8 -top-8 w-px h-8 bg-gray-300 dark:bg-gray-700\" ></div>\n- {{ else }}\n- <div class=\"absolute left-8 -top-4 w-px h-4 bg-gray-300 dark:bg-gray-700\" ></div>\n+ class=\"bg-white dark:bg-gray-800 rounded drop-shadow-sm py-2 px-4 relative w-full md:max-w-3/5 md:w-fit\">\n+ {{ if gt $index 0 }}\n+ <div class=\"absolute left-8 -top-2 w-px h-2 bg-gray-300 dark:bg-gray-600\"></div>\n {{ end }}\n-\n {{ template \"fragments/issueComment\" (dict \"RepoInfo\" $.RepoInfo \"LoggedInUser\" $.LoggedInUser \"DidHandleMap\" $.DidHandleMap \"Issue\" $.Issue \"Comment\" .)}}\n </div>\n {{ end }}\n@@ -64,51 +61,116 @@ {{ end }}\n \n {{ block \"newComment\" . }} {{ end }}\n \n- {{ $isIssueAuthor := and .LoggedInUser (eq .LoggedInUser.Did .Issue.OwnerDid) }}\n- {{ $isRepoCollaborator := .RepoInfo.Roles.IsCollaborator }}\n- {{ if or $isIssueAuthor $isRepoCollaborator }}\n- {{ $action := \"close\" }}\n- {{ $icon := \"circle-x\" }}\n- {{ $hoverColor := \"red\" }}\n- {{ if eq .State \"closed\" }}\n- {{ $action = \"reopen\" }}\n- {{ $icon = \"circle-dot\" }}\n- {{ $hoverColor = \"green\" }}\n- {{ end }}\n- <form\n- hx-post=\"/{{ .RepoInfo.FullName }}/issues/{{ .Issue.IssueId }}/{{ $action }}\"\n- hx-swap=\"none\"\n- class=\"mt-8\"\n- >\n- <button type=\"submit\" class=\"btn hover:bg-{{ $hoverColor }}-300\">\n- {{ i $icon \"w-4 h-4 mr-2\" }}\n- <span class=\"text-black dark:text-gray-400\">{{ $action }}</span>\n- </button>\n- <div id=\"issue-action\" class=\"error\"></div>\n- </form>\n- {{ end }}\n {{ end }}\n \n {{ define \"newComment\" }}\n {{ if .LoggedInUser }}\n- <div class=\"bg-white rounded drop-shadow-sm py-4 px-6 relative w-full flex flex-col gap-2 mt-8 dark:bg-gray-800 dark:text-gray-400\">\n- <div class=\"absolute left-8 -top-8 w-px h-8 bg-gray-300 dark:bg-gray-700\" ></div>\n- <div class=\"text-sm text-gray-500 dark:text-gray-400\">\n+\n+ <form \n+ id=\"comment-form\" \n+ hx-post=\"/{{ .RepoInfo.FullName }}/issues/{{ .Issue.IssueId }}/comment\"\n+ hx-on::after-request=\"if(event.detail.successful) this.reset()\"\n+ >\n+ <div class=\"bg-white dark:bg-gray-800 rounded drop-shadow-sm py-4 px-4 relative w-full md:w-3/5\">\n+ <div class=\"absolute left-8 -top-4 w-px h-4 bg-gray-300 dark:bg-gray-600\"></div>\n+ <div class=\"text-sm pb-2 text-gray-500 dark:text-gray-400\">\n {{ didOrHandle .LoggedInUser.Did .LoggedInUser.Handle }}\n </div>\n- <form hx-post=\"/{{ .RepoInfo.FullName }}/issues/{{ .Issue.IssueId }}/comment\">\n <textarea\n+ id=\"comment-textarea\"\n name=\"body\"\n class=\"w-full p-2 rounded border border-gray-200 dark:border-gray-700\"\n- placeholder=\"Add to the discussion...\"\n+ placeholder=\"Add to the discussion. Markdown is supported.\"\n+ onkeyup=\"updateCommentForm()\"\n ></textarea>\n- <button type=\"submit\" class=\"btn mt-2\">comment</button>\n <div id=\"issue-comment\"></div>\n- </form>\n+ \n+ <div id=\"issue-action\" class=\"error\"></div>\n </div>\n+ \n+ <div class=\"flex gap-2 mt-2\">\n+ <button \n+ id=\"comment-button\" \n+ hx-post=\"/{{ .RepoInfo.FullName }}/issues/{{ .Issue.IssueId }}/comment\" \n+ type=\"submit\" \n+ hx-disabled-elt=\"#comment-button\"\n+ class=\"btn p-2 flex items-center gap-2 no-underline hover:no-underline\" \n+ disabled\n+ >\n+ {{ i \"message-square-plus\" \"w-4 h-4\" }}\n+ comment\n+ </button>\n+ \n+ {{ $isIssueAuthor := and .LoggedInUser (eq .LoggedInUser.Did .Issue.OwnerDid) }}\n+ {{ $isRepoCollaborator := .RepoInfo.Roles.IsCollaborator }}\n+ {{ if and (or $isIssueAuthor $isRepoCollaborator) (eq .State \"open\") }}\n+ <button \n+ id=\"close-button\"\n+ type=\"button\" \n+ class=\"btn flex items-center gap-2\"\n+ hx-trigger=\"click\"\n+ >\n+ {{ i \"ban\" \"w-4 h-4\" }}\n+ close\n+ </button>\n+ <div \n+ id=\"close-with-comment\" \n+ hx-post=\"/{{ .RepoInfo.FullName }}/issues/{{ .Issue.IssueId }}/comment\" \n+ hx-trigger=\"click from:#close-button\" \n+ hx-disabled-elt=\"#close-with-comment\"\n+ hx-target=\"#issue-comment\"\n+ hx-vals=\"js:{body: document.getElementById('comment-textarea').value.trim() !== '' ? document.getElementById('comment-textarea').value : null}\">\n+ </div>\n+ <div \n+ id=\"close-issue\" \n+ hx-disabled-elt=\"#close-issue\"\n+ hx-post=\"/{{ .RepoInfo.FullName }}/issues/{{ .Issue.IssueId }}/close\" \n+ hx-trigger=\"click from:#close-button, revealed from:#close-with-comment\" \n+ hx-target=\"#issue-action\"\n+ hx-swap=\"none\">\n+ </div>\n+ {{ else if and (or $isIssueAuthor $isRepoCollaborator) (eq .State \"closed\") }}\n+ <button \n+ type=\"button\" \n+ class=\"btn flex items-center gap-2\"\n+ hx-post=\"/{{ .RepoInfo.FullName }}/issues/{{ .Issue.IssueId }}/reopen\"\n+ hx-swap=\"none\"\n+ >\n+ {{ i \"circle-dot\" \"w-4 h-4\" }}\n+ reopen\n+ </button>\n+ {{ end }}\n+ \n+ <script>\n+ function updateCommentForm() {\n+ const textarea = document.getElementById('comment-textarea');\n+ const commentButton = document.getElementById('comment-button');\n+ const closeButton = document.getElementById('close-button');\n+ \n+ if (textarea.value.trim() !== '') {\n+ commentButton.removeAttribute('disabled');\n+ } else {\n+ commentButton.setAttribute('disabled', '');\n+ }\n+ \n+ if (closeButton) {\n+ if (textarea.value.trim() !== '') {\n+ closeButton.innerHTML = '{{ i \"ban\" \"w-4 h-4\" }} close with comment';\n+ } else {\n+ closeButton.innerHTML = '{{ i \"ban\" \"w-4 h-4\" }} close';\n+ }\n+ }\n+ }\n+ \n+ document.addEventListener('DOMContentLoaded', function() {\n+ updateCommentForm();\n+ });\n+ </script>\n+ </div>\n+ </form> \n {{ else }}\n <div class=\"bg-white dark:bg-gray-800 dark:text-gray-400 rounded drop-shadow-sm px-6 py-4 mt-8\">\n- <div class=\"absolute left-8 -top-8 w-px h-8 bg-gray-300 dark:bg-gray-700\" ></div>\n+ <div class=\"absolute left-8 -top-2 w-px h-2 bg-gray-300 dark:bg-gray-600\"></div>\n <a href=\"/login\" class=\"underline\">login</a> to join the discussion\n </div>\n {{ end }}\ndiff --git a/appview/pages/templates/repo/pulls/pull.html b/appview/pages/templates/repo/pulls/pull.html\nindex 6e9f363ee87d48fd8828bde6792568e37b393a3c..cab77fd01f2feb329d01fffdfe0846ca60d875ba 100644\n--- a/appview/pages/templates/repo/pulls/pull.html\n+++ b/appview/pages/templates/repo/pulls/pull.html\n@@ -21,7 +21,7 @@ {{ $bgColor = \"bg-purple-600 dark:bg-purple-700\" }}\n {{ $icon = \"git-merge\" }}\n {{ end }}\n \n- <section>\n+ <section class=\"mt-2\">\n <div class=\"flex items-center gap-2\">\n <div\n id=\"state\"\n@@ -64,7 +64,7 @@ </span>\n </div>\n \n {{ if .Pull.Body }}\n- <article id=\"body\" class=\"mt-2 prose dark:prose-invert\">\n+ <article id=\"body\" class=\"mt-8 prose dark:prose-invert\">\n {{ .Pull.Body | markdown }}\n </article>\n {{ end }}\ndiff --git a/appview/pages/templates/repo/pulls/pulls.html b/appview/pages/templates/repo/pulls/pulls.html\nindex 663cc2cedaf2677567732e745970180e55576769..17e728854e6a0f2620d7ddbe5e3a634ceb5df1ae 100644\n--- a/appview/pages/templates/repo/pulls/pulls.html\n+++ b/appview/pages/templates/repo/pulls/pulls.html\n@@ -22,7 +22,7 @@ pull requests\n </p>\n <a\n href=\"/{{ .RepoInfo.FullName }}/pulls/new\"\n- class=\"btn text-sm flex items-center gap-2 no-underline hover:no-underline dark:text-white dark:bg-gray-700 dark:hover:bg-gray-600\"\n+ class=\"btn text-sm flex items-center gap-2 no-underline hover:no-underline\"\n >\n {{ i \"git-pull-request-create\" \"w-4 h-4\" }}\n <span>new</span>\n", "title": "appview: pages/templates/repo: make issues more consistent with pulls", "pullId": 45, "source": { "branch": "push-xttmuzqzktwv" }, "targetRepo": "at://did:plc:wshs7t2adsemcrrd4snkeqli/sh.tangled.repo/3liuighjy2h22", "targetBranch": "master" } }