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 content overflow in expanded thread view #9474

Merged
merged 8 commits into from
Oct 27, 2024
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 @@ -62,10 +62,7 @@
<jhi-course-wide-search (openThread)="postInThread = $event" [courseWideSearchConfig]="courseWideSearchConfig" />
}
</div>
<div
class="communication-answer-message-wrap col flex-grow-1 justify-end px-0 scrollable-content"
[ngClass]="{ 'content-height-dev': !isProduction || isTestServer, 'is-answer-thread-open': !!postInThread }"
>
<div class="scrollable-content" [ngClass]="{ 'content-height-dev': !isProduction || isTestServer, 'is-answer-thread-open': !!postInThread }">
@if (!!postInThread) {
<jhi-conversation-thread-sidebar
[activeConversation]="activeConversation ?? postInThread.conversation!"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
overflow-y: auto;
overflow-x: hidden;
max-height: calc(100vh - var(--header-height) - var(--message-input-height-prod));
flex-wrap: wrap;

&.content-height-dev {
max-height: calc(100vh - var(--header-height) - var(--message-input-height-dev));
Expand All @@ -42,12 +43,7 @@
}

.communication-message-wrap {
min-width: 200px;
}

.communication-answer-message-wrap {
max-width: min-content;
display: flex;
min-width: 30%;
}

@include media-breakpoint-down(sm) {
Expand Down Expand Up @@ -92,15 +88,6 @@
display: none;
}

.communication-answer-message-wrap {
max-width: 100%;
display: none;
}

.communication-answer-message-wrap.is-answer-thread-open {
display: flex;
}

.communication-message-wrap {
max-width: 100%;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,28 @@
@import 'bootstrap/scss/variables';
@import 'bootstrap/scss/mixins';

$draggable-width: 15px;
$thread-section-card-min-width: 420px;

.postings-container {
display: flex;
height: 100%;
margin-left: auto;
min-width: 30%;
max-width: 100%;

.back-instruction {
font-size: 12px;
}
}

.expanded-thread {
width: calc(#{$draggable-width} + #{$thread-section-card-min-width});
display: flex;
flex-grow: 1;
min-width: 30%;
max-width: 100%;

.scrollbar {
position: relative;
max-height: 1000px;
overflow: auto;
overflow-x: hidden;
}

.wrapper-scroll-y {
Expand All @@ -34,12 +36,12 @@ $thread-section-card-min-width: 420px;
flex-direction: column;
align-items: center;
justify-content: center;
min-width: $draggable-width;
min-width: 1.5%;
max-width: 1.5%;
}

.card {
width: inherit;
min-width: $thread-section-card-min-width;

.card-header {
justify-content: space-between;
Expand All @@ -62,7 +64,6 @@ $thread-section-card-min-width: 420px;

.collapsed-thread {
display: flex;
width: 38px;
justify-content: space-between;
flex-flow: column;
margin-left: auto;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ export class ConversationThreadSidebarComponent implements AfterViewInit {
modifiers: [
// Set maximum width
interact.modifiers!.restrictSize({
min: { width: 435, height: 0 },
max: { width: 600, height: 4000 },
min: { width: window.innerWidth * 0.3, height: 0 },
max: { width: window.innerWidth, height: 0 },
}),
],
inertia: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="d-flex gap-2 fs-xx-small">
<div class="d-flex flex-wrap gap-2 fs-xx-small">
@for (reactionMetaData of reactionMetaDataMap | keyvalue; track reactionMetaData) {
<div>
<button
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="d-flex gap-2 fs-xx-small">
<div class="d-flex flex-wrap gap-2 fs-xx-small">
@if (!isCommunicationPage) {
@if (sortedAnswerPosts.length) {
<!-- collapse answers -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,16 @@ describe('ConversationThreadSidebarComponent', () => {
component.activeConversation = conversation;
expect(component.hasChannelModerationRights).toBe(hasModerationRights);
});

it('should set min and max width for the resizable thread section', () => {
const expandedThreadElement = fixture.debugElement.nativeElement.querySelector('.expanded-thread');
const minWidth = window.innerWidth * 0.3;
const maxWidth = window.innerWidth;

expandedThreadElement.style.width = `${minWidth}px`;
expect(parseFloat(expandedThreadElement.style.width)).toBeGreaterThanOrEqual(minWidth);

expandedThreadElement.style.width = `${maxWidth}px`;
expect(parseFloat(expandedThreadElement.style.width)).toBeLessThanOrEqual(maxWidth);
});
});
Loading