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: Improve the user interface #9103

Merged
merged 8 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
@@ -1,5 +1,5 @@
<jhi-loading-indicator-container [isLoading]="isLoading">
<div class="input-group mb-1 rounded-2 p-2 me-2 module-bg" [hidden]="!isCodeOfConductAccepted">
<div class="input-group mb-2 rounded-3 p-2 me-2 module-bg" [hidden]="!isCodeOfConductAccepted">
<!-- search bar -->
<input
#courseWideSearchInput
Expand Down Expand Up @@ -42,15 +42,24 @@
<jhi-course-conversations-code-of-conduct [course]="course!" />
</div>
}
<div class="col pe-0 flex-grow-1 module-bg" [ngClass]="{ 'card-border': true }" style="min-width: 200px">
<div class="col flex-grow-1 module-bg rounded-3 scrollable-content" [ngClass]="{ 'content-height-dev': !isProduction || isTestServer }" style="min-width: 200px">
@if (activeConversation) {
<jhi-conversation-header (collapseSearch)="toggleChannelSearch()" />
<jhi-conversation-messages (openThread)="postInThread = $event" [course]="course" [searchbarCollapsed]="channelSearchCollapsed" />
<jhi-conversation-messages
[contentHeightDev]="!isProduction || isTestServer"
(openThread)="postInThread = $event"
[course]="course"
[searchbarCollapsed]="channelSearchCollapsed"
/>
} @else {
<jhi-course-wide-search (openThread)="postInThread = $event" [courseWideSearchConfig]="courseWideSearchConfig" />
}
</div>
<div class="col d-flex flex-grow-1 justify-end px-0 card-border" style="max-width: min-content">
<div
class="col d-flex flex-grow-1 justify-end px-0 scrollable-content"
[ngClass]="{ 'content-height-dev': !isProduction || isTestServer }"
style="max-width: min-content"
>
@if (!!postInThread) {
<jhi-conversation-thread-sidebar
[activeConversation]="activeConversation ?? postInThread.conversation!"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,18 @@
max-height: calc(100vh - var(--header-height) - var(--communications-header-height));
}

.card-border {
--message-input-height: 175px;

border: 1px solid;
border-color: var(--bs-card-border-color);
border-radius: 0.25rem;
.scrollable-content {
--message-input-height-dev: 193px;
--message-input-height-prod: 177px;
overflow-y: auto;
overflow-x: hidden;
max-height: calc(100vh - var(--header-height) - var(--message-input-height));
max-height: calc(100vh - var(--header-height) - var(--message-input-height-prod));
&.content-height-dev {

Check notice on line 24 in src/main/webapp/app/overview/course-conversations/course-conversations.component.scss

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/main/webapp/app/overview/course-conversations/course-conversations.component.scss#L24

Expected empty line before rule (rule-empty-line-before)
rabeatwork marked this conversation as resolved.
Show resolved Hide resolved
max-height: calc(100vh - var(--header-height) - var(--message-input-height-dev));
}
@media (max-width: 768px) {

Check notice on line 27 in src/main/webapp/app/overview/course-conversations/course-conversations.component.scss

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/main/webapp/app/overview/course-conversations/course-conversations.component.scss#L27

Expected empty line before at-rule (at-rule-empty-line-before)
rabeatwork marked this conversation as resolved.
Show resolved Hide resolved
max-height: calc(100vh - var(--header-height) - var(--message-input-height-prod)) !important;
}
}

.message-input {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ConversationDTO } from 'app/entities/metis/conversation/conversation.mo
import { Post } from 'app/entities/metis/post.model';
import { ActivatedRoute, Router } from '@angular/router';
import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
import { EMPTY, Subject, from, take, takeUntil } from 'rxjs';
import { EMPTY, Subject, Subscription, from, take, takeUntil } from 'rxjs';
import { catchError } from 'rxjs/operators';
import { MetisConversationService } from 'app/shared/metis/metis-conversation.service';
import { ChannelSubType, getAsChannelDTO } from 'app/entities/metis/conversation/channel.model';
Expand All @@ -21,6 +21,7 @@ import { defaultFirstLayerDialogOptions } from 'app/overview/course-conversation
import { UserPublicInfoDTO } from 'app/core/user/user.model';
import { OneToOneChatCreateDialogComponent } from 'app/overview/course-conversations/dialogs/one-to-one-chat-create-dialog/one-to-one-chat-create-dialog.component';
import { ChannelsOverviewDialogComponent } from 'app/overview/course-conversations/dialogs/channels-overview-dialog/channels-overview-dialog.component';
import { ProfileService } from 'app/shared/layouts/profiles/profile.service';

const DEFAULT_CHANNEL_GROUPS: AccordionGroups = {
favoriteChannels: { entityData: [] },
Expand Down Expand Up @@ -80,13 +81,16 @@ export class CourseConversationsComponent implements OnInit, OnDestroy {
postInThread?: Post;
activeConversation?: ConversationDTO = undefined;
conversationsOfUser: ConversationDTO[] = [];
channelSearchCollapsed = false;
channelSearchCollapsed = true;

conversationSelected = true;
sidebarData: SidebarData;
accordionConversationGroups: AccordionGroups;
sidebarConversations: SidebarCardElement[] = [];
profileSubscription?: Subscription;
isCollapsed = false;
isProduction = true;
isTestServer = false;

readonly CHANNEL_TYPE_SHOW_ADD_OPTION = CHANNEL_TYPE_SHOW_ADD_OPTION;
readonly CHANNEL_TYPE_ICON = CHANNEL_TYPE_ICON;
Expand Down Expand Up @@ -119,6 +123,7 @@ export class CourseConversationsComponent implements OnInit, OnDestroy {
private metisService: MetisService,
private courseOverviewService: CourseOverviewService,
private modalService: NgbModal,
private profileService: ProfileService,
) {}

getAsChannel = getAsChannelDTO;
Expand Down Expand Up @@ -159,6 +164,11 @@ export class CourseConversationsComponent implements OnInit, OnDestroy {
this.isServiceSetUp = true;
}
});

this.profileSubscription = this.profileService.getProfileInfo()?.subscribe((profileInfo) => {
this.isProduction = profileInfo?.inProduction;
this.isTestServer = profileInfo.testServer ?? false;
});
}

