Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/main/webapp/app/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import { DatePipe } from '@angular/common';
import { HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
import { ApplicationConfig, ErrorHandler, LOCALE_ID, importProvidersFrom, inject, provideAppInitializer, provideZoneChangeDetection } from '@angular/core';
import { BrowserModule, Title } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { Router, RouterModule, provideRouter, withRouterConfig } from '@angular/router';
import { Router, provideRouter, withRouterConfig } from '@angular/router';
import { ServiceWorkerModule } from '@angular/service-worker';
import { NgbDateAdapter } from '@ng-bootstrap/ng-bootstrap';
import { MissingTranslationHandler, provideTranslateService } from '@ngx-translate/core';
Expand Down Expand Up @@ -38,9 +37,7 @@ export const appConfig: ApplicationConfig = {
ArtemisTranslatePipe,
importProvidersFrom(
// TODO: we should exclude modules here in the future
BrowserAnimationsModule,
BrowserModule,
RouterModule,
ScrollingModule,
OwlNativeDateTimeModule,
),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { CompetencyGraphComponent } from 'app/atlas/manage/competency-graph/competency-graph.component';
import { MockTranslateService } from 'test/helpers/mocks/service/mock-translate.service';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { TranslateService } from '@ngx-translate/core';
import { CompetencyGraphDTO, CompetencyGraphEdgeDTO, CompetencyGraphNodeDTO } from 'app/atlas/shared/entities/learning-path.model';
import { SizeUpdate } from 'app/atlas/manage/competency-node/competency-node.component';
import { provideNoopAnimationsForTests } from 'test/helpers/animations';

describe('CompetencyGraphComponent', () => {
let component: CompetencyGraphComponent;
Expand All @@ -31,12 +31,13 @@ describe('CompetencyGraphComponent', () => {

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [CompetencyGraphComponent, NoopAnimationsModule],
imports: [CompetencyGraphComponent],
providers: [
{
provide: TranslateService,
useClass: MockTranslateService,
},
provideNoopAnimationsForTests(),
],
}).compileComponents();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { CourseCompetenciesRelationGraphComponent } from 'app/atlas/manage/course-competencies-relation-graph/course-competencies-relation-graph.component';
import { CompetencyRelationDTO, CompetencyRelationType, CourseCompetency, CourseCompetencyType } from 'app/atlas/shared/entities/competency.model';
import { MockTranslateService } from 'test/helpers/mocks/service/mock-translate.service';
import { TranslateService } from '@ngx-translate/core';
import { provideNoopAnimationsForTests } from 'test/helpers/animations';

interface CourseCompetencyStyle {
dimension: {
Expand Down Expand Up @@ -54,12 +54,13 @@ describe('CourseCompetenciesRelationGraphComponent', () => {

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [CourseCompetenciesRelationGraphComponent, NoopAnimationsModule],
imports: [CourseCompetenciesRelationGraphComponent],
providers: [
{
provide: TranslateService,
useClass: MockTranslateService,
},
provideNoopAnimationsForTests(),
],
}).compileComponents();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { MockNgbActiveModalService } from 'test/helpers/mocks/service/mock-ngb-active-modal.service';
import { TranslateService } from '@ngx-translate/core';
import { MockTranslateService } from 'test/helpers/mocks/service/mock-translate.service';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { provideNoopAnimationsForTests } from 'test/helpers/animations';

describe('CourseCompetenciesRelationModalComponent', () => {
let component: CourseCompetenciesRelationModalComponent;
Expand All @@ -35,7 +35,6 @@ describe('CourseCompetenciesRelationModalComponent', () => {

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [NoopAnimationsModule],
providers: [
provideHttpClient(),
provideHttpClientTesting(),
Expand All @@ -57,6 +56,7 @@ describe('CourseCompetenciesRelationModalComponent', () => {
getCourseCompetencyRelationsByCourseId: jest.fn(),
},
},
provideNoopAnimationsForTests(),
],
}).compileComponents();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,19 @@
<ng-container #createEditAnswerPostContainer />
</div>
@if (!isDeleted) {
<div class="post-content-padding post-reactions-bar" [ngClass]="{ 'is-saved': posting.isSaved && isConsecutive() }" @fade>
<jhi-posting-reactions-bar
[isReadOnlyMode]="isReadOnlyMode()"
[posting]="posting"
[isLastAnswer]="isLastAnswer()"
[isThreadSidebar]="isThreadSidebar"
(openPostingCreateEditModal)="createAnswerPostModal.open()"
(reactionsUpdated)="onReactionsUpdated($event)"
[isEmojiCount]="true"
(onBookmarkClicked)="toggleSavePost()"
/>
<div animate.enter="reactions-entering" animate.leave="reactions-leaving">
<div class="post-content-padding post-reactions-bar" [ngClass]="{ 'is-saved': posting.isSaved && isConsecutive() }">
<jhi-posting-reactions-bar
[isReadOnlyMode]="isReadOnlyMode()"
[posting]="posting"
[isLastAnswer]="isLastAnswer()"
[isThreadSidebar]="isThreadSidebar"
(openPostingCreateEditModal)="createAnswerPostModal.open()"
(reactionsUpdated)="onReactionsUpdated($event)"
[isEmojiCount]="true"
(onBookmarkClicked)="toggleSavePost()"
/>
</div>
</div>
}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,55 @@
@import 'bootstrap/scss/mixins';
@import '../metis.component';

// CSS animations for enter/leave (used with Angular's animate.enter/animate.leave)
// Reactions bar enter animation using CSS Grid for height + opacity
.reactions-entering {
display: grid;
grid-template-rows: 0fr;
opacity: 0;
animation: reactions-enter 0.3s ease-in-out forwards;

> * {
overflow: hidden;
}
}

@keyframes reactions-enter {
from {
grid-template-rows: 0fr;
opacity: 0;
}

to {
grid-template-rows: 1fr;
opacity: 1;
}
}

// Reactions bar leave animation
.reactions-leaving {
display: grid;
grid-template-rows: 1fr;
opacity: 1;
animation: reactions-leave 0.2s ease-in-out forwards;

> * {
overflow: hidden;
}
}

@keyframes reactions-leave {
from {
grid-template-rows: 1fr;
opacity: 1;
}

to {
grid-template-rows: 0fr;
opacity: 0;
}
}

.answer-post {
border-radius: 7px;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
import { AnswerPostComponent } from 'app/communication/answer-post/answer-post.component';
import { DebugElement } from '@angular/core';
import { SessionStorageService } from 'app/shared/service/session-storage.service';
import { MockComponent, MockDirective, MockModule, MockPipe, ngMocks } from 'ng-mocks';
import { MockComponent, MockDirective, MockPipe, ngMocks } from 'ng-mocks';
import { HtmlForMarkdownPipe } from 'app/shared/pipes/html-for-markdown.pipe';
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
import { By } from '@angular/platform-browser';
import { PostingContentComponent } from 'app/communication/posting-content/posting-content.components';
Expand All @@ -11,7 +11,6 @@ import { OverlayModule } from '@angular/cdk/overlay';
import { AnswerPostCreateEditModalComponent } from 'app/communication/posting-create-edit-modal/answer-post-create-edit-modal/answer-post-create-edit-modal.component';
import { DOCUMENT } from '@angular/common';
import { Reaction } from 'app/communication/shared/entities/reaction.model';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { MetisService } from 'app/communication/service/metis.service';
import { MockMetisService } from 'test/helpers/mocks/service/mock-metis-service.service';
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
Expand Down Expand Up @@ -44,7 +43,7 @@ describe('AnswerPostComponent', () => {
document.body.appendChild(mainContainer);

return TestBed.configureTestingModule({
imports: [OverlayModule, MockModule(BrowserAnimationsModule), MockDirective(NgbTooltip)],
imports: [OverlayModule],
declarations: [
AnswerPostComponent,
FaIconComponent,
Expand All @@ -55,6 +54,7 @@ describe('AnswerPostComponent', () => {
ArtemisDatePipe,
ArtemisTranslatePipe,
MockDirective(TranslateDirective),
MockDirective(NgbTooltip),
],
providers: [
provideHttpClient(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
import { AnswerPost } from 'app/communication/shared/entities/answer-post.model';
import { PostingDirective } from 'app/communication/directive/posting.directive';
import dayjs from 'dayjs/esm';
import { animate, style, transition, trigger } from '@angular/animations';
import { Reaction } from 'app/communication/shared/entities/reaction.model';
import { faBookmark, faPencilAlt, faShare, faSmile, faTrash } from '@fortawesome/free-solid-svg-icons';
import { DOCUMENT, NgClass, NgStyle } from '@angular/common';
Expand All @@ -38,12 +37,6 @@ import { TranslateDirective } from 'app/shared/language/translate.directive';
templateUrl: './answer-post.component.html',
styleUrls: ['./answer-post.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
animations: [
trigger('fade', [
transition(':enter', [style({ opacity: 0 }), animate('300ms ease-in', style({ opacity: 1 }))]),
transition(':leave', [animate('300ms ease-out', style({ opacity: 0 }))]),
]),
],
imports: [
NgClass,
FaIconComponent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,24 @@ <h4 class="course-notification-overview-overlay-headline mb-0" jhiTranslate="art
<div #scrollContainer class="course-notification-overview-notification-container">
@if (!isLoading) {
@if (notificationsForSelectedCategory.length > 0) {
<div @fadeAnimation>
<div>
@for (notification of notificationsForSelectedCategory; track notification) {
<div class="course-notification-overview-notification-wrap" @notificationWrapAnimation>
<jhi-course-notification
[courseNotification]="notification"
[isUnseen]="notification.status === CourseNotificationViewingStatus.UNSEEN"
[isShowClose]="true"
[isRedirectToUrl]="true"
(onCloseClicked)="closeClicked(notification)"
/>
<div class="notification-animation-wrapper" animate.enter="notification-item-entering" animate.leave="notification-item-leaving">
<div class="course-notification-overview-notification-wrap">
<jhi-course-notification
[courseNotification]="notification"
[isUnseen]="notification.status === CourseNotificationViewingStatus.UNSEEN"
[isShowClose]="true"
[isRedirectToUrl]="true"
(onCloseClicked)="closeClicked(notification)"
/>
</div>
</div>
}
<div class="py-1"></div>
</div>
} @else {
<div class="course-notification-overview-notification-empty-prompt" @fadeAnimation>
<div class="course-notification-overview-notification-empty-prompt">
<fa-icon class="course-notification-overview-notification-empty-prompt-icon" [icon]="faEnvelopeOpen" />
<div class="mt-3 text-secondary">
<strong jhiTranslate="artemisApp.courseNotification.overview.emptyTitle"></strong>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,70 @@ $overlay-container-height: 30rem;
$padding: 1.4rem;
$overlay-offset-top: 2.8rem;

// CSS animations for enter/leave (used with Angular's animate.enter/animate.leave)
// Wrapper for animation - similar pattern to alerts
.notification-animation-wrapper {
margin: 0.5rem 0;

&:first-child {
margin-top: 1rem;
}

&:last-child {
margin-bottom: 0;
}
}

// Notification item enter animation: fade in + height expand
.notification-item-entering {
max-height: 0;
overflow: hidden;
animation:
notification-height-in 0.2s ease-in-out forwards,
notification-fade-in 0.2s ease-in-out forwards;
}

@keyframes notification-height-in {
from {
max-height: 0;
}

to {
max-height: 200px;
}
}

@keyframes notification-fade-in {
from {
opacity: 0;
}

to {
opacity: 1;
}
}

// Notification item leave animation: fade out + height collapse
.notification-item-leaving {
max-height: 200px;
overflow: hidden;
animation:
notification-height-out 0.15s ease-in-out forwards,
notification-fade-out 0.15s ease-in-out forwards;
}

@keyframes notification-height-out {
to {
max-height: 0;
}
}

@keyframes notification-fade-out {
to {
opacity: 0;
}
}

.course-notification-overview-bubble {
position: absolute;
top: 0;
Expand Down Expand Up @@ -86,16 +150,9 @@ $overlay-offset-top: 2.8rem;
border-color: var(--secondary);
}

// Margins are now handled by .notification-animation-wrapper
.course-notification-overview-notification-wrap {
margin: 0.5rem 0;
}

.course-notification-overview-notification-wrap:first-child {
margin-top: 1rem;
}

.course-notification-overview-notification-wrap:last-child {
margin-bottom: 0;
// Content wrapper - no margins here, handled by animation wrapper
}

.course-notification-overview-notification-empty-prompt {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { By } from '@angular/platform-browser';
import { CourseNotificationOverviewComponent } from 'app/communication/course-notification/course-notification-overview/course-notification-overview.component';
import { CourseNotificationService } from 'app/communication/course-notification/course-notification.service';
Expand Down Expand Up @@ -54,7 +53,7 @@ describe('CourseNotificationOverviewComponent', () => {
} as unknown as CourseNotificationService;

await TestBed.configureTestingModule({
imports: [NoopAnimationsModule, CommonModule, FontAwesomeModule],
imports: [CommonModule, FontAwesomeModule],
declarations: [
CourseNotificationOverviewComponent,
MockComponent(CourseNotificationBubbleComponent),
Expand Down
Loading