quickblox-react-ui-kit 0.2.4 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/dist/Data/repository/DialogsRepository.d.ts +1 -0
- package/dist/Data/repository/EventMessagesRepository.d.ts +1 -0
- package/dist/Data/repository/MessagesRepository.d.ts +2 -2
- package/dist/Domain/entity/NotificationTypes.d.ts +1 -0
- package/dist/Domain/repository/IDialogsRepository.d.ts +1 -0
- package/dist/Domain/repository/IMessagesRepository.d.ts +2 -2
- package/dist/Domain/use_cases/CreateDialogUseCase.d.ts +2 -1
- package/dist/Domain/use_cases/LeaveDialogUseCase.d.ts +2 -1
- package/dist/Domain/use_cases/RemoveUsersFromTheDialogUseCase.d.ts +2 -1
- package/dist/Domain/use_cases/SubscribeToDialogEventsUseCase.d.ts +1 -0
- package/dist/Domain/use_cases/UpdateDialogUseCase.d.ts +2 -1
- package/dist/Presentation/Views/Base/BaseViewModel.d.ts +1 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/DefaultAttachmentComponent/DefaultAttachmentComponent.d.ts +1 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/InComingMessage/AvatarContentIncomingUser/AvatarContentIncomingUser.d.ts +3 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/InComingMessage/InComingMessage.d.ts +9 -2
- package/dist/Presentation/components/UI/Dialogs/MessagesView/MessagesView.d.ts +10 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/MessagesViewModel.d.ts +2 -2
- package/dist/Presentation/components/UI/Dialogs/MessagesView/SystemDateBanner/SystemDateBanner.d.ts +7 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/SystemMessageBanner/SystemMessageBanner.d.ts +7 -0
- package/dist/index-ui.d.ts +5 -1
- package/dist/index-ui.js +101 -35
- package/package.json +1 -1
- package/src/App.tsx +1 -1
- package/src/Data/repository/DialogsRepository.ts +4 -0
- package/src/Data/repository/EventMessagesRepository.ts +34 -0
- package/src/Data/repository/MessagesRepository.ts +16 -10
- package/src/Data/source/exception/MapperDTOException.ts +3 -0
- package/src/Data/source/remote/RemoteDataSource.ts +134 -112
- package/src/Domain/entity/NotificationTypes.ts +2 -0
- package/src/Domain/repository/IDialogsRepository.ts +2 -0
- package/src/Domain/repository/IMessagesRepository.ts +2 -2
- package/src/Domain/use_cases/CreateDialogUseCase.ts +8 -1
- package/src/Domain/use_cases/GetAllDialogsUseCaseWithMock.ts +1 -0
- package/src/Domain/use_cases/LeaveDialogUseCase.ts +8 -1
- package/src/Domain/use_cases/RemoveUsersFromTheDialogUseCase.ts +40 -17
- package/src/Domain/use_cases/SendTextMessageUseCase.ts +3 -2
- package/src/Domain/use_cases/SubscribeToDialogEventsUseCase.ts +21 -0
- package/src/Domain/use_cases/UpdateDialogUseCase.ts +8 -1
- package/src/Domain/use_cases/base/Subscribable/SubscriptionPerformer.ts +7 -10
- package/src/Presentation/Views/Base/BaseViewModel.ts +1 -0
- package/src/Presentation/Views/Dialogs/Dialogs.scss +3 -0
- package/src/Presentation/Views/Dialogs/useDialogsViewModel.ts +109 -48
- package/src/Presentation/assets/styles/_variables.scss +19 -0
- package/src/Presentation/components/UI/Buttons/MainButton/MainButton.scss +9 -0
- package/src/Presentation/components/UI/Dialogs/EditDialog/EditDialog.scss +3 -0
- package/src/Presentation/components/UI/Dialogs/InviteMembers/InviteMembers.scss +3 -0
- package/src/Presentation/components/UI/Dialogs/MembersList/MembersList.scss +3 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/AudioAttachmentComponent/AudioAttachmentComponent.tsx +1 -1
- package/src/Presentation/components/UI/Dialogs/MessagesView/DefaultAttachmentComponent/DefaultAttachmentComponent.tsx +20 -14
- package/src/Presentation/components/UI/Dialogs/MessagesView/ImageAttachmentComponent/ImageAttachmentComponent.tsx +8 -6
- package/src/Presentation/components/UI/Dialogs/MessagesView/InComingMessage/AvatarContentIncomingUser/AvatarContentIncomingUser.tsx +6 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/InComingMessage/InComingMessage.scss +1 -1
- package/src/Presentation/components/UI/Dialogs/MessagesView/InComingMessage/InComingMessage.tsx +74 -29
- package/src/Presentation/components/UI/Dialogs/MessagesView/MessagesView.scss +12 -23
- package/src/Presentation/components/UI/Dialogs/MessagesView/MessagesView.tsx +101 -33
- package/src/Presentation/components/UI/Dialogs/MessagesView/MessagesViewModel.ts +2 -2
- package/src/Presentation/components/UI/Dialogs/MessagesView/OutGoingMessage/OutGoingMessage.tsx +1 -1
- package/src/Presentation/components/UI/Dialogs/MessagesView/SystemDateBanner/SystemDateBanner.scss +23 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/SystemDateBanner/SystemDateBanner.tsx +17 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/SystemMessageBanner/SystemMessageBanner.scss +21 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/SystemMessageBanner/SystemMessageBanner.tsx +17 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/useMessagesViewModel.ts +124 -83
- package/src/Presentation/components/UI/Dialogs/PreviewDialog/PreviewDialog.scss +27 -1
- package/src/Presentation/components/UI/Dialogs/PreviewDialog/PreviewDialog.tsx +6 -3
- package/src/index-ui.ts +8 -1
- package/src/index.scss +0 -1
- package/src/package_artan_react_ui.json +1 -1
- package/src/package_original.json +1 -1
- package/src/Presentation/assets/styles/_reset-styles.scss +0 -435
|
@@ -19,8 +19,9 @@ export class SendTextMessageUseCase implements IUseCase<void, MessageEntity> {
|
|
|
19
19
|
async execute(): Promise<MessageEntity> {
|
|
20
20
|
console.log('execute SendTextMessageUseCase');
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
const sentMessage: MessageEntity =
|
|
23
|
+
await this.messagesRepository.sendMessageToRemote(this.messageToSend);
|
|
23
24
|
|
|
24
|
-
return Promise.resolve(
|
|
25
|
+
return Promise.resolve(sentMessage);
|
|
25
26
|
}
|
|
26
27
|
}
|
|
@@ -51,6 +51,12 @@ export class SubscribeToDialogEventsUseCase extends BaseUseCase<
|
|
|
51
51
|
this.EVENT_NAME,
|
|
52
52
|
);
|
|
53
53
|
|
|
54
|
+
this.eventMessagesRepository.subscribeOnSystemMessaging(
|
|
55
|
+
NotificationTypes.REMOVE_USER,
|
|
56
|
+
this.removeUserDialogEventHandler.bind(this),
|
|
57
|
+
this.EVENT_NAME,
|
|
58
|
+
);
|
|
59
|
+
|
|
54
60
|
this.eventMessagesRepository.subscribeOnSystemMessaging(
|
|
55
61
|
NotificationTypes.UPDATE_DIALOG,
|
|
56
62
|
this.updateDialogEventHandler.bind(this),
|
|
@@ -124,6 +130,21 @@ export class SubscribeToDialogEventsUseCase extends BaseUseCase<
|
|
|
124
130
|
this.informSubscribers(messageInfo);
|
|
125
131
|
}
|
|
126
132
|
|
|
133
|
+
removeUserDialogEventHandler(messageEntity: MessageEntity): void {
|
|
134
|
+
console.log(
|
|
135
|
+
'execute removeUserDialogEventHandler in SubscribeToDialogEventsUseCase:',
|
|
136
|
+
JSON.stringify(messageEntity),
|
|
137
|
+
);
|
|
138
|
+
const messageInfo: DialogEventInfo = {
|
|
139
|
+
messageInfo: messageEntity,
|
|
140
|
+
notificationTypes: NotificationTypes.REMOVE_USER,
|
|
141
|
+
eventMessageType: EventMessageType.SystemMessage,
|
|
142
|
+
messageStatus: undefined,
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
this.informSubscribers(messageInfo);
|
|
146
|
+
}
|
|
147
|
+
|
|
127
148
|
newDialogEventHandler(messageEntity: MessageEntity): void {
|
|
128
149
|
console.log(
|
|
129
150
|
'execute newDialogEventHandler in SubscribeToDialogEventsUseCase:',
|
|
@@ -14,15 +14,19 @@ export class UpdateDialogUseCase implements IUseCase<void, DialogEntity> {
|
|
|
14
14
|
|
|
15
15
|
private updateDialog: GroupDialogEntity;
|
|
16
16
|
|
|
17
|
+
private textInformationMessage: string;
|
|
18
|
+
|
|
17
19
|
constructor(
|
|
18
20
|
eventMessagesRepository: EventMessagesRepository,
|
|
19
21
|
dialogRepository: DialogsRepository,
|
|
20
22
|
updateDialog: GroupDialogEntity,
|
|
23
|
+
textInformationMessage: string,
|
|
21
24
|
) {
|
|
22
25
|
console.log('CONSTRUCTOR UpdateDialogUseCase');
|
|
23
26
|
this.dialogRepository = dialogRepository;
|
|
24
27
|
this.updateDialog = updateDialog;
|
|
25
28
|
this.eventMessagesRepository = eventMessagesRepository;
|
|
29
|
+
this.textInformationMessage = textInformationMessage;
|
|
26
30
|
}
|
|
27
31
|
|
|
28
32
|
async execute(): Promise<DialogEntity> {
|
|
@@ -37,7 +41,10 @@ export class UpdateDialogUseCase implements IUseCase<void, DialogEntity> {
|
|
|
37
41
|
remoteMessageDTO.dialogId = result.id;
|
|
38
42
|
remoteMessageDTO.notification_type = NotificationTypes.UPDATE_DIALOG;
|
|
39
43
|
remoteMessageDTO.date_sent = Date.now();
|
|
40
|
-
remoteMessageDTO.message =
|
|
44
|
+
remoteMessageDTO.message =
|
|
45
|
+
this.textInformationMessage && this.textInformationMessage.length > 0
|
|
46
|
+
? this.textInformationMessage
|
|
47
|
+
: `User ${this.updateDialog.ownerId} has updated dialog ${this.updateDialog.name}`;
|
|
41
48
|
|
|
42
49
|
this.eventMessagesRepository.dispatchEvent<RemoteMessageDTO>(
|
|
43
50
|
EventMessageType.RegularMessage,
|
|
@@ -35,20 +35,17 @@ export class SubscriptionPerformer<TArg> implements ISubscribable<TArg> {
|
|
|
35
35
|
|
|
36
36
|
protected EVENT_TYPE: string = EventMessageType.LocalMessage;
|
|
37
37
|
|
|
38
|
+
// eslint-disable-next-line class-methods-use-this
|
|
38
39
|
public release(): void {
|
|
39
|
-
|
|
40
|
-
const eventName = x[0];
|
|
41
|
-
|
|
42
|
-
this.onEventByTypeSubscribers[eventName][this.EVENT_NAME] = () => {
|
|
43
|
-
console.log('ERROR release event in SubscriptionPerformer');
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
return this.onEventByTypeSubscribers[eventName][this.EVENT_NAME];
|
|
47
|
-
});
|
|
40
|
+
console.log('SubscriptionPerformer release actions.');
|
|
48
41
|
// Object.entries(this.onEventByTypeSubscribers).map((x) => {
|
|
49
42
|
// const eventName = x[0];
|
|
50
43
|
//
|
|
51
|
-
//
|
|
44
|
+
// this.onEventByTypeSubscribers[eventName][this.EVENT_NAME] = () => {
|
|
45
|
+
// console.log('ERROR release event in SubscriptionPerformer');
|
|
46
|
+
// };
|
|
47
|
+
//
|
|
48
|
+
// return this.onEventByTypeSubscribers[eventName][this.EVENT_NAME];
|
|
52
49
|
// });
|
|
53
50
|
}
|
|
54
51
|
|
|
@@ -53,6 +53,7 @@ export type EditDialogParams = {
|
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
export type FunctionTypeFileToToVoid = (file: File) => void;
|
|
56
|
+
export type FunctionTypeFileToToBoolean = (file: File) => Promise<boolean>;
|
|
56
57
|
export type FunctionTypePaginationToVoid = (pagination: Pagination) => void;
|
|
57
58
|
export type FunctionTypeVoidToVoid = () => void;
|
|
58
59
|
export type FunctionTypeStringToVoid = (value: string) => void;
|
|
@@ -28,6 +28,9 @@ import { DialogType } from '../../../Domain/entity/DialogTypes';
|
|
|
28
28
|
import { RemoveUsersFromTheDialogUseCase } from '../../../Domain/use_cases/RemoveUsersFromTheDialogUseCase';
|
|
29
29
|
import { DialogEventInfo } from '../../../Domain/entity/DialogEventInfo';
|
|
30
30
|
import { RemoteDataSource } from '../../../Data/source/remote/RemoteDataSource';
|
|
31
|
+
import { GetUsersByIdsUseCase } from '../../../Domain/use_cases/GetUsersByIdsUseCase';
|
|
32
|
+
import UsersRepository from '../../../Data/repository/UsersRepository';
|
|
33
|
+
import { UserEntity } from '../../../Domain/entity/UserEntity';
|
|
31
34
|
|
|
32
35
|
export default function useDialogsViewModel(
|
|
33
36
|
currentContext: QBDataContextType,
|
|
@@ -43,7 +46,9 @@ export default function useDialogsViewModel(
|
|
|
43
46
|
|
|
44
47
|
//
|
|
45
48
|
const currentUserId =
|
|
46
|
-
currentContext.storage.REMOTE_DATA_SOURCE.authInformation?.userId;
|
|
49
|
+
currentContext.storage.REMOTE_DATA_SOURCE.authInformation?.userId || -1;
|
|
50
|
+
const currentUserName =
|
|
51
|
+
currentContext.storage.REMOTE_DATA_SOURCE.authInformation?.userName || '';
|
|
47
52
|
// const currentContext = useQbInitializedDataContext();
|
|
48
53
|
const remoteDataSourceMock: RemoteDataSource =
|
|
49
54
|
currentContext.storage.REMOTE_DATA_SOURCE;
|
|
@@ -65,6 +70,49 @@ export default function useDialogsViewModel(
|
|
|
65
70
|
'DialogsViewModel',
|
|
66
71
|
);
|
|
67
72
|
|
|
73
|
+
async function getDialogs(currentPagination: Pagination) {
|
|
74
|
+
console.log('getDialogs in useDialogsViewModel');
|
|
75
|
+
console.log(
|
|
76
|
+
'EXECUTE USE CASES GET DIALOG WITH PAGINATION: ',
|
|
77
|
+
JSON.stringify(currentPagination),
|
|
78
|
+
);
|
|
79
|
+
setLoading(true);
|
|
80
|
+
const useCaseGetAllDialogs: GetAllDialogsUseCaseWithMock =
|
|
81
|
+
new GetAllDialogsUseCaseWithMock(
|
|
82
|
+
new DialogsRepository(
|
|
83
|
+
currentContext.storage.LOCAL_DATA_SOURCE,
|
|
84
|
+
remoteDataSourceMock,
|
|
85
|
+
),
|
|
86
|
+
currentPagination,
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
await useCaseGetAllDialogs
|
|
90
|
+
?.execute()
|
|
91
|
+
// eslint-disable-next-line promise/always-return
|
|
92
|
+
.then((result) => {
|
|
93
|
+
console.log('EXECUTE COMPLETED: ', JSON.stringify(currentPagination));
|
|
94
|
+
setDialogs([...(result.ResultData as PublicDialogEntity[])]);
|
|
95
|
+
setLoading(false);
|
|
96
|
+
setPagination(result.CurrentPagination);
|
|
97
|
+
})
|
|
98
|
+
.catch((e) => {
|
|
99
|
+
console.log('call catch....', JSON.stringify(e));
|
|
100
|
+
setError(`${(e as unknown as Error).message}`);
|
|
101
|
+
setLoading(false);
|
|
102
|
+
});
|
|
103
|
+
await useCaseSubscribeToDialogsUpdates?.execute((data) => {
|
|
104
|
+
try {
|
|
105
|
+
console.log('3.SUBSCRIBE EXECUTE in useDialogsViewModel:', data);
|
|
106
|
+
setDialogs([...(data as PublicDialogEntity[])]);
|
|
107
|
+
setLoading(false);
|
|
108
|
+
setError('');
|
|
109
|
+
} catch (e) {
|
|
110
|
+
console.log('catch error2');
|
|
111
|
+
setError('ERROR2!!!');
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
68
116
|
const dialogUpdateHandler = (dialogInfo: DialogEventInfo) => {
|
|
69
117
|
console.log('call dialogUpdateHandler in useDialogsViewModel');
|
|
70
118
|
if (
|
|
@@ -89,9 +137,7 @@ export default function useDialogsViewModel(
|
|
|
89
137
|
setNewDialog(updatedDialog);
|
|
90
138
|
});
|
|
91
139
|
}
|
|
92
|
-
}
|
|
93
|
-
//
|
|
94
|
-
if (
|
|
140
|
+
} else if (
|
|
95
141
|
dialogInfo.notificationTypes === NotificationTypes.DELETE_LEAVE_DIALOG
|
|
96
142
|
) {
|
|
97
143
|
if (
|
|
@@ -100,8 +146,23 @@ export default function useDialogsViewModel(
|
|
|
100
146
|
) {
|
|
101
147
|
setNewDialog(undefined);
|
|
102
148
|
}
|
|
149
|
+
} else if (
|
|
150
|
+
dialogInfo.notificationTypes === NotificationTypes.REMOVE_USER
|
|
151
|
+
) {
|
|
152
|
+
if (
|
|
153
|
+
dialogInfo.messageInfo &&
|
|
154
|
+
dialogInfo.messageInfo.dialogId === newDialog?.id
|
|
155
|
+
) {
|
|
156
|
+
setNewDialog(undefined);
|
|
157
|
+
}
|
|
158
|
+
getDialogs(pagination);
|
|
159
|
+
} else if (
|
|
160
|
+
dialogInfo.notificationTypes === NotificationTypes.NEW_DIALOG
|
|
161
|
+
) {
|
|
162
|
+
// const pagination: Pagination = new Pagination();
|
|
163
|
+
|
|
164
|
+
getDialogs(pagination).catch();
|
|
103
165
|
}
|
|
104
|
-
//
|
|
105
166
|
}
|
|
106
167
|
};
|
|
107
168
|
|
|
@@ -112,48 +173,6 @@ export default function useDialogsViewModel(
|
|
|
112
173
|
});
|
|
113
174
|
|
|
114
175
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
115
|
-
async function getDialogs(currentPagination: Pagination) {
|
|
116
|
-
console.log('getDialogs in useDialogsViewModel');
|
|
117
|
-
console.log(
|
|
118
|
-
'EXECUTE USE CASES GET DIALOG WITH PAGINATION: ',
|
|
119
|
-
JSON.stringify(currentPagination),
|
|
120
|
-
);
|
|
121
|
-
setLoading(true);
|
|
122
|
-
const useCaseGetAllDialogs: GetAllDialogsUseCaseWithMock =
|
|
123
|
-
new GetAllDialogsUseCaseWithMock(
|
|
124
|
-
new DialogsRepository(
|
|
125
|
-
currentContext.storage.LOCAL_DATA_SOURCE,
|
|
126
|
-
remoteDataSourceMock,
|
|
127
|
-
),
|
|
128
|
-
currentPagination,
|
|
129
|
-
);
|
|
130
|
-
|
|
131
|
-
await useCaseGetAllDialogs
|
|
132
|
-
?.execute()
|
|
133
|
-
// eslint-disable-next-line promise/always-return
|
|
134
|
-
.then((result) => {
|
|
135
|
-
console.log('EXECUTE COMPLETED: ', JSON.stringify(currentPagination));
|
|
136
|
-
setDialogs([...(result.ResultData as PublicDialogEntity[])]);
|
|
137
|
-
setLoading(false);
|
|
138
|
-
setPagination(result.CurrentPagination);
|
|
139
|
-
})
|
|
140
|
-
.catch((e) => {
|
|
141
|
-
console.log('call catch....', JSON.stringify(e));
|
|
142
|
-
setError(`${(e as unknown as Error).message}`);
|
|
143
|
-
setLoading(false);
|
|
144
|
-
});
|
|
145
|
-
await useCaseSubscribeToDialogsUpdates?.execute((data) => {
|
|
146
|
-
try {
|
|
147
|
-
console.log('3.SUBSCRIBE EXECUTE in useDialogsViewModel:', data);
|
|
148
|
-
setDialogs([...(data as PublicDialogEntity[])]);
|
|
149
|
-
setLoading(false);
|
|
150
|
-
setError('');
|
|
151
|
-
} catch (e) {
|
|
152
|
-
console.log('catch error2');
|
|
153
|
-
setError('ERROR2!!!');
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
176
|
|
|
158
177
|
const release = () => {
|
|
159
178
|
useCaseSubscribeToDialogsUpdates.release();
|
|
@@ -163,6 +182,31 @@ export default function useDialogsViewModel(
|
|
|
163
182
|
setLoading(status);
|
|
164
183
|
};
|
|
165
184
|
|
|
185
|
+
const getSenders = async (senders: number[]) => {
|
|
186
|
+
const getUsers: GetUsersByIdsUseCase = new GetUsersByIdsUseCase(
|
|
187
|
+
new UsersRepository(
|
|
188
|
+
currentContext.storage.LOCAL_DATA_SOURCE,
|
|
189
|
+
currentContext.storage.REMOTE_DATA_SOURCE,
|
|
190
|
+
),
|
|
191
|
+
[...senders],
|
|
192
|
+
);
|
|
193
|
+
|
|
194
|
+
let userEntites: UserEntity[] = [];
|
|
195
|
+
|
|
196
|
+
await getUsers
|
|
197
|
+
.execute()
|
|
198
|
+
// eslint-disable-next-line promise/always-return
|
|
199
|
+
.then((data) => {
|
|
200
|
+
// eslint-disable-next-line prefer-destructuring
|
|
201
|
+
userEntites = data;
|
|
202
|
+
})
|
|
203
|
+
.catch((e) => {
|
|
204
|
+
console.log('have ERROR get users :', JSON.stringify(e));
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
return userEntites;
|
|
208
|
+
};
|
|
209
|
+
|
|
166
210
|
const createDialog = async (
|
|
167
211
|
dialogInfo: GroupDialogEntity,
|
|
168
212
|
): Promise<DialogEntity> => {
|
|
@@ -170,7 +214,7 @@ export default function useDialogsViewModel(
|
|
|
170
214
|
'call createDialog in use case with params: ',
|
|
171
215
|
JSON.stringify(dialogInfo),
|
|
172
216
|
);
|
|
173
|
-
|
|
217
|
+
const textInformationMessage = `${currentUserName} create the chat`;
|
|
174
218
|
const createDialogUseCase: CreateDialogUseCase = new CreateDialogUseCase(
|
|
175
219
|
eventMessageRepository,
|
|
176
220
|
new DialogsRepository(
|
|
@@ -178,6 +222,7 @@ export default function useDialogsViewModel(
|
|
|
178
222
|
remoteDataSourceMock,
|
|
179
223
|
),
|
|
180
224
|
dialogInfo,
|
|
225
|
+
textInformationMessage,
|
|
181
226
|
);
|
|
182
227
|
const resultDialog: DialogEntity = await createDialogUseCase
|
|
183
228
|
.execute()
|
|
@@ -201,6 +246,7 @@ export default function useDialogsViewModel(
|
|
|
201
246
|
// eslint-disable-next-line @typescript-eslint/no-shadow,@typescript-eslint/no-unused-vars
|
|
202
247
|
dialog: GroupDialogEntity,
|
|
203
248
|
): Promise<DialogEntity> => {
|
|
249
|
+
const textInformationMessage = `${currentUserName} has updated dialog`;
|
|
204
250
|
const updateDialogUseCase: UpdateDialogUseCase = new UpdateDialogUseCase(
|
|
205
251
|
eventMessageRepository,
|
|
206
252
|
new DialogsRepository(
|
|
@@ -208,6 +254,7 @@ export default function useDialogsViewModel(
|
|
|
208
254
|
remoteDataSourceMock,
|
|
209
255
|
),
|
|
210
256
|
dialog,
|
|
257
|
+
textInformationMessage,
|
|
211
258
|
);
|
|
212
259
|
|
|
213
260
|
const resultDialog: DialogEntity = await updateDialogUseCase
|
|
@@ -242,6 +289,7 @@ export default function useDialogsViewModel(
|
|
|
242
289
|
let leaveResult = false;
|
|
243
290
|
|
|
244
291
|
if (dialogToDelete.type === DialogType.private) {
|
|
292
|
+
const textInformationMessage = `${currentUserName} has left dialog`;
|
|
245
293
|
const leaveDialogUseCase: LeaveDialogUseCase = new LeaveDialogUseCase(
|
|
246
294
|
eventMessageRepository,
|
|
247
295
|
new DialogsRepository(
|
|
@@ -250,6 +298,7 @@ export default function useDialogsViewModel(
|
|
|
250
298
|
),
|
|
251
299
|
dialogToDelete,
|
|
252
300
|
DialogLeaveType.delete,
|
|
301
|
+
textInformationMessage,
|
|
253
302
|
);
|
|
254
303
|
|
|
255
304
|
leaveResult = await leaveDialogUseCase.execute().catch((e) => {
|
|
@@ -263,6 +312,7 @@ export default function useDialogsViewModel(
|
|
|
263
312
|
remoteDataSourceMock?.authInformation?.userId || 0;
|
|
264
313
|
|
|
265
314
|
usersForDeleteFromDialog.push(userToDeleteId);
|
|
315
|
+
const textInformationMessage = `${currentUserName} has left dialog`;
|
|
266
316
|
const deleteUsersFromDialog: RemoveUsersFromTheDialogUseCase =
|
|
267
317
|
new RemoveUsersFromTheDialogUseCase(
|
|
268
318
|
eventMessageRepository,
|
|
@@ -272,6 +322,7 @@ export default function useDialogsViewModel(
|
|
|
272
322
|
),
|
|
273
323
|
dialogToDelete,
|
|
274
324
|
usersForDeleteFromDialog,
|
|
325
|
+
textInformationMessage,
|
|
275
326
|
);
|
|
276
327
|
|
|
277
328
|
leaveResult = await deleteUsersFromDialog.execute().catch((e) => {
|
|
@@ -297,6 +348,15 @@ export default function useDialogsViewModel(
|
|
|
297
348
|
dialog.participantsToRemoveIds &&
|
|
298
349
|
dialog.participantsToRemoveIds.length > 0
|
|
299
350
|
) {
|
|
351
|
+
const usersToDelete: UserEntity[] = await getSenders(
|
|
352
|
+
dialog.participantsToRemoveIds,
|
|
353
|
+
);
|
|
354
|
+
let userNames = '';
|
|
355
|
+
|
|
356
|
+
usersToDelete.forEach((u) => {
|
|
357
|
+
userNames += u.login || u.full_name || u.email;
|
|
358
|
+
});
|
|
359
|
+
const textInformationMessage = `${currentUserName} remove ${userNames}`;
|
|
300
360
|
const deleteUsersFromDialog: RemoveUsersFromTheDialogUseCase =
|
|
301
361
|
new RemoveUsersFromTheDialogUseCase(
|
|
302
362
|
eventMessageRepository,
|
|
@@ -306,6 +366,7 @@ export default function useDialogsViewModel(
|
|
|
306
366
|
),
|
|
307
367
|
dialog,
|
|
308
368
|
dialog.participantsToRemoveIds,
|
|
369
|
+
textInformationMessage,
|
|
309
370
|
);
|
|
310
371
|
|
|
311
372
|
leaveResult = await deleteUsersFromDialog.execute().catch((e) => {
|
|
@@ -1,2 +1,21 @@
|
|
|
1
1
|
@import "theme_light";
|
|
2
2
|
@import "theme_dark";
|
|
3
|
+
|
|
4
|
+
/* Fonts */
|
|
5
|
+
:root{
|
|
6
|
+
--title-title-large: 500 20px/24px "Roboto", sans-serif;
|
|
7
|
+
--title-title-medium: 500 16px/24px "Roboto", sans-serif;
|
|
8
|
+
--title-title-small: 500 14px/20px "Roboto", sans-serif;
|
|
9
|
+
--label-label-large: 500 14px/20px "Roboto", sans-serif;
|
|
10
|
+
--label-label-medium: 500 12px/16px "Roboto", sans-serif;
|
|
11
|
+
--label-label-small: 500 11px/16px "Roboto", sans-serif;
|
|
12
|
+
--body-body-large: 400 16px/24px "Roboto", sans-serif;
|
|
13
|
+
--body-body-medium: 400 14px/20px "Roboto", sans-serif;
|
|
14
|
+
--body-body-small: 400 12px/16px "Roboto", sans-serif;
|
|
15
|
+
--button-fab: 500 14px/16px "Roboto", sans-serif;
|
|
16
|
+
--button-default: 700 14px/16px "Roboto", sans-serif;
|
|
17
|
+
--ui-kit-header: 500 48px "Roboto Mono", sans-serif;
|
|
18
|
+
--ui-kit-title: 500 32px "Roboto Mono", sans-serif;
|
|
19
|
+
--ui-kit-body: 400 17px "Roboto Mono", sans-serif;
|
|
20
|
+
}
|
|
21
|
+
|
|
@@ -31,6 +31,9 @@
|
|
|
31
31
|
|
|
32
32
|
/* Light UiKitTheme/System */
|
|
33
33
|
color: var(--main-background);
|
|
34
|
+
|
|
35
|
+
border: none;
|
|
36
|
+
outline: none;
|
|
34
37
|
}
|
|
35
38
|
|
|
36
39
|
.danger-button {
|
|
@@ -61,6 +64,9 @@
|
|
|
61
64
|
letter-spacing: 0.4px;
|
|
62
65
|
/* Light UiKitTheme/System */
|
|
63
66
|
color: var(--main-background);
|
|
67
|
+
|
|
68
|
+
border: none;
|
|
69
|
+
outline: none;
|
|
64
70
|
}
|
|
65
71
|
|
|
66
72
|
.secondary-button{
|
|
@@ -124,4 +130,7 @@
|
|
|
124
130
|
letter-spacing: 0.4px;
|
|
125
131
|
/* Light UiKitTheme/Secondary text */
|
|
126
132
|
color: var(--secondary-text);
|
|
133
|
+
|
|
134
|
+
border: none;
|
|
135
|
+
outline: none;
|
|
127
136
|
}
|
|
@@ -17,7 +17,7 @@ const AudioAttachmentComponent: React.FC<AudioAttachmentComponentProps> = ({
|
|
|
17
17
|
<source src={audioFile.url} type="audio/mpeg" />
|
|
18
18
|
<source src={audioFile.url} type="audio/ogg" />
|
|
19
19
|
</audio>
|
|
20
|
-
<a href={audioFile.url} download>
|
|
20
|
+
<a href={audioFile.url} target="_blank" download rel="noreferrer">
|
|
21
21
|
Download
|
|
22
22
|
</a>
|
|
23
23
|
</div>
|
|
@@ -4,27 +4,33 @@ import TextDocument from '../../../svgs/Icons/Media/TextDocument';
|
|
|
4
4
|
|
|
5
5
|
type DefaultAttachmentComponentProps = {
|
|
6
6
|
fileName: string;
|
|
7
|
+
fileUrl: string;
|
|
7
8
|
};
|
|
8
9
|
// eslint-disable-next-line react/function-component-definition
|
|
9
10
|
const DefaultAttachmentComponent: React.FC<DefaultAttachmentComponentProps> = ({
|
|
10
11
|
fileName,
|
|
12
|
+
fileUrl,
|
|
11
13
|
}: DefaultAttachmentComponentProps) => {
|
|
12
14
|
return (
|
|
13
|
-
<div
|
|
14
|
-
<div className="default-attachment-component-container
|
|
15
|
-
<div className="default-attachment-component-container--file-wrapper
|
|
16
|
-
<div className="default-attachment-component-container--file-wrapper--
|
|
17
|
-
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
<div>
|
|
16
|
+
<div className="default-attachment-component-container">
|
|
17
|
+
<div className="default-attachment-component-container--file-wrapper">
|
|
18
|
+
<div className="default-attachment-component-container--file-wrapper--placeholder">
|
|
19
|
+
<div className="default-attachment-component-container--file-wrapper--placeholder__bg" />
|
|
20
|
+
<div className="default-attachment-component-container--file-wrapper--placeholder__icon">
|
|
21
|
+
<a href={fileUrl} target="_blank" download rel="noreferrer">
|
|
22
|
+
<TextDocument
|
|
23
|
+
width="16"
|
|
24
|
+
height="16"
|
|
25
|
+
applyZoom
|
|
26
|
+
color="var(--incoming-background)"
|
|
27
|
+
/>
|
|
28
|
+
</a>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
<div className="default-attachment-component-container--file-wrapper__file-d">
|
|
32
|
+
{fileName}
|
|
24
33
|
</div>
|
|
25
|
-
</div>
|
|
26
|
-
<div className="default-attachment-component-container--file-wrapper__file-d">
|
|
27
|
-
{fileName}
|
|
28
34
|
</div>
|
|
29
35
|
</div>
|
|
30
36
|
</div>
|
|
@@ -12,12 +12,14 @@ const ImageAttachmentComponent: React.FC<ImageAttachmentComponentProps> = ({
|
|
|
12
12
|
}: ImageAttachmentComponentProps) => {
|
|
13
13
|
return (
|
|
14
14
|
<div>
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
<a href={imageFile.url} download="file" target="_blank" rel="noreferrer">
|
|
16
|
+
<img
|
|
17
|
+
className="image-body"
|
|
18
|
+
key={imageFile.id}
|
|
19
|
+
src={imageFile.url}
|
|
20
|
+
alt={imageFile.name || 'attached image'}
|
|
21
|
+
/>
|
|
22
|
+
</a>
|
|
21
23
|
</div>
|
|
22
24
|
);
|
|
23
25
|
};
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import './AvatarContentIncomingUser.scss';
|
|
3
3
|
|
|
4
|
+
export interface AvatarContentIncomingUserProps {
|
|
5
|
+
// eslint-disable-next-line react/no-unused-prop-types
|
|
6
|
+
userId: number;
|
|
7
|
+
}
|
|
8
|
+
|
|
4
9
|
export default function AvatarContentIncomingUser() {
|
|
10
|
+
// props: AvatarContentIncomingUserProps,
|
|
5
11
|
return (
|
|
6
12
|
<div className="avatar-wrap">
|
|
7
13
|
<div className="avatar">
|
package/src/Presentation/components/UI/Dialogs/MessagesView/InComingMessage/InComingMessage.scss
CHANGED
|
@@ -255,7 +255,7 @@
|
|
|
255
255
|
max-width: 480px;
|
|
256
256
|
}
|
|
257
257
|
.message-in-a-single-line {
|
|
258
|
-
color: var(--
|
|
258
|
+
color: var(--main-text);
|
|
259
259
|
text-align: left;
|
|
260
260
|
font: var(--body-body-medium, 400 14px/20px "Roboto", sans-serif);
|
|
261
261
|
position: relative;
|