Skip to content

Commit

Permalink
Shortcuts that should be not dev exclusive
Browse files Browse the repository at this point in the history
  • Loading branch information
MrVauxs committed Jan 6, 2024
1 parent a0e36a3 commit 06b6d82
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/lib/components/ItemList.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,16 @@
console.log(selected);
}
let filters: Writable<filteringArray<T>> = localStorageStore('filters-background', [
const initialValue = [
{
OR: [{ label: 'start Z' }, { label: 'start X' }],
},
{
OR: [{ label: 'start A' }, { label: 'start B' }, { label: 'start C' }],
},
{ label: 'end R' },
]);
];
let filters: Writable<filteringArray<T>> = localStorageStore('filters-background', initialValue);
const modalStore = getModalStore();
const modalSettings: ModalSettings = {
type: 'component',
Expand Down Expand Up @@ -99,6 +100,10 @@
});
function move(event: KeyboardEvent) {
if (dev && event.shiftKey && event.key === 'R') {
if (event.altKey) filters.set([]);
else filters.set(initialValue);
}
if ((event.key === 'j' || event.key === 'k') && document?.activeElement?.tagName !== 'INPUT') {
event.preventDefault();
// Find the current selected row with #row and .active
Expand Down Expand Up @@ -148,7 +153,12 @@
/>
</div>
{#if $filters.length}
<div class="flex flex-wrap [&_*]:mr-1 last:[&_*]:mr-0 overflow-x-clip">
<div
class="flex flex-wrap [&_*]:mr-1 last:[&_*]:mr-0 overflow-x-clip border-b border-surface-300-600-token"
title={dev
? 'Shift + R to reset. Shift + Alt + R to remove all filters.'
: 'Remove filters by clicking on them.'}
>
{#each $filters as filter}
{#if 'OR' in filter}
<div class="p-px flex rounded-token variant-ghost-interact">
Expand Down

0 comments on commit 06b6d82

Please sign in to comment.