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,16 +1,16 @@
|
||||
const media = await Service.import("mpris");
|
||||
import { MediaInfo } from "./components/mediainfo.js";
|
||||
import { Controls } from "./components/controls.js";
|
||||
import { Bar } from "./components/bar.js";
|
||||
import { MprisPlayer } from "types/service/mpris.js";
|
||||
import options from "options.js";
|
||||
const media = await Service.import('mpris');
|
||||
import { MediaInfo } from './components/mediainfo.js';
|
||||
import { Controls } from './components/controls.js';
|
||||
import { Bar } from './components/bar.js';
|
||||
import { MprisPlayer } from 'types/service/mpris.js';
|
||||
import options from 'options.js';
|
||||
import { BoxWidget } from 'lib/types/widget.js';
|
||||
|
||||
const { tint, color } = options.theme.bar.menus.menu.media.card;
|
||||
|
||||
const generateAlbumArt = (imageUrl: string): string => {
|
||||
const userTint = tint.value;
|
||||
const userHexColor = color.value;
|
||||
let css: string;
|
||||
|
||||
const r = parseInt(userHexColor.slice(1, 3), 16);
|
||||
const g = parseInt(userHexColor.slice(3, 5), 16);
|
||||
@@ -18,36 +18,30 @@ const generateAlbumArt = (imageUrl: string): string => {
|
||||
|
||||
const alpha = userTint / 100;
|
||||
|
||||
css = `background-image: linear-gradient(
|
||||
const css = `background-image: linear-gradient(
|
||||
rgba(${r}, ${g}, ${b}, ${alpha}),
|
||||
rgba(${r}, ${g}, ${b}, ${alpha}),
|
||||
${userHexColor} 65em
|
||||
), url("${imageUrl}");`;
|
||||
|
||||
return css;
|
||||
}
|
||||
const Media = () => {
|
||||
const curPlayer = Variable("");
|
||||
};
|
||||
const Media = (): BoxWidget => {
|
||||
const curPlayer = Variable('');
|
||||
|
||||
media.connect("changed", () => {
|
||||
media.connect('changed', () => {
|
||||
const statusOrder = {
|
||||
Playing: 1,
|
||||
Paused: 2,
|
||||
Stopped: 3,
|
||||
};
|
||||
|
||||
const isPlaying = media.players.find(
|
||||
(p) => p["play_back_status"] === "Playing",
|
||||
);
|
||||
const isPlaying = media.players.find((p) => p['play_back_status'] === 'Playing');
|
||||
|
||||
const playerStillExists = media.players.some(
|
||||
(p) => curPlayer.value === p["bus_name"],
|
||||
);
|
||||
const playerStillExists = media.players.some((p) => curPlayer.value === p['bus_name']);
|
||||
|
||||
const nextPlayerUp = media.players.sort(
|
||||
(a, b) =>
|
||||
statusOrder[a["play_back_status"]] -
|
||||
statusOrder[b["play_back_status"]],
|
||||
(a, b) => statusOrder[a['play_back_status']] - statusOrder[b['play_back_status']],
|
||||
)[0].bus_name;
|
||||
|
||||
if (isPlaying || !playerStillExists) {
|
||||
@@ -60,26 +54,22 @@ const Media = () => {
|
||||
};
|
||||
|
||||
return Widget.Box({
|
||||
class_name: "menu-section-container",
|
||||
class_name: 'menu-section-container',
|
||||
children: [
|
||||
Widget.Box({
|
||||
class_name: "menu-items-section",
|
||||
class_name: 'menu-items-section',
|
||||
vertical: false,
|
||||
child: Widget.Box({
|
||||
class_name: "menu-content",
|
||||
class_name: 'menu-content',
|
||||
children: [
|
||||
Widget.Box({
|
||||
class_name: "media-content",
|
||||
class_name: 'media-content',
|
||||
child: Widget.Box({
|
||||
class_name: "media-indicator-right-section",
|
||||
hpack: "fill",
|
||||
class_name: 'media-indicator-right-section',
|
||||
hpack: 'fill',
|
||||
hexpand: true,
|
||||
vertical: true,
|
||||
children: [
|
||||
MediaInfo(getPlayerInfo),
|
||||
Controls(getPlayerInfo),
|
||||
Bar(getPlayerInfo),
|
||||
],
|
||||
children: [MediaInfo(getPlayerInfo), Controls(getPlayerInfo), Bar(getPlayerInfo)],
|
||||
}),
|
||||
}),
|
||||
],
|
||||
@@ -91,7 +81,7 @@ const Media = () => {
|
||||
}
|
||||
});
|
||||
|
||||
Utils.merge([color.bind("value"), tint.bind("value")], () => {
|
||||
Utils.merge([color.bind('value'), tint.bind('value')], () => {
|
||||
const curPlayer = getPlayerInfo();
|
||||
if (curPlayer !== undefined) {
|
||||
self.css = generateAlbumArt(curPlayer.track_cover_url);
|
||||
|
||||
Reference in New Issue
Block a user