@@ -30,7 +30,7 @@ export default function InputComponent({ addMessage }) {
3030 } = useAudioRecorder ( {
3131 logger : console ,
3232 } )
33-
33+
3434 /**
3535 * Reads the callsign from the filesystem.
3636 * @returns {string } - The callsign read from the file, or an empty string if the callsign has less than 3 characters.
@@ -44,6 +44,7 @@ export default function InputComponent({ addMessage }) {
4444 return callSign . length === 3 ? callSign : "" ;
4545 } catch ( error ) {
4646 console . error ( "Error reading callsign from file:" , error ) ;
47+ return "" ;
4748 }
4849 }
4950
@@ -61,7 +62,7 @@ export default function InputComponent({ addMessage }) {
6162 // This is done to ensure that the callsign is not displayed in the input field.
6263 const callSign = await readCallsignFromFile ( ) ;
6364 const displayText = encodeText . trim ( ) . toUpperCase ( ) ;
64- const morseText = callSign . length ? "@" + callSign + ": " + encodeText : encodeText
65+ const morseText = callSign . length === 3 ? `@ ${ callSign } : ${ encodeText } ` : encodeText ;
6566 const morse = await textToMorse ( morseText ) ;
6667
6768 addMessage ( displayText , morse , callSign , null , true , true ) ;
@@ -122,7 +123,7 @@ export default function InputComponent({ addMessage }) {
122123 // If the text starts with a call sign in the format @XXX : , extract the call sign
123124 console . log ( `InputComponent:handleStop: Evaluating ${ text } ` ) ;
124125 if ( text . match ( / @ [ A - Z ] { 3 } : / ) ) {
125- callSign = text . substring ( 1 , 4 ) ;
126+ callSign = text . substring ( 1 , 4 ) ;
126127 text = text . substring ( 6 ) ;
127128 }
128129 console . log ( `Callsign: ${ callSign } , Text: ${ text } ` ) ;
0 commit comments