{ console.log('e', e); if (e.code === 'Enter' && (chatList ?? []).length > 0) { const item = document.querySelector(`[data-arrow-selected="true"]`); if (item) { item?.click(); } show = false; return; } else if (e.code === 'ArrowDown') { selectedIdx = Math.min(selectedIdx + 1, (chatList ?? []).length - 1); } else if (e.code === 'ArrowUp') { selectedIdx = Math.max(selectedIdx - 1, 0); } else { selectedIdx = 0; } const item = document.querySelector(`[data-arrow-selected="true"]`); item?.scrollIntoView({ block: 'center', inline: 'nearest', behavior: 'instant' }); }} />
{#if chatList} {#if chatList.length === 0}
{$i18n.t('No results found')}
{/if} {#each chatList as chat, idx (chat.id)} {#if idx === 0 || (idx > 0 && chat.time_range !== chatList[idx - 1].time_range)}
{$i18n.t(chat.time_range)}
{/if} { selectedIdx = idx; }} on:click={() => { show = false; onClose(); }} >
{chat?.title}
{dayjs(chat?.updated_at * 1000).calendar()}
{/each} {#if !allChatsLoaded} { if (!chatListLoading) { loadMoreChats(); } }} >
Loading...
{/if} {:else}
{/if}