Skip to content

Commit 18c8b7e

Browse files
authored
UX: Enhance SendMessage component by adding KeepContents feature with tooltip and update styling (#1574)
1 parent 8a4c289 commit 18c8b7e

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

frontend/src/components/Topics/Topic/SendMessage/SendMessage.tsx

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { Button } from 'components/common/Button/Button';
55
import Editor from 'components/common/Editor/Editor';
66
import Select from 'components/common/Select/Select';
77
import Switch from 'components/common/Switch/Switch';
8+
import Tooltip from 'components/common/Tooltip/Tooltip';
9+
import InfoIcon from 'components/common/Icons/InfoIcon';
810
import useAppParams from 'lib/hooks/useAppParams';
911
import { showAlert } from 'lib/errorHandling';
1012
import { useSendMessage, useTopicDetails } from 'lib/hooks/api/topics';
@@ -190,16 +192,6 @@ const SendMessage: React.FC<SendMessageProps> = ({
190192
/>
191193
</S.FlexItem>
192194
</S.Flex>
193-
<div>
194-
<Controller
195-
control={control}
196-
name="keepContents"
197-
render={({ field: { name, onChange, value } }) => (
198-
<Switch name={name} onChange={onChange} checked={value} />
199-
)}
200-
/>
201-
<InputLabel>Keep contents</InputLabel>
202-
</div>
203195
</S.Columns>
204196
<S.Columns>
205197
<div>
@@ -253,6 +245,22 @@ const SendMessage: React.FC<SendMessageProps> = ({
253245
/>
254246
</div>
255247
</S.Columns>
248+
<S.Columns>
249+
<S.Flex>
250+
<Controller
251+
control={control}
252+
name="keepContents"
253+
render={({ field: { name, onChange, value } }) => (
254+
<Switch name={name} onChange={onChange} checked={value} />
255+
)}
256+
/>
257+
<InputLabel>Keep contents after producing a message</InputLabel>
258+
<Tooltip
259+
value={<InfoIcon />}
260+
content="When enabled, the form will remain populated after sending a message."
261+
/>
262+
</S.Flex>
263+
</S.Columns>
256264
<Button
257265
buttonSize="M"
258266
buttonType="primary"

0 commit comments

Comments
 (0)