Fix TypeAheadSearch.svelte, Remove Logout
Dieser Commit ist enthalten in:
Ursprung
dd85aeca7b
Commit
076fc7046d
@ -23,6 +23,7 @@
|
|||||||
export let selected: string | null = null
|
export let selected: string | null = null
|
||||||
export let items: {name: string, value: string}[] = []
|
export let items: {name: string, value: string}[] = []
|
||||||
export let maxItems = 5;
|
export let maxItems = 5;
|
||||||
|
export let leftText: boolean = false;
|
||||||
|
|
||||||
export let searchValue = items.find(item => item.value === selected)?.name || ''
|
export let searchValue = items.find(item => item.value === selected)?.name || ''
|
||||||
let open = false
|
let open = false
|
||||||
@ -36,13 +37,13 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Button color="alternative" on:click={() => open = true}>{selected === null ? 'Auswählen' : items.find(value => value.value === selected)?.name}</Button>
|
<Button color="light" on:click={() => open = true}>{selected === null ? 'Auswählen' : items.find(value => value.value === selected)?.name}</Button>
|
||||||
<Dropdown bind:open class="w-60">
|
<Dropdown bind:open class="w-60">
|
||||||
<div class="overflow-y-auto p-3 text-sm w-60" slot="header">
|
<div class="overflow-y-auto p-3 text-sm w-60" slot="header">
|
||||||
<Search bind:value={searchValue} on:focus={() => open = true} on:keydown={() => open = true}/>
|
<Search bind:value={searchValue} on:focus={() => open = true} on:keydown={() => open = true}/>
|
||||||
</div>
|
</div>
|
||||||
{#each filteredItems as item (item)}
|
{#each filteredItems as item (item)}
|
||||||
<button on:click={() => selectItem(item)} class="rounded p-2 hover:bg-gray-100 dark:hover:bg-gray-600 w-full cursor-pointer border-b border-b-gray-600">
|
<button on:click={() => selectItem(item)} class="rounded p-2 hover:bg-gray-100 dark:hover:bg-gray-600 w-full cursor-pointer border-b border-b-gray-600" class:text-left={leftText}>
|
||||||
{item.name}
|
{item.name}
|
||||||
</button>
|
</button>
|
||||||
{/each}
|
{/each}
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
let searchValue: string = "";
|
let searchValue: string = "";
|
||||||
let dirty = false;
|
let dirty = false;
|
||||||
|
|
||||||
let selectedPath: string = "";
|
let selectedPath: string | null = null;
|
||||||
let pathSearchValue: string = "";
|
let pathSearchValue: string = "";
|
||||||
|
|
||||||
$: availableBranches = $branches.map((branch) => ({
|
$: availableBranches = $branches.map((branch) => ({
|
||||||
@ -121,7 +121,7 @@
|
|||||||
<div class="border-b border-b-gray-600 pb-2 flex justify-between">
|
<div class="border-b border-b-gray-600 pb-2 flex justify-between">
|
||||||
<div>
|
<div>
|
||||||
<TypeAheadSearch items={availableBranches} bind:selected={selectedBranch} bind:searchValue />
|
<TypeAheadSearch items={availableBranches} bind:selected={selectedBranch} bind:searchValue />
|
||||||
<TypeAheadSearch items={Array.from(pagesMap.keys()).map(value => ({value, name: value}))} bind:selected={selectedPath} bind:searchValue={pathSearchValue} maxItems={Number.MAX_VALUE} />
|
<TypeAheadSearch items={Array.from(pagesMap.keys()).map(value => ({value, name: value}))} bind:selected={selectedPath} bind:searchValue={pathSearchValue} maxItems={Number.MAX_VALUE} leftText={true} />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
{#if selectedBranch !== "master"}
|
{#if selectedBranch !== "master"}
|
||||||
|
@ -28,13 +28,7 @@
|
|||||||
|
|
||||||
let events = $eventRepo.listEvents()
|
let events = $eventRepo.listEvents()
|
||||||
let showAdd = false
|
let showAdd = false
|
||||||
let showLogoutModal = false
|
|
||||||
let millis = Date.now()
|
let millis = Date.now()
|
||||||
|
|
||||||
function logout() {
|
|
||||||
$tokenStore = ""
|
|
||||||
replace("/login")
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Navbar let:hidden let:toggle class="shadow-lg border-b">
|
<Navbar let:hidden let:toggle class="shadow-lg border-b">
|
||||||
@ -47,20 +41,11 @@
|
|||||||
<NavUl {hidden}>
|
<NavUl {hidden}>
|
||||||
<NavLi href="#/edit">Edit Pages</NavLi>
|
<NavLi href="#/edit">Edit Pages</NavLi>
|
||||||
<NavLi href="#/perms">Permissions</NavLi>
|
<NavLi href="#/perms">Permissions</NavLi>
|
||||||
<NavLi on:click={() => showLogoutModal = true} class="cursor-pointer select-none">Logout</NavLi>
|
|
||||||
</NavUl>
|
</NavUl>
|
||||||
</Navbar>
|
</Navbar>
|
||||||
|
|
||||||
<CreateEventModal bind:open={showAdd} on:create={() => events = $eventRepo.listEvents()}/>
|
<CreateEventModal bind:open={showAdd} on:create={() => events = $eventRepo.listEvents()}/>
|
||||||
|
|
||||||
<Modal bind:open={showLogoutModal} title="Logout?" outsideclose size="sm">
|
|
||||||
<p>Do you really want to logout?</p>
|
|
||||||
<svelte:fragment slot="footer">
|
|
||||||
<Button on:click={() => showLogoutModal = false} color="alternative" class="ml-auto">Cancel</Button>
|
|
||||||
<Button on:click={logout} color="red">Logout</Button>
|
|
||||||
</svelte:fragment>
|
|
||||||
</Modal>
|
|
||||||
|
|
||||||
{#await events}
|
{#await events}
|
||||||
<div class="h-screen w-screen grid place-items-center">
|
<div class="h-screen w-screen grid place-items-center">
|
||||||
<Spinner size={16}/>
|
<Spinner size={16}/>
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren