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,40 +1,41 @@
|
||||
import brightness from "../../../../services/Brightness.js";
|
||||
import icons from "../../../icons/index.js";
|
||||
import { BoxWidget } from 'lib/types/widget.js';
|
||||
import brightness from '../../../../services/Brightness.js';
|
||||
import icons from '../../../icons/index.js';
|
||||
|
||||
const Brightness = () => {
|
||||
const Brightness = (): BoxWidget => {
|
||||
return Widget.Box({
|
||||
class_name: "menu-section-container brightness",
|
||||
class_name: 'menu-section-container brightness',
|
||||
vertical: true,
|
||||
children: [
|
||||
Widget.Box({
|
||||
class_name: "menu-label-container",
|
||||
hpack: "fill",
|
||||
class_name: 'menu-label-container',
|
||||
hpack: 'fill',
|
||||
child: Widget.Label({
|
||||
class_name: "menu-label",
|
||||
class_name: 'menu-label',
|
||||
hexpand: true,
|
||||
hpack: "start",
|
||||
label: "Brightness",
|
||||
hpack: 'start',
|
||||
label: 'Brightness',
|
||||
}),
|
||||
}),
|
||||
Widget.Box({
|
||||
class_name: "menu-items-section",
|
||||
vpack: "fill",
|
||||
class_name: 'menu-items-section',
|
||||
vpack: 'fill',
|
||||
vexpand: true,
|
||||
vertical: true,
|
||||
child: Widget.Box({
|
||||
class_name: "brightness-container",
|
||||
class_name: 'brightness-container',
|
||||
children: [
|
||||
Widget.Icon({
|
||||
vexpand: true,
|
||||
vpack: "center",
|
||||
class_name: "brightness-slider-icon",
|
||||
vpack: 'center',
|
||||
class_name: 'brightness-slider-icon',
|
||||
icon: icons.brightness.screen,
|
||||
}),
|
||||
Widget.Slider({
|
||||
vpack: "center",
|
||||
vpack: 'center',
|
||||
vexpand: true,
|
||||
value: brightness.bind("screen"),
|
||||
class_name: "menu-active-slider menu-slider brightness",
|
||||
value: brightness.bind('screen'),
|
||||
class_name: 'menu-active-slider menu-slider brightness',
|
||||
draw_value: false,
|
||||
hexpand: true,
|
||||
min: 0,
|
||||
@@ -42,12 +43,10 @@ const Brightness = () => {
|
||||
onChange: ({ value }) => (brightness.screen = value),
|
||||
}),
|
||||
Widget.Label({
|
||||
vpack: "center",
|
||||
vpack: 'center',
|
||||
vexpand: true,
|
||||
class_name: "brightness-slider-label",
|
||||
label: brightness
|
||||
.bind("screen")
|
||||
.as((b) => `${Math.round(b * 100)}%`),
|
||||
class_name: 'brightness-slider-label',
|
||||
label: brightness.bind('screen').as((b) => `${Math.round(b * 100)}%`),
|
||||
}),
|
||||
],
|
||||
}),
|
||||
|
||||
@@ -1,24 +1,23 @@
|
||||
import DropdownMenu from "../DropdownMenu.js";
|
||||
import { EnergyProfiles } from "./profiles/index.js";
|
||||
import { Brightness } from "./brightness/index.js";
|
||||
import DropdownMenu from '../DropdownMenu.js';
|
||||
import { EnergyProfiles } from './profiles/index.js';
|
||||
import { Brightness } from './brightness/index.js';
|
||||
import { Attribute, Child } from 'lib/types/widget.js';
|
||||
import Window from 'types/widgets/window.js';
|
||||
|
||||
export default () => {
|
||||
export default (): Window<Child, Attribute> => {
|
||||
return DropdownMenu({
|
||||
name: "energymenu",
|
||||
transition: "crossfade",
|
||||
name: 'energymenu',
|
||||
transition: 'crossfade',
|
||||
child: Widget.Box({
|
||||
class_name: "menu-items energy",
|
||||
hpack: "fill",
|
||||
class_name: 'menu-items energy',
|
||||
hpack: 'fill',
|
||||
hexpand: true,
|
||||
child: Widget.Box({
|
||||
vertical: true,
|
||||
hpack: "fill",
|
||||
hpack: 'fill',
|
||||
hexpand: true,
|
||||
class_name: "menu-items-container energy",
|
||||
children: [
|
||||
Brightness(),
|
||||
EnergyProfiles(),
|
||||
],
|
||||
class_name: 'menu-items-container energy',
|
||||
children: [Brightness(), EnergyProfiles()],
|
||||
}),
|
||||
}),
|
||||
});
|
||||
|
||||
@@ -1,36 +1,37 @@
|
||||
const powerProfiles = await Service.import("powerprofiles");
|
||||
import { PowerProfile, PowerProfileObject, PowerProfiles } from "lib/types/powerprofiles.js";
|
||||
import icons from "../../../icons/index.js";
|
||||
const powerProfiles = await Service.import('powerprofiles');
|
||||
import { PowerProfile, PowerProfileObject, PowerProfiles } from 'lib/types/powerprofiles.js';
|
||||
import icons from '../../../icons/index.js';
|
||||
import { BoxWidget } from 'lib/types/widget.js';
|
||||
|
||||
const EnergyProfiles = () => {
|
||||
const EnergyProfiles = (): BoxWidget => {
|
||||
const isValidProfile = (profile: string): profile is PowerProfile =>
|
||||
profile === "power-saver" || profile === "balanced" || profile === "performance";
|
||||
profile === 'power-saver' || profile === 'balanced' || profile === 'performance';
|
||||
|
||||
return Widget.Box({
|
||||
class_name: "menu-section-container energy",
|
||||
class_name: 'menu-section-container energy',
|
||||
vertical: true,
|
||||
children: [
|
||||
Widget.Box({
|
||||
class_name: "menu-label-container",
|
||||
hpack: "fill",
|
||||
class_name: 'menu-label-container',
|
||||
hpack: 'fill',
|
||||
child: Widget.Label({
|
||||
class_name: "menu-label",
|
||||
class_name: 'menu-label',
|
||||
hexpand: true,
|
||||
hpack: "start",
|
||||
label: "Power Profile",
|
||||
hpack: 'start',
|
||||
label: 'Power Profile',
|
||||
}),
|
||||
}),
|
||||
Widget.Box({
|
||||
class_name: "menu-items-section",
|
||||
vpack: "fill",
|
||||
class_name: 'menu-items-section',
|
||||
vpack: 'fill',
|
||||
vexpand: true,
|
||||
vertical: true,
|
||||
children: powerProfiles.bind("profiles").as((profiles: PowerProfiles) => {
|
||||
children: powerProfiles.bind('profiles').as((profiles: PowerProfiles) => {
|
||||
return profiles.map((prof: PowerProfileObject) => {
|
||||
const profileLabels = {
|
||||
"power-saver": "Power Saver",
|
||||
balanced: "Balanced",
|
||||
performance: "Performance",
|
||||
'power-saver': 'Power Saver',
|
||||
balanced: 'Balanced',
|
||||
performance: 'Performance',
|
||||
};
|
||||
|
||||
const profileType = prof.Profile;
|
||||
@@ -43,17 +44,17 @@ const EnergyProfiles = () => {
|
||||
on_primary_click: () => {
|
||||
powerProfiles.active_profile = prof.Profile;
|
||||
},
|
||||
class_name: powerProfiles.bind("active_profile").as((active) => {
|
||||
return `power-profile-item ${active === prof.Profile ? "active" : ""}`;
|
||||
class_name: powerProfiles.bind('active_profile').as((active) => {
|
||||
return `power-profile-item ${active === prof.Profile ? 'active' : ''}`;
|
||||
}),
|
||||
child: Widget.Box({
|
||||
children: [
|
||||
Widget.Icon({
|
||||
class_name: "power-profile-icon",
|
||||
class_name: 'power-profile-icon',
|
||||
icon: icons.powerprofile[profileType],
|
||||
}),
|
||||
Widget.Label({
|
||||
class_name: "power-profile-label",
|
||||
class_name: 'power-profile-label',
|
||||
label: profileLabels[profileType],
|
||||
}),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user