From 6100b99828153a1b712e73da84d90b583d833b01 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Mon, 31 Jul 2023 15:23:28 +0100 Subject: [PATCH] Notifications: Extracted watch options, updated UI further --- app/Users/UserWatchOptions.php | 22 ++++++ lang/en/entities.php | 14 ++++ resources/js/components/dropdown.js | 1 + resources/sass/_layout.scss | 10 ++- resources/sass/_lists.scss | 8 +- resources/sass/_variables.scss | 1 + resources/views/books/show.blade.php | 3 +- resources/views/entities/meta.blade.php | 7 +- .../views/entities/watch-action.blade.php | 9 +++ .../views/entities/watch-controls.blade.php | 73 +++++-------------- 10 files changed, 86 insertions(+), 62 deletions(-) create mode 100644 app/Users/UserWatchOptions.php create mode 100644 resources/views/entities/watch-action.blade.php diff --git a/app/Users/UserWatchOptions.php b/app/Users/UserWatchOptions.php new file mode 100644 index 000000000..a835bcfc7 --- /dev/null +++ b/app/Users/UserWatchOptions.php @@ -0,0 +1,22 @@ + -1, + 'ignore' => 0, + 'new' => 1, + 'updates' => 2, + 'comments' => 3, + ]; + + /** + * @return string[] + */ + public static function getAvailableOptionNames(): array + { + return array_keys(static::$levelByOption); + } +} diff --git a/lang/en/entities.php b/lang/en/entities.php index 4fb043aa9..80b9142f5 100644 --- a/lang/en/entities.php +++ b/lang/en/entities.php @@ -403,4 +403,18 @@ return [ 'references' => 'References', 'references_none' => 'There are no tracked references to this item.', 'references_to_desc' => 'Shown below are all the known pages in the system that link to this item.', + + // Watch Options + 'watch' => 'Watch', + 'watch_title_default' => 'Default Preferences', + 'watch_desc_default' => 'Revert watching to just your default notification preferences.', + 'watch_title_ignore' => 'Ignore', + 'watch_desc_ignore' => 'Ignore all notifications, including those from user-level preferences.', + 'watch_title_new' => 'New Pages', + 'watch_desc_new' => 'Notify when any new page is created within this item.', + 'watch_title_updates' => 'All Page Updates', + 'watch_desc_updates' => 'Notify upon all new pages and page changes.', + 'watch_title_comments' => 'All Page Updates & Comments', + 'watch_desc_comments' => 'Notify upon all new pages, page changes and new comments.', + 'watch_change_default' => 'Change default notification preferences', ]; diff --git a/resources/js/components/dropdown.js b/resources/js/components/dropdown.js index b68f332b6..2c5919a37 100644 --- a/resources/js/components/dropdown.js +++ b/resources/js/components/dropdown.js @@ -132,6 +132,7 @@ export class Dropdown extends Component { onSelect(this.toggle, event => { event.stopPropagation(); + event.preventDefault(); this.show(event); if (event instanceof KeyboardEvent) { keyboardNavHandler.focusNext(); diff --git a/resources/sass/_layout.scss b/resources/sass/_layout.scss index a8604b81b..50776ea28 100644 --- a/resources/sass/_layout.scss +++ b/resources/sass/_layout.scss @@ -353,7 +353,7 @@ body.flexbox { margin-inline-end: $-xl; grid-template-columns: 1fr 4fr 1fr; grid-template-areas: "a b c"; - grid-column-gap: $-xxl; + grid-column-gap: $-xl; .tri-layout-right { grid-area: c; min-width: 0; @@ -378,6 +378,14 @@ body.flexbox { padding-inline-end: $-l; } } +@include between($xxl, $xxxl) { + .tri-layout-container { + grid-template-columns: 1fr calc(940px + (2 * $-m)) 1fr; + grid-column-gap: $-s; + margin-inline-start: $-m; + margin-inline-end: $-m; + } +} @include between($l, $xxl) { .tri-layout-left { position: sticky; diff --git a/resources/sass/_lists.scss b/resources/sass/_lists.scss index 64411014d..323551196 100644 --- a/resources/sass/_lists.scss +++ b/resources/sass/_lists.scss @@ -672,7 +672,7 @@ ul.pagination { @include lightDark(color, #555, #eee); fill: currentColor; text-align: start !important; - max-height: 500px; + max-height: 80vh; overflow-y: auto; &.anchor-left { inset-inline-end: auto; @@ -683,6 +683,7 @@ ul.pagination { } &.xl-limited { width: 280px; + max-width: 100%; } .text-muted { color: #999; @@ -708,6 +709,11 @@ ul.pagination { white-space: nowrap; line-height: 1.4; cursor: pointer; + &.break-text { + white-space: normal; + word-wrap: break-word; + overflow-wrap: break-word; + } &:hover, &:focus { text-decoration: none; background-color: var(--color-primary-light); diff --git a/resources/sass/_variables.scss b/resources/sass/_variables.scss index a3598e29c..35586bf58 100644 --- a/resources/sass/_variables.scss +++ b/resources/sass/_variables.scss @@ -2,6 +2,7 @@ /////////////// // Screen breakpoints +$xxxl: 1700px; $xxl: 1400px; $xl: 1100px; $l: 1000px; diff --git a/resources/views/books/show.blade.php b/resources/views/books/show.blade.php index f126c6219..305a65132 100644 --- a/resources/views/books/show.blade.php +++ b/resources/views/books/show.blade.php @@ -67,7 +67,7 @@ @stop @section('right') -
+
{{ trans('common.details') }}