diff --git a/src/components/import/SmartImportTab.tsx b/src/components/import/SmartImportTab.tsx index 2cc3323..471394f 100644 --- a/src/components/import/SmartImportTab.tsx +++ b/src/components/import/SmartImportTab.tsx @@ -1,4 +1,4 @@ -import React, { useState, useRef } from 'react'; +import React, { useState, useRef, useEffect } from 'react'; import { useChannelsStore } from '../../store/channelsStore'; import { useZonesStore } from '../../store/zonesStore'; import { getCurrentLocation, geocodeLocation } from '../../services/repeaterFinder'; @@ -98,9 +98,18 @@ export const SmartImportTab: React.FC = () => { const [mmdvmEntries, setMmdvmEntries] = useState([ { channelName: '', talkGroupName: 'Local', talkGroupId: 9 }, ]); - const [mmdvmZoneName, setMmdvmZoneName] = useState(''); + const [mmdvmZoneName, setMmdvmZoneName] = useState('MMDVM'); const [mmdvmDmrRadioIdIndex, setMmdvmDmrRadioIdIndex] = useState(''); // '' = None, or String(index) const [isAddingMmdvm, setIsAddingMmdvm] = useState(false); + const mmdvmDmrIdDefaultSetRef = useRef(false); + + // Preset MMDVM DMR Radio ID to first ID (slot 1) when list becomes available, once + useEffect(() => { + if (radioIds.length > 0 && !mmdvmDmrIdDefaultSetRef.current) { + setMmdvmDmrRadioIdIndex(String(radioIds[0].index)); + mmdvmDmrIdDefaultSetRef.current = true; + } + }, [radioIds]); // Unified search handler that searches all selected types @@ -1594,40 +1603,52 @@ export const SmartImportTab: React.FC = () => {

-
- - setMmdvmFrequency(e.target.value)} - min={MMDVM_FREQ_MIN_MHZ} - max={MMDVM_FREQ_MAX_MHZ} - step="0.001" - placeholder="431.150" - className="w-full bg-black border border-neon-cyan rounded px-3 py-2 text-white" - /> -

- {MMDVM_FREQ_MIN_MHZ}–{MMDVM_FREQ_MAX_MHZ} MHz (simplex: same RX/TX) -

-
- -
- - -

- Used for TX on all MMDVM channels. Set in the Digital tab if the list is empty. -

+
+
+ + setMmdvmZoneName(e.target.value)} + placeholder="Default: MMDVM" + maxLength={16} + className="w-full bg-black border border-neon-cyan rounded px-3 py-2 text-white" + /> +
+
+ + setMmdvmFrequency(e.target.value)} + min={MMDVM_FREQ_MIN_MHZ} + max={MMDVM_FREQ_MAX_MHZ} + step="0.001" + placeholder="431.150" + className="w-full bg-black border border-neon-cyan rounded px-3 py-2 text-white" + /> +

+ {MMDVM_FREQ_MIN_MHZ}–{MMDVM_FREQ_MAX_MHZ} MHz +

+
+
+ + +

+ For TX on all channels +

+
@@ -1718,18 +1739,6 @@ export const SmartImportTab: React.FC = () => {
-
- - setMmdvmZoneName(e.target.value)} - placeholder="Default: MMDVM" - maxLength={16} - className="w-full bg-black border border-neon-cyan rounded px-3 py-2 text-white" - /> -
- {radioIds.length === 0 && (
No DMR Radio ID set. Add one in the Digital tab so your radio can transmit on these channels.