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

[#59879] use nearly-correct-dimensions when loading hover card content

Tobias Dillmanna8fee12c3dd8
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
index 7a382190fe7..d97925b8569 100644
--- 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
@@ -8,7 +8,7 @@
id="op-hover-card-body"
[src]="turboFrameSrc">
<op-content-loader
- viewBox="0 0 330 60"
+ viewBox="0 0 500 95"
>
<svg:rect x="10" y="0" width="60%" height="16" rx="1" />
<svg:rect x="10" y="20" width="80%" height="16" rx="1" />
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
index d9480570d01..dcab4bc4fa7 100644
--- 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
@@ -7,7 +7,7 @@
opacity: 1
.op-hover-card
- animation: fade-in-hover-card .4s ease-in
+ animation: fade-in-hover-card .25s ease-in
position: absolute
background-color: var(--body-background)
z-index: 5000
@@ -16,3 +16,7 @@
pointer-events: all
padding: var(--overlay-paddingBlock-normal)
border-radius: var(--overlay-borderRadius)
+
+ &.user-sized
+ width: 500px
+ height: 182px
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
index e9c481007ed..eb5b92e6381 100644
--- 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
@@ -58,6 +58,13 @@ export class HoverCardComponent extends OpModalComponent implements OnInit {
@ViewChild('turboFrame')
set turboFrame(frame:ElementRef<HTMLIFrameElement>|undefined) {
if (frame !== undefined) {
+ if (this.turboFrameSrc.includes('/users/')) {
+ // User hover cards require additional space, this must be designated before loading the turbo frame so that
+ // the rough size of the hover card can be adjusted in advance. This makes the popup appear smoothly.
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call
+ this.elementRef.nativeElement.querySelector('.op-hover-card')?.classList.add('user-sized');
+ }
+
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