- {allChannels.length === 0 ? (
-
-
-
{t('audioChannels.empty.message')}
-
-
- ) : (
-
- {allChannels.map((channel) => {
- const isSelected = selectedChannelId === channel.id;
- return (
-
- );
- })}
-
- )}
-
-
-
{t('audioChannels.devices.title')}
-
- {selectedChannelId
- ? selectedChannel?.is_default
- ? t('audioChannels.devices.defaultNote')
- : t('audioChannels.devices.toggleHint')
- : t('audioChannels.devices.selectHint')}
-
-
- {allDevices.length > 0 ? (
-
- {allDevices.map((device) => {
- const isConnected =
- selectedChannelId &&
- selectedChannel &&
- (selectedChannel.device_ids.length === 0
- ? device.is_default
- : selectedChannel.device_ids.includes(device.id));
- const canToggle =
- selectedChannelId && selectedChannel && !selectedChannel.is_default;
-
- const handleDeviceClick = () => {
- if (!canToggle || !selectedChannel) return;
-
- const currentDeviceIds = selectedChannel.device_ids;
- const newDeviceIds = isConnected
- ? currentDeviceIds.filter((id) => id !== device.id)
- : [...currentDeviceIds, device.id];
-
- updateChannel.mutate({
- channelId: selectedChannelId,
- data: { device_ids: newDeviceIds },
- });
- };
-
- return (
-
- {canToggle ? (
-
- {isConnected && }
-
- ) : device.is_default ? (
-
- ) : null}
-
- {device.name}
-
-
- );
- })}
-
- ) : (
-
-
-
- {platform.metadata.isTauri
- ? t('audioChannels.devices.empty')
- : t('audioChannels.devices.requiresTauri')}
-
-
- )}
-