More code clean up
This commit is contained in:
@@ -2,13 +2,13 @@
|
||||
import { Filter, Plus, Search, SearchCode, User } from '@lucide/svelte';
|
||||
import { ae_api, ae_loc, slct } from '$lib/stores/ae_stores';
|
||||
import { load_ae_obj_li__person } from '$lib/ae_core/ae_core__person';
|
||||
|
||||
|
||||
interface Props {
|
||||
on_results: (results: any[]) => void;
|
||||
}
|
||||
|
||||
|
||||
let { on_results }: Props = $props();
|
||||
|
||||
|
||||
let qry_str = $state('');
|
||||
let loading = $state(false);
|
||||
let qry_enabled = $state('enabled');
|
||||
@@ -17,21 +17,21 @@
|
||||
async function handle_search() {
|
||||
if (!$ae_loc.account_id) return;
|
||||
loading = true;
|
||||
|
||||
|
||||
// V3 search logic
|
||||
const results = await load_ae_obj_li__person({
|
||||
api_cfg: $ae_api,
|
||||
for_obj_id: $ae_loc.account_id,
|
||||
enabled: qry_enabled as any,
|
||||
hidden: qry_hidden as any,
|
||||
// qry_str: qry_str || null, // Assuming load_ae_obj_li__person supports qry_str in the future or we use search_ae_obj_v3
|
||||
// qry_str: qry_str || null, // Assuming load_ae_obj_li__person supports qry_str in the future or we use search_ae_obj
|
||||
log_lvl: 1
|
||||
});
|
||||
|
||||
|
||||
// Filter locally for now if needed, or update the API wrapper to support search_query
|
||||
const filtered = qry_str
|
||||
? results.filter(p =>
|
||||
p.full_name?.toLowerCase().includes(qry_str.toLowerCase()) ||
|
||||
const filtered = qry_str
|
||||
? results.filter(p =>
|
||||
p.full_name?.toLowerCase().includes(qry_str.toLowerCase()) ||
|
||||
p.primary_email?.toLowerCase().includes(qry_str.toLowerCase()) ||
|
||||
p.person_id_random?.toLowerCase().includes(qry_str.toLowerCase())
|
||||
)
|
||||
@@ -50,12 +50,12 @@
|
||||
<div class="flex items-center justify-center px-4 bg-surface-300-600-token border-r border-surface-500/20">
|
||||
<Search size={18} class="opacity-50" />
|
||||
</div>
|
||||
<input
|
||||
<input
|
||||
class="bg-transparent border-0 ring-0 focus:ring-0 p-3 grow placeholder:opacity-50"
|
||||
type="search"
|
||||
bind:value={qry_str}
|
||||
placeholder="Search by name, email, or ID..."
|
||||
onkeydown={(e) => e.key === 'Enter' && handle_search()}
|
||||
type="search"
|
||||
bind:value={qry_str}
|
||||
placeholder="Search by name, email, or ID..."
|
||||
onkeydown={(e) => e.key === 'Enter' && handle_search()}
|
||||
/>
|
||||
<button class="preset-filled-primary font-bold px-10 py-3 hover:brightness-110 transition-all border-l border-surface-500/20 flex items-center justify-center min-w-[100px]" onclick={handle_search} disabled={loading}>
|
||||
{#if loading}
|
||||
|
||||
Reference in New Issue
Block a user