Refactoring the resource details page

This commit is contained in:
Aleksi Lassila
2023-07-23 14:41:10 +03:00
parent 7b6da297c3
commit 51a7ab630a
25 changed files with 1097 additions and 586 deletions

View File

@@ -0,0 +1,28 @@
import { writable } from 'svelte/store';
function createModalStack() {
const store = writable<{ stack: Symbol[]; top: Symbol | undefined }>({
stack: [],
top: undefined
});
return {
...store,
push: (symbol: Symbol) => {
store.update((s) => {
s.stack.push(symbol);
s.top = symbol;
return s;
});
},
remove: (symbol: Symbol) => {
store.update((s) => {
s.stack = s.stack.filter((x) => x !== symbol);
s.top = s.stack[s.stack.length - 1];
return s;
});
}
};
}
export const modalStack = createModalStack();