From 6497f33be4ecb9512ca7bf9ed10a7ff3a1f4059f Mon Sep 17 00:00:00 2001
From: Florent Poittevin <florent.poittevin@unige.ch>
Date: Fri, 4 Mar 2022 18:14:32 +0100
Subject: [PATCH 1/4] feat: [DLCM-708] diplay data citation on archive detail
 page

---
 src/app/enums/index.ts                        | 15 ++++
 .../home-archive-detail.presentational.html   | 25 ++++++
 .../home-archive-detail.presentational.scss   | 30 +++++++
 .../home-archive-detail.presentational.ts     | 11 ++-
 .../home-citations.presentational.html        | 40 +++++++++
 .../home-citations.presentational.scss        | 15 ++++
 .../home-citations.presentational.ts          | 89 +++++++++++++++++++
 .../home-archive-detail.routable.html         | 20 +++--
 .../home-archive-detail.routable.ts           |  9 +-
 src/app/features/home/home.module.ts          |  2 +
 src/app/features/home/stores/home.action.ts   | 41 +++++++++
 src/app/features/home/stores/home.state.ts    | 77 +++++++++++++++-
 src/app/models/index.ts                       |  8 ++
 src/app/shared/enums/api-action-name.enum.ts  |  2 +
 src/app/shared/enums/label-translate.enum.ts  |  9 +-
 src/assets/i18n/de.json                       |  9 +-
 src/assets/i18n/en.json                       |  9 +-
 src/assets/i18n/fr.json                       | 17 ++--
 18 files changed, 408 insertions(+), 20 deletions(-)
 create mode 100644 src/app/features/home/components/presentationals/home-citations/home-citations.presentational.html
 create mode 100644 src/app/features/home/components/presentationals/home-citations/home-citations.presentational.scss
 create mode 100644 src/app/features/home/components/presentationals/home-citations/home-citations.presentational.ts

diff --git a/src/app/enums/index.ts b/src/app/enums/index.ts
index 29e556686..1161dfe2e 100644
--- a/src/app/enums/index.ts
+++ b/src/app/enums/index.ts
@@ -41,6 +41,21 @@ import {DisseminationPolicy as DisseminationPolicyPartial} from "../generated-ap
 /* eslint-enable no-restricted-imports */
 
 export namespace Enums {
+  export namespace Archive {
+    export type OutputFormat =
+      "TEXT"
+      | "HTML"
+      | "ASCII_DOC"
+      | "FO"
+      | "RTF";
+    export const OutputFormat = {
+      TEXT: "TEXT",
+      HTML: "HTML",
+      ASCII_DOC: "ASCII_DOC",
+      FO: "FO",
+      RTF: "RTF",
+    };
+  }
   export namespace Facet {
     export type Name =
       "metadata-versions"
diff --git a/src/app/features/home/components/presentationals/home-archive-form/home-archive-detail.presentational.html b/src/app/features/home/components/presentationals/home-archive-form/home-archive-detail.presentational.html
index c63e6b115..f6e73f089 100644
--- a/src/app/features/home/components/presentationals/home-archive-form/home-archive-detail.presentational.html
+++ b/src/app/features/home/components/presentationals/home-archive-form/home-archive-detail.presentational.html
@@ -284,6 +284,31 @@
   </ul>
 </solidify-panel-expandable>
 
+<solidify-panel-expandable *ngIf="(listCitations | isNonEmptyArray) || (listBibliographies | isNonEmptyArray)"
+                           [isOpen]="false"
+                           [titleToTranslate]="labelTranslateEnum.citationsAndBibliographies | translate"
+                           class="panel-citations-bibliographies"
+>
+  <div *ngIf="(listCitations | isNonEmptyArray)"
+       class="citations-section"
+  >
+    <h2 class="title">{{labelTranslateEnum.citations | translate}}</h2>
+    <dlcm-home-citations [listCitations]="listCitations"
+                         class="citations"
+    ></dlcm-home-citations>
+  </div>
+
+  <div *ngIf="listBibliographies | isNonEmptyArray"
+       class="bibliographies-section"
+       [class.with-separator]="(listCitations | isNonEmptyArray)"
+  >
+    <h2 class="title">{{labelTranslateEnum.bibliographies | translate}}</h2>
+    <dlcm-home-citations [listCitations]="listBibliographies"
+                         class="citations"
+    ></dlcm-home-citations>
+  </div>
+</solidify-panel-expandable>
+
 <solidify-panel-expandable *ngIf="relativeArchive | isNonEmptyArray"
                            [isOpen]="true"
                            [titleToTranslate]="labelTranslateEnum.similarArchive | translate"
diff --git a/src/app/features/home/components/presentationals/home-archive-form/home-archive-detail.presentational.scss b/src/app/features/home/components/presentationals/home-archive-form/home-archive-detail.presentational.scss
index 5de47af17..6bbeb3878 100644
--- a/src/app/features/home/components/presentationals/home-archive-form/home-archive-detail.presentational.scss
+++ b/src/app/features/home/components/presentationals/home-archive-form/home-archive-detail.presentational.scss
@@ -177,6 +177,36 @@ $padding-bottom-desktop: 20px;
         display: flex;
       }
     }
