Implemented strict linting standards and prettier formatting config. (#248)
* 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.
This commit is contained in:
@@ -1,78 +1,82 @@
|
||||
const media = await Service.import("mpris");
|
||||
import { BoxWidget } from 'lib/types/widget';
|
||||
import { MprisPlayer } from 'types/service/mpris';
|
||||
|
||||
const MediaInfo = (getPlayerInfo: Function) => {
|
||||
const media = await Service.import('mpris');
|
||||
|
||||
const MediaInfo = (getPlayerInfo: () => MprisPlayer): BoxWidget => {
|
||||
return Widget.Box({
|
||||
class_name: "media-indicator-current-media-info",
|
||||
hpack: "center",
|
||||
class_name: 'media-indicator-current-media-info',
|
||||
hpack: 'center',
|
||||
hexpand: true,
|
||||
vertical: true,
|
||||
children: [
|
||||
Widget.Box({
|
||||
class_name: "media-indicator-current-song-name",
|
||||
hpack: "center",
|
||||
class_name: 'media-indicator-current-song-name',
|
||||
hpack: 'center',
|
||||
children: [
|
||||
Widget.Label({
|
||||
truncate: "end",
|
||||
truncate: 'end',
|
||||
max_width_chars: 31,
|
||||
wrap: true,
|
||||
class_name: "media-indicator-current-song-name-label",
|
||||
class_name: 'media-indicator-current-song-name-label',
|
||||
setup: (self) => {
|
||||
self.hook(media, () => {
|
||||
const curPlayer = getPlayerInfo();
|
||||
return (self.label =
|
||||
curPlayer !== undefined && curPlayer["track-title"].length
|
||||
? curPlayer["track-title"]
|
||||
: "No Media Currently Playing");
|
||||
curPlayer !== undefined && curPlayer['track_title'].length
|
||||
? curPlayer['track_title']
|
||||
: 'No Media Currently Playing');
|
||||
});
|
||||
},
|
||||
}),
|
||||
],
|
||||
}),
|
||||
Widget.Box({
|
||||
class_name: "media-indicator-current-song-author",
|
||||
hpack: "center",
|
||||
class_name: 'media-indicator-current-song-author',
|
||||
hpack: 'center',
|
||||
children: [
|
||||
Widget.Label({
|
||||
truncate: "end",
|
||||
truncate: 'end',
|
||||
wrap: true,
|
||||
max_width_chars: 35,
|
||||
class_name: "media-indicator-current-song-author-label",
|
||||
class_name: 'media-indicator-current-song-author-label',
|
||||
setup: (self) => {
|
||||
self.hook(media, () => {
|
||||
const curPlayer = getPlayerInfo();
|
||||
|
||||
const makeArtistList = (trackArtists: string[]) => {
|
||||
const makeArtistList = (trackArtists: string[]): string => {
|
||||
if (trackArtists.length === 1 && !trackArtists[0].length) {
|
||||
return "-----";
|
||||
return '-----';
|
||||
}
|
||||
|
||||
return trackArtists.join(", ");
|
||||
return trackArtists.join(', ');
|
||||
};
|
||||
|
||||
return (self.label =
|
||||
curPlayer !== undefined && curPlayer["track-artists"].length
|
||||
? makeArtistList(curPlayer["track-artists"])
|
||||
: "-----");
|
||||
curPlayer !== undefined && curPlayer['track_artists'].length
|
||||
? makeArtistList(curPlayer['track_artists'])
|
||||
: '-----');
|
||||
});
|
||||
},
|
||||
}),
|
||||
],
|
||||
}),
|
||||
Widget.Box({
|
||||
class_name: "media-indicator-current-song-album",
|
||||
hpack: "center",
|
||||
class_name: 'media-indicator-current-song-album',
|
||||
hpack: 'center',
|
||||
children: [
|
||||
Widget.Label({
|
||||
truncate: "end",
|
||||
truncate: 'end',
|
||||
wrap: true,
|
||||
max_width_chars: 40,
|
||||
class_name: "media-indicator-current-song-album-label",
|
||||
class_name: 'media-indicator-current-song-album-label',
|
||||
setup: (self) => {
|
||||
self.hook(media, () => {
|
||||
const curPlayer = getPlayerInfo();
|
||||
return (self.label =
|
||||
curPlayer !== undefined && curPlayer["track-album"].length
|
||||
? curPlayer["track-album"]
|
||||
: "---");
|
||||
curPlayer !== undefined && curPlayer['track_album'].length
|
||||
? curPlayer['track_album']
|
||||
: '---');
|
||||
});
|
||||
},
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user