Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Communication: Fix element height in announcement channel #9664

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,13 @@
<div
id="scrollableDiv"
#container
[ngClass]="{ 'posting-infinite-scroll-container': posts.length !== 0, 'content-height-dev': contentHeightDev, 'is-fetching-posts': isFetchingPosts }"
[ngClass]="{
'posting-infinite-scroll-container': posts.length !== 0,
'content-height-dev': contentHeightDev,
'is-fetching-posts': isFetchingPosts,
'hide-input-full': isHiddenInputFull,
'hide-input': isHiddenInputWithCallToAction,
}"
infinite-scroll
class="conversation-messages-message-list"
[scrollWindow]="false"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@
max-height: calc(75vh - var(--message-input-height-prod) - var(--search-height) - var(--channel-header-height));
overflow-y: auto;

&.hide-input-full {
max-height: calc(94vh - var(--message-input-height-prod) - var(--search-height) - var(--channel-header-height));
}

&.hide-input {
max-height: calc(87vh - var(--message-input-height-prod) - var(--search-height) - var(--channel-header-height));
}

&.content-height-dev {
max-height: calc(75vh - var(--message-input-height-dev) - var(--search-height) - var(--channel-header-height));

Expand All @@ -56,6 +64,14 @@
}
}

&.hide-input-full.content-height-dev {
max-height: calc(94vh - var(--message-input-height-dev) - var(--search-height) - var(--channel-header-height));
}

&.hide-input.content-height-dev {
max-height: calc(87vh - var(--message-input-height-dev) - var(--search-height) - var(--channel-header-height));
}
PaRangger marked this conversation as resolved.
Show resolved Hide resolved

@include media-breakpoint-down(sm) {
max-height: calc(90vh - var(--message-input-height-prod) - var(--search-height) - var(--channel-header-height));
max-height: calc(90dvh - var(--message-input-height-prod) - var(--search-height) - var(--channel-header-height));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ export class ConversationMessagesComponent implements OnInit, AfterViewInit, OnD
faEnvelope = faEnvelope;
faCircleNotch = faCircleNotch;
isMobile = false;
isHiddenInputWithCallToAction = false;
isHiddenInputFull = false;

private layoutService: LayoutService = inject(LayoutService);

Expand Down Expand Up @@ -145,6 +147,14 @@ export class ConversationMessagesComponent implements OnInit, AfterViewInit, OnD
}

private onActiveConversationChange() {
if (this._activeConversation !== undefined && this.getAsChannel(this._activeConversation)?.isAnnouncementChannel) {
this.isHiddenInputFull = !canCreateNewMessageInConversation(this._activeConversation);
this.isHiddenInputWithCallToAction = canCreateNewMessageInConversation(this._activeConversation);
} else {
this.isHiddenInputFull = false;
this.isHiddenInputWithCallToAction = false;
}
PaRangger marked this conversation as resolved.
Show resolved Hide resolved

if (this.course && this._activeConversation) {
if (this.searchInput) {
this.searchInput.nativeElement.value = '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ examples.forEach((activeConversation) => {
it('should display the "new announcement" button when the conversation is an announcement channel', fakeAsync(() => {
const announcementButton = fixture.debugElement.query(By.css('.btn.btn-md.btn-primary'));
expect(announcementButton).toBeTruthy(); // Check if the button is present
expect(component.isHiddenInputFull).toBeFalsy();
expect(component.isHiddenInputWithCallToAction).toBeTruthy();

const modal = fixture.debugElement.query(By.directive(PostCreateEditModalComponent));
expect(modal).toBeTruthy(); // Check if the modal is present
Expand Down
Loading