* Implemented strict linting standards and prettier formatting config. * More linter fixes and type updates. * More linter updates and type fixes * Remove noisy comments * Linter and type updates * Linter, formatting and type updates. * Linter updates * Type updates * Type updates * fixed all linter errors * Fixed all linting, formatting and type issues. * Resolve merge conflicts.
61 lines
2.5 KiB
TypeScript
61 lines
2.5 KiB
TypeScript
const audio = await Service.import('audio');
|
|
import { PlaybackDevices } from 'lib/types/audio';
|
|
import { Stream } from 'types/service/audio';
|
|
|
|
const renderPlaybacks = (playbackDevices: Stream[]): PlaybackDevices => {
|
|
return playbackDevices.map((device) => {
|
|
if (device.description === 'Dummy Output') {
|
|
return Widget.Box({
|
|
class_name: 'menu-unfound-button playback',
|
|
child: Widget.Box({
|
|
children: [
|
|
Widget.Label({
|
|
class_name: 'menu-button-name playback',
|
|
label: 'No playback devices found...',
|
|
}),
|
|
],
|
|
}),
|
|
});
|
|
}
|
|
return Widget.Button({
|
|
class_name: `menu-button audio playback ${device}`,
|
|
on_primary_click: () => (audio.speaker = device),
|
|
child: Widget.Box({
|
|
children: [
|
|
Widget.Box({
|
|
hpack: 'start',
|
|
children: [
|
|
Widget.Label({
|
|
truncate: 'end',
|
|
wrap: true,
|
|
class_name: audio.speaker
|
|
.bind('description')
|
|
.as((v) =>
|
|
device.description === v
|
|
? 'menu-button-icon active playback txt-icon'
|
|
: 'menu-button-icon playback txt-icon',
|
|
),
|
|
label: '',
|
|
}),
|
|
Widget.Label({
|
|
truncate: 'end',
|
|
wrap: true,
|
|
class_name: audio.speaker
|
|
.bind('description')
|
|
.as((v) =>
|
|
device.description === v
|
|
? 'menu-button-name active playback'
|
|
: 'menu-button-name playback',
|
|
),
|
|
label: device.description,
|
|
}),
|
|
],
|
|
}),
|
|
],
|
|
}),
|
|
});
|
|
});
|
|
};
|
|
|
|
export { renderPlaybacks };
|