diff --git a/components/common/box-list/box-list.css b/components/common/box-list/box-list.css index 5a724a79..bc08cf7c 100644 --- a/components/common/box-list/box-list.css +++ b/components/common/box-list/box-list.css @@ -81,7 +81,15 @@ font-weight: 600; } -.theme-box-list-header > .theme-dropdown > summary.theme-control { +/* More than one menu on the right of the header (Type and Sort). */ +.theme-box-list-filters { + display: flex; + align-items: center; + gap: 4px; +} + +.theme-box-list-header > .theme-dropdown > summary.theme-control, +.theme-box-list-filters > .theme-dropdown > summary.theme-control { font-weight: 400; } diff --git a/src/build-output.test.ts b/src/build-output.test.ts index 10385caa..8cdceb62 100644 --- a/src/build-output.test.ts +++ b/src/build-output.test.ts @@ -661,6 +661,16 @@ describe("Forgejo 15 native integration", () => { expect(layout).toContain('template "components/common/settings/context"'); }); + it("shows subscriptions and watched repositories in the notifications sidebar layout", () => { + const read = (...parts: string[]) => + fs.readFileSync(path.join(ROOT_DIR, "templates", "user", "notification", ...parts), "utf-8"); + expect(read("notification_div.tmpl")).toContain('template "user/notification/sidebar"'); + const subscriptions = read("notification_subscriptions.tmpl"); + expect(subscriptions).toContain('template "user/notification/sidebar" dict "Data" . "Current" $current'); + expect(subscriptions).toContain('"Items" "user/notification/subscriptions_sort"'); + expect(read("sidebar.tmpl")).toContain('href="{{AppSubUrl}}/notifications/watching"'); + }); + it("matches GitHub's repository About, visibility, and code-search details", () => { const headerStyle = fs.readFileSync(path.join(ROOT_DIR, "styles", "templates", "repo", "header.ts"), "utf-8"); const headerTemplate = fs.readFileSync(path.join(ROOT_DIR, "templates", "repo", "home_header.tmpl"), "utf-8"); diff --git a/styles/pages/dashboard-lists.css b/styles/pages/dashboard-lists.css index 26822b8e..a8e4cd09 100644 --- a/styles/pages/dashboard-lists.css +++ b/styles/pages/dashboard-lists.css @@ -1,4 +1,4 @@ -/* The dashboard's own lists: issues, pull requests and notifications. */ +/* The dashboard's own lists: issues, pull requests, notifications and subscriptions. */ /* The context switcher sits at the top of the sidebar instead of in a bar across the page. */ .dashboard-list-context .secondary-nav { @@ -84,3 +84,9 @@ .dashboard-list-context .ui.secondary.menu > .item { align-self: flex-start; } + +/* Subscriptions: the issue list sits in the box under its header instead of drawing its own border. As specific as + the issue list rule for notification pages, and loaded after it. */ +.page-content.user.notification .theme-box-list #issue-list { + border: 0; +} diff --git a/templates/user/notification/notification_div.tmpl b/templates/user/notification/notification_div.tmpl index 58cd00bf..b511b13c 100644 --- a/templates/user/notification/notification_div.tmpl +++ b/templates/user/notification/notification_div.tmpl @@ -1,18 +1,7 @@
{{$notificationUnreadCount := call .NotificationUnreadCount}} - + {{$current := "unread"}}{{if eq .Status 2}}{{$current = "read"}}{{end}} + {{template "user/notification/sidebar" dict "Data" . "Current" $current}}
diff --git a/templates/user/notification/notification_subscriptions.tmpl b/templates/user/notification/notification_subscriptions.tmpl new file mode 100644 index 00000000..f1bf838a --- /dev/null +++ b/templates/user/notification/notification_subscriptions.tmpl @@ -0,0 +1,43 @@ +{{/* Subscriptions and watched repositories in the notifications sidebar layout, as the inbox: the heading, then the +subscribed issues in a box headed by All, Open and Closed with Type and Sort, or the watched repositories. */}} +{{template "base/head" .}} +{{$current := "subscriptions"}}{{if eq .Status 2}}{{$current = "watching"}}{{end}} +
+ {{template "user/notification/sidebar" dict "Data" . "Current" $current}} +
+
+
+ +

{{if eq .Status 1}}{{ctx.Locale.Tr "notification.subscriptions"}}{{else}}{{ctx.Locale.Tr "notification.watching"}}{{end}}

+
+
+ {{if eq .Status 1}} +
+
+ +
+ {{template "components/common/dropdown/dropdown" dict "Kind" "actions" "Label" (ctx.Locale.Tr "repo.issues.filter_type") "Quiet" true "Items" "user/notification/subscriptions_type" "Data" .}} + {{template "components/common/dropdown/dropdown" dict "Kind" "actions" "Label" (ctx.Locale.Tr "repo.issues.filter_sort") "Quiet" true "Items" "user/notification/subscriptions_sort" "Data" .}} +
+
+ {{if .Issues}} + {{template "shared/issuelist" dict "." . "listType" "dashboard"}} + {{else}} +
+ {{svg "octicon-bell" 24}} +

{{ctx.Locale.Tr "notification.no_subscriptions"}}

+
+ {{end}} +
+ {{else}} + {{template "shared/repo_search" .}} + {{template "explore/repo_list" .}} + {{template "base/paginate" .}} + {{end}} +
+
+{{template "base/footer" .}} diff --git a/templates/user/notification/sidebar.tmpl b/templates/user/notification/sidebar.tmpl new file mode 100644 index 00000000..4454ae61 --- /dev/null +++ b/templates/user/notification/sidebar.tmpl @@ -0,0 +1,17 @@ +{{/* The notifications sidebar, shared by the inbox and the subscription pages. Data is the page context; Current names +the page (unread, read, subscriptions or watching). */}} +{{$notificationUnreadCount := call .Data.NotificationUnreadCount}} + diff --git a/templates/user/notification/subscriptions_sort.tmpl b/templates/user/notification/subscriptions_sort.tmpl new file mode 100644 index 00000000..2af1383f --- /dev/null +++ b/templates/user/notification/subscriptions_sort.tmpl @@ -0,0 +1,9 @@ +{{$query := print "?state=" .State "&issueType=" .IssueType "&labels=" .Labels}} +{{svg "octicon-check" 16 "theme-box-list-check"}}{{ctx.Locale.Tr "issues.search.sort.latest"}} +{{svg "octicon-check" 16 "theme-box-list-check"}}{{ctx.Locale.Tr "issues.search.sort.oldest"}} +{{svg "octicon-check" 16 "theme-box-list-check"}}{{ctx.Locale.Tr "issues.search.sort.recentupdate"}} +{{svg "octicon-check" 16 "theme-box-list-check"}}{{ctx.Locale.Tr "issues.search.sort.leastupdate"}} +{{svg "octicon-check" 16 "theme-box-list-check"}}{{ctx.Locale.Tr "issues.search.sort.mostcomment"}} +{{svg "octicon-check" 16 "theme-box-list-check"}}{{ctx.Locale.Tr "issues.search.sort.leastcomment"}} +{{svg "octicon-check" 16 "theme-box-list-check"}}{{ctx.Locale.Tr "issues.search.sort.nearduedate"}} +{{svg "octicon-check" 16 "theme-box-list-check"}}{{ctx.Locale.Tr "issues.search.sort.farduedate"}} diff --git a/templates/user/notification/subscriptions_type.tmpl b/templates/user/notification/subscriptions_type.tmpl new file mode 100644 index 00000000..a438ef33 --- /dev/null +++ b/templates/user/notification/subscriptions_type.tmpl @@ -0,0 +1,4 @@ +{{$query := print "?sort=" .SortType "&state=" .State "&labels=" .Labels}} +{{svg "octicon-check" 16 "theme-box-list-check"}}{{ctx.Locale.Tr "all"}} +{{svg "octicon-check" 16 "theme-box-list-check"}}{{ctx.Locale.Tr "issues"}} +{{svg "octicon-check" 16 "theme-box-list-check"}}{{ctx.Locale.Tr "pull_requests"}}