Added strict type checking to the project. (#236)
* Implement strict typing (WIP). * changes * Finish type checks * Fix notification icon, matugen settings and update tsconfig. * OSD Styling updates and added the ability to configure OSD duration.
This commit is contained in:
@@ -1,32 +1,18 @@
|
||||
import icons from "../../../../icons/index.js";
|
||||
import { Notification } from "types/service/notifications.js";
|
||||
import { NotificationIcon } from "lib/types/notification.js";
|
||||
import { getNotificationIcon } from "globals/notification";
|
||||
|
||||
const NotificationIcon = ({ app_entry, app_icon, app_name }) => {
|
||||
let icon = icons.fallback.notification;
|
||||
|
||||
if (
|
||||
Utils.lookUpIcon(app_name) ||
|
||||
Utils.lookUpIcon(app_name.toLowerCase() || "")
|
||||
)
|
||||
icon = Utils.lookUpIcon(app_name)
|
||||
? app_name
|
||||
: Utils.lookUpIcon(app_name.toLowerCase())
|
||||
? app_name.toLowerCase()
|
||||
: "";
|
||||
|
||||
if (Utils.lookUpIcon(app_icon) && icon === "") icon = app_icon;
|
||||
|
||||
if (Utils.lookUpIcon(app_entry || "") && icon === "") icon = app_entry || "";
|
||||
|
||||
return Widget.Box({
|
||||
css: `
|
||||
const NotificationIcon = ({ app_entry = "", app_icon = "", app_name = "" }: Partial<Notification>) => {
|
||||
return Widget.Box({
|
||||
css: `
|
||||
min-width: 2rem;
|
||||
min-height: 2rem;
|
||||
`,
|
||||
child: Widget.Icon({
|
||||
class_name: "notification-icon menu",
|
||||
icon,
|
||||
}),
|
||||
});
|
||||
child: Widget.Icon({
|
||||
class_name: "notification-icon menu",
|
||||
icon: getNotificationIcon(app_name, app_icon, app_entry),
|
||||
}),
|
||||
});
|
||||
};
|
||||
|
||||
export { NotificationIcon };
|
||||
|
||||
@@ -10,7 +10,7 @@ export const NotificationPager = (curPage: Variable<number>) => {
|
||||
class_name: "notification-menu-pager",
|
||||
hexpand: true,
|
||||
vexpand: false,
|
||||
children: Utils.merge([curPage.bind("value"), displayedTotal.bind("value"), notifs.bind("notifications")], (currentPage, dispTotal, notifications) => {
|
||||
children: Utils.merge([curPage.bind("value"), displayedTotal.bind("value"), notifs.bind("notifications")], (currentPage, dispTotal, _) => {
|
||||
return [
|
||||
Widget.Button({
|
||||
hexpand: true,
|
||||
|
||||
Reference in New Issue
Block a user