Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

[#61126] Remove unneeded HoverCardComponent modal component (TS)

Tobias Dillmann832b5b15a46e
diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.ts
index c3db5148528..c42c3a74cdb 100644
--- a/frontend/src/app/app.module.ts
+++ b/frontend/src/app/app.module.ts
@@ -76,7 +76,6 @@ import { DynamicContentModalComponent } from 'core-app/shared/components/modals/
import {
PasswordConfirmationModalComponent,
} from 'core-app/shared/components/modals/request-for-confirmation/password-confirmation.modal';
-import { HoverCardComponent } from 'core-app/shared/components/modals/preview-modal/hover-card-modal/hover-card.modal';
import {
OpHeaderProjectSelectComponent,
} from 'core-app/shared/components/header-project-select/header-project-select.component';
@@ -381,7 +380,6 @@ export function initializeServices(injector:Injector) {
ConfirmDialogModalComponent,
DynamicContentModalComponent,
PasswordConfirmationModalComponent,
- HoverCardComponent,
// Main menu
MainMenuResizerComponent,
diff --git a/frontend/src/app/shared/components/modals/preview-modal/hover-card-modal/hover-card.modal.html b/frontend/src/app/shared/components/modals/preview-modal/hover-card-modal/hover-card.modal.html
deleted file mode 100644
index 21552890a44..00000000000
--- a/frontend/src/app/shared/components/modals/preview-modal/hover-card-modal/hover-card.modal.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<div
- class="op-hover-card"
- *ngIf="turboFrameSrc"
->
- <turbo-frame
- #turboFrame
- loading="lazy"
- id="op-hover-card-body"
- [src]="turboFrameSrc">
- </turbo-frame>
-</div>
diff --git a/frontend/src/app/shared/components/modals/preview-modal/hover-card-modal/hover-card.modal.sass b/frontend/src/app/shared/components/modals/preview-modal/hover-card-modal/hover-card.modal.sass
deleted file mode 100644
index 0e008140173..00000000000
--- a/frontend/src/app/shared/components/modals/preview-modal/hover-card-modal/hover-card.modal.sass
+++ /dev/null
@@ -1,18 +0,0 @@
-@import "helpers"
-
-@keyframes fade-in-hover-card
- from
- opacity: 0
- to
- opacity: 1
-
-.op-hover-card
- animation: fade-in-hover-card .25s ease-in
- position: absolute
- background-color: var(--body-background)
- z-index: 5000
- width: 500px
- box-shadow: var(--shadow-floating-medium)
- pointer-events: all
- padding: var(--overlay-paddingBlock-normal)
- border-radius: var(--overlay-borderRadius)
diff --git a/frontend/src/app/shared/components/modals/preview-modal/hover-card-modal/hover-card.modal.ts b/frontend/src/app/shared/components/modals/preview-modal/hover-card-modal/hover-card.modal.ts
deleted file mode 100644
index 619d9a7cbfa..00000000000
--- a/frontend/src/app/shared/components/modals/preview-modal/hover-card-modal/hover-card.modal.ts
+++ /dev/null
@@ -1,124 +0,0 @@
-//-- copyright
-// OpenProject is an open source project management software.
-// Copyright (C) the OpenProject GmbH
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License version 3.
-//
-// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
-// Copyright (C) 2006-2013 Jean-Philippe Lang
-// Copyright (C) 2010-2013 the ChiliProject Team
-//
-// 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, write to the Free Software
-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-// See COPYRIGHT and LICENSE files for more details.
-//++
-
-import {
- ChangeDetectionStrategy,
- ChangeDetectorRef,
- Component,
- ElementRef,
- Inject,
- Input,
- OnInit,
- ViewChild,
-} from '@angular/core';
-import { OpModalComponent } from 'core-app/shared/components/modal/modal.component';
-import { OpModalLocalsToken } from 'core-app/shared/components/modal/modal.service';
-import { OpModalLocalsMap } from 'core-app/shared/components/modal/modal.types';
-import {
- computePosition,
- flip,
- limitShift,
- Placement,
- shift,
-} from '@floating-ui/dom';
-import { WorkPackageIsolatedQuerySpaceDirective } from 'core-app/features/work-packages/directives/query-space/wp-isolated-query-space.directive';
-
-@Component({
- templateUrl: './hover-card.modal.html',
- styleUrls: ['./hover-card.modal.sass'],
- changeDetection: ChangeDetectionStrategy.OnPush,
- hostDirectives: [WorkPackageIsolatedQuerySpaceDirective],
-})
-export class HoverCardComponent extends OpModalComponent implements OnInit {
- @ViewChild('turboFrame')
- set turboFrame(frame:ElementRef<HTMLIFrameElement>|undefined) {
- if (frame !== undefined) {
- // When a new turbo frame is set, hide the modal until the frame is loaded.
- // Since the size of the new content is unknown in advance, showing a loading indicator within the hover card
- // leads to a bumpy result once the actual content is inserted and the card extends its dimensions.
- this.setOpacity(this.elementRef, 0);
-
- frame.nativeElement?.addEventListener('turbo:frame-load', () => {
- const modal = this.elementRef.nativeElement as HTMLElement;
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-explicit-any
- void this.reposition(modal, this.locals.event.target as HTMLElement);
-
- // Content has been loaded, card has been positioned. Show it!
- this.setOpacity(this.elementRef, 1);
- });
- }
- }
-
- turboFrameSrc:string;
-
- @Input() public alignment?:Placement = 'bottom-end';
-
- @Input() public allowRepositioning? = true;
-
- constructor(
- readonly elementRef:ElementRef,
- @Inject(OpModalLocalsToken) readonly locals:OpModalLocalsMap,
- readonly cdRef:ChangeDetectorRef,
- ) {
- super(locals, cdRef, elementRef);
- }
-
- ngOnInit() {
- super.ngOnInit();
- this.turboFrameSrc = this.locals.turboFrameSrc as string;
- }
-
- public async reposition(element:HTMLElement, target:HTMLElement) {
- const floatingEl = element.children[0] as HTMLElement;
- const { x, y } = await computePosition(
- target,
- floatingEl,
- {
- placement: this.alignment,
- middleware: this.allowRepositioning ? [
- flip({
- mainAxis: true,
- crossAxis: true,
- fallbackAxisSideDirection: 'start',
- }),
- shift({ limiter: limitShift() }),
- ] : [],
- },
- );
- Object.assign(floatingEl.style, {
- left: `${x}px`,
- top: `${y}px`,
- });
- }
-
- private setOpacity(elementRef:ElementRef, opacity:number) {
- const element = elementRef.nativeElement as HTMLElement;
-
- element.style.opacity = opacity.toString();
- }
-}