Skip to content

Commit

Permalink
Merge pull request #263 from iceljc/features/refine-chat-window
Browse files Browse the repository at this point in the history
Features/refine chat window
  • Loading branch information
iceljc authored Nov 5, 2024
2 parents 8d4f855 + e9852aa commit 20b0d03
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
11 changes: 10 additions & 1 deletion src/lib/helpers/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,16 @@ const conversationSearchOptionKey = "conversation_search_option";
const conversationUserMessageKey = "conversation_user_messages";

/** @type {Writable<import('$commonTypes').GlobalEvent>} */
export const globalEventStore = writable({ name: "", payload: {} });
const createGlobalEventStore = () => {
const { subscribe, set } = writable({ name: "", payload: {} });
return {
subscribe,
set,
reset: () => set({})
};
}

export const globalEventStore = createGlobalEventStore();


/** @type {Writable<import('$userTypes').UserModel>} */
Expand Down
12 changes: 9 additions & 3 deletions src/routes/VerticalLayout/Sidebar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import { page } from '$app/stores';
import { browser } from '$app/environment';
import { _ } from 'svelte-i18n';
import { globalEventStore } from '$lib/helpers/store';
/** @type {import('$pluginTypes').PluginMenuDefModel[]} */
export let menu;
Expand Down Expand Up @@ -199,6 +200,11 @@
const path = $page.url.pathname;
return path?.startsWith('/') ? path.substring(1) : path;
};
/** @param {string} link */
const goToPage = (link) => {
globalEventStore.reset();
}
</script>
<div class="vertical-menu">
Expand All @@ -225,19 +231,19 @@
</Link>
<ul class="sub-menu mm-collapse">
{#each subMenu.childItems as childItem}
<li><Link href={childItem.link}>{$_(childItem.label)}</Link></li>
<li><Link href={childItem.link} on:click={() => goToPage(childItem.link)}>{$_(childItem.label)}</Link></li>
{/each}
</ul>
</li>
{:else}
<li><Link href={subMenu.link}>{$_(subMenu.label)}</Link></li>
<li><Link href={subMenu.link} on:click={() => goToPage(subMenu.link)}>{$_(subMenu.label)}</Link></li>
{/if}
{/each}
</ul>
</li>
{:else}
<li>
<Link href={item.link} class="waves-effect">
<Link class="waves-effect" href={item.link} on:click={() => goToPage(item.link)} >
<i class={item.icon} /> <span>{$_(item.label)}</span>
</Link>
</li>
Expand Down

0 comments on commit 20b0d03

Please sign in to comment.