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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[#59879] amiably animate hover cards
Tobias Dillmannd4abe0ae614a
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.sassindex dcab4bc4fa7..44e0bd0a973 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@@ -12,11 +12,8 @@background-color: var(--body-background)z-index: 5000width: 500px+ min-height: 95pxbox-shadow: var(--shadow-floating-medium)pointer-events: allpadding: var(--overlay-paddingBlock-normal)border-radius: var(--overlay-borderRadius)-- &.user-sized- width: 500px- height: 182pxdiff --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.tsindex eb5b92e6381..619d9a7cbfa 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,17 +58,18 @@ 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');- }+ // 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-anyvoid this.reposition(modal, this.locals.event.target as HTMLElement);++ // Content has been loaded, card has been positioned. Show it!+ this.setOpacity(this.elementRef, 1);});}}@@ -114,4 +115,10 @@ export class HoverCardComponent extends OpModalComponent implements OnInit {top: `${y}px`,});}++ private setOpacity(elementRef:ElementRef, opacity:number) {+ const element = elementRef.nativeElement as HTMLElement;++ element.style.opacity = opacity.toString();+ }}