Skip to content

Commit

Permalink
Communication: Improve the user interface (#9103)
Browse files Browse the repository at this point in the history
  • Loading branch information
rabeatwork authored Aug 8, 2024
1 parent 3e55f73 commit 1fbeab4
Show file tree
Hide file tree
Showing 36 changed files with 267 additions and 241 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,14 @@ <h3 jhiTranslate="artemisApp.competency.generate.listTitle" class="mt-2"></h3>
@if (isLoading) {
<div class="d-flex flex-column align-items-center mb-1">
<div class="spinner-border" role="status">
<span class="sr-only">{{ 'loading' | artemisTranslate }}</span>
<span jhiTranslate="loading" class="sr-only"></span>
</div>
<span class="">{{ 'artemisApp.competency.generate.loading' | artemisTranslate }}</span>
<span jhiTranslate="artemisApp.competency.generate.loading"></span>
</div>
}
<form [formGroup]="form" (ngSubmit)="onSubmit()">
@if (!competencies.length && !isLoading) {
<div class="mb-1">
{{ 'global.generic.emptyList' | artemisTranslate }}
</div>
<div class="mb-1" jhiTranslate="global.generic.emptyList"></div>
}
<div class="border-0" formArrayName="competencies">
@for (competencies of competencies.controls; track competencies; let i = $index) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ <h2>
<div class="flex-grow-1 flex-basis-10 position-relative">
<div class="position-absolute w-100 h-100 top-0">
<ngb-progressbar
class=""
[value]="exercisePreparationStatus.finished!"
[max]="exercisePreparationStatus.overall ? exercisePreparationStatus.overall - exercisePreparationStatus.failed! : 0"
[animated]="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
<td>{{ quizExercise.maxPoints }}</td>
<td>{{ exerciseService.isIncludedInScore(quizExercise) }}</td>
<td class="text-end">
<div class="">
<div>
<jhi-quiz-exercise-lifecycle-buttons
[quizExercise]="quizExercise"
(loadOne)="loadOne($event)"
Expand Down
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,20 @@
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 {
max-height: calc(100vh - var(--header-height) - var(--message-input-height-dev));
}

@media (max-width: 768px) {
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 @@ -20,6 +20,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 @@ -79,13 +80,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 @@ -118,6 +122,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 @@ -158,6 +163,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 @@ -186,6 +196,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,29 @@ <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">
{{ channelSubTypeReferenceTranslationKey | artemisTranslate }}
<a
[jhiTranslate]="channelSubTypeReferenceTranslationKey ?? ''"
class="btn btn-sm btn-outline-secondary sub-type-reference"
[routerLink]="channelSubTypeReferenceRouterLink"
>
</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 +58,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 id="conversation-topic" class="d-inline-block mw-100">{{ activeConversationAsChannel.topic }}</span>
</div>
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +0,0 @@
@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%;
}
}
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>
<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,22 @@
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 {
max-height: calc(75vh - var(--message-input-height-dev) - var(--search-height) - var(--channel-header-height));
}

@media (max-width: 768px) {
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;

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 #scrollBody 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"
Expand Down
Loading

0 comments on commit 1fbeab4

Please sign in to comment.