tangled
alpha
login
or
join now
stream.place
/
streamplace
74
fork
atom
Live video on the AT Protocol
74
fork
atom
overview
issues
1
pulls
pipelines
fix: create toast for long messages + outline text
ElshadHu
2 months ago
2247e888
3a63fc3a
+21
-1
1 changed file
expand all
collapse all
unified
split
js
components
src
components
chat
chat-box.tsx
+21
-1
js/components/src/components/chat/chat-box.tsx
···
7
7
Button,
8
8
Loader,
9
9
Text,
10
10
+
toast,
10
11
useChat,
11
12
useCreateChatMessage,
12
13
useLivestream,
···
62
63
new Map(),
63
64
);
64
65
const [filteredEmojis, setFilteredEmojis] = useState<any[]>([]);
66
66
+
const isOverLimit = [...message].length > 300;
65
67
66
68
let linfo = useLivestream();
67
69
···
234
236
235
237
const submit = () => {
236
238
if (!message.trim()) return;
239
239
+
if ([...message].length > 300) {
240
240
+
toast.show(
241
241
+
"Message too long",
242
242
+
"Please limit your message to 300 characters.",
243
243
+
{
244
244
+
variant: "error",
245
245
+
duration: 3,
246
246
+
},
247
247
+
);
248
248
+
return;
249
249
+
}
237
250
setMessage("");
238
251
setReplyToMessage(null);
239
252
···
412
425
}
413
426
}
414
427
}}
415
415
-
style={[chatBoxStyle]}
428
428
+
style={[
429
429
+
chatBoxStyle,
430
430
+
isOverLimit && {
431
431
+
borderColor: "#ef4444",
432
432
+
borderWidth: 2,
433
433
+
outline: "none",
434
434
+
},
435
435
+
]}
416
436
// "submit" won't blur on enter
417
437
submitBehavior="submit"
418
438
placeholder="Type a message..."