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

[Live-Site] - make sidebar collapsible #720

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
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
11 changes: 11 additions & 0 deletions app/components/live-panel.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
<div class='live-panel' data-test-live-panel>
<Reusables::IconButton
@id='toggle-panel'
@class='icon-button--md icon__sidebar__toggle'
@title='toggle sidebar panel'
@onClick={{@sidebarDisplayToggle}}
@icon={{if
@isExpanded
'material-symbols:fullscreen-exit'
'material-symbols:fullscreen'
}}
/>
{{#if (eq @role this.ROLES.host)}}
<Reusables::IconButton
@id='screen-share'
Expand Down
21 changes: 18 additions & 3 deletions app/components/live-sidebar.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
<div data-test-sidebar class='sidebar {{if this.isSideBarOpen "open" "close"}}'>
<div data-test-sidebar-participants class='sidebar__participants'>
<h4>Participants</h4>
<div
data-test-sidebar
class='sidebar
{{if this.isSideBarOpen "open" "close"}}
{{if @isExpanded "sidebar--closes" "sidebar--opens"}}'
>
<div
data-test-sidebar-participants
class='sidebar__participants
{{if
@isExpanded
"sidebar__participants--hide"
"sidebar__participants--open"
}}'
>
<h4
class='{{if @isExpanded "participants__heading--hide" ""}}'
>Participants</h4>
<button
data-test-sidebar-button
class='sidebar__accordian-button'
Expand Down
6 changes: 6 additions & 0 deletions app/controllers/live.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,17 @@ export default class LiveController extends Controller {
@tracked newRoomCode = '';
@tracked isActiveEventFound;
@tracked buttonText = '';
@tracked isExpanded = false;

@globalRef('videoEl') videoEl;
get liveService() {
return getOwner(this).lookup('service:live');
}

@action sidebarDisplayToggle() {
this.isExpanded = !this.isExpanded;
}

constructor() {
super(...arguments);
setTimeout(() => {
Expand Down
29 changes: 26 additions & 3 deletions app/styles/live-sidebar.module.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.sidebar {
padding: 1rem 0;
width: 100%;
width: 0%;
background-color: var(--color-sidebar);
height: 100%;
z-index: 2;
Expand All @@ -11,6 +11,30 @@
box-sizing: border-box;
}

.sidebar--opens {
width: 90%;
}

.sidebar--closes {
width: 0%;
}

.sidebar__participants--hide {
display: none;
}

.sidebar__participants--open {
display: flex;
}

.participants__heading--hide {
display: none;
}

.participantsHeadingHide {
display: block;
}

.sidebar__accordian-button {
all: unset;
display: none;
Expand All @@ -33,7 +57,6 @@

.sidebar__participants {
width: 90%;
display: flex;
justify-content: center;
align-items: center;
background: var(--color-white);
Expand Down Expand Up @@ -250,4 +273,4 @@
.self {
border: 3px solid var(--color-pink);
background: var(--color-pink-low-opacity);
}
}
15 changes: 14 additions & 1 deletion app/styles/live.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,22 @@
aspect-ratio: 16/9;
}

.live__video-container--show {
width: 100%;
aspect-ratio: 16/9;
}

.container__sidebar {
display: flex;
width: 28%;
width: 0%;
}

.container__sidebar--show {
width: 28%;
}

.container__sidebar--hide {
width: 0%;
}

.live__panel-container {
Expand Down
16 changes: 14 additions & 2 deletions app/templates/live.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@
<div class='live__container'>
<div
class='live__video-container
{{if this.liveService.isScreenShareOn "bg-black" ""}}'
{{if this.liveService.isScreenShareOn "bg-black" ""}}
{{if this.isExpanded "live__video-container--show" ""}}'
data-test-video-container
>
{{! TODO - add skeleton to the whole structure }}
Expand All @@ -72,14 +73,23 @@
<VideoScreen @src='/assets/starting-soon.mp4' />
{{/if}}
</div>
<div class='container__sidebar'>
<div
class='container__sidebar
{{if
this.isExpanded
"container__sidebar--hide"
"container__sidebar--show"
}}'
>
{{#if this.isLoading}}
<Reusables::Skeleton />
{{else}}
<LiveSidebar
@openKickoutModal={{this.openKickoutModal}}
@peers={{this.liveService.peers}}
@peerToRemove={{this.peerToRemove}}
@sidebarDisplayToggle={{this.sidebarDisplayToggle}}
@isExpanded={{this.isExpanded}}
/>
{{/if}}
</div>
Expand All @@ -95,6 +105,8 @@
@buttonClickHandler={{this.buttonClickHandler}}
@openRoomCodeModal={{this.toggleRoomCodeModal}}
@openWarningModal={{this.toggleWarningModal}}
@sidebarDisplayToggle={{this.sidebarDisplayToggle}}
@isExpanded={{this.isExpanded}}
/>
{{/if}}
</div>
Expand Down
9 changes: 8 additions & 1 deletion tests/integration/components/live-panel-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@ module('Integration | Component | live-panel', function (hooks) {
assert.expect(10);
this.set('buttonClickHandler', () => {});
this.set('toggleRoomCodeModal', () => {});
this.set('sidebarDisplayToggle', () => {});
this.set('role', 'guest');
this.set('expanded', true);

await render(
hbs`<LivePanel @buttonClickHandler={{this.buttonClickHandler}} @role={{this.role}} @openRoomCodeModal={{this.toggleRoomCodeModal}}/>`
hbs`<LivePanel @buttonClickHandler={{this.buttonClickHandler}} @role={{this.role}} @openRoomCodeModal={{this.toggleRoomCodeModal}} @sidebarDisplayToggle={{this.sidebarDisplayToggle}}
@isExpanded={{this.isExpanded}}/>`
);

assert.dom('[data-test-live-panel]').exists();
Expand All @@ -40,17 +43,21 @@ module('Integration | Component | live-panel', function (hooks) {
};
this.set('buttonClickHandler', () => {});
this.set('toggleRoomCodeModal', () => {});
this.set('sidebarDisplayToggle', () => {});
this.set('toggleWarningModal', () => {
objToCheckFunctions.isOpenWarningModalWorks = true;
});
this.set('role', 'host');
this.set('expanded', true);

await render(
hbs`<LivePanel
@buttonClickHandler={{this.buttonClickHandler}}
@role={{this.role}}
@openRoomCodeModal={{this.toggleRoomCodeModal}}
@openWarningModal={{this.toggleWarningModal}}
@sidebarDisplayToggle={{this.sidebarDisplayToggle}}
@isExpanded={{this.isExpanded}}
/>`
);

Expand Down
Loading