diff --git a/packages/react/src/views/AttachmentPreview/AttachmentPreview.js b/packages/react/src/views/AttachmentPreview/AttachmentPreview.js index 01123dafbe..c0e1b1473d 100644 --- a/packages/react/src/views/AttachmentPreview/AttachmentPreview.js +++ b/packages/react/src/views/AttachmentPreview/AttachmentPreview.js @@ -1,6 +1,13 @@ import React, { useContext, useState, useRef, useEffect } from 'react'; import { css } from '@emotion/react'; -import { Box, Icon, Button, Input, Modal } from '@embeddedchat/ui-elements'; +import { + Box, + Icon, + Button, + Input, + Modal, + useTheme, +} from '@embeddedchat/ui-elements'; import useAttachmentWindowStore from '../../store/attachmentwindow'; import CheckPreviewType from './CheckPreviewType'; import RCContext from '../../context/RCInstance'; @@ -14,6 +21,7 @@ import useSearchMentionUser from '../../hooks/useSearchMentionUser'; const AttachmentPreview = () => { const { RCInstance, ECOptions } = useContext(RCContext); const styles = getAttachmentPreviewStyles(); + const { theme } = useTheme(); const toggle = useAttachmentWindowStore((state) => state.toggle); const data = useAttachmentWindowStore((state) => state.data); @@ -109,47 +117,74 @@ const AttachmentPreview = () => { css={css` text-align: center; margin-top: 1rem; + display: flex; + justify-content: center; + padding: 0 50px 0 50px; `} > - File name - + { handleFileName(e); }} value={fileName} + id="file-name" type="text" - css={styles.input} placeholder="name" + css={css` + ${styles.input} + &:focus { + border-color: ${fileName === '' + ? theme.colors.destructive + : theme.colors.ring}; + transition: border 0.1s ease-in; + } + `} /> + {fileName === '' && ( + + The field File name is required. + + )} - File description - + {showMembersList && ( @@ -171,9 +206,16 @@ const AttachmentPreview = () => { onChange={(e) => { handleFileDescription(e); }} + id="file-description" type="text" - css={styles.input} placeholder="Description" + css={css` + ${styles.input} + &:focus { + border: ${theme.colors.ring}; + transition: border 0.9s ease-in, border 0.9s ease-out; + } + `} ref={messageRef} /> @@ -184,16 +226,19 @@ const AttachmentPreview = () => { @@ -363,7 +335,7 @@ export const MessageToolbox = ({ handleOnClose(); }} > - Delete message + Yes, delete diff --git a/packages/react/src/views/UserInformation/UserInformation.js b/packages/react/src/views/UserInformation/UserInformation.js index d03232d651..894b8b77c8 100644 --- a/packages/react/src/views/UserInformation/UserInformation.js +++ b/packages/react/src/views/UserInformation/UserInformation.js @@ -29,6 +29,8 @@ const UserInformation = () => { const styles = getUserInformationStyles(theme); const [currentUserInfo, setCurrentUserInfo] = useState({}); const [isUserInfoFetched, setIsUserInfoFetched] = useState(false); + const [error, setError] = useState(null); + const [loader, setLoader] = useState(true); const currentUser = useUserStore((state) => state.currentUser); const currentUserRoles = useUserStore((state) => state.roles); const viewUserFullInfoRoles = useUserStore( @@ -51,6 +53,10 @@ const UserInformation = () => { if (res?.user) { setCurrentUserInfo(res.user); setIsUserInfoFetched(true); + setLoader(false); + } else { + setError('No user found'); + setLoader(false); } } catch (err) { console.error('Error fetching current user info', err); @@ -58,7 +64,7 @@ const UserInformation = () => { }; getCurrentUserInfo(); - }, [RCInstance, setCurrentUserInfo]); + }, [RCInstance, setCurrentUserInfo, currentUser._id]); const ViewComponent = viewType === 'Popup' ? Popup : Sidebar; @@ -77,6 +83,9 @@ const UserInformation = () => { } : {})} > + + {loader ? : null} + {isUserInfoFetched ? ( { /> - ) : ( - - + ) : error ? ( + + +
+ No Info Found +
- )} + ) : null} ); }; diff --git a/packages/ui-elements/src/components/Icon/icons/Reaction.js b/packages/ui-elements/src/components/Icon/icons/Reaction.js new file mode 100644 index 0000000000..d327ea48ca --- /dev/null +++ b/packages/ui-elements/src/components/Icon/icons/Reaction.js @@ -0,0 +1,15 @@ +import React from 'react'; + +const Pin = (props) => ( + + + +); + +export default Pin; diff --git a/packages/ui-elements/src/components/Icon/icons/index.js b/packages/ui-elements/src/components/Icon/icons/index.js index 234251edab..becd103142 100644 --- a/packages/ui-elements/src/components/Icon/icons/index.js +++ b/packages/ui-elements/src/components/Icon/icons/index.js @@ -2,6 +2,7 @@ import File from './File'; import Mobile from './Mobile'; import Star from './Star'; import Pin from './Pin'; +import Reaction from './Reaction'; import ReplyDirectly from './ReplyDirectly'; import Hash from './Hash'; import HashLock from './HashLock'; @@ -70,6 +71,7 @@ const icons = { mobile: Mobile, star: Star, pin: Pin, + reaction: Reaction, 'reply-directly': ReplyDirectly, hash: Hash, hash_lock: HashLock, diff --git a/packages/ui-elements/tools/icons-generator.js b/packages/ui-elements/tools/icons-generator.js index d12396c2b1..b01de21d8f 100644 --- a/packages/ui-elements/tools/icons-generator.js +++ b/packages/ui-elements/tools/icons-generator.js @@ -18,6 +18,7 @@ const iconsList = [ 'circle-check', 'send', 'emoji', + 'reaction', 'plus', 'thread', 'user',