mirror of
https://github.com/HeyPuter/puter.git
synced 2025-01-24 15:20:21 +08:00
feat: handle notif.ack
in desktop
This commit is contained in:
parent
9e303a2f7c
commit
a6650ee2d8
@ -46,6 +46,13 @@ import UIWindowSearch from "./UIWindowSearch.js"
|
||||
async function UIDesktop(options){
|
||||
let h = '';
|
||||
|
||||
// Set up the desktop channel for communication between different tabs in the same browser
|
||||
window.channel = new BroadcastChannel('puter-desktop-channel');
|
||||
channel.onmessage = function(e){
|
||||
}
|
||||
|
||||
// channel.postMessage({'hello': 'world'});
|
||||
|
||||
// connect socket.
|
||||
window.socket = io(window.gui_origin + '/', {
|
||||
auth: {
|
||||
@ -122,6 +129,7 @@ async function UIDesktop(options){
|
||||
text: notification.text,
|
||||
icon: icon,
|
||||
value: notification,
|
||||
uid,
|
||||
close: async () => {
|
||||
await fetch(`${window.api_origin}/notif/mark-ack`, {
|
||||
method: 'POST',
|
||||
@ -160,6 +168,7 @@ async function UIDesktop(options){
|
||||
icon,
|
||||
title: notification.title,
|
||||
text: notification.text ?? notification.title,
|
||||
uid: notif_info.uid,
|
||||
close: async () => {
|
||||
await fetch(`${window.api_origin}/notif/mark-ack`, {
|
||||
method: 'POST',
|
||||
@ -176,6 +185,10 @@ async function UIDesktop(options){
|
||||
}
|
||||
});
|
||||
|
||||
window.socket.on('notif.ack', ({ uid }) => {
|
||||
$(`.notification[data-uid="${uid}"]`).remove();
|
||||
});
|
||||
|
||||
window.socket.on('app.opened', async (app) => {
|
||||
// don't update if this is the original client that initiated the action
|
||||
if(app.original_client_socket_id === window.socket.id)
|
||||
|
@ -22,7 +22,7 @@ function UINotification(options){
|
||||
options.text = options.text ?? '';
|
||||
|
||||
let h = '';
|
||||
h += `<div id="ui-notification__${window.global_element_id}" data-el-id="${window.global_element_id}" class="notification antialiased animate__animated animate__fadeInRight animate__slow">`;
|
||||
h += `<div id="ui-notification__${window.global_element_id}" data-uid="${html_encode(options.uid)}" data-el-id="${window.global_element_id}" class="notification antialiased animate__animated animate__fadeInRight animate__slow">`;
|
||||
h += `<img class="notification-close disable-user-select" src="${html_encode(window.icons['close.svg'])}">`;
|
||||
h += `<div class="notification-icon">`;
|
||||
h += `<img src="${html_encode(options.icon ?? window.icons['bell.svg'])}">`;
|
||||
|
@ -1173,7 +1173,7 @@ span.header-sort-icon img {
|
||||
min-width: 170px;
|
||||
height: calc(100% - 28px);
|
||||
float: left;
|
||||
border-right: 1px solid #CCC;
|
||||
border-right: 0.5px solid #CCC;
|
||||
padding: 15px 10px;
|
||||
box-sizing: border-box;
|
||||
background-color: hsla(var(--window-sidebar-hue),
|
||||
@ -1182,6 +1182,7 @@ span.header-sort-icon img {
|
||||
calc(0.5 + 0.5*var(--window-sidebar-alpha)));
|
||||
overflow-y: scroll;
|
||||
margin-top: 1px;
|
||||
box-shadow: inset -4px 0 8px -8px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.window-sidebar .ui-resizable-e {
|
||||
|
Loading…
Reference in New Issue
Block a user