diff --git a/apps/dispatch/app/_components/navbar/Settings.tsx b/apps/dispatch/app/_components/navbar/Settings.tsx index f8a4ec57..1889edb9 100644 --- a/apps/dispatch/app/_components/navbar/Settings.tsx +++ b/apps/dispatch/app/_components/navbar/Settings.tsx @@ -52,9 +52,11 @@ export const SettingsBtn = () => { }, [user, setMic]); useEffect(() => { - navigator.mediaDevices.enumerateDevices().then((devices) => { - setInputDevices(devices.filter((d) => d.kind === "audioinput")); - }); + if (typeof navigator !== "undefined" && navigator.mediaDevices?.enumerateDevices) { + navigator.mediaDevices.enumerateDevices().then((devices) => { + setInputDevices(devices.filter((d) => d.kind === "audioinput")); + }); + } }, []); return ( diff --git a/apps/dispatch/app/_store/pilot/MrtStore.ts b/apps/dispatch/app/_store/pilot/MrtStore.ts index ea3a9662..735fe473 100644 --- a/apps/dispatch/app/_store/pilot/MrtStore.ts +++ b/apps/dispatch/app/_store/pilot/MrtStore.ts @@ -132,6 +132,10 @@ export const useMrtStore = create( } case "sds": { 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({ page: "sds", lines: [ @@ -141,9 +145,17 @@ export const useMrtStore = create( textSize: "2", }, { - textLeft: sdsMessage.data.message, - style: {}, - textSize: "1", + textLeft: safeMsg, + style: { + whiteSpace: "normal", + overflow: "hidden", + textOverflow: "ellipsis", + maxWidth: "100%", + width: "100%", + display: "block", + wordBreak: "break-word", + }, + textSize: "2", }, ], });