Skip to content

Commit aa68ef9

Browse files
committed
call notify instead of signal._emit. fixes #7
1 parent 6d9cb16 commit aa68ef9

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

src/components/Toast.svelte

+5-10
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,9 @@ import Icon from "./Icon.svelte";
1010
function close() {
1111
dispatch('close');
1212
}
13-
14-
const getColor = (type: string) => {
15-
switch (type) {
16-
case "error":
17-
return "red";
18-
}
19-
return "blue";
20-
}
2113
</script>
2214

23-
<div class="toast" style="--color: {getColor(notification.type)}">
15+
<div class="toast" class:error={notification.type==1}>
2416
<div class="text">{notification.text}</div>
2517
<div class="icon" on:click={close}>
2618
<Icon icon="X16" />
@@ -30,7 +22,10 @@ import Icon from "./Icon.svelte";
3022
<style>
3123
.toast {
3224
@apply flex justify-between items-center shadow-lg border bg-gray-900 text-light-200 fill-light-200 border-gray-600 p-3 rounded-sm select-none;
33-
/*border-bottom: 1px solid var(--color);*/
25+
}
26+
27+
.toast.error {
28+
@apply bg-red-900 border-red-700;
3429
}
3530
3631
.icon {

src/signals.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { get } from "svelte/store";
22
import { authenticating, selectedSession } from "./store/runtime";
3+
import { notify } from "./utils/notification";
34

45
export const connectSignals = () => {
56
console.debug(`connecting to lightdm signals using theme`, window.theme);
@@ -24,7 +25,7 @@ export const connectSignals = () => {
2425
console.debug("authentication_complete");
2526
authenticating.update(_ => false);
2627
if (!window.lightdm?.is_authenticated) {
27-
window.lightdm.show_message._emit("Authentication Failed", "error");
28+
notify("Authentication Failed", 1);
2829
window.lightdm.authenticate(window.lightdm.authentication_user);
2930
} else {
3031
console.debug("authentication successful, start session");

0 commit comments

Comments
 (0)