From 75d0170efa98bbca78bfe2f73f313dc04e61ffd8 Mon Sep 17 00:00:00 2001 From: Lukas Haase <lukas.haase@mni.thm.de> Date: Fri, 16 Jul 2021 14:48:29 +0200 Subject: [PATCH] add active users counter to comment-list --- .../comment-list/comment-list.component.html | 4 +++- .../comment-list/comment-list.component.scss | 18 +++++++++++++++--- .../comment-list/comment-list.component.ts | 2 +- src/app/services/http/active-user.service.ts | 4 ++-- src/assets/icons/view.png | Bin 0 -> 1145 bytes src/assets/icons/viewer.svg | 9 +++++++++ src/styles.scss | 7 +++++++ 7 files changed, 37 insertions(+), 7 deletions(-) create mode 100644 src/assets/icons/view.png create mode 100644 src/assets/icons/viewer.svg diff --git a/src/app/components/shared/comment-list/comment-list.component.html b/src/app/components/shared/comment-list/comment-list.component.html index 57627e228..95f3ecd00 100644 --- a/src/app/components/shared/comment-list/comment-list.component.html +++ b/src/app/components/shared/comment-list/comment-list.component.html @@ -260,7 +260,9 @@ </div> <!-- Active User Overlay --> <div class="activeUserOverlay"> - <p>Active Users: {{activeUsers}}</p> + <div class="viewer-icon"> + </div> + <p style="float:left;">Active Users: {{activeUsers}}</p> </div> <!-- No Questions Present --> diff --git a/src/app/components/shared/comment-list/comment-list.component.scss b/src/app/components/shared/comment-list/comment-list.component.scss index 845ae6dc0..bb413dd36 100644 --- a/src/app/components/shared/comment-list/comment-list.component.scss +++ b/src/app/components/shared/comment-list/comment-list.component.scss @@ -260,10 +260,22 @@ h1{ } .activeUserOverlay{ - width:100px; - height:100px; + width:180px; + height:25px; position:fixed; - background-color:red; top:80px; left:20px; + >*{ + float:left; + padding:0; + margin:0; + } + >p{ + font-family:'Roboto', sans-serif; + font-weight:bold; + float:left; + padding:5px; + margin:0; + color:var(--on-background); + } } diff --git a/src/app/components/shared/comment-list/comment-list.component.ts b/src/app/components/shared/comment-list/comment-list.component.ts index 3838b3872..18d71b3c1 100644 --- a/src/app/components/shared/comment-list/comment-list.component.ts +++ b/src/app/components/shared/comment-list/comment-list.component.ts @@ -244,7 +244,7 @@ export class CommentListComponent implements OnInit, OnDestroy { this.roomId = room.id; this.activeUserService.getActiveUser(this.room) .subscribe(i=>{ - this.activeUsers=i; + this.activeUsers=i.length; }); this._subscriptionRoomService = this.wsRoomService.getRoomStream(this.roomId).subscribe(msg => { const message = JSON.parse(msg.body); diff --git a/src/app/services/http/active-user.service.ts b/src/app/services/http/active-user.service.ts index d8e864e98..8c60106e4 100644 --- a/src/app/services/http/active-user.service.ts +++ b/src/app/services/http/active-user.service.ts @@ -18,8 +18,8 @@ export class ActiveUserService extends BaseHttpService { super(); } - public getActiveUser(room: Room):Observable<number>{ - const url = '/api/roomsubscription/usercount'; + public getActiveUser(room: Room):Observable<any>{ + const url = '/api/roomsubscription/usercount?ids='+room.id; return this.http.get(url, httpOptions).pipe( tap(_ => ''), catchError(this.handleError<any>('yeet')) diff --git a/src/assets/icons/view.png b/src/assets/icons/view.png new file mode 100644 index 0000000000000000000000000000000000000000..e1c4a4e15328218b7e73df60d475c0401f7d8102 GIT binary patch literal 1145 zcmV-<1cv*GP)<h;3K|Lk000e1NJLTq001cf001cn1^@s6s9*s00004mX+uL$Nkc;* zaB^>EX>4Tx04R}tkv&MmKpe$iQ>7vm1v`j1WT=8*K~%(1t5Adrp;l<s!Q|2}Xws0R zxHt-~1qVMCs}3&Cx;nTDg5U>;o12rOi<J1kq|hS9gX4a@yZ5+z2MF~t)2xnhK+|nA zm57U(?5Y@gMF@QeV-zzovy3@OO2T)1-6O!)yBN>%KlkV8QF9gp0wVD&GfbO!gLrz= zHaPDSM_5r-iO-40Ou8WPBi9v=-#8as7I<dFOsD3FBgA5%jg>ZLMN=c5B95w>PWeK{ zW0mt3XRTai&3p0}hI9JLGS_JiA%R6KL4pVcRg_SMjTo&uDHc++ANTPOx_*gV3b{&P z<XAuj8f4cG{s+Iiweph_UQ##?biO#w$1o7u1sXNS`95}>#t9I72Cnp$zfuQgK1r{& zwCEAgyA51iw=`uBxZD8-o($QPT`5RY$mfCgGy0}1(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0 --- /dev/null +++ b/src/assets/icons/viewer.svg @@ -0,0 +1,9 @@ +<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16"> + <path fill="#000000" d="M96 224c35.3 0 64-28.7 64-64s-28.7-64-64-64-64 28.7-64 64 28.7 64 64 64zm448 0c35.3 0 64-28.7 + 64-64s-28.7-64-64-64-64 28.7-64 64 28.7 64 64 64zm32 32h-64c-17.6 0-33.5 7.1-45.1 18.6 40.3 22.1 + 68.9 62 75.1 109.4h66c17.7 0 32-14.3 32-32v-32c0-35.3-28.7-64-64-64zm-256 0c61.9 0 112-50.1 + 112-112S381.9 32 320 32 208 82.1 208 144s50.1 112 112 112zm76.8 32h-8.3c-20.8 10-43.9 16-68.5 + 16s-47.6-6-68.5-16h-8.3C179.6 288 128 339.6 128 403.2V432c0 26.5 21.5 48 48 48h288c26.5 0 + 48-21.5 48-48v-28.8c0-63.6-51.6-115.2-115.2-115.2zm-223.7-13.4C161.5 263.1 145.6 256 + 128 256H64c-35.3 0-64 28.7-64 64v32c0 17.7 14.3 32 32 32h65.9c6.3-47.4 34.9-87.3 75.2-109.4z"/> +</svg> diff --git a/src/styles.scss b/src/styles.scss index 5c2c9ce9e..63f41701f 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -249,3 +249,10 @@ a { height: 1px !important; border-top-color: rgba(0, 0, 0, 0.12) !important; } + +.viewer-icon{ + width:25px; + height:25px; + background-size:cover; + background-image:url("assets/icons/view.png"); +} -- GitLab