This commit is contained in:
병준 박 2019-10-21 18:26:26 +09:00
commit 8fdfb528f5
10 changed files with 160 additions and 124 deletions

View File

@ -6,7 +6,11 @@
<button mat-icon-button>
<mat-icon>person_add</mat-icon>
</button>
<button mat-icon-button [matMenuTriggerFor]="groupMenu" aria-label="group menu">
<button
mat-icon-button
[matMenuTriggerFor]="groupMenu"
aria-label="group menu"
>
<mat-icon>more_vert</mat-icon>
</button>
</div>
@ -84,7 +88,7 @@
mat-menu-item
(click)="onClickProfileContextMenu('REGISTER_FAVORITE', userInfo)"
>
즐겨찾기 등록
즐겨찾기 {{ userInfo.isFavorit ? '해제' : '등록' }}
</button>
<button mat-menu-item (click)="onClickProfileContextMenu('CHAT', userInfo)">
대화하기

View File

@ -1,16 +1,33 @@
import { UserSelectDialogType } from './../../../../types/userselect.dialog.type';
import {
CreateChatDialogComponent,
CreateChatDialogData,
CreateChatDialogResult
} from './../../dialogs/chat/create-chat.dialog.component';
import { MatMenuTrigger } from '@angular/material';
import { Component, OnInit, ViewChild, OnDestroy } from '@angular/core';
import { Observable, combineLatest, Subscription } from 'rxjs';
import { map, tap } from 'rxjs/operators';
import { Store, select } from '@ngrx/store';
import * as AppStore from '@app/store';
import * as ChatStore from '@app/store/messenger/chat';
import * as QueryStore from '@app/store/messenger/query';
import * as SyncStore from '@app/store/messenger/sync';
import { NGXLogger } from 'ngx-logger';
import { Company } from '@ucap-webmessenger/api-external';
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import { VersionInfo2Response } from '@ucap-webmessenger/api-public';
import { LoginInfo, KEY_LOGIN_INFO } from '@app/types';
import { KEY_VER_INFO } from '@app/types/ver-info.type';
import { ExpansionPanelComponent as GroupExpansionPanelComponent } from '@ucap-webmessenger/ui-group';
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
import { UserInfo, GroupDetailData } from '@ucap-webmessenger/protocol-sync';
import {
DeptSearchType,
UserInfoSS,
UserInfoF,
UserInfoDN
} from '@ucap-webmessenger/protocol-query';
import {
ucapAnimations,
DialogService,
@ -18,48 +35,16 @@ import {
ConfirmDialogComponent,
ConfirmDialogResult
} from '@ucap-webmessenger/ui';
import { UserInfo, GroupDetailData } from '@ucap-webmessenger/protocol-sync';
import * as AppStore from '@app/store';
import * as ChatStore from '@app/store/messenger/chat';
import * as QueryStore from '@app/store/messenger/query';
import * as SyncStore from '@app/store/messenger/sync';
import { NGXLogger } from 'ngx-logger';
import { Company } from '@ucap-webmessenger/api-external';
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import { LoginInfo, KEY_LOGIN_INFO } from '@app/types';
import { ExpansionPanelComponent as GroupExpansionPanelComponent } from '@ucap-webmessenger/ui-group';
import {
CreateGroupDialogComponent,
CreateGroupDialogData,
CreateGroupDialogResult
} from '@app/layouts/messenger/dialogs/group/create-group.dialog.component';
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
import {
DeptSearchType,
UserInfoSS,
UserInfoF,
UserInfoDN
} from '@ucap-webmessenger/protocol-query';
import { MatMenuTrigger } from '@angular/material';
import { VersionInfo2Response } from '@ucap-webmessenger/api-public';
import { KEY_VER_INFO } from '@app/types/ver-info.type';
import {
DeleteGroupDialogComponent,
DeleteGroupDialogData,
DeleteGroupDialogResult
} from '@app/layouts/messenger/dialogs/group/delete-group.dialog.component';
CreateChatDialogComponent,
CreateChatDialogData,
CreateChatDialogResult
} from './../../dialogs/chat/create-chat.dialog.component';
import {
EditGroupDialogComponent,
EditGroupDialogData,
EditGroupDialogResult
} from '@app/layouts/messenger/dialogs/group/edit-group.dialog.component';
import {
EditGroupMemberDialogComponent,
EditGroupMemberDialogData,
EditGroupMemberDialogResult
} from '@app/layouts/messenger/dialogs/group/edit-group-member.dialog.component';
@Component({
selector: 'app-layout-chat-left-sidenav-group',
@ -251,10 +236,7 @@ export class GroupComponent implements OnInit, OnDestroy {
);
}
onClickProfileContextMenu(
menuType: string,
userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN
) {
onClickProfileContextMenu(menuType: string, userInfo: UserInfo | UserInfoF) {
this.logger.debug(
'onClickProfileContextMenu',
'menuType',
@ -262,6 +244,16 @@ export class GroupComponent implements OnInit, OnDestroy {
'userInfo',
userInfo
);
switch (menuType) {
case 'REGISTER_FAVORITE':
this.store.dispatch(
SyncStore.updateBuddy({
seq: userInfo.seq,
isFavorit: !userInfo.isFavorit
})
);
break;
}
}
onContextMenuProfile(

View File

@ -31,19 +31,21 @@ import {
refreshRoom,
refreshRoomFailure,
refreshRoomSuccess,
createGroup,
createGroupSuccess,
createGroupFailure,
createGroupAndBuddy,
addBuddy,
addBuddyFailure,
delBuddy,
delBuddyFailure,
delBuddySuccess,
updateBuddy,
updateBuddySuccess,
updateBuddyFailure,
createGroup,
createGroupSuccess,
createGroupFailure,
updateGroup,
updateGroupFailure,
updateGroupMember,
updateBuddy,
delBuddySuccess,
delGroup,
delGroupFailure,
delGroupSuccess
@ -92,7 +94,8 @@ import {
import {
BuddyProtocolService,
AddResponse as BuddyAddResponse,
DelResponse as BuddyDelResponse
DelResponse as BuddyDelResponse,
UpdateResponse as BuddyUpdateResponse
} from '@ucap-webmessenger/protocol-buddy';
import * as ChatStore from '@app/store/messenger/chat';
@ -682,6 +685,20 @@ export class Effects {
)
);
updateBuddy$ = createEffect(() =>
this.actions$.pipe(
ofType(updateBuddy),
exhaustMap(req =>
this.buddyProtocolService.update(req).pipe(
map((res: BuddyUpdateResponse) => {
return updateBuddySuccess(res);
}),
catchError(error => of(updateBuddyFailure({ error })))
)
)
)
);
updateGroup$ = createEffect(() =>
this.actions$.pipe(
ofType(updateGroup),

View File

@ -17,17 +17,20 @@ import {
createGroupSuccess,
addBuddySuccess,
delBuddySuccess,
delGroupSuccess
delGroupSuccess,
updateBuddySuccess
} from './actions';
import {
RoomUserDetailData,
RoomUserData,
GroupDetailData
GroupDetailData,
UserInfo
} from '@ucap-webmessenger/protocol-sync';
import * as AuthenticationStore from '@app/store/account/authentication';
import * as RoomStore from '@app/store/messenger/room';
import { RoomInfo } from '@ucap-webmessenger/protocol-room';
import { UpdateResponse } from '@ucap-webmessenger/protocol-buddy';
export const reducer = createReducer(
initialState,
@ -222,5 +225,17 @@ export const reducer = createReducer(
...state.buddy2
})
};
}),
on(updateBuddySuccess, (state, action) => {
const userInfo: UserInfo = {
...state.buddy2.entities[action.seq],
isFavorit: action.isFavorit
};
return {
...state,
buddy2: adapterBuddy2.upsertOne(userInfo, { ...state.buddy2 })
};
})
);

View File

@ -1,6 +1,5 @@
<div class="date-split">
<span class="line"></span>
<!-- {{ message.sendDate | date: 'short' }} -->
<span class="date">{{ dateInfo }}2019.10.3</span>
<span class="date">{{ dateInfo }}</span>
<span class="line"></span>
</div>

View File

@ -18,7 +18,7 @@ export class DateSplitterComponent implements OnInit {
ngOnInit() {
this.dateInfo = this.datePipe.transform(
this.message.sendDate,
'yyyy-MM-dd EEE'
'yyyy.MM.dd EEE'
);
}
}

View File

@ -1,3 +1,3 @@
<p>
<div>
{{ contents }}
</p>
</div>

View File

@ -1,12 +1,11 @@
<div class="bubble-main">
<span>
<span class="content">
{{ content }}
</span>
<span>
{{ message.sendDate | date: 'short' }}
</span>
</div>
{{detailButteonShow}}
<div *ngIf="detailButteonShow" class="btn-box">
<button mat-button (click)="onClickDetailView()">Detail View</button>
</div>

View File

@ -1,6 +1,12 @@
@charset 'utf-8';
@import '../../../../ucap-webmessenger-app/src/assets/scss/global/common.scss';
.bubble-main {
padding: 14px;
text-align: left;
.content {
max-width: 250px;
@include ellipsis(1);
}
}
.btn-box {

View File

@ -1,8 +1,5 @@
<div class="chat-messages">
<!-- MESSAGE -->
<ucap-chat-message-box-date-splitter *ngIf="getDateSplitter(i)" [message]="message">
</ucap-chat-message-box-date-splitter>
<div
*ngFor="let message of messages; let i = index"
class="message-row"
@ -11,6 +8,13 @@
contact: message.senderSeq !== loginRes.userSeq
}"
>
<div>
<ucap-chat-message-box-date-splitter
*ngIf="getDateSplitter(i)"
[message]="message"
>
</ucap-chat-message-box-date-splitter>
</div>
<div
*ngIf="getIsInformation(message); then information; else contents"