Skip to content

Commit

Permalink
Implement notification support
Browse files Browse the repository at this point in the history
  • Loading branch information
iiPythonx committed Feb 17, 2024
1 parent de6ba1c commit a22dbca
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions nightwatch/desktop/src/css/notifications.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions nightwatch/desktop/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<link rel = "stylesheet" href = "./css/bootstrap.min.css" type = "text/css">
<link rel = "stylesheet" href = "./css/index.css" type = "text/css">
<link rel = "stylesheet" href = "./css/nano.min.css" type = "text/css">
<link rel = "stylesheet" href = "./css/notifications.css" type = "text/css">

<title>Nightwatch</title>
</head>
Expand Down Expand Up @@ -87,6 +88,7 @@
<!-- Nightwatch JS -->
<script src = "./js/nightwatch.js"></script>
<script src = "./js/pickr.min.js"></script>
<script src = "./js/notifications.js"></script>
<script src = "./js/main.js"></script>
</body>
</html>
7 changes: 6 additions & 1 deletion nightwatch/desktop/src/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ class UIStateManager {

const ui = new UIStateManager();

// Handle notifications
const notifier = new AWN({
icons: { enabled: false }
});

// Handle message processing
const container = $("#messages-container");
function process_message(message) {
Expand All @@ -30,7 +35,7 @@ $("#connect-form").on("submit", (e) => {
const nw = new NightwatchServer($("#connect-address").val());
nw.connected(() => {
nw.identify($("#connect-username").val(), window._usercolor || "#fefefe", (d) => {
if (d.text) return console.error(d.text);
if (d.text) return notifier.alert(d.text);
ui.switch("messages");
});
});
Expand Down
Loading

0 comments on commit a22dbca

Please sign in to comment.