This commit is contained in:
@@ -338,12 +338,15 @@ Every listener in the app (there are only these six `emitter.on` call sites):
|
|||||||
|---|---|---|
|
|---|---|---|
|
||||||
| `toast` | `{color,text,duration}` | `ToastManager.vue` |
|
| `toast` | `{color,text,duration}` | `ToastManager.vue` |
|
||||||
| `push-note` | `{key,title,text,date}` | `NoteContainer.vue` |
|
| `push-note` | `{key,title,text,date}` | `NoteContainer.vue` |
|
||||||
| `delete-note` | note key (string) | `NoteContainer.vue` |
|
| `close-note` | note key (string) | `NoteContainer.vue` (removes the note from the open column only) |
|
||||||
|
| `delete-note` | note key (string) | `NoteContainer.vue`, `ContentSidebar.vue`, `NestedNoteList.vue` (real deletion: closes the note **and** removes it from the sidebar) |
|
||||||
| `title-updated` | `{key,title}` | `Note.vue`, `NoteContainer.vue` |
|
| `title-updated` | `{key,title}` | `Note.vue`, `NoteContainer.vue` |
|
||||||
| `status-bar-update` | `{text,icon}` | `FetchStatus.vue` |
|
| `status-bar-update` | `{text,icon}` | `FetchStatus.vue` |
|
||||||
|
|
||||||
Emitters: `Toaster.js` (`toast`), `ContentSidebar` / `TopSearchBar` (`push-note`), `Note.vue` /
|
Emitters: `Toaster.js` (`toast`), `ContentSidebar` / `TopSearchBar` (`push-note`), `Note.vue`
|
||||||
`NestedNoteList.vue` (`delete-note`), `ContentSidebar` (`title-updated`), `FetchStatus` (self-test emit).
|
(`close-note` — the close button must not use `delete-note` or the sidebar entry disappears),
|
||||||
|
`NestedNoteList.vue` (`delete-note`, after `POST /note/delete`), `ContentSidebar` (`title-updated`),
|
||||||
|
`FetchStatus` (self-test emit).
|
||||||
|
|
||||||
**Orphan events** — emitted, never subscribed to anywhere (the matching handlers `handleNoteCreated` /
|
**Orphan events** — emitted, never subscribed to anywhere (the matching handlers `handleNoteCreated` /
|
||||||
`handleNoteRenamed` exist in `ContentSidebar.vue` but were never wired with `emitter.on`; see §9.17):
|
`handleNoteRenamed` exist in `ContentSidebar.vue` but were never wired with `emitter.on`; see §9.17):
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import TopSearchBar from './topbar/TopSearchBar.vue';
|
import TopSearchBar from './topbar/TopSearchBar.vue';
|
||||||
import { useCampaignService } from '~/services/Campaign.js';
|
import { useCampaignService } from '~/services/Campaign.js';
|
||||||
|
import { SetShowContent } from '~/services/Content.js';
|
||||||
import { ClearWindow, CreateWindow } from '~/services/Windows';
|
import { ClearWindow, CreateWindow } from '~/services/Windows';
|
||||||
|
|
||||||
const { Campaign } = useCampaignService();
|
const { Campaign, SetCampaign } = useCampaignService();
|
||||||
const campaignName = computed(() => Campaign.value?.name || 'Campaign');
|
const campaignName = computed(() => Campaign.value?.name || 'Campaign');
|
||||||
|
|
||||||
function OpenCampaignSettings() {
|
function OpenCampaignSettings() {
|
||||||
@@ -11,6 +12,15 @@ function OpenCampaignSettings() {
|
|||||||
ClearWindow({ type: 'campaign_settings' });
|
ClearWindow({ type: 'campaign_settings' });
|
||||||
CreateWindow('campaign_settings', { campaign: Campaign.value });
|
CreateWindow('campaign_settings', { campaign: Campaign.value });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ExitCampaign() {
|
||||||
|
// Torn al menú principal: neteja la campanya (i el localStorage), amaga
|
||||||
|
// l'espai de treball i reobre el menú
|
||||||
|
ClearWindow({ type: 'campaign_settings' });
|
||||||
|
SetCampaign(null);
|
||||||
|
SetShowContent(false);
|
||||||
|
CreateWindow('main_menu');
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -28,6 +38,9 @@ function OpenCampaignSettings() {
|
|||||||
<button class="btn-primary settings-button sound-click" type="button" @click="OpenCampaignSettings">
|
<button class="btn-primary settings-button sound-click" type="button" @click="OpenCampaignSettings">
|
||||||
{{ $t('main-menu.settings') }}
|
{{ $t('main-menu.settings') }}
|
||||||
</button>
|
</button>
|
||||||
|
<button class="btn-primary settings-button exit-button sound-click" type="button" @click="ExitCampaign">
|
||||||
|
{{ $t('main-menu.exit') }}
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -65,6 +78,7 @@ function OpenCampaignSettings() {
|
|||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
padding: 0 10px;
|
padding: 0 10px;
|
||||||
|
gap: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.settings-button {
|
.settings-button {
|
||||||
|
|||||||
@@ -26,7 +26,9 @@ function markDirty() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function closeNote(){
|
function closeNote(){
|
||||||
emitter.emit('delete-note', props.noteKey);
|
// 'close-note' only closes the opened note; 'delete-note' is reserved for
|
||||||
|
// actual deletions (sidebar removal happens on that event instead)
|
||||||
|
emitter.emit('close-note', props.noteKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
const compiledMarkdown = computed(() => {
|
const compiledMarkdown = computed(() => {
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ function handleDeleteNote(key) {
|
|||||||
// Moure aixo
|
// Moure aixo
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
emitter.on("push-note", handlePushNote);
|
emitter.on("push-note", handlePushNote);
|
||||||
|
emitter.on("close-note", handleDeleteNote);
|
||||||
emitter.on("delete-note", handleDeleteNote);
|
emitter.on("delete-note", handleDeleteNote);
|
||||||
emitter.on("title-updated", handleTitleUpdated);
|
emitter.on("title-updated", handleTitleUpdated);
|
||||||
});
|
});
|
||||||
@@ -60,6 +61,7 @@ function handleTitleUpdated(data) {
|
|||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
emitter.off("push-note", handlePushNote);
|
emitter.off("push-note", handlePushNote);
|
||||||
|
emitter.off("close-note", handleDeleteNote);
|
||||||
emitter.off("delete-note", handleDeleteNote);
|
emitter.off("delete-note", handleDeleteNote);
|
||||||
emitter.off("title-updated", handleTitleUpdated);
|
emitter.off("title-updated", handleTitleUpdated);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,5 +3,6 @@
|
|||||||
"edit-profile": "Editar perfil",
|
"edit-profile": "Editar perfil",
|
||||||
"create-campaign": "Crear campanya",
|
"create-campaign": "Crear campanya",
|
||||||
"log-out": "Tanca la sessió",
|
"log-out": "Tanca la sessió",
|
||||||
"settings": "Configuració"
|
"settings": "Configuració",
|
||||||
|
"exit": "Sortir"
|
||||||
}
|
}
|
||||||
@@ -3,5 +3,6 @@
|
|||||||
"edit-profile": "Edit profile",
|
"edit-profile": "Edit profile",
|
||||||
"create-campaign": "Create Campaign",
|
"create-campaign": "Create Campaign",
|
||||||
"log-out": "Log out",
|
"log-out": "Log out",
|
||||||
"settings": "Settings"
|
"settings": "Settings",
|
||||||
|
"exit": "Exit"
|
||||||
}
|
}
|
||||||
@@ -3,5 +3,6 @@
|
|||||||
"edit-profile": "Editar perfil",
|
"edit-profile": "Editar perfil",
|
||||||
"create-campaign": "Crear campanya",
|
"create-campaign": "Crear campanya",
|
||||||
"log-out": "Cerrar sesión",
|
"log-out": "Cerrar sesión",
|
||||||
"settings": "Configuración"
|
"settings": "Configuración",
|
||||||
|
"exit": "Salir"
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user