indicator of left side drawer is added
This commit is contained in:
parent
0f51d458e0
commit
c17eb2a2fa
@ -64,12 +64,3 @@
|
|||||||
(buttonClick)="onClickFab($event)"
|
(buttonClick)="onClickFab($event)"
|
||||||
></ucap-float-action-button>
|
></ucap-float-action-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button
|
|
||||||
mat-icon-button
|
|
||||||
class="left-drawer-toggle"
|
|
||||||
*ngIf="showLeftDrawerToggle"
|
|
||||||
(click)="onClickLeftDrawerToggle()"
|
|
||||||
>
|
|
||||||
<mat-icon>settings</mat-icon>
|
|
||||||
</button>
|
|
||||||
|
@ -100,8 +100,6 @@ export class LeftSideComponent implements OnInit, OnDestroy {
|
|||||||
loginRes: LoginResponse;
|
loginRes: LoginResponse;
|
||||||
loginResSubscription: Subscription;
|
loginResSubscription: Subscription;
|
||||||
|
|
||||||
showLeftDrawerToggle = false;
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private store: Store<any>,
|
private store: Store<any>,
|
||||||
private dialogService: DialogService,
|
private dialogService: DialogService,
|
||||||
@ -203,17 +201,32 @@ export class LeftSideComponent implements OnInit, OnDestroy {
|
|||||||
event.pageY <= maxY
|
event.pageY <= maxY
|
||||||
) {
|
) {
|
||||||
this.logger.debug('mouseOver edge of container');
|
this.logger.debug('mouseOver edge of container');
|
||||||
this.showLeftDrawerToggle = true;
|
this.store.dispatch(
|
||||||
|
ChatStore.toggleLeftSideDrawerIndicator({ show: true })
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@HostListener('mouseleave', ['$event'])
|
@HostListener('mouseleave', ['$event'])
|
||||||
mouseLeave(event: MouseEvent) {
|
mouseLeave(event: MouseEvent) {
|
||||||
this.showLeftDrawerToggle = false;
|
const rect = this.leftSideContainer.nativeElement.getBoundingClientRect();
|
||||||
}
|
|
||||||
|
|
||||||
onClickLeftDrawerToggle() {
|
const minX = rect.left;
|
||||||
this.store.dispatch(ChatStore.toggleLeftSideDrawer());
|
const maxX = rect.left + rect.width + 5;
|
||||||
|
const minY = rect.top;
|
||||||
|
const maxY = rect.top + rect.height;
|
||||||
|
|
||||||
|
if (
|
||||||
|
event.pageX >= minX &&
|
||||||
|
event.pageX <= maxX &&
|
||||||
|
event.pageY >= minY &&
|
||||||
|
event.pageY <= maxY
|
||||||
|
) {
|
||||||
|
} else {
|
||||||
|
this.store.dispatch(
|
||||||
|
ChatStore.toggleLeftSideDrawerIndicator({ show: false })
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async onClickNewChat(type: string = 'NORMAL') {
|
async onClickNewChat(type: string = 'NORMAL') {
|
||||||
|
@ -12,6 +12,15 @@
|
|||||||
></app-layout-messenger-left-side>
|
></app-layout-messenger-left-side>
|
||||||
</mat-drawer>
|
</mat-drawer>
|
||||||
<div class="chat-messages">
|
<div class="chat-messages">
|
||||||
|
<button
|
||||||
|
mat-icon-button
|
||||||
|
class="left-drawer-toggle"
|
||||||
|
*ngIf="!showLeftDrawer || showLeftDrawerIndicator"
|
||||||
|
(click)="onClickLeftDrawerToggle()"
|
||||||
|
>
|
||||||
|
<mat-icon>settings</mat-icon>
|
||||||
|
</button>
|
||||||
|
|
||||||
<app-layout-messenger-intro
|
<app-layout-messenger-intro
|
||||||
*ngIf="!(this.selectedChat$ | async)"
|
*ngIf="!(this.selectedChat$ | async)"
|
||||||
></app-layout-messenger-intro>
|
></app-layout-messenger-intro>
|
||||||
|
@ -48,3 +48,8 @@
|
|||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
justify-content: space-around;
|
justify-content: space-around;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.left-drawer-toggle {
|
||||||
|
position: absolute;
|
||||||
|
top: calc(50% - 20px);
|
||||||
|
}
|
||||||
|
@ -55,6 +55,9 @@ import { TranslateService } from '@ngx-translate/core';
|
|||||||
styleUrls: ['./main.page.component.scss']
|
styleUrls: ['./main.page.component.scss']
|
||||||
})
|
})
|
||||||
export class MainPageComponent implements OnInit, OnDestroy {
|
export class MainPageComponent implements OnInit, OnDestroy {
|
||||||
|
@ViewChild('rightDrawer', { static: true }) rightDrawer: MatDrawer;
|
||||||
|
@ViewChild('leftSideDrawer', { static: true }) leftSideDrawer: MatDrawer;
|
||||||
|
|
||||||
selectedChat$: Observable<string | null>;
|
selectedChat$: Observable<string | null>;
|
||||||
selectedRightDrawer$: Observable<string | null>;
|
selectedRightDrawer$: Observable<string | null>;
|
||||||
idleStateChangedSubscription: Subscription;
|
idleStateChangedSubscription: Subscription;
|
||||||
@ -62,6 +65,7 @@ export class MainPageComponent implements OnInit, OnDestroy {
|
|||||||
msgOpenMessageSubscription: Subscription;
|
msgOpenMessageSubscription: Subscription;
|
||||||
myIdleCheckTimeSubscription: Subscription;
|
myIdleCheckTimeSubscription: Subscription;
|
||||||
leftSideDrawerSubscription: Subscription;
|
leftSideDrawerSubscription: Subscription;
|
||||||
|
leftSideDrawerIndicatorSubscription: Subscription;
|
||||||
|
|
||||||
defaultLeftSideComponentWidth = 380;
|
defaultLeftSideComponentWidth = 380;
|
||||||
leftSideComponentWidth = this.defaultLeftSideComponentWidth;
|
leftSideComponentWidth = this.defaultLeftSideComponentWidth;
|
||||||
@ -70,8 +74,8 @@ export class MainPageComponent implements OnInit, OnDestroy {
|
|||||||
loginResSubscription: Subscription;
|
loginResSubscription: Subscription;
|
||||||
environmentsInfo: EnvironmentsInfo;
|
environmentsInfo: EnvironmentsInfo;
|
||||||
|
|
||||||
@ViewChild('rightDrawer', { static: true }) rightDrawer: MatDrawer;
|
showLeftDrawer = true;
|
||||||
@ViewChild('leftSideDrawer', { static: true }) leftSideDrawer: MatDrawer;
|
showLeftDrawerIndicator = false;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService,
|
@Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService,
|
||||||
@ -117,6 +121,7 @@ export class MainPageComponent implements OnInit, OnDestroy {
|
|||||||
select(AppStore.MessengerSelector.ChatSelector.selectLeftSideDrawer)
|
select(AppStore.MessengerSelector.ChatSelector.selectLeftSideDrawer)
|
||||||
)
|
)
|
||||||
.subscribe(leftSideDrawer => {
|
.subscribe(leftSideDrawer => {
|
||||||
|
this.showLeftDrawer = leftSideDrawer;
|
||||||
if (leftSideDrawer) {
|
if (leftSideDrawer) {
|
||||||
this.leftSideDrawer.open();
|
this.leftSideDrawer.open();
|
||||||
} else {
|
} else {
|
||||||
@ -124,6 +129,16 @@ export class MainPageComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.leftSideDrawerIndicatorSubscription = this.store
|
||||||
|
.pipe(
|
||||||
|
select(
|
||||||
|
AppStore.MessengerSelector.ChatSelector.selectLeftSideDrawerIndicator
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.subscribe(leftSideDrawerIndicator => {
|
||||||
|
this.showLeftDrawerIndicator = leftSideDrawerIndicator;
|
||||||
|
});
|
||||||
|
|
||||||
this.idleStateChangedSubscription = this.nativeService
|
this.idleStateChangedSubscription = this.nativeService
|
||||||
.idleStateChanged()
|
.idleStateChanged()
|
||||||
.subscribe(action => {
|
.subscribe(action => {
|
||||||
@ -236,6 +251,10 @@ export class MainPageComponent implements OnInit, OnDestroy {
|
|||||||
this.leftSideDrawerSubscription.unsubscribe();
|
this.leftSideDrawerSubscription.unsubscribe();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!!this.leftSideDrawerIndicatorSubscription) {
|
||||||
|
this.leftSideDrawerIndicatorSubscription.unsubscribe();
|
||||||
|
}
|
||||||
|
|
||||||
this.logger.debug('-----------------------MainPageComponent ngOnDestroy');
|
this.logger.debug('-----------------------MainPageComponent ngOnDestroy');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -411,4 +430,8 @@ export class MainPageComponent implements OnInit, OnDestroy {
|
|||||||
onCloseRightDrawer() {
|
onCloseRightDrawer() {
|
||||||
this.rightDrawer.close();
|
this.rightDrawer.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onClickLeftDrawerToggle() {
|
||||||
|
this.store.dispatch(ChatStore.toggleLeftSideDrawer());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,8 @@ import { CommonModule } from '@angular/common';
|
|||||||
|
|
||||||
import { FlexLayoutModule } from '@angular/flex-layout';
|
import { FlexLayoutModule } from '@angular/flex-layout';
|
||||||
|
|
||||||
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
import { MatSidenavModule } from '@angular/material/sidenav';
|
import { MatSidenavModule } from '@angular/material/sidenav';
|
||||||
|
|
||||||
import { AppMessengerLayoutModule } from '@app/layouts/messenger/messenger.layout.module';
|
import { AppMessengerLayoutModule } from '@app/layouts/messenger/messenger.layout.module';
|
||||||
@ -17,13 +19,15 @@ import { AngularSplitModule } from 'angular-split';
|
|||||||
imports: [
|
imports: [
|
||||||
CommonModule,
|
CommonModule,
|
||||||
FlexLayoutModule,
|
FlexLayoutModule,
|
||||||
|
MatButtonModule,
|
||||||
|
MatIconModule,
|
||||||
MatSidenavModule,
|
MatSidenavModule,
|
||||||
AppMessengerLayoutModule,
|
AppMessengerLayoutModule,
|
||||||
AppMessengerRoutingPageModule,
|
AppMessengerRoutingPageModule,
|
||||||
|
|
||||||
AngularSplitModule.forRoot(),
|
AngularSplitModule.forRoot()
|
||||||
],
|
],
|
||||||
declarations: [...COMPONENTS],
|
declarations: [...COMPONENTS],
|
||||||
entryComponents: [],
|
entryComponents: []
|
||||||
})
|
})
|
||||||
export class AppMessengerPageModule {}
|
export class AppMessengerPageModule {}
|
||||||
|
@ -57,3 +57,8 @@ export const clearRightDrawer = createAction(
|
|||||||
export const toggleLeftSideDrawer = createAction(
|
export const toggleLeftSideDrawer = createAction(
|
||||||
'[Messenger::Chat] Toggle Left Side Drawer'
|
'[Messenger::Chat] Toggle Left Side Drawer'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const toggleLeftSideDrawerIndicator = createAction(
|
||||||
|
'[Messenger::Chat] Toggle Left Side Drawer Indicator',
|
||||||
|
props<{ show: boolean }>()
|
||||||
|
);
|
||||||
|
@ -9,7 +9,8 @@ import {
|
|||||||
clearSelectedRoom,
|
clearSelectedRoom,
|
||||||
selectedRightDrawer,
|
selectedRightDrawer,
|
||||||
clearRightDrawer,
|
clearRightDrawer,
|
||||||
toggleLeftSideDrawer
|
toggleLeftSideDrawer,
|
||||||
|
toggleLeftSideDrawerIndicator
|
||||||
} from './actions';
|
} from './actions';
|
||||||
|
|
||||||
import * as AuthenticationStore from '@app/store/account/authentication';
|
import * as AuthenticationStore from '@app/store/account/authentication';
|
||||||
@ -68,6 +69,12 @@ export const reducer = createReducer(
|
|||||||
leftSideDrawer: !state.leftSideDrawer
|
leftSideDrawer: !state.leftSideDrawer
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
|
on(toggleLeftSideDrawerIndicator, (state, action) => {
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
leftSideDrawerIndicator: action.show
|
||||||
|
};
|
||||||
|
}),
|
||||||
on(clearRightDrawer, (state, action) => {
|
on(clearRightDrawer, (state, action) => {
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
|
@ -8,6 +8,7 @@ export interface State {
|
|||||||
|
|
||||||
selectedRightDrawer: string | null;
|
selectedRightDrawer: string | null;
|
||||||
leftSideDrawer: boolean;
|
leftSideDrawer: boolean;
|
||||||
|
leftSideDrawerIndicator: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const initialState: State = {
|
export const initialState: State = {
|
||||||
@ -15,7 +16,8 @@ export const initialState: State = {
|
|||||||
selectedMassDetail: null,
|
selectedMassDetail: null,
|
||||||
massDetailProcessing: false,
|
massDetailProcessing: false,
|
||||||
selectedRightDrawer: '',
|
selectedRightDrawer: '',
|
||||||
leftSideDrawer: true
|
leftSideDrawer: true,
|
||||||
|
leftSideDrawerIndicator: false
|
||||||
};
|
};
|
||||||
|
|
||||||
export function selectors<S>(selector: Selector<any, State>) {
|
export function selectors<S>(selector: Selector<any, State>) {
|
||||||
@ -35,6 +37,10 @@ export function selectors<S>(selector: Selector<any, State>) {
|
|||||||
selectLeftSideDrawer: createSelector(
|
selectLeftSideDrawer: createSelector(
|
||||||
selector,
|
selector,
|
||||||
(state: State) => state.leftSideDrawer
|
(state: State) => state.leftSideDrawer
|
||||||
|
),
|
||||||
|
selectLeftSideDrawerIndicator: createSelector(
|
||||||
|
selector,
|
||||||
|
(state: State) => state.leftSideDrawerIndicator
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user