mirror of
https://github.com/Blah-IM/Weblah.git
synced 2025-05-02 01:01:08 +00:00
fix: various fixes around discover
This commit is contained in:
parent
ca3dba04e0
commit
78d30020c3
6 changed files with 21 additions and 18 deletions
|
@ -75,7 +75,6 @@ export function useChat(
|
||||||
|
|
||||||
sections.push(currentSection);
|
sections.push(currentSection);
|
||||||
|
|
||||||
console.log(sections);
|
|
||||||
return sections;
|
return sections;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,6 @@ export class ChatListManager {
|
||||||
existing.lastMessage = newChat.lastMessage ?? existing.lastMessage;
|
existing.lastMessage = newChat.lastMessage ?? existing.lastMessage;
|
||||||
} else {
|
} else {
|
||||||
chatList.push(newChat);
|
chatList.push(newChat);
|
||||||
console.log('new chat added to list', newChat);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,12 +25,9 @@ export class GlobalSearchManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
const results = await Promise.allSettled(jobs);
|
const results = await Promise.allSettled(jobs);
|
||||||
console.log(results);
|
|
||||||
|
|
||||||
const chats: { joined: Chat[]; public: Chat[] } = { joined: [], public: [] };
|
const chats: { joined: Chat[]; public: Chat[] } = { joined: [], public: [] };
|
||||||
for (const result of results) {
|
for (const result of results) {
|
||||||
console.log(result);
|
|
||||||
|
|
||||||
if (result.status === 'rejected') continue;
|
if (result.status === 'rejected') continue;
|
||||||
|
|
||||||
const [type, chatList] = result.value;
|
const [type, chatList] = result.value;
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
{/each}
|
{/each}
|
||||||
{/if}
|
{/if}
|
||||||
</ul>
|
</ul>
|
||||||
{#if isSearchFocused}
|
{#if isSearchFocused || searchQuery}
|
||||||
<div
|
<div
|
||||||
class="absolute inset-0 size-full origin-top touch-pan-y overflow-y-auto bg-sb-primary"
|
class="absolute inset-0 size-full origin-top touch-pan-y overflow-y-auto bg-sb-primary"
|
||||||
transition:scale={{ start: 0.9 }}
|
transition:scale={{ start: 0.9 }}
|
||||||
|
|
|
@ -10,40 +10,48 @@
|
||||||
|
|
||||||
let inputElement: HTMLInputElement;
|
let inputElement: HTMLInputElement;
|
||||||
|
|
||||||
function onTapClear() {
|
function onTapClear(e: MouseEvent) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
searchQuery = '';
|
searchQuery = '';
|
||||||
inputElement.blur();
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<header class="flex items-center justify-stretch gap-2 border-b border-ss-secondary p-2 shadow-sm">
|
<header class="flex items-center justify-stretch gap-2 border-b border-ss-secondary p-2 shadow-sm">
|
||||||
<IdentityMenu class={tw('transition-opacity duration-200', isSearchFocused && 'opacity-0')} />
|
<IdentityMenu class={tw('transition-opacity duration-200', isSearchFocused && 'opacity-0')} />
|
||||||
<InputFrame class={tw('z-10 flex-1 transition-all duration-200', isSearchFocused && '-mx-10')}>
|
<InputFrame
|
||||||
|
class={tw('z-10 h-8 flex-1 transition-all duration-200', isSearchFocused && '-mx-10')}
|
||||||
|
>
|
||||||
<Icon src={MagnifyingGlass} class="size-5 text-slate-400" />
|
<Icon src={MagnifyingGlass} class="size-5 text-slate-400" />
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="search"
|
||||||
placeholder="Search"
|
placeholder="Search"
|
||||||
class="w-full flex-1 bg-transparent text-sm leading-4 text-slate-900 focus:outline-none"
|
class="w-full flex-1 bg-transparent text-sm leading-4 text-sf-primary focus:outline-none"
|
||||||
bind:value={searchQuery}
|
bind:value={searchQuery}
|
||||||
bind:this={inputElement}
|
bind:this={inputElement}
|
||||||
on:focus={() => (isSearchFocused = true)}
|
on:focus={() => {
|
||||||
|
isSearchFocused = true;
|
||||||
|
}}
|
||||||
on:blur={(e) => {
|
on:blur={(e) => {
|
||||||
// If the related target is an anchor element, trigger the click as the user is trying to navigate
|
// If the related target is an anchor element, trigger the click as the user is trying to navigate
|
||||||
if (e.relatedTarget instanceof HTMLAnchorElement) {
|
if (
|
||||||
console.log('relatedTarget is an anchor element');
|
e.relatedTarget instanceof HTMLAnchorElement ||
|
||||||
|
e.relatedTarget instanceof HTMLButtonElement
|
||||||
|
) {
|
||||||
e.relatedTarget.click();
|
e.relatedTarget.click();
|
||||||
}
|
}
|
||||||
isSearchFocused = false;
|
isSearchFocused = false;
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
|
tabindex="0"
|
||||||
class={tw(
|
class={tw(
|
||||||
'pointer-events-none size-4 cursor-default text-slate-300 opacity-0 transition-opacity dark:text-slate-500',
|
'-mx-2 -my-1.5 flex size-8 cursor-text items-center justify-center text-slate-300 opacity-0 transition-opacity duration-200 dark:text-slate-500',
|
||||||
isSearchFocused && 'pointer-events-auto opacity-100'
|
isSearchFocused && 'cursor-default opacity-100 '
|
||||||
)}
|
)}
|
||||||
on:click={onTapClear}
|
on:click={onTapClear}
|
||||||
>
|
>
|
||||||
<Icon src={XCircle} mini />
|
<Icon src={XCircle} class="size-4" mini />
|
||||||
<span class="sr-only">Clear</span>
|
<span class="sr-only">Clear</span>
|
||||||
</button>
|
</button>
|
||||||
</InputFrame>
|
</InputFrame>
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<a
|
<a
|
||||||
tabindex="-1"
|
tabindex="0"
|
||||||
href="/chats/{urlSafeEndpoint}/{chat.id}"
|
href="/chats/{urlSafeEndpoint}/{chat.id}"
|
||||||
class="flex h-20 cursor-default items-center gap-2 px-2"
|
class="flex h-20 cursor-default items-center gap-2 px-2"
|
||||||
>
|
>
|
||||||
|
|
Loading…
Add table
Reference in a new issue