{#if $user?.role === 'admin'}
{/if}
{#each $chats.filter((chat) => {
if (search === '') {
return true;
} else {
let title = chat.title.toLowerCase();
if (title.includes(search)) {
return true;
} else {
return false;
}
}
}) as chat, i}
{#if chat.id === $chatId}
{#if chatTitleEditId === chat.id}
{:else if chatDeleteId === chat.id}
{:else}
{/if}
{/if}
{/each}
{#if $user !== undefined}
{
showDropdown = !showDropdown;
}}
>
{$user.name}
{#if showDropdown}
{#if $user.role === 'admin'}
{
goto('/admin');
showDropdown = false;
}}
>
Admin Panel
{/if}
{
await showSettings.set(true);
showDropdown = false;
}}
>
Settings
{
localStorage.removeItem('token');
location.href = '/auth';
showDropdown = false;
}}
>
Sign Out
{/if}
{:else}
{
await showSettings.set(true);
}}
>
Settings
{/if}