Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Features/refine chat window #263

Merged
merged 2 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading