Updated Announcement

This commit is contained in:
andrei-mihnea-cerbu
2025-02-12 18:15:56 +02:00
parent 23802acd98
commit 3ed7efa806
6 changed files with 9 additions and 5 deletions
+1 -1
View File
@@ -1,3 +1,3 @@
UDP_PORT=41234 UDP_PORT=41234
TCP_PORT=41233 TCP_PORT=41233
IS_CLIENT=true IS_CLIENT=false
@@ -87,6 +87,8 @@ async function fetchDepartments() {
return; return;
} }
console.log(filteredDepartments)
filteredDepartments.forEach(department => { filteredDepartments.forEach(department => {
const departmentDiv = document.createElement('div'); const departmentDiv = document.createElement('div');
departmentDiv.classList.add('department-card'); departmentDiv.classList.add('department-card');
+2 -2
View File
@@ -1,7 +1,7 @@
// Load announcement content from the application info when the page loads // Load announcement content from the application info when the page loads
async function loadAnnouncement() { async function loadAnnouncement() {
try { try {
const announcementText = await window.electronAPI.readAnnouncement(); const announcementText = await window.uiAPI.readAnnouncement();
const announcementContent = document.getElementById('announcement-content'); const announcementContent = document.getElementById('announcement-content');
if (announcementContent && announcementText) { if (announcementContent && announcementText) {
announcementContent.innerHTML = formatTextForHtml(announcementText); announcementContent.innerHTML = formatTextForHtml(announcementText);
@@ -22,5 +22,5 @@ function formatTextForHtml(text) {
// Close the window when the close button is clicked // Close the window when the close button is clicked
function closeWindow() { function closeWindow() {
window.electronAPI.closeAnnouncementWindow(); window.uiAPI.closeAnnouncementWindow();
} }
@@ -45,9 +45,11 @@ export class AnnouncementSender {
type: 'showAlert', type: 'showAlert',
message: 'Announcement sent to all active users successfully.', message: 'Announcement sent to all active users successfully.',
}) })
process.send?.({ type: 'changeContent', page: 'announcement' })
} catch (error: any) { } catch (error: any) {
console.error('Error in AnnouncementWorker:', error) console.error('Error in AnnouncementWorker:', error)
process.send?.({ type: 'shotAlert', message: `A problem occurred: ${error.message}` }) process.send?.({ type: 'shotAlert', message: `A problem occurred: ${error.message}` })
process.send?.({ type: 'changeContent', page: 'announcement' })
} }
console.log('AnnouncementWorker finished.') console.log('AnnouncementWorker finished.')
+1 -1
View File
@@ -102,7 +102,7 @@ app.whenReady().then(async () => {
}, },
}) })
mainWindow.removeMenu() //mainWindow.removeMenu()
await ensureDirectoryExists(pathToClientsBackups) await ensureDirectoryExists(pathToClientsBackups)
@@ -52,7 +52,7 @@ export class UserToUserOperations implements OperationPlugin {
await database.update((data: any) => { await database.update((data: any) => {
if (!parsedMessage.metaInfo) return data if (!parsedMessage.metaInfo) return data
data.app_config.announcement = parsedMessage.metaInfo.message data.network.announcement = parsedMessage.metaInfo.message
return data return data
}) })
return { operationCode: operationCodes.OK, metaInfo: { message: 'Announcement saved.' } } return { operationCode: operationCodes.OK, metaInfo: { message: 'Announcement saved.' } }