Skip to content

Commit b501f76

Browse files
fix: ChatInput Formatter Tool UI for small screens (#693)
* Fix chatFormatter Toolbar UI * make message box and popover menu occupy full width * make message composer configurable * zIndex fix * resolve conflict * Place popoverMenu icon to the extreme right * feat: Add 'Cancel Recording' and 'Finish Recording' tooltips for audio/video buttons (#812) * fix message box width and minor UI issues for chatinput formatters * remove redundant tooltip * remove audio from pop over menu * run prettier * fix audio issue * change font size for chat input --------- Co-authored-by: Dhairyashil Shinde <[email protected]>
1 parent 016e985 commit b501f76

File tree

6 files changed

+296
-68
lines changed

6 files changed

+296
-68
lines changed

packages/react/src/views/ChatInput/AudioMessageRecorder.js

+13-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ import useMessageStore from '../../store/messageStore';
1111
import { getCommonRecorderStyles } from './ChatInput.styles';
1212
import useAttachmentWindowStore from '../../store/attachmentwindow';
1313

14-
const AudioMessageRecorder = ({ disabled }) => {
14+
const AudioMessageRecorder = (props) => {
15+
const { disabled, displayName, popOverItemStyles } = props;
1516
const videoRef = useRef(null);
1617
const { theme } = useTheme();
1718
const styles = getCommonRecorderStyles(theme);
@@ -136,7 +137,17 @@ const AudioMessageRecorder = ({ disabled }) => {
136137
}, [isRecorded, file]);
137138

138139
if (state === 'idle') {
139-
return (
140+
return displayName ? (
141+
<Box
142+
key="audio"
143+
css={popOverItemStyles}
144+
onClick={handleRecordButtonClick}
145+
disabled={disabled}
146+
>
147+
<Icon name="mic" size="1rem" />
148+
<span>{displayName}</span>
149+
</Box>
150+
) : (
140151
<Tooltip text="Audio Message" position="top">
141152
<ActionButton
142153
ghost

packages/react/src/views/ChatInput/ChatInput.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ const ChatInput = ({ scrollToBottom }) => {
524524
disabled={!isUserAuthenticated || !canSendMsg || isRecordingMessage}
525525
placeholder={
526526
isUserAuthenticated && canSendMsg
527-
? `Message #${channelInfo.name}`
527+
? `Message ${channelInfo.name ? `#${channelInfo.name}` : ''}`
528528
: isUserAuthenticated
529529
? 'This room is read only'
530530
: 'Sign in to chat'

packages/react/src/views/ChatInput/ChatInput.styles.js

+26-5
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ export const getChatInputStyles = (theme) => {
1010
&.focused {
1111
border: ${`1.5px solid ${theme.colors.ring}`};
1212
}
13+
@media (max-width: 500px) {
14+
margin: 0;
15+
width: 100%;
16+
}
1317
`,
1418

1519
editMessage: css`
@@ -80,10 +84,27 @@ export const getChatInputFormattingToolbarStyles = ({ theme, mode }) => {
8084
position: relative;
8185
gap: 0.1rem;
8286
border-radius: 0 0 ${theme.radius} ${theme.radius};
83-
@media (max-width: 383px) {
84-
display: grid;
85-
grid-template-columns: repeat(5, 0.2fr);
86-
}
87+
`,
88+
popOverStyles: css`
89+
position: absolute;
90+
bottom: 3rem;
91+
left: 0;
92+
width: 100%;
93+
background: ${theme.colors.background};
94+
box-shadow: 0 -8px 10px ${mode === 'light' ? darken(theme.colors.background, 0.1) : lighten(theme.colors.background, 1)};
95+
border-radius: 8px;
96+
padding: 1rem;
97+
display: flex;
98+
flex-direction: column;
99+
align-items: flex-start;
100+
z-index: 1300;
101+
`,
102+
popOverItemStyles: css`
103+
display: flex;
104+
gap: 0.5rem;
105+
align-items: center;
106+
cursor: pointer;
107+
padding: 0.5rem;
87108
`,
88109
};
89110
return styles;
@@ -101,8 +122,8 @@ export const getCommonRecorderStyles = (theme) => {
101122
`,
102123

103124
controller: css`
104-
display: flex;
105125
gap: 0.15rem;
126+
display: inline-flex;
106127
`,
107128

108129
timer: css`

0 commit comments

Comments
 (0)