+
+    .panel-citations-bibliographies {
+    }
+  }
+
+  .panel-citations-bibliographies {
+    ::ng-deep {
+      .content {
+        display: grid;
+        grid-template-columns: 1fr 1fr;
+        grid-gap: 20px;
+
+        @include respond-to-smaller-than-breakpoint('md') {
+          grid-template-columns: 1fr;
+        }
+
+        .title {
+          font-size: 18px;
+        }
+
+        .bibliographies-section {
+          &.with-separator {
+            @include respond-to-smaller-than-breakpoint('md') {
+              border-top: 1px solid $light-grey;
+              padding-top: 20px;
+            }
+          }
+        }
+      }
+    }
   }
 
   .pre {
diff --git a/src/app/features/home/components/presentationals/home-archive-form/home-archive-detail.presentational.ts b/src/app/features/home/components/presentationals/home-archive-form/home-archive-detail.presentational.ts
index d27b94d7f..697ca691c 100644
--- a/src/app/features/home/components/presentationals/home-archive-form/home-archive-detail.presentational.ts
+++ b/src/app/features/home/components/presentationals/home-archive-form/home-archive-detail.presentational.ts
@@ -41,7 +41,10 @@ import {
   ArchiveContributor,
 } from "@home/models/archive.model";
 import {ArchiveAccessRightService} from "@home/services/archive-access-right.service";
-import {ArchiveUserRating} from "@models";
+import {
+  ArchiveUserRating,
+  Citation,
+} from "@models";
 import {Navigate} from "@ngxs/router-plugin";
 import {GetShortDoiWrapper} from "@shared/components/presentationals/shared-doi-menu/shared-doi-menu.presentational";
 import {ApiEnum} from "@shared/enums/api.enum";
@@ -124,6 +127,12 @@ export class HomeArchiveDetailPresentational extends SharedAbstractPresentationa
   @Input()
   relativeArchive: Archive[];
 
+  @Input()
+  listCitations: Citation[];
+
+  @Input()
+  listBibliographies: Citation[];
+
   @Input()
   isLoadingPrepareDownload: boolean;
 
diff --git a/src/app/features/home/components/presentationals/home-citations/home-citations.presentational.html b/src/app/features/home/components/presentationals/home-citations/home-citations.presentational.html
new file mode 100644
index 000000000..282f42ea8
--- /dev/null
+++ b/src/app/features/home/components/presentationals/home-citations/home-citations.presentational.html
@@ -0,0 +1,40 @@
+<mat-form-field [appearance]="appearanceInputMaterial"
+                solidifyTooltipOnEllipsis
+                class="selector"
+>
+  <mat-label>{{labelTranslateEnum.citationStyles | translate }}</mat-label>
+  <mat-select [solidifyValidation]="errors"
+              [formControl]="formControl"
+  >
+    <mat-option *ngFor="let citation of listCitations"
+                [value]="citation"
+    >
+      {{citation.style}} - {{citation.outputFormat}} [{{citation.language}}]
+    </mat-option>
+  </mat-select>
+  <mat-error #errors
+             solidifyTooltipOnEllipsis
+  ></mat-error>
+</mat-form-field>
+
+<div *ngIf="selectedCitation | isNotNullNorUndefined"
+     class="selected-citation"
+>
+  <span class="text">{{selectedCitation.text}}</span>
+  <button (click)="copyToClipboard()"
+          (onEnter)="copyToClipboard()"
+          [matTooltipPosition]="'above'"
+          [matTooltip]="labelTranslateEnum.copyToClipboard | translate"
+          class="copy-button"
+          mat-icon-button
+          solidifyShortCuts
+  >
+    <solidify-icon [iconName]="iconNameEnum.copyToClipboard"></solidify-icon>
+  </button>
+</div>
+
+<div *ngIf="listCitations | isNullOrUndefinedOrEmptyArray"
+     class="no-citation-available"
+>
+  {{labelTranslateEnum.noCitationsAreAvailable | translate}}
+</div>
diff --git a/src/app/features/home/components/presentationals/home-citations/home-citations.presentational.scss b/src/app/features/home/components/presentationals/home-citations/home-citations.presentational.scss
new file mode 100644
index 000000000..08d2bd8c3
--- /dev/null
+++ b/src/app/features/home/components/presentationals/home-citations/home-citations.presentational.scss
@@ -0,0 +1,15 @@
+@import "abstracts/abstracts";
+
+:host {
+  .selector {
+    width: 100%;
+  }
+
+  .selected-citation {
+    display: grid;
+    grid-template-columns: 1fr max-content;
+    grid-gap: 10px;
+    align-items: center;
+    justify-content: space-between;
+  }
+}
diff --git a/src/app/features/home/components/presentationals/home-citations/home-citations.presentational.ts b/src/app/features/home/components/presentationals/home-citations/home-citations.presentational.ts
new file mode 100644
index 000000000..76963084b
--- /dev/null
+++ b/src/app/features/home/components/presentationals/home-citations/home-citations.presentational.ts
@@ -0,0 +1,89 @@
+/*-
+ * %%----------------------------------------------------------------------------------------------
+ * DLCM Technology - DLCM Portal - home-citations.presentational.ts
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * %----------------------------------------------------------------------------------------------%
+ * Copyright (C) 2017 - 2022 University of Geneva
+ * %----------------------------------------------------------------------------------------------%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program.  If not, see
+ * <http://www.gnu.org/licenses/gpl-2.0.html>.
+ * ----------------------------------------------------------------------------------------------%%
+ */
+
+import {
+  ChangeDetectionStrategy,
+  Component,
+  Input,
+  OnInit,
+} from "@angular/core";
+import {FormControl} from "@angular/forms";
+import {Citation} from "@models";
+import {SharedAbstractPresentational} from "@shared/components/presentationals/shared-abstract/shared-abstract.presentational";
+import {LabelTranslateEnum} from "@shared/enums/label-translate.enum";
+import {tap} from "rxjs/operators";
+import {
+  ClipboardUtil,
+  isNonEmptyArray,
+  NotificationService,
+} from "solidify-frontend";
+
+@Component({
+  selector: "dlcm-home-citations",
+  templateUrl: "./home-citations.presentational.html",
+  styleUrls: ["./home-citations.presentational.scss"],
+  changeDetection: ChangeDetectionStrategy.OnPush,
+})
+export class HomeCitationsPresentational extends SharedAbstractPresentational implements OnInit {
+  formControl = new FormControl();
+
+  private _listCitations: Citation[];
+
+  selectedCitation: Citation = undefined;
+
+  @Input()
+  set listCitations(value: Citation[]) {
+    this._listCitations = value;
+
+    if (isNonEmptyArray(this.listCitations)) {
+      this.selectedCitation = this.listCitations[0];
+    } else {
+      this.selectedCitation = undefined;
+    }
+    this.formControl.setValue(this.selectedCitation);
+  }
+
+  get listCitations(): Citation[] {
+    return this._listCitations;
+  }
+
+  constructor(private readonly _notificationService: NotificationService) {
+    super();
+  }
+
+  ngOnInit(): void {
+    super.ngOnInit();
+
+    this.subscribe(this.formControl.valueChanges.pipe(
+      tap(value => {
+        this.selectedCitation = value;
+      }),
+    ));
+  }
+
+  copyToClipboard(): void {
+    if (ClipboardUtil.copyStringToClipboard(this.selectedCitation.text)) {
+      this._notificationService.showInformation(LabelTranslateEnum.notificationCopiedToClipboard);
+    }
+  }
+}
diff --git a/src/app/features/home/components/routables/home-archive-detail/home-archive-detail.routable.html b/src/app/features/home/components/routables/home-archive-detail/home-archive-detail.routable.html
index fb10cf8f8..51d08e702 100644
--- a/src/app/features/home/components/routables/home-archive-detail/home-archive-detail.routable.html
+++ b/src/app/features/home/components/routables/home-archive-detail/home-archive-detail.routable.html
@@ -24,23 +24,25 @@
     <div [solidifySpinner]="(isLoadingObs | async)"
          class="wrapper"
     >
-      <dlcm-home-archive-detail (addToCartChange)="addToCart($event)"
-                                (askAccessChange)="askAccess($event)"
-                                (downloadChange)="download($event)"
-                                (getShortDoi)="getShortDoi($event)"
-                                (navigateChange)="navigate($event)"
-                                (navigateToOrcid)="navigateToOrcid($event)"
-                                (rateChange)="updateRate($event)"
-                                (showArchiveChange)="showArchive($event)"
-                                *ngIf="(currentObs | async) | isNotNullNorUndefined"
+      <dlcm-home-archive-detail *ngIf="(currentObs | async) | isNotNullNorUndefined"
                                 [archivePackages]="packageObs | async"
                                 [archiveStatistics]="archiveStatisticDtoObs | async"
                                 [archive]="currentObs | async"
+                                [listCitations]="citationsObs | async"
+                                [listBibliographies]="bibliographiesObs | async"
                                 [isLoadingPrepareDownload]="isLoadingPrepareDownloadObs | async"
                                 [isLoggedIn]="isLoggedInObs | async"
                                 [listArchiveUserRating]="listArchiveRatingObs | async"
                                 [relativeArchive]="listArchiveFromOrgUnitObs | async"
                                 [isLoadingArchiveRating]="isLoadingArchiveRatingObs | async"
+                                (addToCartChange)="addToCart($event)"
+                                (askAccessChange)="askAccess($event)"
+                                (downloadChange)="download($event)"
+                                (getShortDoi)="getShortDoi($event)"
+                                (navigateChange)="navigate($event)"
+                                (navigateToOrcid)="navigateToOrcid($event)"
+                                (rateChange)="updateRate($event)"
+                                (showArchiveChange)="showArchive($event)"
       ></dlcm-home-archive-detail>
     </div>
   </solidify-empty-container>
diff --git a/src/app/features/home/components/routables/home-archive-detail/home-archive-detail.routable.ts b/src/app/features/home/components/routables/home-archive-detail/home-archive-detail.routable.ts
index e099c72cc..8687353ae 100644
--- a/src/app/features/home/components/routables/home-archive-detail/home-archive-detail.routable.ts
+++ b/src/app/features/home/components/routables/home-archive-detail/home-archive-detail.routable.ts
@@ -49,7 +49,10 @@ import {HomeArchivePackageAction} from "@home/stores/archive/package/home-archiv
 import {HomeArchivePackageState} from "@home/stores/archive/package/home-archive-package.state";
 import {HomeArchiveRatingAction} from "@home/stores/archive/rating/home-archive-rating.action";
 import {HomeArchiveRatingState} from "@home/stores/archive/rating/home-archive-rating.state";
-import {ArchiveUserRating} from "@models";
+import {
+  ArchiveUserRating,
+  Citation,
+} from "@models";
 import {Navigate} from "@ngxs/router-plugin";
 import {
   Actions,
@@ -92,6 +95,8 @@ export class HomeArchiveDetailRoutable extends SharedAbstractPresentational impl
   isLoadingPrepareDownloadObs: Observable<boolean>;
   isLoadingObs: Observable<boolean> = MemoizedUtil.isLoading(this._store, HomeState);
   currentObs: Observable<Archive> = MemoizedUtil.select(this._store, HomeState, state => state.current);
+  citationsObs: Observable<Citation[]> = MemoizedUtil.select(this._store, HomeState, state => state.citations);
+  bibliographiesObs: Observable<Citation[]> = MemoizedUtil.select(this._store, HomeState, state => state.bibliographies);
   archiveStatisticDtoObs: Observable<ArchiveStatisticsDto> = MemoizedUtil.select(this._store, HomeState, state => state.archiveStatisticDto);
   isLoggedInObs: Observable<boolean> = MemoizedUtil.select(this._store, AppState, state => state.isLoggedIn);
   isLoadingPackageObs: Observable<boolean> = MemoizedUtil.isLoading(this._store, HomeArchivePackageState);
@@ -174,6 +179,8 @@ export class HomeArchiveDetailRoutable extends SharedAbstractPresentational impl
   private _getById(id: string): void {
     const archive = MemoizedUtil.selectSnapshot(this._store, HomeState, state => state.current);
     this._store.dispatch(new HomeAction.GetStatistics(id));
+    this._store.dispatch(new HomeAction.GetBibliographies(id));
+    this._store.dispatch(new HomeAction.GetCitations(id));
     if (this._archiveAccessRightService.isDownloadAuthorized(archive)) {
       this._store.dispatch(new HomeArchivePackageAction.GetById(this._resId));
     }
diff --git a/src/app/features/home/home.module.ts b/src/app/features/home/home.module.ts
index 3c13af35e..aeefb624b 100644
--- a/src/app/features/home/home.module.ts
+++ b/src/app/features/home/home.module.ts
@@ -35,6 +35,7 @@ import {HomeSearchHelpDialog} from "@home/components/dialogs/home-search-help/ho
 import {HomeArchiveDetailPresentational} from "@home/components/presentationals/home-archive-form/home-archive-detail.presentational";
 import {HomeArchiveRatingPresentational} from "@home/components/presentationals/home-archive-rating/home-archive-rating.presentational";
 import {HomeCarouselPresentational} from "@home/components/presentationals/home-carousel/home-carousel.presentational";
+import {HomeCitationsPresentational} from "@home/components/presentationals/home-citations/home-citations.presentational";
 import {HomeMainButtonPresentational} from "@home/components/presentationals/home-main-button/home-main-button.presentational";
 import {HomeMainPageContentPresentational} from "@home/components/presentationals/home-main-page-content/home-main-page-content.presentational";
 import {HomePartnerImagePresentational} from "@home/components/presentationals/home-partner-image/home-partner-image.presentational";
@@ -83,6 +84,7 @@ const presentationals = [
   HomeMainButtonPresentational,
   HomeSearchFacetPresentational,
   HomeArchiveRatingPresentational,
+  HomeCitationsPresentational,
 ];
 const services = [
   TwitterService,
diff --git a/src/app/features/home/stores/home.action.ts b/src/app/features/home/stores/home.action.ts
index a290d7f82..74b56f755 100644
--- a/src/app/features/home/stores/home.action.ts
+++ b/src/app/features/home/stores/home.action.ts
@@ -23,6 +23,7 @@
 
 import {ArchiveStatisticsDto} from "@home/models/archive-statistics-dto.model";
 import {Archive} from "@home/models/archive.model";
+import {Citation} from "@models";
 import {StateEnum} from "@shared/enums/state.enum";
 import {ViewModeTableEnum} from "@shared/enums/view-mode-table.enum";
 import {
@@ -149,6 +150,46 @@ export namespace HomeAction {
     static readonly type: string = `[${state}] Get Statistics Fail`;
   }
 
+  export class GetBibliographies extends BaseAction {
+    static readonly type: string = `[${state}] Get Bibliographies`;
+
+    constructor(public archiveId: string) {
+      super();
+    }
+  }
+
+  export class GetBibliographiesSuccess extends BaseSubActionSuccess<GetBibliographies> {
+    static readonly type: string = `[${state}] Get Bibliographies Success`;
+
+    constructor(public parentAction: GetBibliographies, public bibliographies: Citation[]) {
+      super(parentAction);
+    }
+  }
+
+  export class GetBibliographiesFail extends BaseSubActionFail<GetBibliographies> {
+    static readonly type: string = `[${state}] Get Bibliographies Fail`;
+  }
+
+  export class GetCitations extends BaseAction {
+    static readonly type: string = `[${state}] Get Citations`;
+
+    constructor(public archiveId: string) {
+      super();
+    }
+  }
+
+  export class GetCitationsSuccess extends BaseSubActionSuccess<GetCitations> {
+    static readonly type: string = `[${state}] Get Citations Success`;
+
+    constructor(public parentAction: GetCitations, public citations: Citation[]) {
+      super(parentAction);
+    }
+  }
+
+  export class GetCitationsFail extends BaseSubActionFail<GetCitations> {
+    static readonly type: string = `[${state}] Get Citations Fail`;
+  }
+
   export class GoToOrcid extends BaseAction {
     static readonly type: string = `[${state}] Go To Orcid`;
 
diff --git a/src/app/features/home/stores/home.state.ts b/src/app/features/home/stores/home.state.ts
index 88f2566df..b2ac6f0f5 100644
--- a/src/app/features/home/stores/home.state.ts
+++ b/src/app/features/home/stores/home.state.ts
@@ -41,7 +41,10 @@ import {HomeArchivePackageAction} from "@home/stores/archive/package/home-archiv
 import {HomeArchivePackageState} from "@home/stores/archive/package/home-archive-package.state";
 import {HomeArchiveRatingAction} from "@home/stores/archive/rating/home-archive-rating.action";
 import {HomeArchiveRatingState} from "@home/stores/archive/rating/home-archive-rating.state";
-import {Metadata} from "@models";
+import {
+  Citation,
+  Metadata,
+} from "@models";
 import {
   Action,
   Actions,
@@ -91,6 +94,8 @@ export interface HomeStateModel extends ResourceStateModel<Archive> {
   listRelativeArchive: Archive[];
   facetsSelected: MappingObject<string[]>;
   archiveStatisticDto: ArchiveStatisticsDto;
+  bibliographies: Citation[];
+  citations: Citation[];
 }
 
 @Injectable()
@@ -105,6 +110,8 @@ export interface HomeStateModel extends ResourceStateModel<Archive> {
     facets: undefined,
     facetsSelected: {},
     archiveStatisticDto: undefined,
+    bibliographies: [],
+    citations: [],
   },
   children: [
     HomeArchiveDataFileState,
@@ -374,6 +381,74 @@ export class HomeState extends BasicState<HomeStateModel> {
     });
   }
 
+  @Action(HomeAction.GetBibliographies)
+  getBibliographies(ctx: StateContext<HomeStateModel>, action: HomeAction.GetBibliographies): Observable<Citation[]> {
+    ctx.patchState({
+      isLoadingCounter: ctx.getState().isLoadingCounter + 1,
+      archiveStatisticDto: undefined,
+    });
+
+    return this._apiService.getByIdInPath<Citation[]>(`${this._urlResource}/${action.archiveId}/${ApiActionNameEnum.BIBLIOGRAPHIES}`)
+      .pipe(
+        tap((model: Citation[]) => {
+          ctx.dispatch(new HomeAction.GetBibliographiesSuccess(action, model));
+        }),
+        catchError((error: SolidifyHttpErrorResponseModel) => {
+          ctx.dispatch(new HomeAction.GetBibliographiesFail(action));
+          throw new SolidifyStateError(this, error);
+        }),
+      );
+  }
+
+  @Action(HomeAction.GetBibliographiesSuccess)
+  getBibliographiesSuccess(ctx: StateContext<HomeStateModel>, action: HomeAction.GetBibliographiesSuccess): void {
+    ctx.patchState({
+      isLoadingCounter: ctx.getState().isLoadingCounter - 1,
+      bibliographies: action.bibliographies,
+    });
+  }
+
+  @Action(HomeAction.GetBibliographiesFail)
+  getBibliographiesFail(ctx: StateContext<HomeStateModel>, action: HomeAction.GetBibliographiesFail): void {
+    ctx.patchState({
+      isLoadingCounter: ctx.getState().isLoadingCounter - 1,
+    });
+  }
+
+  @Action(HomeAction.GetCitations)
+  getCitations(ctx: StateContext<HomeStateModel>, action: HomeAction.GetCitations): Observable<Citation[]> {
+    ctx.patchState({
+      isLoadingCounter: ctx.getState().isLoadingCounter + 1,
+      archiveStatisticDto: undefined,
+    });
+
+    return this._apiService.getByIdInPath<Citation[]>(`${this._urlResource}/${action.archiveId}/${ApiActionNameEnum.CITATIONS}`)
+      .pipe(
+        tap((model: Citation[]) => {
+          ctx.dispatch(new HomeAction.GetCitationsSuccess(action, model));
+        }),
+        catchError((error: SolidifyHttpErrorResponseModel) => {
+          ctx.dispatch(new HomeAction.GetCitationsFail(action));
+          throw new SolidifyStateError(this, error);
+        }),
+      );
+  }
+
+  @Action(HomeAction.GetCitationsSuccess)
+  getCitationsSuccess(ctx: StateContext<HomeStateModel>, action: HomeAction.GetCitationsSuccess): void {
+    ctx.patchState({
+      isLoadingCounter: ctx.getState().isLoadingCounter - 1,
+      citations: action.citations,
+    });
+  }
+
+  @Action(HomeAction.GetCitationsFail)
+  getCitationsFail(ctx: StateContext<HomeStateModel>, action: HomeAction.GetCitationsFail): void {
+    ctx.patchState({
+      isLoadingCounter: ctx.getState().isLoadingCounter - 1,
+    });
+  }
+
   @Action(HomeAction.GoToOrcid)
   goToOrcid(ctx: StateContext<AppStateModel>, action: HomeAction.GoToOrcid): void {
     window.open(environment.orcidUrl + urlSeparator + action.orcid, "_blank");
diff --git a/src/app/models/index.ts b/src/app/models/index.ts
index ff04c2d00..19ff0fa57 100644
--- a/src/app/models/index.ts
+++ b/src/app/models/index.ts
@@ -77,6 +77,7 @@ import {SubmissionAgreement as SubmissionAgreementPartial} from "../generated-ap
 import {SubmissionPolicy as SubmissionPolicyPartial} from "../generated-api/model/submission-policy.partial.model";
 import {SystemProperty as SystemPropertyPartial} from "../generated-api/model/system-property.partial.model";
 import {User as UserPartial} from "../generated-api/model/user.partial.model";
+import OutputFormat = Enums.Archive.OutputFormat;
 import RatingTypeEnum = Enums.Archive.RatingTypeEnum;
 
 /* eslint-enable no-restricted-imports */
@@ -165,6 +166,13 @@ export interface Checksum {
   creationTime?: string;
 }
 
+export interface Citation {
+  language: string;
+  text: string;
+  style: string;
+  outputFormat: OutputFormat;
+}
+
 export interface Collection extends CollectionPartial {
 }
 
diff --git a/src/app/shared/enums/api-action-name.enum.ts b/src/app/shared/enums/api-action-name.enum.ts
index 5ef868c37..c882ff130 100644
--- a/src/app/shared/enums/api-action-name.enum.ts
+++ b/src/app/shared/enums/api-action-name.enum.ts
@@ -145,6 +145,8 @@ export enum ApiActionNameExtendEnum {
   RATING = "ratings",
   RATING_BY_USER = "list-for-user",
   BY_RATING = "by-rating",
+  BIBLIOGRAPHIES = "bibliographies",
+  CITATIONS = "citations",
   GET_MY_ACLS = "get-my-acls",
   LIST_REFERENCE_TYPES = "list-reference-types",
 }
diff --git a/src/app/shared/enums/label-translate.enum.ts b/src/app/shared/enums/label-translate.enum.ts
index 12a51ba8c..40f55ec56 100644
--- a/src/app/shared/enums/label-translate.enum.ts
+++ b/src/app/shared/enums/label-translate.enum.ts
@@ -387,6 +387,11 @@ export class LabelTranslateEnum {
   static tilesView: string = MARK_AS_TRANSLATABLE("general.label.tilesView");
   static metadataDatacite: string = MARK_AS_TRANSLATABLE("general.label.metadataDatacite");
   static similarArchive: string = MARK_AS_TRANSLATABLE("general.label.similarArchive");
+  static citationsAndBibliographies: string = MARK_AS_TRANSLATABLE("general.label.citationsAndBibliographies");
+  static citations: string = MARK_AS_TRANSLATABLE("general.label.citations");
+  static citation: string = MARK_AS_TRANSLATABLE("general.label.citation");
+  static bibliographies: string = MARK_AS_TRANSLATABLE("general.label.bibliographies");
+  static bibliographie: string = MARK_AS_TRANSLATABLE("general.label.bibliographie");
   static uploadLogo: string = MARK_AS_TRANSLATABLE("general.label.uploadLogo");
   static youAreInEditMode: string = MARK_AS_TRANSLATABLE("general.label.inEditMode");
   static additionalInformation: string = MARK_AS_TRANSLATABLE("general.label.additionalInformation");
@@ -464,6 +469,8 @@ export class LabelTranslateEnum {
   static masterType: string = MARK_AS_TRANSLATABLE("general.label.masterType");
   static isMasterType: string = MARK_AS_TRANSLATABLE("general.label.isMasterType");
   static showOnlyMastersTypes: string = MARK_AS_TRANSLATABLE("general.label.showOnlyMastersTypes");
+  static noCitationsAreAvailable: string = MARK_AS_TRANSLATABLE("general.label.noCitationsAreAvailable");
+  static citationStyles: string = MARK_AS_TRANSLATABLE("general.label.citationStyles");
   static archivesSelected: string = MARK_AS_TRANSLATABLE("general.label.archivesSelected");
   static noSelection: string = MARK_AS_TRANSLATABLE("general.label.noSelection");
 
@@ -500,7 +507,7 @@ export class LabelTranslateEnum {
   static notificationHttpOffline: string = MARK_AS_TRANSLATABLE("general.notification.httpOffline");
   static notificationHttpUnauthorized: string = MARK_AS_TRANSLATABLE("general.notification.httpUnauthorized");
   static notificationIdCopyToClipboard: string = MARK_AS_TRANSLATABLE("general.notification.idCopyToClipboard");
-  static notificationCopyToClipboard: string = MARK_AS_TRANSLATABLE("general.notification.copyToClipboard");
+  static notificationCopiedToClipboard: string = MARK_AS_TRANSLATABLE("general.notification.copiedToClipboard");
   static notificationUploadInProgress: string = MARK_AS_TRANSLATABLE("general.notification.upload.inProgress");
   static notificationUploadCancelled: string = MARK_AS_TRANSLATABLE("general.notification.upload.cancelled");
   static notificationUploadSuccess: string = MARK_AS_TRANSLATABLE("general.notification.upload.success");
diff --git a/src/assets/i18n/de.json b/src/assets/i18n/de.json
index 2c3ce55cb..85d5571e5 100644
--- a/src/assets/i18n/de.json
+++ b/src/assets/i18n/de.json
@@ -1250,6 +1250,8 @@
       "associatedOrganizationalUnit": "Zugehörige Organisationseinheit",
       "associatedPeople": "Assoziierte Personen",
       "avatar": "Avatar",
+      "bibliographie": "general.label.bibliographie",
+      "bibliographies": "general.label.bibliographies",
       "browsing": "Browsing",
       "calculating": "general.label.calculating",
       "cannotPreviewWhileMovingTheFile": "Vorschau während des Verschiebens der Datei nicht möglich",
@@ -1260,6 +1262,10 @@
       "checksumComputing": "Prüfsummenberechnung",
       "checksums": "Prüfsummen",
       "checksumsComputedByThePortal": "general.label.checksumsComputedByThePortal",
+      "citation": "general.label.citation",
+      "citationStyles": "general.label.citationStyles",
+      "citations": "general.label.citations",
+      "citationsAndBibliographies": "general.label.citationsAndBibliographies",
       "clearFilters": "Filter löschen",
       "clickHereToAddAContributor": "Klicken Sie hier, um einen Beitragenden hinzuzufügen",
       "clickHereToAddAPolicy": "Klicken Sie hier, um eine Richtlinie hinzuzufügen",
@@ -1420,6 +1426,7 @@
       "myOrders": "Öffentlichkeit Downloads",
       "name": "Name",
       "newSubDirectory": "Neues Unterverzeichnis",
+      "noCitationsAreAvailable": "general.label.noCitationsAreAvailable",
       "noFiltering": "Keine Filterung",
       "noSelection": "general.label.noSelection",
       "notification": "Benachrichtigung",
@@ -1579,7 +1586,7 @@
       "placeholder": "Klicken Sie hier, um einen Wert hinzuzufügen"
     },
     "notification": {
-      "copyToClipboard": "In die Zwischenablage kopiert",
+      "copiedToClipboard": "general.notification.copiedToClipboard",
       "evaluationTakenIntoAccount": "Auswertung berücksichtigt",
       "fileDownloadFail": "Fehler beim Herunterladen",
       "fileDownloadForbidden": "Es ist nicht erlaubt, diese Datei herunterzuladen",
diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json
index 5aaf09d61..b6a6a25ec 100644
--- a/src/assets/i18n/en.json
+++ b/src/assets/i18n/en.json
@@ -1250,6 +1250,8 @@
       "associatedOrganizationalUnit": "Associated organizational unit",
       "associatedPeople": "Associated people",
       "avatar": "Avatar",
+      "bibliographie": "Bibliography",
+      "bibliographies": "Bibliographies",
       "browsing": "Browsing",
       "calculating": "Calculating",
       "cannotPreviewWhileMovingTheFile": "Cannot preview while moving the file",
@@ -1260,6 +1262,10 @@
       "checksumComputing": "Checksum computing",
       "checksums": "Checksums",
       "checksumsComputedByThePortal": "Checksums computed by the portal",
+      "citation": "citation",
+      "citationStyles": "Citation styles",
+      "citations": "Citations",
+      "citationsAndBibliographies": "Citations and Bibliographies",
       "clearFilters": "Clear filters",
       "clickHereToAddAContributor": "Click here to add a contributor",
       "clickHereToAddAPolicy": "Click here to add a policy",
@@ -1420,6 +1426,7 @@
       "myOrders": "Public download orders",
       "name": "Name",
       "newSubDirectory": "New sub directory",
+      "noCitationsAreAvailable": "No citations are available",
       "noFiltering": "No filtering",
       "noSelection": "No selection",
       "notification": "Notification",
@@ -1579,7 +1586,7 @@
       "placeholder": "Click here to add a value"
     },
     "notification": {
-      "copyToClipboard": "Copied to clipboard",
+      "copiedToClipboard": "Copied to clipboard",
       "evaluationTakenIntoAccount": "Evaluation taken into account",
       "fileDownloadFail": "Error while downloading",
       "fileDownloadForbidden": "You do not have the right to download this file",
diff --git a/src/assets/i18n/fr.json b/src/assets/i18n/fr.json
index caa5f1388..fa292a0a8 100644
--- a/src/assets/i18n/fr.json
+++ b/src/assets/i18n/fr.json
@@ -1114,7 +1114,7 @@
       "close": "Fermer",
       "completionStatus": "État d'avancement",
       "confirm": "Confirmer",
-      "copyIdToClipboard": "Copier l'identifiant dans le presse-papiers",
+      "copyIdToClipboard": "Copier l'identifiant dans le presse-papier",
       "create": "Créer",
       "createDeposit": "Créer un nouveau dépôt",
       "darkMode": "Mode sombre",
@@ -1250,6 +1250,8 @@
       "associatedOrganizationalUnit": "Unité organisationnelle associée",
       "associatedPeople": "Personnes associées",
       "avatar": "Avatar",
+      "bibliographie": "Bibliographie",
+      "bibliographies": "Bibliographies",
       "browsing": "En naviguant sur",
       "calculating": "Calcul",
       "cannotPreviewWhileMovingTheFile": "Prévisualisation impossible pendant le déplacement du fichier",
@@ -1260,6 +1262,10 @@
       "checksumComputing": "Calcul des checksums",
       "checksums": "Checksums",
       "checksumsComputedByThePortal": "Checksums calculés par le portail",
+      "citation": "Citation",
+      "citationStyles": "Styles de citation",
+      "citations": "Citations",
+      "citationsAndBibliographies": "Citations et Bibliographies",
       "clearFilters": "Effacer les filtres",
       "clickHereToAddAContributor": "Cliquez ici pour ajouter un-e contributeur-trice",
       "clickHereToAddAPolicy": "Cliquez ici pour ajouter une politique",
@@ -1279,7 +1285,7 @@
       "container": "Conteneur",
       "contributor": "Contributeur-trice",
       "contributors": "Contributeurs-trices",
-      "copyToClipboard": "Copie dans le presse-papiers",
+      "copyToClipboard": "Copier dans le presse-papier",
       "createNewPerson": "Créer une nouvelle personne",
       "created": "Créé",
       "createdBy": "Créé par",
@@ -1420,6 +1426,7 @@
       "myOrders": "Téléchargements publiques",
       "name": "Nom",
       "newSubDirectory": "Nouveau sous-répertoire",
+      "noCitationsAreAvailable": "Aucunes citations ne sont disponibles",
       "noFiltering": "Pas de filtrage",
       "noSelection": "Aucune sélection",
       "notification": "Notification",
@@ -1575,11 +1582,11 @@
     "multiSelect": {
       "defaultValue": "Valeur par défaut",
       "noDataToSelect": "Il n'y a pas de données à séléctionner",
-      "notificationExtraInfoCopyToClipboard": "Valeur copié dans le presse-papiers",
+      "notificationExtraInfoCopyToClipboard": "Valeur copié dans le presse-papier",
       "placeholder": "Cliquer ici pour ajouter une valeur"
     },
     "notification": {
-      "copyToClipboard": "Copié dans le presse-papiers",
+      "copiedToClipboard": "Copié dans le presse-papier",
       "evaluationTakenIntoAccount": "Évaluation prise en compte",
       "fileDownloadFail": "Erreur lors du téléchargement",
       "fileDownloadForbidden": "Vous n'avez pas le droit de télécharger ce fichier",
@@ -1591,7 +1598,7 @@
       "httpNotFound": "La ressource demandée est introuvable",
       "httpOffline": "Vous êtes actuellement hors ligne",
       "httpUnauthorized": "La ressource demandée est non autorisée",
-      "idCopyToClipboard": "Identifiant copié dans le presse-papiers",
+      "idCopyToClipboard": "Identifiant copié dans le presse-papier",
       "objectCreated": "Objet créé",
       "objectDeleted": "Objet supprimé",
       "objectUpdated": "Objet mis à jour",
-- 
GitLab


From 79faf609d54d91bfa75aff98d2b1eb179954a65b Mon Sep 17 00:00:00 2001
From: Florent Poittevin <florent.poittevin@unige.ch>
Date: Mon, 7 Mar 2022 09:47:10 +0100
Subject: [PATCH 2/4] fix: style

---
 .../home-archive-detail.presentational.scss          | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/app/features/home/components/presentationals/home-archive-form/home-archive-detail.presentational.scss b/src/app/features/home/components/presentationals/home-archive-form/home-archive-detail.presentational.scss
index 6bbeb3878..22206b906 100644
--- a/src/app/features/home/components/presentationals/home-archive-form/home-archive-detail.presentational.scss
+++ b/src/app/features/home/components/presentationals/home-archive-form/home-archive-detail.presentational.scss
@@ -200,7 +200,7 @@ $padding-bottom-desktop: 20px;
         .bibliographies-section {
           &.with-separator {
             @include respond-to-smaller-than-breakpoint('md') {
-              border-top: 1px solid $light-grey;
+              border-top: 1px solid $intermediate-grey;
               padding-top: 20px;
             }
           }
@@ -290,5 +290,15 @@ $padding-bottom-desktop: 20px;
     border-color: $dark-mode-line;
     background-color: #0d1117;
   }
+
+  .panel-citations-bibliographies {
+    ::ng-deep {
+      .content {
+        .bibliographies-section {
+          border-color: $dark-mode-line;
+        }
+      }
+    }
+  }
 }
 
-- 
GitLab


From c358dc66f458af5894aed2a123da218d2628bdb2 Mon Sep 17 00:00:00 2001
From: Florent Poittevin <florent.poittevin@unige.ch>
Date: Mon, 7 Mar 2022 11:35:40 +0100
Subject: [PATCH 3/4] fix: move citation component to solidify

---
 src/app/enums/index.ts                        | 15 ----
 .../home-archive-detail.presentational.html   | 12 +--
 .../home-archive-detail.presentational.ts     |  6 +-
 .../home-citations.presentational.html        | 40 ---------
 .../home-citations.presentational.scss        | 15 ----
 .../home-citations.presentational.ts          | 89 -------------------
 .../home-archive-detail.routable.ts           |  6 +-
 src/app/features/home/home.module.ts          |  2 -
 src/app/features/home/stores/home.action.ts   |  2 +-
 src/app/features/home/stores/home.state.ts    |  6 +-
 src/app/label-translate-solidify.ts           |  4 +
 src/app/models/index.ts                       |  8 --
 12 files changed, 17 insertions(+), 188 deletions(-)
 delete mode 100644 src/app/features/home/components/presentationals/home-citations/home-citations.presentational.html
 delete mode 100644 src/app/features/home/components/presentationals/home-citations/home-citations.presentational.scss
 delete mode 100644 src/app/features/home/components/presentationals/home-citations/home-citations.presentational.ts

diff --git a/src/app/enums/index.ts b/src/app/enums/index.ts
index 1161dfe2e..29e556686 100644
--- a/src/app/enums/index.ts
+++ b/src/app/enums/index.ts
@@ -41,21 +41,6 @@ import {DisseminationPolicy as DisseminationPolicyPartial} from "../generated-ap
 /* eslint-enable no-restricted-imports */
 
 export namespace Enums {
-  export namespace Archive {
-    export type OutputFormat =
-      "TEXT"
-      | "HTML"
-      | "ASCII_DOC"
-      | "FO"
-      | "RTF";
-    export const OutputFormat = {
-      TEXT: "TEXT",
-      HTML: "HTML",
-      ASCII_DOC: "ASCII_DOC",
-      FO: "FO",
-      RTF: "RTF",
-    };
-  }
   export namespace Facet {
     export type Name =
       "metadata-versions"
diff --git a/src/app/features/home/components/presentationals/home-archive-form/home-archive-detail.presentational.html b/src/app/features/home/components/presentationals/home-archive-form/home-archive-detail.presentational.html
index f6e73f089..3d5bc4639 100644
--- a/src/app/features/home/components/presentationals/home-archive-form/home-archive-detail.presentational.html
+++ b/src/app/features/home/components/presentationals/home-archive-form/home-archive-detail.presentational.html
@@ -293,9 +293,9 @@
        class="citations-section"
   >
     <h2 class="title">{{labelTranslateEnum.citations | translate}}</h2>
-    <dlcm-home-citations [listCitations]="listCitations"
-                         class="citations"
-    ></dlcm-home-citations>
+    <solidify-citations [listCitations]="listCitations"
+                        class="citations"
+    ></solidify-citations>
   </div>
 
   <div *ngIf="listBibliographies | isNonEmptyArray"
@@ -303,9 +303,9 @@
        [class.with-separator]="(listCitations | isNonEmptyArray)"
   >
     <h2 class="title">{{labelTranslateEnum.bibliographies | translate}}</h2>
-    <dlcm-home-citations [listCitations]="listBibliographies"
-                         class="citations"
-    ></dlcm-home-citations>
+    <solidify-citations [listCitations]="listBibliographies"
+                        class="citations"
+    ></solidify-citations>
   </div>
 </solidify-panel-expandable>
 
diff --git a/src/app/features/home/components/presentationals/home-archive-form/home-archive-detail.presentational.ts b/src/app/features/home/components/presentationals/home-archive-form/home-archive-detail.presentational.ts
index 697ca691c..9b90a5343 100644
--- a/src/app/features/home/components/presentationals/home-archive-form/home-archive-detail.presentational.ts
+++ b/src/app/features/home/components/presentationals/home-archive-form/home-archive-detail.presentational.ts
@@ -41,10 +41,7 @@ import {
   ArchiveContributor,
 } from "@home/models/archive.model";
 import {ArchiveAccessRightService} from "@home/services/archive-access-right.service";
-import {
-  ArchiveUserRating,
-  Citation,
-} from "@models";
+import {ArchiveUserRating} from "@models";
 import {Navigate} from "@ngxs/router-plugin";
 import {GetShortDoiWrapper} from "@shared/components/presentationals/shared-doi-menu/shared-doi-menu.presentational";
 import {ApiEnum} from "@shared/enums/api.enum";
@@ -65,6 +62,7 @@ import {
   Observable,
 } from "rxjs";
 import {
+  Citation,
   ClipboardUtil,
   DateUtil,
   EnumUtil,
diff --git a/src/app/features/home/components/presentationals/home-citations/home-citations.presentational.html b/src/app/features/home/components/presentationals/home-citations/home-citations.presentational.html
deleted file mode 100644
index 282f42ea8..000000000
--- a/src/app/features/home/components/presentationals/home-citations/home-citations.presentational.html
+++ /dev/null
@@ -1,40 +0,0 @@
-<mat-form-field [appearance]="appearanceInputMaterial"
-                solidifyTooltipOnEllipsis
-                class="selector"
->
-  <mat-label>{{labelTranslateEnum.citationStyles | translate }}</mat-label>
-  <mat-select [solidifyValidation]="errors"
-              [formControl]="formControl"
-  >
-    <mat-option *ngFor="let citation of listCitations"
-                [value]="citation"
-    >
-      {{citation.style}} - {{citation.outputFormat}} [{{citation.language}}]
-    </mat-option>
-  </mat-select>
-  <mat-error #errors
-             solidifyTooltipOnEllipsis
-  ></mat-error>
-</mat-form-field>
-
-<div *ngIf="selectedCitation | isNotNullNorUndefined"
-     class="selected-citation"
->
-  <span class="text">{{selectedCitation.text}}</span>
-  <button (click)="copyToClipboard()"
-          (onEnter)="copyToClipboard()"
-          [matTooltipPosition]="'above'"
-          [matTooltip]="labelTranslateEnum.copyToClipboard | translate"
-          class="copy-button"
-          mat-icon-button
-          solidifyShortCuts
-  >
-    <solidify-icon [iconName]="iconNameEnum.copyToClipboard"></solidify-icon>
-  </button>
-</div>
-
-<div *ngIf="listCitations | isNullOrUndefinedOrEmptyArray"
-     class="no-citation-available"
->
-  {{labelTranslateEnum.noCitationsAreAvailable | translate}}
-</div>
diff --git a/src/app/features/home/components/presentationals/home-citations/home-citations.presentational.scss b/src/app/features/home/components/presentationals/home-citations/home-citations.presentational.scss
deleted file mode 100644
index 08d2bd8c3..000000000
--- a/src/app/features/home/components/presentationals/home-citations/home-citations.presentational.scss
+++ /dev/null
@@ -1,15 +0,0 @@
-@import "abstracts/abstracts";
-
-:host {
-  .selector {
-    width: 100%;
-  }
-
-  .selected-citation {
-    display: grid;
-    grid-template-columns: 1fr max-content;
-    grid-gap: 10px;
-    align-items: center;
-    justify-content: space-between;
-  }
-}
diff --git a/src/app/features/home/components/presentationals/home-citations/home-citations.presentational.ts b/src/app/features/home/components/presentationals/home-citations/home-citations.presentational.ts
deleted file mode 100644
index 76963084b..000000000
--- a/src/app/features/home/components/presentationals/home-citations/home-citations.presentational.ts
+++ /dev/null
@@ -1,89 +0,0 @@
-/*-
- * %%----------------------------------------------------------------------------------------------
- * DLCM Technology - DLCM Portal - home-citations.presentational.ts
- * SPDX-License-Identifier: GPL-2.0-or-later
- * %----------------------------------------------------------------------------------------------%
- * Copyright (C) 2017 - 2022 University of Geneva
- * %----------------------------------------------------------------------------------------------%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program.  If not, see
- * <http://www.gnu.org/licenses/gpl-2.0.html>.
- * ----------------------------------------------------------------------------------------------%%
- */
-
-import {
-  ChangeDetectionStrategy,
-  Component,
-  Input,
-  OnInit,
-} from "@angular/core";
-import {FormControl} from "@angular/forms";
-import {Citation} from "@models";
-import {SharedAbstractPresentational} from "@shared/components/presentationals/shared-abstract/shared-abstract.presentational";
-import {LabelTranslateEnum} from "@shared/enums/label-translate.enum";
-import {tap} from "rxjs/operators";
-import {
-  ClipboardUtil,
-  isNonEmptyArray,
-  NotificationService,
-} from "solidify-frontend";
-
-@Component({
-  selector: "dlcm-home-citations",
-  templateUrl: "./home-citations.presentational.html",
-  styleUrls: ["./home-citations.presentational.scss"],
-  changeDetection: ChangeDetectionStrategy.OnPush,
-})
-export class HomeCitationsPresentational extends SharedAbstractPresentational implements OnInit {
-  formControl = new FormControl();
-
-  private _listCitations: Citation[];
-
-  selectedCitation: Citation = undefined;
-
-  @Input()
-  set listCitations(value: Citation[]) {
-    this._listCitations = value;
-
-    if (isNonEmptyArray(this.listCitations)) {
-      this.selectedCitation = this.listCitations[0];
-    } else {
-      this.selectedCitation = undefined;
-    }
-    this.formControl.setValue(this.selectedCitation);
-  }
-
-  get listCitations(): Citation[] {
-    return this._listCitations;
-  }
-
-  constructor(private readonly _notificationService: NotificationService) {
-    super();
-  }
-
-  ngOnInit(): void {
-    super.ngOnInit();
-
-    this.subscribe(this.formControl.valueChanges.pipe(
-      tap(value => {
-        this.selectedCitation = value;
-      }),
-    ));
-  }
-
-  copyToClipboard(): void {
-    if (ClipboardUtil.copyStringToClipboard(this.selectedCitation.text)) {
-      this._notificationService.showInformation(LabelTranslateEnum.notificationCopiedToClipboard);
-    }
-  }
-}
diff --git a/src/app/features/home/components/routables/home-archive-detail/home-archive-detail.routable.ts b/src/app/features/home/components/routables/home-archive-detail/home-archive-detail.routable.ts
index 8687353ae..db5af560e 100644
--- a/src/app/features/home/components/routables/home-archive-detail/home-archive-detail.routable.ts
+++ b/src/app/features/home/components/routables/home-archive-detail/home-archive-detail.routable.ts
@@ -49,10 +49,7 @@ import {HomeArchivePackageAction} from "@home/stores/archive/package/home-archiv
 import {HomeArchivePackageState} from "@home/stores/archive/package/home-archive-package.state";
 import {HomeArchiveRatingAction} from "@home/stores/archive/rating/home-archive-rating.action";
 import {HomeArchiveRatingState} from "@home/stores/archive/rating/home-archive-rating.state";
-import {
-  ArchiveUserRating,
-  Citation,
-} from "@models";
+import {ArchiveUserRating} from "@models";
 import {Navigate} from "@ngxs/router-plugin";
 import {
   Actions,
@@ -76,6 +73,7 @@ import {
   tap,
 } from "rxjs/operators";
 import {
+  Citation,
   isNotNullNorUndefined,
   isNotNullNorUndefinedNorWhiteString,
   MappingObject,
diff --git a/src/app/features/home/home.module.ts b/src/app/features/home/home.module.ts
index aeefb624b..3c13af35e 100644
--- a/src/app/features/home/home.module.ts
+++ b/src/app/features/home/home.module.ts
@@ -35,7 +35,6 @@ import {HomeSearchHelpDialog} from "@home/components/dialogs/home-search-help/ho
 import {HomeArchiveDetailPresentational} from "@home/components/presentationals/home-archive-form/home-archive-detail.presentational";
 import {HomeArchiveRatingPresentational} from "@home/components/presentationals/home-archive-rating/home-archive-rating.presentational";
 import {HomeCarouselPresentational} from "@home/components/presentationals/home-carousel/home-carousel.presentational";
-import {HomeCitationsPresentational} from "@home/components/presentationals/home-citations/home-citations.presentational";
 import {HomeMainButtonPresentational} from "@home/components/presentationals/home-main-button/home-main-button.presentational";
 import {HomeMainPageContentPresentational} from "@home/components/presentationals/home-main-page-content/home-main-page-content.presentational";
 import {HomePartnerImagePresentational} from "@home/components/presentationals/home-partner-image/home-partner-image.presentational";
@@ -84,7 +83,6 @@ const presentationals = [
   HomeMainButtonPresentational,
   HomeSearchFacetPresentational,
   HomeArchiveRatingPresentational,
-  HomeCitationsPresentational,
 ];
 const services = [
   TwitterService,
diff --git a/src/app/features/home/stores/home.action.ts b/src/app/features/home/stores/home.action.ts
index 74b56f755..9afdbe77a 100644
--- a/src/app/features/home/stores/home.action.ts
+++ b/src/app/features/home/stores/home.action.ts
@@ -23,7 +23,6 @@
 
 import {ArchiveStatisticsDto} from "@home/models/archive-statistics-dto.model";
 import {Archive} from "@home/models/archive.model";
-import {Citation} from "@models";
 import {StateEnum} from "@shared/enums/state.enum";
 import {ViewModeTableEnum} from "@shared/enums/view-mode-table.enum";
 import {
@@ -31,6 +30,7 @@ import {
   BaseSubAction,
   BaseSubActionFail,
   BaseSubActionSuccess,
+  Citation,
   CollectionTyped,
   MappingObject,
   QueryParameters,
diff --git a/src/app/features/home/stores/home.state.ts b/src/app/features/home/stores/home.state.ts
index b2ac6f0f5..325b3a326 100644
--- a/src/app/features/home/stores/home.state.ts
+++ b/src/app/features/home/stores/home.state.ts
@@ -41,10 +41,7 @@ import {HomeArchivePackageAction} from "@home/stores/archive/package/home-archiv
 import {HomeArchivePackageState} from "@home/stores/archive/package/home-archive-package.state";
 import {HomeArchiveRatingAction} from "@home/stores/archive/rating/home-archive-rating.action";
 import {HomeArchiveRatingState} from "@home/stores/archive/rating/home-archive-rating.state";
-import {
-  Citation,
-  Metadata,
-} from "@models";
+import {Metadata} from "@models";
 import {
   Action,
   Actions,
@@ -66,6 +63,7 @@ import {
 import {
   ApiService,
   BasicState,
+  Citation,
   CollectionTyped,
   defaultResourceStateInitValue,
   Facet,
diff --git a/src/app/label-translate-solidify.ts b/src/app/label-translate-solidify.ts
index 9229d8bed..b3fd98c5e 100644
--- a/src/app/label-translate-solidify.ts
+++ b/src/app/label-translate-solidify.ts
@@ -109,6 +109,7 @@ export const labelTranslateSolidify: LabelTranslateInterface = {
   notificationHttpOfflineToTranslate: LabelTranslateEnum.notificationHttpOffline,
   notificationHttpUnauthorizedToTranslate: LabelTranslateEnum.notificationHttpUnauthorized,
   notificationIdCopyToClipboard: LabelTranslateEnum.notificationIdCopyToClipboard,
+  notificationCopiedToClipboard: LabelTranslateEnum.notificationCopiedToClipboard,
   objectNotFound: LabelTranslateEnum.objectNotFound,
   refresh: LabelTranslateEnum.refresh,
   search: LabelTranslateEnum.search,
@@ -175,4 +176,7 @@ export const labelTranslateSolidify: LabelTranslateInterface = {
   notificationUnableToCopyCookieNameToClipboard: MARK_AS_TRANSLATABLE("cookieConsentSidebar.notification.unableToCopyCookieNameToClipboard"),
   notificationFeatureDisabledBecauseCookieDeclined: MARK_AS_TRANSLATABLE("cookieConsentSidebar.notification.featureDisabledBecauseCookieDeclined"),
   notificationCookieXEnabled: MARK_AS_TRANSLATABLE("cookieConsentSidebar.notification.notificationCookieXEnabled"),
+  citationStyles: LabelTranslateEnum.citationStyles,
+  citationCopyToClipboard: LabelTranslateEnum.copyToClipboard,
+  noCitationsAreAvailable: LabelTranslateEnum.noCitationsAreAvailable,
 };
diff --git a/src/app/models/index.ts b/src/app/models/index.ts
index 19ff0fa57..ff04c2d00 100644
--- a/src/app/models/index.ts
+++ b/src/app/models/index.ts
@@ -77,7 +77,6 @@ import {SubmissionAgreement as SubmissionAgreementPartial} from "../generated-ap
 import {SubmissionPolicy as SubmissionPolicyPartial} from "../generated-api/model/submission-policy.partial.model";
 import {SystemProperty as SystemPropertyPartial} from "../generated-api/model/system-property.partial.model";
 import {User as UserPartial} from "../generated-api/model/user.partial.model";
-import OutputFormat = Enums.Archive.OutputFormat;
 import RatingTypeEnum = Enums.Archive.RatingTypeEnum;
 
 /* eslint-enable no-restricted-imports */
@@ -166,13 +165,6 @@ export interface Checksum {
   creationTime?: string;
 }
 
-export interface Citation {
-  language: string;
-  text: string;
-  style: string;
-  outputFormat: OutputFormat;
-}
-
 export interface Collection extends CollectionPartial {
 }
 
-- 
GitLab


From 93d8c09c0f298cc8b95db1089ec26b30d15c18c5 Mon Sep 17 00:00:00 2001
From: Florent Poittevin <florent.poittevin@unige.ch>
Date: Mon, 7 Mar 2022 12:00:41 +0100
Subject: [PATCH 4/4] fix: add translate for theme selector

---
 src/app/label-translate-solidify.ts | 1 +
 src/assets/i18n/de.json             | 1 +
 src/assets/i18n/en.json             | 1 +
 src/assets/i18n/fr.json             | 1 +
 4 files changed, 4 insertions(+)

diff --git a/src/app/label-translate-solidify.ts b/src/app/label-translate-solidify.ts
index b3fd98c5e..2259765ab 100644
--- a/src/app/label-translate-solidify.ts
+++ b/src/app/label-translate-solidify.ts
@@ -179,4 +179,5 @@ export const labelTranslateSolidify: LabelTranslateInterface = {
   citationStyles: LabelTranslateEnum.citationStyles,
   citationCopyToClipboard: LabelTranslateEnum.copyToClipboard,
   noCitationsAreAvailable: LabelTranslateEnum.noCitationsAreAvailable,
+  themeSelector: MARK_AS_TRANSLATABLE("app.themeSelector"),
 };
diff --git a/src/assets/i18n/de.json b/src/assets/i18n/de.json
index 85d5571e5..e53e20947 100644
--- a/src/assets/i18n/de.json
+++ b/src/assets/i18n/de.json
@@ -543,6 +543,7 @@
       "newVersionAvailable": "Eine neue Version der Anwendung ist verfügbar",
       "offline": "Sie sind derzeit offline"
     },
+    "themeSelector": "app.themeSelector",
     "updateVersion": {
       "body": "Möchten Sie die Anwendung auf die neueste Version aktualisieren? Die aktuelle Seite wird aktualisiert.",
       "button": {
diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json
index b6a6a25ec..9991cd8d4 100644
--- a/src/assets/i18n/en.json
+++ b/src/assets/i18n/en.json
@@ -543,6 +543,7 @@
       "newVersionAvailable": "A new version of the application is available",
       "offline": "Your are currently offline"
     },
+    "themeSelector": "Theme selector",
     "updateVersion": {
       "body": "Do you want to update the application to the latest version. The current page will be refreshed.",
       "button": {
diff --git a/src/assets/i18n/fr.json b/src/assets/i18n/fr.json
index fa292a0a8..0c2ab9132 100644
--- a/src/assets/i18n/fr.json
+++ b/src/assets/i18n/fr.json
@@ -543,6 +543,7 @@
       "newVersionAvailable": "Une nouvelle version de l'application est disponible",
       "offline": "Vous êtes actuellement hors ligne"
     },
+    "themeSelector": "Sélecteur de thème",
     "updateVersion": {
       "body": "Voulez-vous mettre à jour l'application à la dernière version. La page courante sera rafraîchie.",
       "button": {
-- 
GitLab