From 572800d9ca14ef414890f93ae56c5be8db183606 Mon Sep 17 00:00:00 2001 From: didirus Date: Tue, 27 Jan 2026 20:41:55 +0300 Subject: [PATCH] feat: add info event listener and payload for enhanced event handling - Implemented `info_listener` in `events.js` to listen for 'info' events and handle payloads. - Added `emit_info` function in `emit.rs` to emit 'info' events with a message payload. - Defined `InfoPayload` struct in `mod.rs` to structure the data for 'info' events. - Integrated `emit_info` calls in the Minecraft launch logic to provide feedback on account types. - Introduced a new offline icon in SVG format and removed outdated pirate icons from assets. - Updated asset index to include the new offline icon and removed references to deleted icons. --- apps/app-frontend/src/App.vue | 11 +- .../src/components/ui/AccountsCard.vue | 288 +++++++++++------- apps/app-frontend/src/helpers/events.js | 5 + packages/app-lib/src/event/emit.rs | 22 +- packages/app-lib/src/event/mod.rs | 7 + packages/app-lib/src/launcher/mod.rs | 32 +- packages/assets/icons/offline.svg | 49 +++ packages/assets/icons/pirate-ship.svg | 53 ---- packages/assets/icons/pirate.svg | 12 - packages/assets/index.ts | 8 +- 10 files changed, 293 insertions(+), 194 deletions(-) create mode 100644 packages/assets/icons/offline.svg delete mode 100644 packages/assets/icons/pirate-ship.svg delete mode 100644 packages/assets/icons/pirate.svg diff --git a/apps/app-frontend/src/App.vue b/apps/app-frontend/src/App.vue index cfc5c94e..5d8b7c88 100644 --- a/apps/app-frontend/src/App.vue +++ b/apps/app-frontend/src/App.vue @@ -73,7 +73,7 @@ import { useCheckDisableMouseover } from '@/composables/macCssFix.js' import { debugAnalytics, initAnalytics, optOutAnalytics, trackEvent } from '@/helpers/analytics' import { check_reachable } from '@/helpers/auth.js' import { get_user } from '@/helpers/cache.js' -import { command_listener, warning_listener } from '@/helpers/events.js' +import { command_listener, warning_listener, info_listener } from '@/helpers/events.js' import { useFetch } from '@/helpers/fetch.js' import { cancelLogin, get as getCreds, login, logout } from '@/helpers/mr_auth.ts' import { list } from '@/helpers/profile.js' @@ -286,6 +286,15 @@ async function setupApp() { }), ) + // [AR] Info listener + await info_listener((e) => + addNotification({ + title: 'Info', + text: e.message, + type: 'info', + }), + ) + useFetch( `https://api.modrinth.com/appCriticalAnnouncement.json?version=${version}`, 'criticalAnnouncements', diff --git a/apps/app-frontend/src/components/ui/AccountsCard.vue b/apps/app-frontend/src/components/ui/AccountsCard.vue index f9a44d7b..1e60f947 100644 --- a/apps/app-frontend/src/components/ui/AccountsCard.vue +++ b/apps/app-frontend/src/components/ui/AccountsCard.vue @@ -1,12 +1,24 @@