mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	Add failed tasks badge, better animation
This commit is contained in:
		| @@ -51,8 +51,8 @@ | |||||||
|  |  | ||||||
| <div class="container-fluid"> | <div class="container-fluid"> | ||||||
|   <div class="row"> |   <div class="row"> | ||||||
|     <nav id="sidebarMenu" class="d-md-block bg-light sidebar collapse" [ngClass]="slimSidebarEnabled ? 'slim' : 'col-md-3 col-lg-2'" [ngbCollapse]="isMenuCollapsed"> |     <nav id="sidebarMenu" class="d-md-block bg-light sidebar collapse" [ngClass]="slimSidebarEnabled ? 'slim' : 'col-md-3 col-lg-2'" [class.animating]="slimSidebarAnimating" [ngbCollapse]="isMenuCollapsed"> | ||||||
|       <button class="btn btn-sm btn-dark sidebar-slim-toggler" (click)="slimSidebarEnabled = !slimSidebarEnabled"> |       <button class="btn btn-sm btn-dark sidebar-slim-toggler" (click)="toggleSlimSidebar()"> | ||||||
|         <svg class="sidebaricon-sm" fill="currentColor"> |         <svg class="sidebaricon-sm" fill="currentColor"> | ||||||
|           <use *ngIf="slimSidebarEnabled" xlink:href="assets/bootstrap-icons.svg#chevron-double-right"/> |           <use *ngIf="slimSidebarEnabled" xlink:href="assets/bootstrap-icons.svg#chevron-double-right"/> | ||||||
|           <use *ngIf="!slimSidebarEnabled" xlink:href="assets/bootstrap-icons.svg#chevron-double-left"/> |           <use *ngIf="!slimSidebarEnabled" xlink:href="assets/bootstrap-icons.svg#chevron-double-left"/> | ||||||
| @@ -77,7 +77,7 @@ | |||||||
|         </ul> |         </ul> | ||||||
|  |  | ||||||
|         <h6 class="sidebar-heading px-3 mt-4 mb-1 text-muted" *ngIf='savedViewService.loading || savedViewService.sidebarViews.length > 0'> |         <h6 class="sidebar-heading px-3 mt-4 mb-1 text-muted" *ngIf='savedViewService.loading || savedViewService.sidebarViews.length > 0'> | ||||||
|           <span [class.visually-hidden]="slimSidebarEnabled" i18n>Saved views</span> |           <span i18n>Saved views</span> | ||||||
|           <div *ngIf="savedViewService.loading" class="spinner-border spinner-border-sm fw-normal ms-2" role="status"></div> |           <div *ngIf="savedViewService.loading" class="spinner-border spinner-border-sm fw-normal ms-2" role="status"></div> | ||||||
|         </h6> |         </h6> | ||||||
|         <ul class="nav flex-column mb-2"> |         <ul class="nav flex-column mb-2"> | ||||||
| @@ -91,7 +91,7 @@ | |||||||
|         </ul> |         </ul> | ||||||
|  |  | ||||||
|         <h6 class="sidebar-heading px-3 mt-4 mb-1 text-muted" *ngIf='openDocuments.length > 0'> |         <h6 class="sidebar-heading px-3 mt-4 mb-1 text-muted" *ngIf='openDocuments.length > 0'> | ||||||
|           <span [class.visually-hidden]="slimSidebarEnabled" i18n>Open documents</span> |           <span i18n>Open documents</span> | ||||||
|         </h6> |         </h6> | ||||||
|         <ul class="nav flex-column mb-2"> |         <ul class="nav flex-column mb-2"> | ||||||
|           <li class="nav-item w-100" *ngFor='let d of openDocuments'> |           <li class="nav-item w-100" *ngFor='let d of openDocuments'> | ||||||
| @@ -116,7 +116,7 @@ | |||||||
|         </ul> |         </ul> | ||||||
|  |  | ||||||
|         <h6 class="sidebar-heading px-3 mt-4 mb-1 text-muted"> |         <h6 class="sidebar-heading px-3 mt-4 mb-1 text-muted"> | ||||||
|           <span [class.visually-hidden]="slimSidebarEnabled" i18n>Manage</span> |           <span i18n>Manage</span> | ||||||
|         </h6> |         </h6> | ||||||
|         <ul class="nav flex-column mb-2"> |         <ul class="nav flex-column mb-2"> | ||||||
|           <li class="nav-item"> |           <li class="nav-item"> | ||||||
| @@ -149,6 +149,7 @@ | |||||||
|           </li> |           </li> | ||||||
|           <li class="nav-item"> |           <li class="nav-item"> | ||||||
|             <a class="nav-link" routerLink="tasks" routerLinkActive="active" (click)="closeMenu()" ngbPopover="File Tasks" i18n-ngbPopover [disablePopover]="!slimSidebarEnabled" placement="end" container="body" triggers="mouseenter:mouseleave" popoverClass="popover-slim"> |             <a class="nav-link" routerLink="tasks" routerLinkActive="active" (click)="closeMenu()" ngbPopover="File Tasks" i18n-ngbPopover [disablePopover]="!slimSidebarEnabled" placement="end" container="body" triggers="mouseenter:mouseleave" popoverClass="popover-slim"> | ||||||
|  |               <span *ngIf="tasksService.failedFileTasks.length > 0 && slimSidebarEnabled" class="badge bg-danger position-absolute top-0 end-0">{{tasksService.failedFileTasks.length}}</span> | ||||||
|               <svg class="sidebaricon" fill="currentColor"> |               <svg class="sidebaricon" fill="currentColor"> | ||||||
|                 <use xlink:href="assets/bootstrap-icons.svg#list-task"/> |                 <use xlink:href="assets/bootstrap-icons.svg#list-task"/> | ||||||
|               </svg><span> <ng-container i18n>File Tasks<span *ngIf="tasksService.failedFileTasks.length > 0"><span class="badge bg-danger ms-2">{{tasksService.failedFileTasks.length}}</span></span></ng-container></span> |               </svg><span> <ng-container i18n>File Tasks<span *ngIf="tasksService.failedFileTasks.length > 0"><span class="badge bg-danger ms-2">{{tasksService.failedFileTasks.length}}</span></span></ng-container></span> | ||||||
| @@ -178,7 +179,7 @@ | |||||||
|         </ul> |         </ul> | ||||||
|  |  | ||||||
|         <h6 class="sidebar-heading px-3 mt-auto pt-4 mb-1 text-muted"> |         <h6 class="sidebar-heading px-3 mt-auto pt-4 mb-1 text-muted"> | ||||||
|           <span [class.visually-hidden]="slimSidebarEnabled" i18n>Info</span> |           <span i18n>Info</span> | ||||||
|         </h6> |         </h6> | ||||||
|         <ul class="nav flex-column mb-2"> |         <ul class="nav flex-column mb-2"> | ||||||
|           <li class="nav-item"> |           <li class="nav-item"> | ||||||
|   | |||||||
| @@ -43,14 +43,62 @@ main { | |||||||
|   display: none; // hide on mobile |   display: none; // hide on mobile | ||||||
| } | } | ||||||
|  |  | ||||||
|  | .sidebar li.nav-item span, | ||||||
|  | .sidebar .sidebar-heading span { | ||||||
|  |   transition: all .1s ease; | ||||||
|  | } | ||||||
|  |  | ||||||
| @media(min-width: 768px) { | @media(min-width: 768px) { | ||||||
|   .sidebar.slim { |   .sidebar.slim { | ||||||
|     max-width: 50px; |     max-width: 50px; | ||||||
|     li.nav-item span { |  | ||||||
|  |     li.nav-item span.badge { | ||||||
|  |       display: inline-block; | ||||||
|  |       margin-right: 2px; | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   .sidebar.slim:not(.animating) { | ||||||
|  |     li.nav-item span, | ||||||
|  |     .sidebar-heading span { | ||||||
|       display: none; |       display: none; | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   .sidebar.animating { | ||||||
|  |     li.nav-item span, | ||||||
|  |     .sidebar-heading span { | ||||||
|  |       display: unset; | ||||||
|  |       position: absolute; | ||||||
|  |       opacity: 0; | ||||||
|  |       overflow: hidden; | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   .sidebar:not(.slim):not(.animating) { | ||||||
|  |     li.nav-item span, | ||||||
|  |     .sidebar-heading span { | ||||||
|  |       position: unset; | ||||||
|  |       opacity: 1; | ||||||
|  |       overflow: auto; | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   .sidebar.slim, | ||||||
|  |   .sidebar.animating { | ||||||
|  |     .text-truncate { | ||||||
|  |       text-overflow: unset !important; | ||||||
|  |       word-wrap: break-word !important; | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   .sidebar.slim { | ||||||
|  |     li.nav-item span.badge { | ||||||
|  |       display: inline-block; | ||||||
|  |       margin-right: 2px; | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|   .col-slim { |   .col-slim { | ||||||
|     padding-left: calc(50px + $grid-gutter-width) !important; |     padding-left: calc(50px + $grid-gutter-width) !important; | ||||||
|   } |   } | ||||||
|   | |||||||
| @@ -58,6 +58,16 @@ export class AppFrameComponent implements ComponentCanDeactivate { | |||||||
|  |  | ||||||
|   isMenuCollapsed: boolean = true |   isMenuCollapsed: boolean = true | ||||||
|  |  | ||||||
|  |   slimSidebarAnimating: boolean = false | ||||||
|  |  | ||||||
|  |   toggleSlimSidebar(): void { | ||||||
|  |     this.slimSidebarAnimating = true | ||||||
|  |     this.slimSidebarEnabled = !this.slimSidebarEnabled | ||||||
|  |     setTimeout(() => { | ||||||
|  |       this.slimSidebarAnimating = false | ||||||
|  |     }, 200) // slightly longer than css animation for slim sidebar | ||||||
|  |   } | ||||||
|  |  | ||||||
|   get slimSidebarEnabled(): boolean { |   get slimSidebarEnabled(): boolean { | ||||||
|     return this.settingsService.get(SETTINGS_KEYS.SLIM_SIDEBAR) |     return this.settingsService.get(SETTINGS_KEYS.SLIM_SIDEBAR) | ||||||
|   } |   } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Michael Shamoon
					Michael Shamoon