diff --git a/apps/red-ui/src/app/app-routing.module.ts b/apps/red-ui/src/app/app-routing.module.ts
index ed3ddb7b1..8bf52eec7 100644
--- a/apps/red-ui/src/app/app-routing.module.ts
+++ b/apps/red-ui/src/app/app-routing.module.ts
@@ -15,7 +15,7 @@ import { DOSSIERS_ARCHIVE } from '@utils/constants';
const routes: Routes = [
{
path: '',
- redirectTo: 'main/dossiers',
+ redirectTo: 'main/dashboard',
pathMatch: 'full',
},
{
@@ -33,6 +33,16 @@ const routes: Routes = [
component: BaseScreenComponent,
loadChildren: () => import('./modules/admin/admin.module').then(m => m.AdminModule),
},
+ {
+ path: 'main/dashboard',
+ component: BaseScreenComponent,
+ loadChildren: () => import('./modules/dashboard/dashboard.module').then(m => m.DashboardModule),
+ canActivate: [CompositeRouteGuard],
+ data: {
+ routeGuards: [AuthGuard, RedRoleGuard],
+ requiredRoles: ['RED_USER', 'RED_MANAGER'],
+ },
+ },
{
path: 'main/dossiers',
component: BaseScreenComponent,
diff --git a/apps/red-ui/src/app/modules/admin/base-admin-screen/base-admin-screen.component.scss b/apps/red-ui/src/app/modules/admin/base-admin-screen/base-admin-screen.component.scss
index e7a72018d..333a85d49 100644
--- a/apps/red-ui/src/app/modules/admin/base-admin-screen/base-admin-screen.component.scss
+++ b/apps/red-ui/src/app/modules/admin/base-admin-screen/base-admin-screen.component.scss
@@ -1,3 +1,3 @@
:host {
- display: flex;
+ flex-direction: row;
}
diff --git a/apps/red-ui/src/app/modules/dashboard/components/template-stats/template-stats.component.html b/apps/red-ui/src/app/modules/dashboard/components/template-stats/template-stats.component.html
new file mode 100644
index 000000000..33cf9e9b8
--- /dev/null
+++ b/apps/red-ui/src/app/modules/dashboard/components/template-stats/template-stats.component.html
@@ -0,0 +1,12 @@
+
diff --git a/apps/red-ui/src/app/modules/dashboard/components/template-stats/template-stats.component.scss b/apps/red-ui/src/app/modules/dashboard/components/template-stats/template-stats.component.scss
new file mode 100644
index 000000000..9bbc901f0
--- /dev/null
+++ b/apps/red-ui/src/app/modules/dashboard/components/template-stats/template-stats.component.scss
@@ -0,0 +1,23 @@
+.dialog {
+ flex-direction: row;
+ max-width: unset;
+
+ > div {
+ padding: 24px;
+ display: flex;
+ flex-direction: column;
+ flex: 1;
+
+ &:not(:first-child) {
+ align-items: center;
+ justify-content: center;
+ border-left: 1px solid var(--iqser-separator);
+ }
+
+ &.empty {
+ flex-direction: row;
+ justify-content: space-between;
+ align-items: center;
+ }
+ }
+}
diff --git a/apps/red-ui/src/app/modules/dashboard/components/template-stats/template-stats.component.ts b/apps/red-ui/src/app/modules/dashboard/components/template-stats/template-stats.component.ts
new file mode 100644
index 000000000..2d3e17e7b
--- /dev/null
+++ b/apps/red-ui/src/app/modules/dashboard/components/template-stats/template-stats.component.ts
@@ -0,0 +1,34 @@
+import { ChangeDetectionStrategy, Component, Input, OnChanges } from '@angular/core';
+import { DossierTemplatesService } from '../../../../services/entity-services/dossier-templates.service';
+import { DossierTemplate, DossierTemplateStats } from '@red/domain';
+import { BehaviorSubject, Observable } from 'rxjs';
+import { switchMap } from 'rxjs/operators';
+import { DossierTemplateStatsService } from '@services/entity-services/dossier-template-stats.service';
+
+@Component({
+ selector: 'redaction-template-stats [dossierTemplateId]',
+ templateUrl: './template-stats.component.html',
+ styleUrls: ['./template-stats.component.scss'],
+ changeDetection: ChangeDetectionStrategy.OnPush,
+})
+export class TemplateStatsComponent implements OnChanges {
+ @Input() dossierTemplateId: string;
+
+ readonly dossierTemplate$: Observable;
+ readonly stats$: Observable;
+ readonly #ngOnChanges$ = new BehaviorSubject(undefined);
+
+ constructor(
+ private readonly _dossierTemplatesService: DossierTemplatesService,
+ private readonly _dossierTemplateStatsService: DossierTemplateStatsService,
+ ) {
+ this.dossierTemplate$ = this.#ngOnChanges$.pipe(switchMap(id => this._dossierTemplatesService.getEntityChanged$(id)));
+ this.stats$ = this.#ngOnChanges$.pipe(switchMap(id => this._dossierTemplateStatsService.watch$(id)));
+ }
+
+ ngOnChanges() {
+ if (this.dossierTemplateId) {
+ this.#ngOnChanges$.next(this.dossierTemplateId);
+ }
+ }
+}
diff --git a/apps/red-ui/src/app/modules/dashboard/dashboard-screen/dashboard-screen.component.html b/apps/red-ui/src/app/modules/dashboard/dashboard-screen/dashboard-screen.component.html
new file mode 100644
index 000000000..47dc25cce
--- /dev/null
+++ b/apps/red-ui/src/app/modules/dashboard/dashboard-screen/dashboard-screen.component.html
@@ -0,0 +1,12 @@
+
+
+
diff --git a/apps/red-ui/src/app/modules/dashboard/dashboard-screen/dashboard-screen.component.scss b/apps/red-ui/src/app/modules/dashboard/dashboard-screen/dashboard-screen.component.scss
new file mode 100644
index 000000000..f646df137
--- /dev/null
+++ b/apps/red-ui/src/app/modules/dashboard/dashboard-screen/dashboard-screen.component.scss
@@ -0,0 +1,11 @@
+:host {
+ align-items: center;
+ background-color: var(--iqser-grey-2);
+
+ .container {
+ padding: 32px;
+ width: 900px;
+ max-width: 100%;
+ box-sizing: border-box;
+ }
+}
diff --git a/apps/red-ui/src/app/modules/dashboard/dashboard-screen/dashboard-screen.component.ts b/apps/red-ui/src/app/modules/dashboard/dashboard-screen/dashboard-screen.component.ts
new file mode 100644
index 000000000..09bac094f
--- /dev/null
+++ b/apps/red-ui/src/app/modules/dashboard/dashboard-screen/dashboard-screen.component.ts
@@ -0,0 +1,15 @@
+import { ChangeDetectionStrategy, Component } from '@angular/core';
+import { UserService } from '../../../services/user.service';
+import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
+
+@Component({
+ selector: 'redaction-dashboard-screen',
+ templateUrl: './dashboard-screen.component.html',
+ styleUrls: ['./dashboard-screen.component.scss'],
+ changeDetection: ChangeDetectionStrategy.OnPush,
+})
+export class DashboardScreenComponent {
+ readonly currentUser = this._userService.currentUser;
+
+ constructor(private readonly _userService: UserService, readonly dossierTemplatesService: DossierTemplatesService) {}
+}
diff --git a/apps/red-ui/src/app/modules/dashboard/dashboard.module.ts b/apps/red-ui/src/app/modules/dashboard/dashboard.module.ts
new file mode 100644
index 000000000..c53f748e8
--- /dev/null
+++ b/apps/red-ui/src/app/modules/dashboard/dashboard.module.ts
@@ -0,0 +1,23 @@
+import { NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { DashboardScreenComponent } from './dashboard-screen/dashboard-screen.component';
+import { RouterModule } from '@angular/router';
+import { SharedModule } from '../shared/shared.module';
+import { TemplateStatsComponent } from './components/template-stats/template-stats.component';
+import { DossierTemplatesGuard } from '../../guards/dossier-templates.guard';
+import { CompositeRouteGuard } from '@iqser/common-ui';
+
+const routes = [
+ {
+ path: '',
+ component: DashboardScreenComponent,
+ canActivate: [CompositeRouteGuard],
+ data: { routeGuards: [DossierTemplatesGuard] },
+ },
+];
+
+@NgModule({
+ declarations: [DashboardScreenComponent, TemplateStatsComponent],
+ imports: [RouterModule.forChild(routes), CommonModule, SharedModule],
+})
+export class DashboardModule {}
diff --git a/apps/red-ui/src/assets/i18n/en.json b/apps/red-ui/src/assets/i18n/en.json
index ff5d19017..0cad1169f 100644
--- a/apps/red-ui/src/assets/i18n/en.json
+++ b/apps/red-ui/src/assets/i18n/en.json
@@ -8,6 +8,12 @@
"all": "All",
"none": "None"
},
+ "dashboard": {
+ "greeting": {
+ "title": "Welcome, {name}!",
+ "subtitle": "Here's what's happening in your redaction teams today."
+ }
+ },
"add-dossier-dialog": {
"actions": {
"save": "Save",
diff --git a/libs/common-ui b/libs/common-ui
index fd9d62241..3684acc2c 160000
--- a/libs/common-ui
+++ b/libs/common-ui
@@ -1 +1 @@
-Subproject commit fd9d622413547de842439e8d91ee4316f2facff1
+Subproject commit 3684acc2c99fafc88351af188745c10065c16cdb