Add overflow to SDS Message

This commit is contained in:
nocnico
2025-06-08 13:07:49 +02:00
parent 9f9fc49446
commit 890cf27261
2 changed files with 20 additions and 6 deletions

View File

@@ -52,9 +52,11 @@ export const SettingsBtn = () => {
}, [user, setMic]); }, [user, setMic]);
useEffect(() => { useEffect(() => {
navigator.mediaDevices.enumerateDevices().then((devices) => { if (typeof navigator !== "undefined" && navigator.mediaDevices?.enumerateDevices) {
setInputDevices(devices.filter((d) => d.kind === "audioinput")); navigator.mediaDevices.enumerateDevices().then((devices) => {
}); setInputDevices(devices.filter((d) => d.kind === "audioinput"));
});
}
}, []); }, []);
return ( return (

View File

@@ -132,6 +132,10 @@ export const useMrtStore = create<MrtStore>(
} }
case "sds": { case "sds": {
const { sdsMessage } = pageData as SetSdsPageParams; const { sdsMessage } = pageData as SetSdsPageParams;
const maxLen = 60;
const msg = sdsMessage.data.message;
const safeMsg =
typeof msg === "string" && msg.length > maxLen ? msg.slice(0, maxLen) + "…" : msg;
set({ set({
page: "sds", page: "sds",
lines: [ lines: [
@@ -141,9 +145,17 @@ export const useMrtStore = create<MrtStore>(
textSize: "2", textSize: "2",
}, },
{ {
textLeft: sdsMessage.data.message, textLeft: safeMsg,
style: {}, style: {
textSize: "1", whiteSpace: "normal",
overflow: "hidden",
textOverflow: "ellipsis",
maxWidth: "100%",
width: "100%",
display: "block",
wordBreak: "break-word",
},
textSize: "2",
}, },
], ],
}); });