Files
gods-eye-view/src/ui/stores/radio.js
T
Sameh Khamis b6c7c130f6 feat(ui): render the local RTL-SDR card from the store
LocalSdrControls publishes the card to the radio store and SdrCard renders it. The new v-field-value directive never overwrites a focused field, including one a render disables.
2026-10-31 00:43:27 -07:00

30 lines
1008 B
JavaScript

import { defineStore } from 'pinia';
import { markRaw, shallowRef } from 'vue';
/**
* The Radio panel as its view renders it. RadioControls presents the
* directory row, station card, transport, volume and playback line
* (`renderRadioState()`) and publishes them here; it keeps its listeners,
* the tuner and the Cockpit radio controls. LocalSdrControls publishes the
* local RTL-SDR card beside it.
*/
export const useRadioStore = defineStore('gev-radio', () => {
/** The presented panel; null until the controls first render. */
const view = shallowRef(null);
/** @param {object} next A fresh presentation; every publish re-renders. */
function publish(next) {
view.value = markRaw(next);
}
/** The local RTL-SDR card; null until its controls first render. */
const sdr = shallowRef(null);
/** @param {object} next A fresh presentation of the RTL-SDR card. */
function publishSdr(next) {
sdr.value = markRaw(next);
}
return { view, publish, sdr, publishSdr };
});