subscribeToQueryParameter() {
Expand Down Expand Up @@ -187,6 +197,7 @@ export class CourseConversationsComponent implements OnInit, OnDestroy {
ngOnDestroy() {
this.ngUnsubscribe.next();
this.ngUnsubscribe.complete();
this.profileSubscription?.unsubscribe();
}

private subscribeToActiveConversation() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<div class="mt-2 ms-2">
<div class="conversation-header">
<div class="d-flex justify-content-between">
<div>
<div class="d-flex justify-content-between">
<div>
<h4 class="d-inline-block rounded p-1 info">
@if (!courseWideSearchConfig.searchTerm) {
<h3 class="conversation-name d-inline-block rounded p-1 info">All Messages</h3>
All Messages
} @else {
<h3 class="conversation-name d-inline-block rounded p-1 info">Search Results for "{{ courseWideSearchConfig.searchTerm }}"</h3>
Search Results for "{{ courseWideSearchConfig.searchTerm }}"
}
</div>
</h4>
</div>
</div>
@if (formGroup) {
Expand Down Expand Up @@ -86,7 +86,6 @@ <h3 class="conversation-name d-inline-block rounded p-1 info">Search Results for
<div
id="scrollableDiv"
#container
class="body-bg"
[ngClass]="{ 'posting-infinite-scroll-container': posts.length !== 0 }"
infinite-scroll
[scrollWindow]="false"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@if (activeConversation && course) {
<div class="conversation-header">
<div>
<div class="d-flex justify-content-between flex-wrap">
<div>
<h3 class="conversation-name d-inline-block rounded p-2 info" (click)="openConversationDetailDialog($event, INFO)">
<h4 class="pointer d-inline-block rounded px-3 py-2 info" (click)="openConversationDetailDialog($event, INFO)">
@if (activeConversationAsChannel) {
<jhi-channel-icon
[isPublic]="activeConversationAsChannel.isPublic!"
Expand All @@ -14,7 +14,7 @@ <h3 class="conversation-name d-inline-block rounded p-2 info" (click)="openConve
<jhi-group-chat-icon />
}
{{ conversationService.getConversationName(activeConversation, true) }}
</h3>
</h4>
</div>
@if (activeConversationAsChannel) {
@if (activeConversationAsChannel.tutorialGroupId && activeConversationAsChannel.tutorialGroupTitle) {
Expand All @@ -25,26 +25,26 @@ <h3 class="conversation-name d-inline-block rounded p-2 info" (click)="openConve
</div>
}
}
<div class="d-flex flex-wrap">
<div class="btn-toolbar p-2" role="toolbar">
<div class="d-flex flex-wrap gap-2 p-2">
<div class="btn-toolbar" role="toolbar">
<div class="btn-group me-1" role="group">
<button type="button" class="btn btn-outline-secondary search" (click)="toggleSearchBar()">
<button type="button" class="btn btn-outline-secondary btn-sm search" (click)="toggleSearchBar()">
<fa-icon [icon]="faSearch" />
</button>
</div>
</div>
<div class="btn-toolbar p-2" role="toolbar">
<div class="btn-toolbar" role="toolbar">
<div class="btn-group me-1" role="group">
@if (activeConversationAsChannel?.subTypeReferenceId) {
<a class="btn btn-outline-secondary sub-type-reference" [routerLink]="channelSubTypeReferenceRouterLink">
<a class="btn btn-sm btn-outline-secondary sub-type-reference" [routerLink]="channelSubTypeReferenceRouterLink">
{{ channelSubTypeReferenceTranslationKey | artemisTranslate }}
</a>
}
<button type="button" class="btn btn-outline-secondary members" (click)="openConversationDetailDialog($event, MEMBERS)">
<button type="button" class="btn btn-sm btn-outline-secondary members" (click)="openConversationDetailDialog($event, MEMBERS)">
<fa-icon [icon]="faUserGroup" /> {{ activeConversation.numberOfMembers || 0 }}
</button>
@if (canAddUsers(activeConversation)) {
<button type="button" class="btn btn-outline-secondary addUsers" (click)="openAddUsersDialog($event)">
<button type="button" class="btn btn-sm btn-outline-secondary addUsers" (click)="openAddUsersDialog($event)">
<fa-icon [icon]="faUserPlus" />
</button>
}
Expand All @@ -55,7 +55,7 @@ <h3 class="conversation-name d-inline-block rounded p-2 info" (click)="openConve
@if (activeConversationAsChannel) {
@if (activeConversationAsChannel.topic && activeConversationAsChannel.topic.length > 0) {
<div class="text-body-secondary d-flex justify-content-between px-2">
<span class="d-inline-block conversation-topic">{{ activeConversationAsChannel.topic }}</span>
<span class="d-inline-block mw-100">{{ activeConversationAsChannel.topic }}</span>
</div>
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,4 @@
@import 'node_modules/bootstrap/scss/functions';
@import 'node_modules/bootstrap/scss/variables';
@import 'node_modules/bootstrap/scss/mixins';
@import 'src/main/webapp/content/scss/artemis-variables';

.conversation-header {
.conversation-name {
margin: 0.1rem;
border-radius: 0.25rem;

&:hover {
background-color: var(--slightly-darker-body-bg);
cursor: pointer;
}
}

.conversation-topic {
max-width: 100%;
}
}
// @import 'node_modules/bootstrap/scss/functions';
// @import 'node_modules/bootstrap/scss/variables';
// @import 'node_modules/bootstrap/scss/mixins';
// @import 'src/main/webapp/content/scss/artemis-variables';
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@if (course) {
<div class="row p-3 justify-content-center conversation-messages">
<div class="row p-3 pt-0 justify-content-center conversation-messages">
<div class="justify-content-center">
<div class="row justify-content-center p-0">
<!-- search bar -->
Expand Down Expand Up @@ -47,7 +47,7 @@
</div>
}
</div>
<div class="row mt-3">
<div class="mt-3">
<!-- loading messages -->
@if (isFetchingPosts) {
<div class="envelope">
Expand All @@ -64,16 +64,15 @@
<div
id="scrollableDiv"
#container
class="body-bg"
[ngClass]="{ 'posting-infinite-scroll-container': posts.length !== 0 }"
[ngClass]="{ 'posting-infinite-scroll-container': posts.length !== 0, 'content-height-dev': contentHeightDev }"
infinite-scroll
[scrollWindow]="false"
(scrolledUp)="fetchNextPage()"
>
<!-- list of all top level posts -->
<!-- answers are opened in the thread sidebar -->
@for (post of posts; track postsTrackByFn($index, post)) {
<div class="pt-2">
<div class="">
<jhi-posting-thread
#postingThread
[lastReadDate]="_activeConversation?.lastReadDate"
Expand All @@ -87,7 +86,6 @@
/>
</div>
}
<div class="mb-3"></div>
</div>
@if (_activeConversation && newPost && canCreateNewMessageInConversation(_activeConversation)) {
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,20 @@
padding-top: 0.375rem !important;
}

--message-input-height: 165px;
--message-input-height-prod: 171px;
--message-input-height-dev: 187px;
--search-height: 52px;
--channel-header-height: 52px;

.posting-infinite-scroll-container {
max-height: calc(75vh - var(--message-input-height) - var(--search-height) - var(--channel-header-height));
max-height: calc(75vh - var(--message-input-height-prod) - var(--search-height) - var(--channel-header-height));
overflow-y: auto;
&.content-height-dev {

Check notice on line 45 in src/main/webapp/app/overview/course-conversations/layout/conversation-messages/conversation-messages.component.scss

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/main/webapp/app/overview/course-conversations/layout/conversation-messages/conversation-messages.component.scss#L45

Expected empty line before rule (rule-empty-line-before)
rabeatwork marked this conversation as resolved.
Show resolved Hide resolved
max-height: calc(75vh - var(--message-input-height-dev) - var(--search-height) - var(--channel-header-height));
}
@media (max-width: 768px) {

Check notice on line 48 in src/main/webapp/app/overview/course-conversations/layout/conversation-messages/conversation-messages.component.scss

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/main/webapp/app/overview/course-conversations/layout/conversation-messages/conversation-messages.component.scss#L48

Expected empty line before at-rule (at-rule-empty-line-before)
rabeatwork marked this conversation as resolved.
Show resolved Hide resolved
max-height: calc(75vh - var(--message-input-height-prod) - var(--search-height) - var(--channel-header-height)) !important;
}
}

.envelope {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ export class ConversationMessagesComponent implements OnInit, AfterViewInit, OnD
course?: Course;
@Input()
searchbarCollapsed = false;
@Input()
contentHeightDev: boolean = false;
pzdr7 marked this conversation as resolved.
Show resolved Hide resolved

getAsChannel = getAsChannelDTO;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,26 @@
</div>
<div class="card">
<!-- header -->
<div class="card-header d-flex" [ngbTooltip]="'artemisApp.conversationsLayout.threadSideBar.close' | artemisTranslate" (click)="closePostThread.emit()">
<div class="card-header cursor-default d-flex">
<div class="row flex-grow-1">
<div class="col">
<h5 class="mb-0 fw-medium" jhiTranslate="artemisApp.conversationsLayout.threadSideBar.label"></h5>
</div>
<div class="col-auto">
<fa-icon [icon]="faXmark" />
<fa-icon
class="pointer"
[ngbTooltip]="'artemisApp.conversationsLayout.threadSideBar.close' | artemisTranslate"
[icon]="faXmark"
(click)="closePostThread.emit()"
/>
</div>
</div>
</div>
<!-- body -->
<div class="pt-0 scrollbar wrapper-scroll-y mx-1">
@if (post !== undefined) {
<div class="my-2">
<div class="card-body body-bg">
<div class="card-body">
<jhi-post
[readOnlyMode]="readOnlyMode"
[posting]="post"
Expand All @@ -31,7 +36,7 @@ <h5 class="mb-0 fw-medium" jhiTranslate="artemisApp.conversationsLayout.threadSi
[hasChannelModerationRights]="hasChannelModerationRights"
/>
</div>
<div class="message-input">
<div class="message-input mx-3">
@if (!readOnlyMode) {
<jhi-message-reply-inline-input [posting]="createdAnswerPost" (onCreate)="createdAnswerPost = createEmptyAnswerPost()" />
}
Expand Down
4 changes: 0 additions & 4 deletions src/main/webapp/app/shared/metis/metis.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@
animation: cssAnimation 5s forwards;
}

.highlight-pinned {
background-color: var(--metis-pinned-post-highlight-color);
}

@keyframes cssAnimation {
0% {
opacity: 1;
Expand Down
Loading
Loading