Browse Source

fix: empty pages

stage
Vitalik 4 months ago
parent
commit
5784fa1aba
  1. 34
      src/containers/Chats/plugins/chat-item-message.component.tsx
  2. 3
      src/containers/Chats/transforms/chat-messages.transforms.ts
  3. 5
      src/containers/User/components/DataUser/index.tsx
  4. 2
      src/containers/User/index.tsx
  5. 29946
      yarn.lock

34
src/containers/Chats/plugins/chat-item-message.component.tsx

@ -17,39 +17,9 @@ interface ChatItemMessageProps extends IMessage { @@ -17,39 +17,9 @@ interface ChatItemMessageProps extends IMessage {
const regexToMatch = /@\[([^[]*)]\(([^(^)]*)\)/g;
// interface IMentionData {
// id: number;
// name: string;
// }
// const parseMentions = (message: string) => {
// if (message.charAt(0) === "@") message = " " + message;
// const array = message.split(" @");
// let returnArr: IMentionData[] = [];
// for (const item of array) {
// if (!_.isEmpty(item)) {
// const name = item.substring(
// item.lastIndexOf("[") + 1,
// item.lastIndexOf("]")
// );
// const id = item.substring(
// item.lastIndexOf("(") + 1,
// item.lastIndexOf(")")
// );
// returnArr = [...returnArr, { name: name, id: Number(id) }];
// }
// returnArr = [...returnArr, { name: "", id: 0 }];
// }
// return returnArr;
// };
const parseMessage = (message: string, regex: RegExp): string => {
if (!message) return ''
const subst = ` @$1($2) `;
const result = message.replace(regex, subst);
return result.replace(/\n{3,}\s*/g, "\n\n");
@ -69,6 +39,8 @@ const findMentionId = (user: string): number => { @@ -69,6 +39,8 @@ const findMentionId = (user: string): number => {
const _ChatItemMessage: FC<ChatItemMessageProps> = (props) => {
const resultMessage = parseMessage(props.content?.message, regexToMatch);
if (!resultMessage) return null
return (
<ChatItem {...props}>
<div className="chat-item-message-container">

3
src/containers/Chats/transforms/chat-messages.transforms.ts

@ -119,6 +119,8 @@ const getContentByMessageType = { @@ -119,6 +119,8 @@ const getContentByMessageType = {
};
const createContent = (item: IMessageInChat, members: IChatMember[]) => {
if (!item) return null
if (isSystem(item.type))
return getContentByMessageType[item.type](item, members);
@ -146,6 +148,7 @@ const createContent = (item: IMessageInChat, members: IChatMember[]) => { @@ -146,6 +148,7 @@ const createContent = (item: IMessageInChat, members: IChatMember[]) => {
};
const getForwardedFrom = (item: IMessageInChat) => {
if (!item.content || !item.content?.originalMessage) return null
if (item.type !== MessageType.Forwarded) return null;
const { user } = item.content?.originalMessage;

5
src/containers/User/components/DataUser/index.tsx

@ -196,7 +196,10 @@ export const UsersTableList = (props: IProps) => { @@ -196,7 +196,10 @@ export const UsersTableList = (props: IProps) => {
const handleSelectAllColumnPress = () => {
if (props.selectedUsers.length === props.allUsers?.length)
props.setSelectedUsers([]);
else props.setSelectedUsers(props.allUsers);
else if (props.allUsers?.length === 1) {
console.log(props.paginationList);
props.setSelectedUsers([props.paginationList.items[0]]);
} else props.setSelectedUsers(props.allUsers);
};
return (

2
src/containers/User/index.tsx

@ -78,6 +78,7 @@ export const Users: FC = () => { @@ -78,6 +78,7 @@ export const Users: FC = () => {
) => {
const actionByKey = {
edit: () => {
console.log('selectedUsers', selectedUsers)
setUserModal({
isOpen: true,
mode: UserModalMode.Edit,
@ -144,6 +145,7 @@ export const Users: FC = () => { @@ -144,6 +145,7 @@ export const Users: FC = () => {
});
}, [paginationList, selectedUsers]);
// console.log(paginationList.data)
return (
<Container className="factory">
<ConfirmModal

29946
yarn.lock

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save