From c0959a86447121ef1c9d197de86f5ce30ba3410a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adina=20=C8=9Aeudan?= Date: Wed, 28 Apr 2021 21:42:26 +0300 Subject: [PATCH] RED-776: No annotations on this page, jump to previous/next buttons --- .../src/app/modules/icons/icons.module.ts | 2 + .../file-workload.component.html | 65 ++++++++++++------- .../file-workload.component.scss | 14 +++- .../file-workload/file-workload.component.ts | 13 +++- .../icon-button/icon-button.component.scss | 1 + .../empty-state/empty-state.component.html | 5 +- .../empty-state/empty-state.component.scss | 1 - .../empty-state/empty-state.component.ts | 1 + apps/red-ui/src/assets/i18n/de.json | 4 +- apps/red-ui/src/assets/i18n/en.json | 8 ++- .../src/assets/icons/general/nav-next.svg | 19 ++++++ .../src/assets/icons/general/nav-prev.svg | 19 ++++++ apps/red-ui/src/assets/styles/red-button.scss | 5 ++ .../src/assets/styles/red-page-layout.scss | 4 ++ 14 files changed, 126 insertions(+), 35 deletions(-) create mode 100644 apps/red-ui/src/assets/icons/general/nav-next.svg create mode 100644 apps/red-ui/src/assets/icons/general/nav-prev.svg diff --git a/apps/red-ui/src/app/modules/icons/icons.module.ts b/apps/red-ui/src/app/modules/icons/icons.module.ts index 7788e6834..2d5c8c502 100644 --- a/apps/red-ui/src/app/modules/icons/icons.module.ts +++ b/apps/red-ui/src/app/modules/icons/icons.module.ts @@ -46,6 +46,8 @@ export class IconsModule { 'menu', 'nav-first', 'nav-last', + 'nav-next', + 'nav-prev', 'needs-work', 'new-tab', 'notification', diff --git a/apps/red-ui/src/app/modules/projects/components/file-workload/file-workload.component.html b/apps/red-ui/src/app/modules/projects/components/file-workload/file-workload.component.html index 77f30b942..73bb7a2be 100644 --- a/apps/red-ui/src/app/modules/projects/components/file-workload/file-workload.component.html +++ b/apps/red-ui/src/app/modules/projects/components/file-workload/file-workload.component.html @@ -1,16 +1,16 @@
@@ -20,22 +20,22 @@
{{ selectedAnnotations?.length || 0 }} selected
-
+
-
+
@@ -83,8 +83,8 @@ >
-
All
-
None
+
All
+
None
@@ -93,25 +93,42 @@ (keydown)="preventKeyDefault($event)" (keyup)="preventKeyDefault($event)" [class.active-panel]="!pagesPanelActive" - redactionHasScrollbar class="annotations" + redactionHasScrollbar tabindex="1" > -
- {{ 'file-preview.no-annotations-for-page' | translate }} -
+ + +
+ + +
+
-
+
@@ -132,8 +149,8 @@
@@ -162,7 +179,7 @@ - + diff --git a/apps/red-ui/src/app/modules/projects/components/file-workload/file-workload.component.scss b/apps/red-ui/src/app/modules/projects/components/file-workload/file-workload.component.scss index 29d1a9e01..c323823f8 100644 --- a/apps/red-ui/src/app/modules/projects/components/file-workload/file-workload.component.scss +++ b/apps/red-ui/src/app/modules/projects/components/file-workload/file-workload.component.scss @@ -4,9 +4,14 @@ .right-content { flex-direction: column; - .no-annotations { - padding: 24px; - text-align: center; + .no-annotations-buttons-container { + display: flex; + align-items: center; + flex-direction: column; + + redaction-icon-button { + width: 100%; + } } .multi-select { @@ -115,6 +120,9 @@ overflow: hidden; width: 100%; height: calc(100% - 32px); + display: flex; + align-items: center; + flex-direction: column; .annotation-wrapper { display: flex; diff --git a/apps/red-ui/src/app/modules/projects/components/file-workload/file-workload.component.ts b/apps/red-ui/src/app/modules/projects/components/file-workload/file-workload.component.ts index 39dfecfa7..dcb6fc326 100644 --- a/apps/red-ui/src/app/modules/projects/components/file-workload/file-workload.component.ts +++ b/apps/red-ui/src/app/modules/projects/components/file-workload/file-workload.component.ts @@ -227,6 +227,14 @@ export class FileWorkloadComponent { } } + public jumpToPreviousWithAnnotations() { + this.selectPage.emit(this._prevPageWithAnnotations()); + } + + public jumpToNextWithAnnotations() { + this.selectPage.emit(this._nextPageWithAnnotations()); + } + private _navigateAnnotations($event: KeyboardEvent) { if (!this.firstSelectedAnnotation || this.activeViewerPage !== this.firstSelectedAnnotation.pageNumber) { const pageIdx = this.displayedPages.indexOf(this.activeViewerPage); @@ -325,10 +333,9 @@ export class FileWorkloadComponent { private _prevPageWithAnnotations() { let idx = this.displayedPages.length - 1; - for (const page of this.displayedPages.reverse()) { + const reverseDisplayedPages = [...this.displayedPages].reverse(); + for (const page of reverseDisplayedPages) { if (page < this.activeViewerPage) { - this.selectPage.emit(this.displayedPages[idx]); - this.scrollAnnotations(); break; } --idx; diff --git a/apps/red-ui/src/app/modules/shared/components/buttons/icon-button/icon-button.component.scss b/apps/red-ui/src/app/modules/shared/components/buttons/icon-button/icon-button.component.scss index d84f2d27b..cf946631d 100644 --- a/apps/red-ui/src/app/modules/shared/components/buttons/icon-button/icon-button.component.scss +++ b/apps/red-ui/src/app/modules/shared/components/buttons/icon-button/icon-button.component.scss @@ -2,6 +2,7 @@ button { padding: 0 14px; + width: 100%; &.has-icon { padding: 0 14px 0 10px; diff --git a/apps/red-ui/src/app/modules/shared/components/empty-state/empty-state.component.html b/apps/red-ui/src/app/modules/shared/components/empty-state/empty-state.component.html index a8126d468..b9f7b0425 100644 --- a/apps/red-ui/src/app/modules/shared/components/empty-state/empty-state.component.html +++ b/apps/red-ui/src/app/modules/shared/components/empty-state/empty-state.component.html @@ -1,4 +1,7 @@ -
+
diff --git a/apps/red-ui/src/app/modules/shared/components/empty-state/empty-state.component.scss b/apps/red-ui/src/app/modules/shared/components/empty-state/empty-state.component.scss index ea3dea645..ef18f9b40 100644 --- a/apps/red-ui/src/app/modules/shared/components/empty-state/empty-state.component.scss +++ b/apps/red-ui/src/app/modules/shared/components/empty-state/empty-state.component.scss @@ -4,7 +4,6 @@ display: flex; flex-direction: column; align-items: center; - padding-top: 120px; text-align: center; > mat-icon { diff --git a/apps/red-ui/src/app/modules/shared/components/empty-state/empty-state.component.ts b/apps/red-ui/src/app/modules/shared/components/empty-state/empty-state.component.ts index 9367ebd8b..b42f0e62e 100644 --- a/apps/red-ui/src/app/modules/shared/components/empty-state/empty-state.component.ts +++ b/apps/red-ui/src/app/modules/shared/components/empty-state/empty-state.component.ts @@ -12,6 +12,7 @@ export class EmptyStateComponent implements OnInit { @Input() showButton = true; @Input() buttonIcon = 'red:plus'; @Input() horizontalPadding = 100; + @Input() verticalPadding = 120; @Input() type: 'no-data' | 'no-match' = 'no-data'; @Output() action = new EventEmitter(); diff --git a/apps/red-ui/src/assets/i18n/de.json b/apps/red-ui/src/assets/i18n/de.json index daa4bdd5b..837a5d879 100644 --- a/apps/red-ui/src/assets/i18n/de.json +++ b/apps/red-ui/src/assets/i18n/de.json @@ -276,7 +276,9 @@ } }, "file-preview": { - "no-annotations-for-page": "Auf dieser Seite gibt es keine Redaktionen, Hinweise oder Anfragen.", + "no-data": { + "title": "Auf dieser Seite gibt es keine Redaktionen, Hinweise oder Anfragen." + }, "show-redacted-view": "Redigierte Vorschau anzeigen", "cannot-show-redacted-view": "Redaktionen nicht synchron. Die redigierte Vorschau ist nur nach einer erneuten Analyse verfügbar", "reanalyse-notification": "Dieses Dokument wurde nicht mit dem neuesten Regel- / Wörterbuchsatz verarbeitet. Analysieren Sie jetzt, um aktualisierte Anmerkungen zu erhalten.", diff --git a/apps/red-ui/src/assets/i18n/en.json b/apps/red-ui/src/assets/i18n/en.json index 88ded3be0..7d5246ba8 100644 --- a/apps/red-ui/src/assets/i18n/en.json +++ b/apps/red-ui/src/assets/i18n/en.json @@ -300,7 +300,9 @@ "standard-tooltip": "Standard Workload view shows all hints, redactions, recommendations & suggestions. This view allows editing.", "redacted-tooltip": "Redaction preview shows only redactions. Consider this a preview for the final redacted version. This view is only available if the file has no pending changes & doesn't require a reanalysis", "delta-tooltip": "Delta View shows only the changes since last re-analysis. This view is only available if there is at least 1 change", - "no-annotations-for-page": "There are no redactions, hints or requests on this page.", + "no-data": { + "title": "There are no annotations on this page." + }, "show-redacted-view": "Show Redacted Preview", "cannot-show-redacted-view": "Redactions out of sync. Redacted Preview only available after reanalysis", "reanalyse-notification": "This document was not processed with the latest rule/dictionary set. Analyze now to get updated annotations.", @@ -322,7 +324,9 @@ }, "annotations": { "label": "Workload", - "select": "Select" + "select": "Select", + "jump-to-previous": "Jump to Previous", + "jump-to-next": "Jump to Next" }, "is-excluded": "Redaction is disabled for this document." }, diff --git a/apps/red-ui/src/assets/icons/general/nav-next.svg b/apps/red-ui/src/assets/icons/general/nav-next.svg new file mode 100644 index 000000000..b9f52e81b --- /dev/null +++ b/apps/red-ui/src/assets/icons/general/nav-next.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/apps/red-ui/src/assets/icons/general/nav-prev.svg b/apps/red-ui/src/assets/icons/general/nav-prev.svg new file mode 100644 index 000000000..215a5305a --- /dev/null +++ b/apps/red-ui/src/assets/icons/general/nav-prev.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/apps/red-ui/src/assets/styles/red-button.scss b/apps/red-ui/src/assets/styles/red-button.scss index bae06f57f..cd54d294d 100644 --- a/apps/red-ui/src/assets/styles/red-button.scss +++ b/apps/red-ui/src/assets/styles/red-button.scss @@ -13,10 +13,15 @@ align-items: center; line-height: 34px; transition: opacity 0.2s; + width: 100%; > *:not(:last-child) { margin-right: 6px; } + + > span { + margin: auto; + } } &.mat-button-disabled { diff --git a/apps/red-ui/src/assets/styles/red-page-layout.scss b/apps/red-ui/src/assets/styles/red-page-layout.scss index db844d535..ce6b6c562 100644 --- a/apps/red-ui/src/assets/styles/red-page-layout.scss +++ b/apps/red-ui/src/assets/styles/red-page-layout.scss @@ -232,6 +232,10 @@ section.settings { margin-top: 20px; } +.mt-32 { + margin-top: 32px; +} + .pb-24 { padding-bottom: 24px; }