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,9 +1,9 @@
|
||||
import { Module } from "lib/types/bar";
|
||||
import { BarButtonStyles } from "lib/types/options";
|
||||
import options from "options";
|
||||
import Gtk from "types/@girs/gtk-3.0/gtk-3.0";
|
||||
import { Binding } from "types/service";
|
||||
import { Variable as VariableType } from "types/variable";
|
||||
import { BarBoxChild, Module } from 'lib/types/bar';
|
||||
import { BarButtonStyles } from 'lib/types/options';
|
||||
import { Bind } from 'lib/types/variable';
|
||||
import { GtkWidget } from 'lib/types/widget';
|
||||
import options from 'options';
|
||||
import Gtk from 'types/@girs/gtk-3.0/gtk-3.0';
|
||||
|
||||
const { style } = options.theme.bar.buttons;
|
||||
|
||||
@@ -16,69 +16,69 @@ export const module = ({
|
||||
tooltipText,
|
||||
boxClass,
|
||||
props = {},
|
||||
showLabelBinding = undefinedVar.bind("value"),
|
||||
showLabelBinding = undefinedVar.bind('value'),
|
||||
showLabel,
|
||||
labelHook,
|
||||
hook
|
||||
}: Module) => {
|
||||
const getIconWidget = () => {
|
||||
hook,
|
||||
}: Module): BarBoxChild => {
|
||||
const getIconWidget = (): GtkWidget | undefined => {
|
||||
let iconWidget: Gtk.Widget | undefined;
|
||||
|
||||
if (icon !== undefined) {
|
||||
iconWidget = Widget.Icon({
|
||||
class_name: `txt-icon bar-button-icon module-icon ${boxClass}`,
|
||||
icon: icon
|
||||
icon: icon,
|
||||
}) as unknown as Gtk.Widget;
|
||||
} else if (textIcon !== undefined) {
|
||||
iconWidget = Widget.Label({
|
||||
class_name: `txt-icon bar-button-icon module-icon ${boxClass}`,
|
||||
label: textIcon
|
||||
label: textIcon,
|
||||
}) as unknown as Gtk.Widget;
|
||||
}
|
||||
|
||||
return iconWidget;
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
component: Widget.Box({
|
||||
className: Utils.merge([style.bind("value"), showLabelBinding], (style: BarButtonStyles, shwLabel: boolean) => {
|
||||
const shouldShowLabel = shwLabel || showLabel;
|
||||
const styleMap = {
|
||||
default: "style1",
|
||||
split: "style2",
|
||||
wave: "style3",
|
||||
wave2: "style3",
|
||||
};
|
||||
return `${boxClass} ${styleMap[style]} ${!shouldShowLabel ? "no-label" : ""}`;
|
||||
}),
|
||||
className: Utils.merge(
|
||||
[style.bind('value'), showLabelBinding],
|
||||
(style: BarButtonStyles, shwLabel: boolean) => {
|
||||
const shouldShowLabel = shwLabel || showLabel;
|
||||
const styleMap = {
|
||||
default: 'style1',
|
||||
split: 'style2',
|
||||
wave: 'style3',
|
||||
wave2: 'style3',
|
||||
};
|
||||
return `${boxClass} ${styleMap[style]} ${!shouldShowLabel ? 'no-label' : ''}`;
|
||||
},
|
||||
),
|
||||
tooltip_text: tooltipText,
|
||||
children: Utils.merge(
|
||||
[showLabelBinding],
|
||||
(showLabelBinding): Gtk.Widget[] => {
|
||||
const childrenArray: Gtk.Widget[] = [];
|
||||
const iconWidget = getIconWidget();
|
||||
children: Utils.merge([showLabelBinding], (showLabelBinding): Gtk.Widget[] => {
|
||||
const childrenArray: Gtk.Widget[] = [];
|
||||
const iconWidget = getIconWidget();
|
||||
|
||||
if (iconWidget !== undefined) {
|
||||
childrenArray.push(iconWidget);
|
||||
}
|
||||
|
||||
if (showLabelBinding) {
|
||||
childrenArray.push(
|
||||
Widget.Label({
|
||||
class_name: `bar-button-label module-label ${boxClass}`,
|
||||
label: label,
|
||||
setup: labelHook,
|
||||
}) as unknown as Gtk.Widget
|
||||
);
|
||||
}
|
||||
return childrenArray;
|
||||
if (iconWidget !== undefined) {
|
||||
childrenArray.push(iconWidget);
|
||||
}
|
||||
) as Binding<VariableType<Gtk.Widget[]>, any, Gtk.Widget[]>,
|
||||
|
||||
if (showLabelBinding) {
|
||||
childrenArray.push(
|
||||
Widget.Label({
|
||||
class_name: `bar-button-label module-label ${boxClass}`,
|
||||
label: label,
|
||||
setup: labelHook,
|
||||
}) as unknown as Gtk.Widget,
|
||||
);
|
||||
}
|
||||
return childrenArray;
|
||||
}) as Bind,
|
||||
setup: hook,
|
||||
}),
|
||||
tooltip_text: tooltipText,
|
||||
isVisible: true,
|
||||
boxClass,
|
||||
props
|
||||
props,
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user