this repo has no description

Compare changes

Choose any two refs to compare.

Changed files
+113 -179
appview
issues
knots
pages
templates
repo
fragments
issues
pulls
fragments
settings
fragments
user
settings
fragments
pulls
repo
settings
spindles
+8 -9
appview/issues/issues.go
··· 129 129 } 130 130 131 131 rp.pages.RepoSingleIssue(w, pages.RepoSingleIssueParams{ 132 - LoggedInUser: user, 133 - RepoInfo: rp.repoResolver.GetRepoInfo(r, user), 134 - Issue: issue, 135 - CommentList: issue.CommentList(), 136 - Backlinks: backlinks, 137 - OrderedReactionKinds: models.OrderedReactionKinds, 138 - Reactions: reactionMap, 139 - UserReacted: userReactions, 140 - LabelDefs: defs, 132 + LoggedInUser: user, 133 + RepoInfo: rp.repoResolver.GetRepoInfo(r, user), 134 + Issue: issue, 135 + CommentList: issue.CommentList(), 136 + Backlinks: backlinks, 137 + Reactions: reactionMap, 138 + UserReacted: userReactions, 139 + LabelDefs: defs, 141 140 }) 142 141 } 143 142
-15
appview/knots/knots.go
··· 40 40 Knotstream *eventconsumer.Consumer 41 41 } 42 42 43 - type tab = map[string]any 44 - 45 - var ( 46 - knotsTabs []tab = []tab{ 47 - {"Name": "profile", "Icon": "user"}, 48 - {"Name": "keys", "Icon": "key"}, 49 - {"Name": "emails", "Icon": "mail"}, 50 - {"Name": "notifications", "Icon": "bell"}, 51 - {"Name": "knots", "Icon": "volleyball"}, 52 - {"Name": "spindles", "Icon": "spool"}, 53 - } 54 - ) 55 - 56 43 func (k *Knots) Router() http.Handler { 57 44 r := chi.NewRouter() 58 45 ··· 84 71 k.Pages.Knots(w, pages.KnotsParams{ 85 72 LoggedInUser: user, 86 73 Registrations: registrations, 87 - Tabs: knotsTabs, 88 74 Tab: "knots", 89 75 }) 90 76 } ··· 148 134 Members: members, 149 135 Repos: repoMap, 150 136 IsOwner: true, 151 - Tabs: knotsTabs, 152 137 Tab: "knots", 153 138 }) 154 139 }
+22
appview/pages/funcmap.go
··· 32 32 "tangled.org/core/crypto" 33 33 ) 34 34 35 + type tab map[string]string 36 + 35 37 func (p *Pages) funcMap() template.FuncMap { 36 38 return template.FuncMap{ 37 39 "split": func(s string) []string { ··· 384 386 return "error" 385 387 } 386 388 return fp 389 + }, 390 + // constant values used to define a template 391 + "const": func() map[string]any { 392 + return map[string]any{ 393 + "OrderedReactionKinds": models.OrderedReactionKinds, 394 + // would be great to have ordered maps right about now 395 + "UserSettingsTabs": []tab{ 396 + {"Name": "profile", "Icon": "user"}, 397 + {"Name": "keys", "Icon": "key"}, 398 + {"Name": "emails", "Icon": "mail"}, 399 + {"Name": "notifications", "Icon": "bell"}, 400 + {"Name": "knots", "Icon": "volleyball"}, 401 + {"Name": "spindles", "Icon": "spool"}, 402 + }, 403 + "RepoSettingsTabs": []tab{ 404 + {"Name": "general", "Icon": "sliders-horizontal"}, 405 + {"Name": "access", "Icon": "users"}, 406 + {"Name": "pipelines", "Icon": "layers-2"}, 407 + }, 408 + } 387 409 }, 388 410 } 389 411 }
+18 -34
appview/pages/pages.go
··· 336 336 337 337 type UserProfileSettingsParams struct { 338 338 LoggedInUser *oauth.User 339 - Tabs []map[string]any 340 339 Tab string 341 340 } 342 341 ··· 375 374 type UserKeysSettingsParams struct { 376 375 LoggedInUser *oauth.User 377 376 PubKeys []models.PublicKey 378 - Tabs []map[string]any 379 377 Tab string 380 378 } 381 379 ··· 386 384 type UserEmailsSettingsParams struct { 387 385 LoggedInUser *oauth.User 388 386 Emails []models.Email 389 - Tabs []map[string]any 390 387 Tab string 391 388 } 392 389 ··· 397 394 type UserNotificationSettingsParams struct { 398 395 LoggedInUser *oauth.User 399 396 Preferences *models.NotificationPreferences 400 - Tabs []map[string]any 401 397 Tab string 402 398 } 403 399 ··· 417 413 type KnotsParams struct { 418 414 LoggedInUser *oauth.User 419 415 Registrations []models.Registration 420 - Tabs []map[string]any 421 416 Tab string 422 417 } 423 418 ··· 431 426 Members []string 432 427 Repos map[string][]models.Repo 433 428 IsOwner bool 434 - Tabs []map[string]any 435 429 Tab string 436 430 } 437 431 ··· 450 444 type SpindlesParams struct { 451 445 LoggedInUser *oauth.User 452 446 Spindles []models.Spindle 453 - Tabs []map[string]any 454 447 Tab string 455 448 } 456 449 ··· 460 453 461 454 type SpindleListingParams struct { 462 455 models.Spindle 463 - Tabs []map[string]any 464 456 Tab string 465 457 } 466 458 ··· 473 465 Spindle models.Spindle 474 466 Members []string 475 467 Repos map[string][]models.Repo 476 - Tabs []map[string]any 477 468 Tab string 478 469 } 479 470 ··· 881 872 SubscribedLabels map[string]struct{} 882 873 ShouldSubscribeAll bool 883 874 Active string 884 - Tabs []map[string]any 885 875 Tab string 886 876 Branches []types.Branch 887 877 } ··· 895 885 LoggedInUser *oauth.User 896 886 RepoInfo repoinfo.RepoInfo 897 887 Active string 898 - Tabs []map[string]any 899 888 Tab string 900 889 Collaborators []Collaborator 901 890 } ··· 909 898 LoggedInUser *oauth.User 910 899 RepoInfo repoinfo.RepoInfo 911 900 Active string 912 - Tabs []map[string]any 913 901 Tab string 914 902 Spindles []string 915 903 CurrentSpindle string ··· 947 935 Backlinks []models.RichReferenceLink 948 936 LabelDefs map[string]*models.LabelDefinition 949 937 950 - OrderedReactionKinds []models.ReactionKind 951 - Reactions map[models.ReactionKind]models.ReactionDisplayData 952 - UserReacted map[models.ReactionKind]bool 938 + Reactions map[models.ReactionKind]models.ReactionDisplayData 939 + UserReacted map[models.ReactionKind]bool 953 940 } 954 941 955 942 func (p *Pages) RepoSingleIssue(w io.Writer, params RepoSingleIssueParams) error { ··· 1104 1091 ResubmitCheck ResubmitResult 1105 1092 Pipelines map[string]models.Pipeline 1106 1093 1107 - OrderedReactionKinds []models.ReactionKind 1108 - Reactions map[models.ReactionKind]models.ReactionDisplayData 1109 - UserReacted map[models.ReactionKind]bool 1094 + Reactions map[models.ReactionKind]models.ReactionDisplayData 1095 + UserReacted map[models.ReactionKind]bool 1110 1096 1111 1097 LabelDefs map[string]*models.LabelDefinition 1112 1098 } ··· 1117 1103 } 1118 1104 1119 1105 type RepoPullPatchParams struct { 1120 - LoggedInUser *oauth.User 1121 - RepoInfo repoinfo.RepoInfo 1122 - Pull *models.Pull 1123 - Stack models.Stack 1124 - Diff *types.NiceDiff 1125 - Round int 1126 - Submission *models.PullSubmission 1127 - OrderedReactionKinds []models.ReactionKind 1128 - DiffOpts types.DiffOpts 1106 + LoggedInUser *oauth.User 1107 + RepoInfo repoinfo.RepoInfo 1108 + Pull *models.Pull 1109 + Stack models.Stack 1110 + Diff *types.NiceDiff 1111 + Round int 1112 + Submission *models.PullSubmission 1113 + DiffOpts types.DiffOpts 1129 1114 } 1130 1115 1131 1116 // this name is a mouthful ··· 1134 1119 } 1135 1120 1136 1121 type RepoPullInterdiffParams struct { 1137 - LoggedInUser *oauth.User 1138 - RepoInfo repoinfo.RepoInfo 1139 - Pull *models.Pull 1140 - Round int 1141 - Interdiff *patchutil.InterdiffResult 1142 - OrderedReactionKinds []models.ReactionKind 1143 - DiffOpts types.DiffOpts 1122 + LoggedInUser *oauth.User 1123 + RepoInfo repoinfo.RepoInfo 1124 + Pull *models.Pull 1125 + Round int 1126 + Interdiff *patchutil.InterdiffResult 1127 + DiffOpts types.DiffOpts 1144 1128 } 1145 1129 1146 1130 // this name is a mouthful
+50
appview/pages/templates/repo/fragments/reactions.html
··· 1 + {{ define "repo/fragments/reactions" }} 2 + <div class="flex flex-wrap items-center gap-2"> 3 + {{- $reactions := .Reactions -}} 4 + {{- $userReacted := .UserReacted -}} 5 + {{- $threadAt := .ThreadAt -}} 6 + 7 + {{ template "reactionsPopup" }} 8 + {{ range $kind := const.OrderedReactionKinds }} 9 + {{ $reactionData := index $reactions $kind }} 10 + {{ template "repo/fragments/reaction" 11 + (dict 12 + "Kind" $kind 13 + "Count" $reactionData.Count 14 + "IsReacted" (index $userReacted $kind) 15 + "ThreadAt" $threadAt 16 + "Users" $reactionData.Users) }} 17 + {{ end }} 18 + </div> 19 + {{ end }} 20 + 21 + {{ define "reactionsPopup" }} 22 + <details 23 + id="reactionsPopUp" 24 + class="relative inline-block" 25 + > 26 + <summary 27 + class="flex justify-center items-center min-w-8 min-h-8 rounded border border-gray-200 dark:border-gray-700 28 + hover:bg-gray-50 29 + hover:border-gray-300 30 + dark:hover:bg-gray-700 31 + dark:hover:border-gray-600 32 + cursor-pointer list-none" 33 + > 34 + {{ i "smile" "size-4" }} 35 + </summary> 36 + <div 37 + class="absolute flex left-0 z-10 mt-4 rounded bg-white dark:bg-gray-800 dark:text-white border border-gray-200 dark:border-gray-700 shadow-lg" 38 + > 39 + {{ range $kind := const.OrderedReactionKinds }} 40 + <button 41 + id="reactBtn-{{ $kind }}" 42 + class="size-12 hover:bg-gray-100 dark:hover:bg-gray-700" 43 + hx-on:click="this.parentElement.parentElement.removeAttribute('open')" 44 + > 45 + {{ $kind }} 46 + </button> 47 + {{ end }} 48 + </div> 49 + </details> 50 + {{ end }}
-30
appview/pages/templates/repo/fragments/reactionsPopUp.html
··· 1 - {{ define "repo/fragments/reactionsPopUp" }} 2 - <details 3 - id="reactionsPopUp" 4 - class="relative inline-block" 5 - > 6 - <summary 7 - class="flex justify-center items-center min-w-8 min-h-8 rounded border border-gray-200 dark:border-gray-700 8 - hover:bg-gray-50 9 - hover:border-gray-300 10 - dark:hover:bg-gray-700 11 - dark:hover:border-gray-600 12 - cursor-pointer list-none" 13 - > 14 - {{ i "smile" "size-4" }} 15 - </summary> 16 - <div 17 - class="absolute flex left-0 z-10 mt-4 rounded bg-white dark:bg-gray-800 dark:text-white border border-gray-200 dark:border-gray-700 shadow-lg" 18 - > 19 - {{ range $kind := . }} 20 - <button 21 - id="reactBtn-{{ $kind }}" 22 - class="size-12 hover:bg-gray-100 dark:hover:bg-gray-700" 23 - hx-on:click="this.parentElement.parentElement.removeAttribute('open')" 24 - > 25 - {{ $kind }} 26 - </button> 27 - {{ end }} 28 - </div> 29 - </details> 30 - {{ end }}
+5 -21
appview/pages/templates/repo/issues/issue.html
··· 35 35 {{ if .Issue.Body }} 36 36 <article id="body" class="mt-4 prose dark:prose-invert">{{ .Issue.Body | markdown }}</article> 37 37 {{ end }} 38 - <div class="flex flex-wrap gap-2 items-stretch mt-4"> 39 - {{ template "issueReactions" . }} 38 + <div class="mt-4"> 39 + {{ template "repo/fragments/reactions" 40 + (dict "Reactions" .Reactions 41 + "UserReacted" .UserReacted 42 + "ThreadAt" .Issue.AtUri) }} 40 43 </div> 41 44 </section> 42 45 {{ end }} ··· 106 109 {{ i "loader-circle" "size-3 animate-spin hidden group-[.htmx-request]:inline" }} 107 110 </a> 108 111 {{ end }} 109 - 110 - {{ define "issueReactions" }} 111 - <div class="flex items-center gap-2"> 112 - {{ template "repo/fragments/reactionsPopUp" .OrderedReactionKinds }} 113 - {{ range $kind := .OrderedReactionKinds }} 114 - {{ $reactionData := index $.Reactions $kind }} 115 - {{ 116 - template "repo/fragments/reaction" 117 - (dict 118 - "Kind" $kind 119 - "Count" $reactionData.Count 120 - "IsReacted" (index $.UserReacted $kind) 121 - "ThreadAt" $.Issue.AtUri 122 - "Users" $reactionData.Users) 123 - }} 124 - {{ end }} 125 - </div> 126 - {{ end }} 127 - 128 112 129 113 {{ define "repoAfter" }} 130 114 <div class="flex flex-col gap-4 mt-4">
+5 -16
appview/pages/templates/repo/pulls/fragments/pullHeader.html
··· 64 64 </article> 65 65 {{ end }} 66 66 67 - {{ with .OrderedReactionKinds }} 68 - <div class="flex items-center gap-2 mt-2"> 69 - {{ template "repo/fragments/reactionsPopUp" . }} 70 - {{ range $kind := . }} 71 - {{ $reactionData := index $.Reactions $kind }} 72 - {{ 73 - template "repo/fragments/reaction" 74 - (dict 75 - "Kind" $kind 76 - "Count" $reactionData.Count 77 - "IsReacted" (index $.UserReacted $kind) 78 - "ThreadAt" $.Pull.AtUri 79 - "Users" $reactionData.Users) 80 - }} 81 - {{ end }} 67 + <div class="mt-2"> 68 + {{ template "repo/fragments/reactions" 69 + (dict "Reactions" .Reactions 70 + "UserReacted" .UserReacted 71 + "ThreadAt" .Pull.AtUri) }} 82 72 </div> 83 - {{ end }} 84 73 </section> 85 74 86 75
+1 -2
appview/pages/templates/repo/settings/fragments/sidebar.html
··· 1 1 {{ define "repo/settings/fragments/sidebar" }} 2 2 {{ $active := .Tab }} 3 - {{ $tabs := .Tabs }} 4 3 <div class="sticky top-2 grid grid-cols-1 rounded border border-gray-200 dark:border-gray-700 divide-y divide-gray-200 dark:divide-gray-700 shadow-inner"> 5 4 {{ $activeTab := "bg-white dark:bg-gray-700 drop-shadow-sm" }} 6 5 {{ $inactiveTab := "bg-gray-100 dark:bg-gray-800" }} 7 - {{ range $tabs }} 6 + {{ range const.RepoSettingsTabs }} 8 7 <a href="/{{ $.RepoInfo.FullName }}/settings?tab={{.Name}}" class="no-underline hover:no-underline hover:bg-gray-100/25 hover:dark:bg-gray-700/25"> 9 8 <div class="flex gap-3 items-center p-2 {{ if eq .Name $active }} {{ $activeTab }} {{ else }} {{ $inactiveTab }} {{ end }}"> 10 9 {{ i .Icon "size-4" }}
+2 -3
appview/pages/templates/user/settings/fragments/sidebar.html
··· 1 1 {{ define "user/settings/fragments/sidebar" }} 2 2 {{ $active := .Tab }} 3 - {{ $tabs := .Tabs }} 4 3 <div class="sticky top-2 grid grid-cols-1 rounded border border-gray-200 dark:border-gray-700 divide-y divide-gray-200 dark:divide-gray-700 shadow-inner"> 5 4 {{ $activeTab := "bg-white dark:bg-gray-700 drop-shadow-sm" }} 6 5 {{ $inactiveTab := "bg-gray-100 dark:bg-gray-800" }} 7 - {{ range $tabs }} 6 + {{ range const.UserSettingsTabs }} 8 7 <a href="/settings/{{.Name}}" class="no-underline hover:no-underline hover:bg-gray-100/25 hover:dark:bg-gray-700/25"> 9 8 <div class="flex gap-3 items-center p-2 {{ if eq .Name $active }} {{ $activeTab }} {{ else }} {{ $inactiveTab }} {{ end }}"> 10 9 {{ i .Icon "size-4" }} ··· 13 12 </a> 14 13 {{ end }} 15 14 </div> 16 - {{ end }} 15 + {{ end }}
+2 -3
appview/pulls/pulls.go
··· 244 244 ResubmitCheck: resubmitResult, 245 245 Pipelines: m, 246 246 247 - OrderedReactionKinds: models.OrderedReactionKinds, 248 - Reactions: reactionMap, 249 - UserReacted: userReactions, 247 + Reactions: reactionMap, 248 + UserReacted: userReactions, 250 249 251 250 LabelDefs: defs, 252 251 })
-14
appview/repo/settings.go
··· 22 22 indigoxrpc "github.com/bluesky-social/indigo/xrpc" 23 23 ) 24 24 25 - type tab = map[string]any 26 - 27 - var ( 28 - // would be great to have ordered maps right about now 29 - settingsTabs []tab = []tab{ 30 - {"Name": "general", "Icon": "sliders-horizontal"}, 31 - {"Name": "access", "Icon": "users"}, 32 - {"Name": "pipelines", "Icon": "layers-2"}, 33 - } 34 - ) 35 - 36 25 func (rp *Repo) SetDefaultBranch(w http.ResponseWriter, r *http.Request) { 37 26 l := rp.logger.With("handler", "SetDefaultBranch") 38 27 ··· 262 251 DefaultLabels: defaultLabels, 263 252 SubscribedLabels: subscribedLabels, 264 253 ShouldSubscribeAll: shouldSubscribeAll, 265 - Tabs: settingsTabs, 266 254 Tab: "general", 267 255 }) 268 256 } ··· 308 296 rp.pages.RepoAccessSettings(w, pages.RepoAccessSettingsParams{ 309 297 LoggedInUser: user, 310 298 RepoInfo: rp.repoResolver.GetRepoInfo(r, user), 311 - Tabs: settingsTabs, 312 299 Tab: "access", 313 300 Collaborators: collaborators, 314 301 }) ··· 369 356 rp.pages.RepoPipelineSettings(w, pages.RepoPipelineSettingsParams{ 370 357 LoggedInUser: user, 371 358 RepoInfo: rp.repoResolver.GetRepoInfo(r, user), 372 - Tabs: settingsTabs, 373 359 Tab: "pipelines", 374 360 Spindles: spindles, 375 361 CurrentSpindle: f.Spindle,
-17
appview/settings/settings.go
··· 35 35 Config *config.Config 36 36 } 37 37 38 - type tab = map[string]any 39 - 40 - var ( 41 - settingsTabs []tab = []tab{ 42 - {"Name": "profile", "Icon": "user"}, 43 - {"Name": "keys", "Icon": "key"}, 44 - {"Name": "emails", "Icon": "mail"}, 45 - {"Name": "notifications", "Icon": "bell"}, 46 - {"Name": "knots", "Icon": "volleyball"}, 47 - {"Name": "spindles", "Icon": "spool"}, 48 - } 49 - ) 50 - 51 38 func (s *Settings) Router() http.Handler { 52 39 r := chi.NewRouter() 53 40 ··· 85 72 86 73 s.Pages.UserProfileSettings(w, pages.UserProfileSettingsParams{ 87 74 LoggedInUser: user, 88 - Tabs: settingsTabs, 89 75 Tab: "profile", 90 76 }) 91 77 } ··· 104 90 s.Pages.UserNotificationSettings(w, pages.UserNotificationSettingsParams{ 105 91 LoggedInUser: user, 106 92 Preferences: prefs, 107 - Tabs: settingsTabs, 108 93 Tab: "notifications", 109 94 }) 110 95 } ··· 146 131 s.Pages.UserKeysSettings(w, pages.UserKeysSettingsParams{ 147 132 LoggedInUser: user, 148 133 PubKeys: pubKeys, 149 - Tabs: settingsTabs, 150 134 Tab: "keys", 151 135 }) 152 136 } ··· 161 145 s.Pages.UserEmailsSettings(w, pages.UserEmailsSettingsParams{ 162 146 LoggedInUser: user, 163 147 Emails: emails, 164 - Tabs: settingsTabs, 165 148 Tab: "emails", 166 149 }) 167 150 }
-15
appview/spindles/spindles.go
··· 39 39 Logger *slog.Logger 40 40 } 41 41 42 - type tab = map[string]any 43 - 44 - var ( 45 - spindlesTabs []tab = []tab{ 46 - {"Name": "profile", "Icon": "user"}, 47 - {"Name": "keys", "Icon": "key"}, 48 - {"Name": "emails", "Icon": "mail"}, 49 - {"Name": "notifications", "Icon": "bell"}, 50 - {"Name": "knots", "Icon": "volleyball"}, 51 - {"Name": "spindles", "Icon": "spool"}, 52 - } 53 - ) 54 - 55 42 func (s *Spindles) Router() http.Handler { 56 43 r := chi.NewRouter() 57 44 ··· 83 70 s.Pages.Spindles(w, pages.SpindlesParams{ 84 71 LoggedInUser: user, 85 72 Spindles: all, 86 - Tabs: spindlesTabs, 87 73 Tab: "spindles", 88 74 }) 89 75 } ··· 143 129 Spindle: spindle, 144 130 Members: members, 145 131 Repos: repoMap, 146 - Tabs: spindlesTabs, 147 132 Tab: "spindles", 148 133 }) 149 134 }