From 74694d1992c435b3272e90b60adf05ec9837ad28 Mon Sep 17 00:00:00 2001
From: Pratiyush Kumar
Date: Tue, 22 Aug 2023 19:28:18 +0530
Subject: [PATCH 01/16] sidebar particiapnts lists
---
app/components/live-participants.hbs | 65 +++++++++++++++++++
app/components/live-participants.js | 14 ++++
app/components/live-sidebar.hbs | 49 +++++---------
app/components/live-sidebar.js | 3 +
.../components/live-participants-test.js | 26 ++++++++
5 files changed, 126 insertions(+), 31 deletions(-)
create mode 100644 app/components/live-participants.hbs
create mode 100644 app/components/live-participants.js
create mode 100644 tests/integration/components/live-participants-test.js
diff --git a/app/components/live-participants.hbs b/app/components/live-participants.hbs
new file mode 100644
index 000000000..f301eaa22
--- /dev/null
+++ b/app/components/live-participants.hbs
@@ -0,0 +1,65 @@
+
\ No newline at end of file
diff --git a/app/components/live-participants.js b/app/components/live-participants.js
new file mode 100644
index 000000000..0231794c7
--- /dev/null
+++ b/app/components/live-participants.js
@@ -0,0 +1,14 @@
+import Component from '@glimmer/component';
+import { ROLES } from '../constants/live';
+import { getOwner } from '@ember/application';
+import { tracked } from '@glimmer/tracking';
+
+export default class LiveParticipantsComponent extends Component {
+ @tracked is
+ ROLES = ROLES;
+ peersLength = 1;
+
+ get liveService() {
+ return getOwner(this).lookup('service:live');
+ }
+}
diff --git a/app/components/live-sidebar.hbs b/app/components/live-sidebar.hbs
index 95142af69..6da86ad7b 100644
--- a/app/components/live-sidebar.hbs
+++ b/app/components/live-sidebar.hbs
@@ -40,36 +40,23 @@
{{/each}}
is presenting
-
-
Guest Users
-
-
- {{#each @peers as |peer|}}
- {{#if (eq peer.roleName this.ROLES.guest)}}
- -
-
{{peer.name}}
- {{#if (eq this.liveService.localPeer.roleName this.ROLES.host)}}
-
- {{/if}}
-
- {{/if}}
- {{/each}}
-
-
+
+
+
\ No newline at end of file
diff --git a/app/components/live-sidebar.js b/app/components/live-sidebar.js
index 9ebce74ab..ded0b623c 100644
--- a/app/components/live-sidebar.js
+++ b/app/components/live-sidebar.js
@@ -7,6 +7,9 @@ import { getOwner } from '@ember/application';
export default class LiveHeaderComponent extends Component {
@tracked isSideBarOpen = false;
ROLES = ROLES;
+ constructor(...args) {
+ super(...args);
+ }
get liveService() {
return getOwner(this).lookup('service:live');
}
diff --git a/tests/integration/components/live-participants-test.js b/tests/integration/components/live-participants-test.js
new file mode 100644
index 000000000..ae74b1b91
--- /dev/null
+++ b/tests/integration/components/live-participants-test.js
@@ -0,0 +1,26 @@
+import { module, test } from 'qunit';
+import { setupRenderingTest } from 'website-www/tests/helpers';
+import { render } from '@ember/test-helpers';
+import { hbs } from 'ember-cli-htmlbars';
+
+module('Integration | Component | live-participants', function (hooks) {
+ setupRenderingTest(hooks);
+
+ test('it renders', async function (assert) {
+ // Set any properties with this.set('myProperty', 'value');
+ // Handle any actions with this.set('myAction', function(val) { ... });
+
+ await render(hbs``);
+
+ assert.dom(this.element).hasText('');
+
+ // Template block usage:
+ await render(hbs`
+
+ template block text
+
+ `);
+
+ assert.dom(this.element).hasText('template block text');
+ });
+});
From c8379829000a47b8b6705dc1775fa4b92ecdc090 Mon Sep 17 00:00:00 2001
From: Pratiyush Kumar
Date: Sat, 26 Aug 2023 21:55:56 +0530
Subject: [PATCH 02/16] feature and testing ready
---
app/components/live-participants.hbs | 40 +---
app/components/live-participants.js | 5 +-
app/components/live-sidebar.hbs | 3 +
app/components/live-sidebar.js | 10 +-
app/services/live.js | 10 +
.../components/live-participants-test.js | 196 ++++++++++++++++--
.../components/live-sidebar-test.js | 14 +-
7 files changed, 209 insertions(+), 69 deletions(-)
diff --git a/app/components/live-participants.hbs b/app/components/live-participants.hbs
index f301eaa22..7836d9d4a 100644
--- a/app/components/live-participants.hbs
+++ b/app/components/live-participants.hbs
@@ -4,40 +4,13 @@
class='role-user__type guestUsers'
>{{@user}}
\ No newline at end of file
diff --git a/app/components/live-participants.js b/app/components/live-participants.js
index 0231794c7..e5152428c 100644
--- a/app/components/live-participants.js
+++ b/app/components/live-participants.js
@@ -1,12 +1,11 @@
import Component from '@glimmer/component';
import { ROLES } from '../constants/live';
import { getOwner } from '@ember/application';
-import { tracked } from '@glimmer/tracking';
+import { inject as service } from '@ember/service';
export default class LiveParticipantsComponent extends Component {
- @tracked is
+ @service live;
ROLES = ROLES;
- peersLength = 1;
get liveService() {
return getOwner(this).lookup('service:live');
diff --git a/app/components/live-sidebar.hbs b/app/components/live-sidebar.hbs
index 6da86ad7b..3138eaa1e 100644
--- a/app/components/live-sidebar.hbs
+++ b/app/components/live-sidebar.hbs
@@ -44,18 +44,21 @@
@user='Mavens'
@role='maven'
@peers={{@peers}}
+ @minimumParticipants={{this.liveService.isAnyMavenPresent}}
@openKickoutModal={{@openKickoutModal}}
/>
diff --git a/app/components/live-sidebar.js b/app/components/live-sidebar.js
index ded0b623c..1606cf220 100644
--- a/app/components/live-sidebar.js
+++ b/app/components/live-sidebar.js
@@ -3,17 +3,21 @@ import { action } from '@ember/object';
import { tracked } from '@glimmer/tracking';
import { ROLES } from '../constants/live';
import { getOwner } from '@ember/application';
+import { inject as service } from '@ember/service';
export default class LiveHeaderComponent extends Component {
+ @service live;
@tracked isSideBarOpen = false;
ROLES = ROLES;
constructor(...args) {
super(...args);
}
- get liveService() {
- return getOwner(this).lookup('service:live');
- }
+
@action toggleMobileSidebar() {
this.isSideBarOpen = !this.isSideBarOpen;
}
+
+ get liveService() {
+ return getOwner(this).lookup('service:live');
+ }
}
diff --git a/app/services/live.js b/app/services/live.js
index cf9c2f2c2..5a072e1c0 100644
--- a/app/services/live.js
+++ b/app/services/live.js
@@ -25,6 +25,9 @@ export default class LiveService extends Service {
@globalRef('videoEl') videoEl;
@tracked peers;
@tracked isScreenShareOn;
+ @tracked isAnyMavenPresent = '';
+ @tracked isAnyModeratorPresent = '';
+ @tracked isAnyGuestPresent = '';
constructor() {
super(...arguments);
@@ -209,6 +212,13 @@ export default class LiveService extends Service {
async renderScreenVideoToPeers(peers) {
this.peers = peers;
+ const maven = peers.find((peer) => peer.roleName === ROLES.maven);
+ const moderator = peers.find((peer) => peer.roleName === ROLES.moderator);
+ const guest = peers.find((peer) => peer.roleName === ROLES.guest);
+ this.isAnyMavenPresent = maven?.roleName;
+ this.isAnyModeratorPresent = moderator?.roleName;
+ this.isAnyGuestPresent = guest?.roleName;
+
const presenterTrackId = peers?.find((p) => p.roleName === ROLES.host)
?.auxiliaryTracks[0];
if (presenterTrackId) {
diff --git a/tests/integration/components/live-participants-test.js b/tests/integration/components/live-participants-test.js
index ae74b1b91..0def6139e 100644
--- a/tests/integration/components/live-participants-test.js
+++ b/tests/integration/components/live-participants-test.js
@@ -5,22 +5,184 @@ import { hbs } from 'ember-cli-htmlbars';
module('Integration | Component | live-participants', function (hooks) {
setupRenderingTest(hooks);
-
- test('it renders', async function (assert) {
- // Set any properties with this.set('myProperty', 'value');
- // Handle any actions with this.set('myAction', function(val) { ... });
-
- await render(hbs``);
-
- assert.dom(this.element).hasText('');
-
- // Template block usage:
- await render(hbs`
-
- template block text
-
- `);
-
- assert.dom(this.element).hasText('template block text');
+ test('renders No Maven In the stream Text', async function (assert) {
+ this.setProperties({
+ peers: [
+ {
+ id: 1,
+ name: 'Ankush',
+ roleName: 'host',
+ },
+ ],
+ profilePic: 'profilepicurl',
+ isKickoutModalOpen: true,
+ });
+ this.set('openKickoutModal', () => {
+ this.isKickoutModalOpen = true;
+ });
+ await render(hbs``);
+ assert
+ .dom('[data-test-sidebar-body-role] .user')
+ .hasText('No Mavens in the stream');
+ });
+ test('renders No Moderators In the stream Text', async function (assert) {
+ this.setProperties({
+ peers: [
+ {
+ id: 1,
+ name: 'Ankush',
+ roleName: 'host',
+ },
+ ],
+ profilePic: 'profilepicurl',
+ isKickoutModalOpen: true,
+ });
+ this.set('openKickoutModal', () => {
+ this.isKickoutModalOpen = true;
+ });
+ await render(hbs` `);
+ assert
+ .dom('[data-test-sidebar-body-role] .user')
+ .hasText('No Moderators in the stream');
+ });
+ test('renders No Guests In the stream Text', async function (assert) {
+ this.setProperties({
+ peers: [
+ {
+ id: 1,
+ name: 'Ankush',
+ roleName: 'host',
+ },
+ ],
+ profilePic: 'profilepicurl',
+ isKickoutModalOpen: true,
+ });
+ this.set('openKickoutModal', () => {
+ this.isKickoutModalOpen = true;
+ });
+ await render(hbs` `);
+ assert
+ .dom('[data-test-sidebar-body-role] .user')
+ .hasText('No Guests in the stream');
+ });
+ test('renders Mavens Lists who joined Stream', async function (assert) {
+ this.setProperties({
+ peers: [
+ {
+ id: 1,
+ name: 'Ankush',
+ roleName: 'host',
+ },
+ {
+ id: 2,
+ name: 'Maven1',
+ roleName: 'maven',
+ },
+ {
+ id: 3,
+ name: 'Maven2',
+ roleName: 'maven',
+ },
+ ],
+ profilePic: 'profilepicurl',
+ isKickoutModalOpen: true,
+ });
+ this.set('openKickoutModal', () => {
+ this.isKickoutModalOpen = true;
+ });
+ await render(hbs``);
+ assert.dom('[data-test-sidebar-user="2"]').hasText('Maven1');
+ });
+ test('renders Moderators Lists who joined Stream', async function (assert) {
+ this.setProperties({
+ peers: [
+ {
+ id: 1,
+ name: 'Ankush',
+ roleName: 'host',
+ },
+ {
+ id: 2,
+ name: 'Mod1',
+ roleName: 'moderator',
+ },
+ {
+ id: 3,
+ name: 'Mod3',
+ roleName: 'moderator',
+ },
+ ],
+ profilePic: 'profilepicurl',
+ isKickoutModalOpen: true,
+ });
+ this.set('openKickoutModal', () => {
+ this.isKickoutModalOpen = true;
+ });
+ await render(hbs``);
+ assert.dom('[data-test-sidebar-user="3"]').hasText('Mod3');
+ });
+ test('renders Guests Lists who joined Stream', async function (assert) {
+ this.setProperties({
+ peers: [
+ {
+ id: 1,
+ name: 'Ankush',
+ roleName: 'host',
+ },
+ {
+ id: 2,
+ name: 'Guest1',
+ roleName: 'guest',
+ },
+ {
+ id: 3,
+ name: 'Guest2',
+ roleName: 'guest',
+ },
+ ],
+ profilePic: 'profilepicurl',
+ isKickoutModalOpen: true,
+ });
+ this.set('openKickoutModal', () => {
+ this.isKickoutModalOpen = true;
+ });
+ await render(hbs``);
+ assert.dom('[data-test-sidebar-user="3"]').hasText('Guest2');
});
});
diff --git a/tests/integration/components/live-sidebar-test.js b/tests/integration/components/live-sidebar-test.js
index 5b7f66e9e..af38530ca 100644
--- a/tests/integration/components/live-sidebar-test.js
+++ b/tests/integration/components/live-sidebar-test.js
@@ -7,7 +7,7 @@ module('Integration | Component | live-sidebar', function (hooks) {
setupRenderingTest(hooks);
test('live-sidebar renders', async function (assert) {
- assert.expect(17);
+ assert.expect(12);
this.setProperties({
peers: [
{
@@ -48,17 +48,5 @@ module('Integration | Component | live-sidebar', function (hooks) {
assert.dom('[data-test-sidebar-host-name]').exists();
assert.dom('[data-test-sidebar-host-name]').hasText('Ankush is presenting');
-
- assert.dom('[data-test-sidebar-body-role]').exists();
-
- assert.dom('[data-test-sidebar-body-role-guest]').exists();
- assert.dom('[data-test-sidebar-body-role-guest]').hasText('Guest Users');
-
- assert.dom('[data-test-sidebar-user="2"]').exists();
- assert.strictEqual(
- document.querySelector(`[data-test-sidebar-user="2"]`).innerText,
- this.peers[1].name,
- 'guest name is same!'
- );
});
});
From 9bf26688a76af52ba022b07a4b15f1adf911f2e4 Mon Sep 17 00:00:00 2001
From: Pratiyush Kumar
Date: Sun, 27 Aug 2023 14:43:50 +0530
Subject: [PATCH 03/16] changes done in testing
---
app/components/live-sidebar.hbs | 6 +-
app/services/live.js | 12 +--
tests/constants/participants-data.js | 61 ++++++++++++++
.../components/live-participants-test.js | 84 +++----------------
4 files changed, 82 insertions(+), 81 deletions(-)
create mode 100644 tests/constants/participants-data.js
diff --git a/app/components/live-sidebar.hbs b/app/components/live-sidebar.hbs
index 3138eaa1e..f8ff6b5a9 100644
--- a/app/components/live-sidebar.hbs
+++ b/app/components/live-sidebar.hbs
@@ -44,21 +44,21 @@
@user='Mavens'
@role='maven'
@peers={{@peers}}
- @minimumParticipants={{this.liveService.isAnyMavenPresent}}
+ @minimumParticipants={{this.liveService.mavenRole}}
@openKickoutModal={{@openKickoutModal}}
/>
diff --git a/app/services/live.js b/app/services/live.js
index ee4c7d45a..76058de04 100644
--- a/app/services/live.js
+++ b/app/services/live.js
@@ -30,9 +30,9 @@ export default class LiveService extends Service {
@globalRef('videoEl') videoEl;
@tracked peers;
@tracked isScreenShareOn;
- @tracked isAnyMavenPresent = '';
- @tracked isAnyModeratorPresent = '';
- @tracked isAnyGuestPresent = '';
+ @tracked mavenRole = '';
+ @tracked moderatorRole = '';
+ @tracked guestRole = '';
@tracked roomCodesForMaven = [];
@tracked roomCodeLoading = false;
@@ -303,9 +303,9 @@ export default class LiveService extends Service {
const maven = peers.find((peer) => peer.roleName === ROLES.maven);
const moderator = peers.find((peer) => peer.roleName === ROLES.moderator);
const guest = peers.find((peer) => peer.roleName === ROLES.guest);
- this.isAnyMavenPresent = maven?.roleName;
- this.isAnyModeratorPresent = moderator?.roleName;
- this.isAnyGuestPresent = guest?.roleName;
+ this.mavenRole = maven?.roleName;
+ this.moderatorRole = moderator?.roleName;
+ this.guestRole = guest?.roleName;
const presenterTrackId = peers?.find((p) => p.roleName === ROLES.host)
?.auxiliaryTracks[0];
diff --git a/tests/constants/participants-data.js b/tests/constants/participants-data.js
new file mode 100644
index 000000000..58312fccc
--- /dev/null
+++ b/tests/constants/participants-data.js
@@ -0,0 +1,61 @@
+export const hostPeer = [
+ {
+ id: 1,
+ name: 'Ankush',
+ roleName: 'host',
+ },
+];
+
+export const mavenPeerData = [
+ {
+ id: 1,
+ name: 'Ankush',
+ roleName: 'host',
+ },
+ {
+ id: 2,
+ name: 'Maven1',
+ roleName: 'maven',
+ },
+ {
+ id: 3,
+ name: 'Maven2',
+ roleName: 'maven',
+ },
+];
+
+export const moderatorData = [
+ {
+ id: 1,
+ name: 'Ankush',
+ roleName: 'host',
+ },
+ {
+ id: 2,
+ name: 'Mod1',
+ roleName: 'moderator',
+ },
+ {
+ id: 3,
+ name: 'Mod3',
+ roleName: 'moderator',
+ },
+];
+
+export const guestData = [
+ {
+ id: 1,
+ name: 'Ankush',
+ roleName: 'host',
+ },
+ {
+ id: 2,
+ name: 'Guest1',
+ roleName: 'guest',
+ },
+ {
+ id: 3,
+ name: 'Guest2',
+ roleName: 'guest',
+ },
+];
diff --git a/tests/integration/components/live-participants-test.js b/tests/integration/components/live-participants-test.js
index 0def6139e..a071ee495 100644
--- a/tests/integration/components/live-participants-test.js
+++ b/tests/integration/components/live-participants-test.js
@@ -2,18 +2,18 @@ import { module, test } from 'qunit';
import { setupRenderingTest } from 'website-www/tests/helpers';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
+import {
+ hostPeer,
+ mavenPeerData,
+ moderatorData,
+ guestData,
+} from '../../constants/participants-data';
module('Integration | Component | live-participants', function (hooks) {
setupRenderingTest(hooks);
test('renders No Maven In the stream Text', async function (assert) {
this.setProperties({
- peers: [
- {
- id: 1,
- name: 'Ankush',
- roleName: 'host',
- },
- ],
+ peers: hostPeer,
profilePic: 'profilepicurl',
isKickoutModalOpen: true,
});
@@ -33,13 +33,7 @@ module('Integration | Component | live-participants', function (hooks) {
});
test('renders No Moderators In the stream Text', async function (assert) {
this.setProperties({
- peers: [
- {
- id: 1,
- name: 'Ankush',
- roleName: 'host',
- },
- ],
+ peers: hostPeer,
profilePic: 'profilepicurl',
isKickoutModalOpen: true,
});
@@ -59,13 +53,7 @@ module('Integration | Component | live-participants', function (hooks) {
});
test('renders No Guests In the stream Text', async function (assert) {
this.setProperties({
- peers: [
- {
- id: 1,
- name: 'Ankush',
- roleName: 'host',
- },
- ],
+ peers: hostPeer,
profilePic: 'profilepicurl',
isKickoutModalOpen: true,
});
@@ -85,23 +73,7 @@ module('Integration | Component | live-participants', function (hooks) {
});
test('renders Mavens Lists who joined Stream', async function (assert) {
this.setProperties({
- peers: [
- {
- id: 1,
- name: 'Ankush',
- roleName: 'host',
- },
- {
- id: 2,
- name: 'Maven1',
- roleName: 'maven',
- },
- {
- id: 3,
- name: 'Maven2',
- roleName: 'maven',
- },
- ],
+ peers: mavenPeerData,
profilePic: 'profilepicurl',
isKickoutModalOpen: true,
});
@@ -119,23 +91,7 @@ module('Integration | Component | live-participants', function (hooks) {
});
test('renders Moderators Lists who joined Stream', async function (assert) {
this.setProperties({
- peers: [
- {
- id: 1,
- name: 'Ankush',
- roleName: 'host',
- },
- {
- id: 2,
- name: 'Mod1',
- roleName: 'moderator',
- },
- {
- id: 3,
- name: 'Mod3',
- roleName: 'moderator',
- },
- ],
+ peers: moderatorData,
profilePic: 'profilepicurl',
isKickoutModalOpen: true,
});
@@ -153,23 +109,7 @@ module('Integration | Component | live-participants', function (hooks) {
});
test('renders Guests Lists who joined Stream', async function (assert) {
this.setProperties({
- peers: [
- {
- id: 1,
- name: 'Ankush',
- roleName: 'host',
- },
- {
- id: 2,
- name: 'Guest1',
- roleName: 'guest',
- },
- {
- id: 3,
- name: 'Guest2',
- roleName: 'guest',
- },
- ],
+ peers: guestData,
profilePic: 'profilepicurl',
isKickoutModalOpen: true,
});
From 67551fb48155d8318613cc2ce4e35733faf9d570 Mon Sep 17 00:00:00 2001
From: Pratiyush Kumar
Date: Sun, 27 Aug 2023 17:40:46 +0530
Subject: [PATCH 04/16] adding one loop for multiple roleNames
---
app/services/live.js | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/app/services/live.js b/app/services/live.js
index 76058de04..2d4694af1 100644
--- a/app/services/live.js
+++ b/app/services/live.js
@@ -300,9 +300,16 @@ export default class LiveService extends Service {
async renderScreenVideoToPeers(peers) {
this.peers = peers;
- const maven = peers.find((peer) => peer.roleName === ROLES.maven);
- const moderator = peers.find((peer) => peer.roleName === ROLES.moderator);
- const guest = peers.find((peer) => peer.roleName === ROLES.guest);
+ const rolesToFind = [ROLES.maven, ROLES.moderator, ROLES.guest];
+ const foundPeers = {};
+
+ for (const roleName of rolesToFind) {
+ foundPeers[roleName] = peers.find((peer) => peer.roleName === roleName);
+ }
+
+ const maven = foundPeers[ROLES.maven];
+ const moderator = foundPeers[ROLES.moderator];
+ const guest = foundPeers[ROLES.guest];
this.mavenRole = maven?.roleName;
this.moderatorRole = moderator?.roleName;
this.guestRole = guest?.roleName;
From 7d6586cf1944294aaac9480acd244ad012b152a4 Mon Sep 17 00:00:00 2001
From: Pratiyush Kumar
Date: Mon, 28 Aug 2023 00:30:50 +0530
Subject: [PATCH 05/16] removed unwanted lines from code and gave some spaces
between the test cases
---
app/components/live-participants.js | 2 --
app/components/live-sidebar.js | 5 -----
tests/integration/components/live-participants-test.js | 5 +++++
3 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/app/components/live-participants.js b/app/components/live-participants.js
index e5152428c..b7cea4baf 100644
--- a/app/components/live-participants.js
+++ b/app/components/live-participants.js
@@ -1,10 +1,8 @@
import Component from '@glimmer/component';
import { ROLES } from '../constants/live';
import { getOwner } from '@ember/application';
-import { inject as service } from '@ember/service';
export default class LiveParticipantsComponent extends Component {
- @service live;
ROLES = ROLES;
get liveService() {
diff --git a/app/components/live-sidebar.js b/app/components/live-sidebar.js
index 1606cf220..974100184 100644
--- a/app/components/live-sidebar.js
+++ b/app/components/live-sidebar.js
@@ -3,15 +3,10 @@ import { action } from '@ember/object';
import { tracked } from '@glimmer/tracking';
import { ROLES } from '../constants/live';
import { getOwner } from '@ember/application';
-import { inject as service } from '@ember/service';
export default class LiveHeaderComponent extends Component {
- @service live;
@tracked isSideBarOpen = false;
ROLES = ROLES;
- constructor(...args) {
- super(...args);
- }
@action toggleMobileSidebar() {
this.isSideBarOpen = !this.isSideBarOpen;
diff --git a/tests/integration/components/live-participants-test.js b/tests/integration/components/live-participants-test.js
index a071ee495..a4ea75b5c 100644
--- a/tests/integration/components/live-participants-test.js
+++ b/tests/integration/components/live-participants-test.js
@@ -31,6 +31,7 @@ module('Integration | Component | live-participants', function (hooks) {
.dom('[data-test-sidebar-body-role] .user')
.hasText('No Mavens in the stream');
});
+
test('renders No Moderators In the stream Text', async function (assert) {
this.setProperties({
peers: hostPeer,
@@ -51,6 +52,7 @@ module('Integration | Component | live-participants', function (hooks) {
.dom('[data-test-sidebar-body-role] .user')
.hasText('No Moderators in the stream');
});
+
test('renders No Guests In the stream Text', async function (assert) {
this.setProperties({
peers: hostPeer,
@@ -71,6 +73,7 @@ module('Integration | Component | live-participants', function (hooks) {
.dom('[data-test-sidebar-body-role] .user')
.hasText('No Guests in the stream');
});
+
test('renders Mavens Lists who joined Stream', async function (assert) {
this.setProperties({
peers: mavenPeerData,
@@ -89,6 +92,7 @@ module('Integration | Component | live-participants', function (hooks) {
/>`);
assert.dom('[data-test-sidebar-user="2"]').hasText('Maven1');
});
+
test('renders Moderators Lists who joined Stream', async function (assert) {
this.setProperties({
peers: moderatorData,
@@ -107,6 +111,7 @@ module('Integration | Component | live-participants', function (hooks) {
/>`);
assert.dom('[data-test-sidebar-user="3"]').hasText('Mod3');
});
+
test('renders Guests Lists who joined Stream', async function (assert) {
this.setProperties({
peers: guestData,
From 24d567b005eff107007d4a5fba400fa616b6e563 Mon Sep 17 00:00:00 2001
From: Pratiyush Kumar
Date: Mon, 28 Aug 2023 02:07:24 +0530
Subject: [PATCH 06/16] added the findby method again
---
app/services/live.js | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/app/services/live.js b/app/services/live.js
index 2d4694af1..76058de04 100644
--- a/app/services/live.js
+++ b/app/services/live.js
@@ -300,16 +300,9 @@ export default class LiveService extends Service {
async renderScreenVideoToPeers(peers) {
this.peers = peers;
- const rolesToFind = [ROLES.maven, ROLES.moderator, ROLES.guest];
- const foundPeers = {};
-
- for (const roleName of rolesToFind) {
- foundPeers[roleName] = peers.find((peer) => peer.roleName === roleName);
- }
-
- const maven = foundPeers[ROLES.maven];
- const moderator = foundPeers[ROLES.moderator];
- const guest = foundPeers[ROLES.guest];
+ const maven = peers.find((peer) => peer.roleName === ROLES.maven);
+ const moderator = peers.find((peer) => peer.roleName === ROLES.moderator);
+ const guest = peers.find((peer) => peer.roleName === ROLES.guest);
this.mavenRole = maven?.roleName;
this.moderatorRole = moderator?.roleName;
this.guestRole = guest?.roleName;
From 4f82c314c2aeea685ab2298495ad12af2f443ea0 Mon Sep 17 00:00:00 2001
From: Pratiyush Kumar
Date: Wed, 30 Aug 2023 07:27:51 +0530
Subject: [PATCH 07/16] made sidebar collapsible
---
app/components/live-sidebar.hbs | 13 ++++++++--
app/components/live-sidebar.js | 4 +++
app/controllers/live.js | 5 ++++
app/styles/live-sidebar.module.css | 41 +++++++++++++++++++++++++++++-
app/styles/live.module.css | 17 ++++++++++---
app/templates/live.hbs | 18 +++++++++++--
6 files changed, 90 insertions(+), 8 deletions(-)
diff --git a/app/components/live-sidebar.hbs b/app/components/live-sidebar.hbs
index 95142af69..0f6f0c026 100644
--- a/app/components/live-sidebar.hbs
+++ b/app/components/live-sidebar.hbs
@@ -1,6 +1,15 @@
-